feat(library/algebra): add lattice instances for Prop, fun, and set
Adds weak_order, lattice and complete_lattice instances for Prop, fun, and set. Adds supporting theorems to various other places.
This commit is contained in:
parent
c0deac6a63
commit
9c28552afb
6 changed files with 276 additions and 0 deletions
|
@ -270,3 +270,92 @@ have le₂ : ⨅ univ ≤ ⨆ (∅ : set A), from
|
||||||
le.antisymm le₁ le₂
|
le.antisymm le₁ le₂
|
||||||
|
|
||||||
end complete_lattice
|
end complete_lattice
|
||||||
|
|
||||||
|
/- complete lattice instances -/
|
||||||
|
|
||||||
|
section
|
||||||
|
open eq.ops complete_lattice
|
||||||
|
|
||||||
|
definition complete_lattice_fun [instance] {A B : Type} [complete_lattice B] :
|
||||||
|
complete_lattice (A → B) :=
|
||||||
|
⦃ complete_lattice, lattice_fun,
|
||||||
|
Inf := λS x, Inf ((λf, f x) ' S),
|
||||||
|
le_Inf := take f S H x,
|
||||||
|
le_Inf (take y Hy, obtain g `g ∈ S` `g x = y`, from Hy, `g x = y` ▸ H g `g ∈ S` x),
|
||||||
|
Inf_le := take f S `f ∈ S` x,
|
||||||
|
Inf_le (exists.intro f (and.intro `f ∈ S` rfl)),
|
||||||
|
Sup := λS x, Sup ((λf, f x) ' S),
|
||||||
|
le_Sup := take f S `f ∈ S` x,
|
||||||
|
le_Sup (exists.intro f (and.intro `f ∈ S` rfl)),
|
||||||
|
Sup_le := take f S H x,
|
||||||
|
Sup_le (take y Hy, obtain g `g ∈ S` `g x = y`, from Hy, `g x = y` ▸ H g `g ∈ S` x)
|
||||||
|
⦄
|
||||||
|
|
||||||
|
section
|
||||||
|
open classical -- Prop and set are only in the classical setting a complete lattice
|
||||||
|
|
||||||
|
definition complete_lattice_Prop [instance] : complete_lattice Prop :=
|
||||||
|
⦃ complete_lattice, lattice_Prop,
|
||||||
|
Inf := λS, false ∉ S,
|
||||||
|
le_Inf := take x S H Hx Hf,
|
||||||
|
H _ Hf Hx,
|
||||||
|
Inf_le := take x S Hx Hf,
|
||||||
|
(classical.cases_on x (take x, true.intro) Hf) Hx,
|
||||||
|
Sup := λS, true ∈ S,
|
||||||
|
le_Sup := take x S Hx H,
|
||||||
|
iff_subst (iff.intro (take H, true.intro) (take H', H)) Hx,
|
||||||
|
Sup_le := take x S H Ht,
|
||||||
|
H _ Ht true.intro
|
||||||
|
⦄
|
||||||
|
|
||||||
|
lemma sInter_eq_fun_Inf {A : Type} (S : set (set A)) : ⋂₀ S = @Inf (A → Prop) _ S :=
|
||||||
|
funext (take x,
|
||||||
|
calc
|
||||||
|
(⋂₀ S) x = ∀₀ P ∈ S, P x : rfl
|
||||||
|
... = ¬ (∃₀ P ∈ S, P x = false) :
|
||||||
|
begin
|
||||||
|
rewrite not_bounded_exists,
|
||||||
|
apply bounded_forall_congr,
|
||||||
|
intros,
|
||||||
|
rewrite eq_false,
|
||||||
|
rewrite not_not_iff
|
||||||
|
end
|
||||||
|
... = @Inf (A → Prop) _ S x : rfl)
|
||||||
|
|
||||||
|
lemma sUnion_eq_fun_Sup {A : Type} (S : set (set A)) : ⋃₀ S = @Sup (A → Prop) _ S :=
|
||||||
|
funext (take x,
|
||||||
|
calc
|
||||||
|
(⋃₀ S) x = ∃₀ P ∈ S, P x : rfl
|
||||||
|
... = (∃₀ P ∈ S, P x = true) :
|
||||||
|
begin |