Section BOOLEAN_ALGEBRA. (* Reference: << Constructive Completeness Proofs and Delimited Control >> written by "Danko Ilik" *)
Context {B : Type} {BA : isBA B}.
#[local] Notation andB := (@andB B BA).
Definition andsB : list B -> B :=
fold_right andB trueB.
Context {SETOID : isSetoid B}.
Definition leB (lhs : B) (rhs : B) : Prop :=
andB lhs rhs == lhs.
Context {BOOLEAN_ALGEBRA_LAWS : BooleanAlgebraLaws BA}.
#[global]
Instance leB_PreOrder
: PreOrder leB.
#[global]
Instance leB_PartialOrder
: PartialOrder eqProp leB.
#[global]
Instance BA_isProset : isProset B :=
{ leProp lhs rhs := andB lhs rhs == lhs
; Proset_isSetoid := SETOID
; leProp_PreOrder := leB_PreOrder
; leProp_PartialOrder := leB_PartialOrder
}.
#[global]
Instance andB_compathWith_leProp
: isMonotonic2 andB.
#[local] Hint Resolve andsB_le_In : core.
Variant isFilter (F : ensemble B) : Prop :=
| isFilter_if
(CLOSED_andsB : forall xs, L.is_finsubset_of xs F -> andsB xs \in F)
(CLOSED_UPWARD : forall x, x \in F -> forall x', x =< x' -> x' \in F)
: isFilter F.

Lemma isFilter_compatWith_eqProp F F'
(F_isFilter : isFilter F)
(F_eq_F' : F == F')
: isFilter F'.