law filter_filter_sym

bend-mathlib@0.8.1.0 · list.bend:2755

import bend-mathlib@0.8.1.0/list.bend as List
import Base

2755# Filtering twice is filtering by both predicates: filter p (filter q xs) = filter (p and q) xs, reversed to rewrite toward the simple side.
2756law filter_filter_sym:
2757  for ~A: Data
2758  for ~p: A -> Bool
2759  for ~q: A -> Bool
2760  for xs: List<&2, A>
2761  {List.filter(~A, ~(+x => Bool.and(p(x), q(x))), xs) == List.filter(~A, ~p, List.filter(~A, ~q, xs)) : List<&2, A>}

Uses (6)

Used by (0)

No other definition uses this definition.