Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 22c4d2f

Browse files
committed
feat(order/bounded_order): The lattice of complemented elements (#16267)
Define `complementeds`, the subtype of complemented elements, and show that it is a complemented bounded distributive lattice.
1 parent c4c2ed6 commit 22c4d2f

1 file changed

Lines changed: 82 additions & 1 deletion

File tree

src/order/disjoint.lean

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ This file defines `disjoint`, `codisjoint`, and the `is_compl` predicate.
2323
2424
-/
2525

26+
open function
27+
2628
variable {α : Type*}
2729

2830
section disjoint
@@ -412,10 +414,32 @@ lemma eq_bot_of_top_is_compl (h : is_compl ⊤ x) : x = ⊥ := eq_top_of_bot_is_
412414

413415
end
414416

417+
section is_complemented
418+
section lattice
419+
variables [lattice α] [bounded_order α]
420+
421+
/-- An element is *complemented* if it has a complement. -/
422+
def is_complemented (a : α) : Prop := ∃ b, is_compl a b
423+
424+
lemma is_complemented_bot : is_complemented (⊥ : α) := ⟨⊤, is_compl_bot_top⟩
425+
lemma is_complemented_top : is_complemented (⊤ : α) := ⟨⊥, is_compl_top_bot⟩
426+
427+
end lattice
428+
429+
variables [distrib_lattice α] [bounded_order α] {a b : α}
430+
431+
lemma is_complemented.sup : is_complemented a → is_complemented b → is_complemented (a ⊔ b) :=
432+
λ ⟨a', ha⟩ ⟨b', hb⟩, ⟨a' ⊓ b', ha.sup_inf hb⟩
433+
434+
lemma is_complemented.inf : is_complemented a → is_complemented b → is_complemented (a ⊓ b) :=
435+
λ ⟨a', ha⟩ ⟨b', hb⟩, ⟨a' ⊔ b', ha.inf_sup hb⟩
436+
437+
end is_complemented
438+
415439
/-- A complemented bounded lattice is one where every element has a (not necessarily unique)
416440
complement. -/
417441
class complemented_lattice (α) [lattice α] [bounded_order α] : Prop :=
418-
(exists_is_compl : ∀ (a : α), ∃ (b : α), is_compl a b)
442+
(exists_is_compl : ∀ a : α, is_complemented a)
419443

420444
export complemented_lattice (exists_is_compl)
421445

@@ -427,4 +451,61 @@ instance : complemented_lattice αᵒᵈ :=
427451

428452
end complemented_lattice
429453

454+
-- TODO: Define as a sublattice?
455+
/-- The sublattice of complemented elements. -/
456+
@[reducible, derive partial_order]
457+
def complementeds (α : Type*) [lattice α] [bounded_order α] : Type* := {a : α // is_complemented a}
458+
459+
namespace complementeds
460+
section lattice
461+
variables [lattice α] [bounded_order α] {a b : complementeds α}
462+
463+
instance has_coe_t : has_coe_t (complementeds α) α := ⟨subtype.val⟩
464+
465+
lemma coe_injective : injective (coe : complementeds α → α) := subtype.coe_injective
466+
467+
@[simp, norm_cast] lemma coe_inj : (a : α) = b ↔ a = b := subtype.coe_inj
468+
@[simp, norm_cast] lemma coe_le_coe : (a : α) ≤ b ↔ a ≤ b := by simp
469+
@[simp, norm_cast] lemma coe_lt_coe : (a : α) < b ↔ a < b := iff.rfl
470+
471+
instance : bounded_order (complementeds α) :=
472+
subtype.bounded_order is_complemented_bot is_complemented_top
473+
474+
@[simp, norm_cast] lemma coe_bot : ((⊥ : complementeds α) : α) = ⊥ := rfl
475+
@[simp, norm_cast] lemma coe_top : ((⊤ : complementeds α) : α) = ⊤ := rfl
476+
@[simp] lemma mk_bot : (⟨⊥, is_complemented_bot⟩ : complementeds α) = ⊥ := rfl
477+
@[simp] lemma mk_top : (⟨⊤, is_complemented_top⟩ : complementeds α) = ⊤ := rfl
478+
479+
instance : inhabited (complementeds α) := ⟨⊥⟩
480+
481+
end lattice
482+
483+
variables [distrib_lattice α] [bounded_order α] {a b : complementeds α}
484+
485+
instance : has_sup (complementeds α) := ⟨λ a b, ⟨a ⊔ b, a.2.sup b.2⟩⟩
486+
instance : has_inf (complementeds α) := ⟨λ a b, ⟨a ⊓ b, a.2.inf b.2⟩⟩
487+
488+
@[simp, norm_cast] lemma coe_sup (a b : complementeds α) : (↑(a ⊔ b) : α) = a ⊔ b := rfl
489+
@[simp, norm_cast] lemma coe_inf (a b : complementeds α) : (↑(a ⊓ b) : α) = a ⊓ b := rfl
490+
@[simp] lemma mk_sup_mk {a b : α} (ha : is_complemented a) (hb : is_complemented b) :
491+
(⟨a, ha⟩ ⊔ ⟨b, hb⟩ : complementeds α) = ⟨a ⊔ b, ha.sup hb⟩ := rfl
492+
@[simp] lemma mk_inf_mk {a b : α} (ha : is_complemented a) (hb : is_complemented b) :
493+
(⟨a, ha⟩ ⊓ ⟨b, hb⟩ : complementeds α) = ⟨a ⊓ b, ha.inf hb⟩ := rfl
494+
495+
instance : distrib_lattice (complementeds α) :=
496+
complementeds.coe_injective.distrib_lattice _ coe_sup coe_inf
497+
498+
@[simp, norm_cast] lemma disjoint_coe : disjoint (a : α) b ↔ disjoint a b :=
499+
by rw [disjoint_iff, disjoint_iff, ←coe_inf, ←coe_bot, coe_inj]
500+
501+
@[simp, norm_cast] lemma codisjoint_coe : codisjoint (a : α) b ↔ codisjoint a b :=
502+
by rw [codisjoint_iff, codisjoint_iff, ←coe_sup, ←coe_top, coe_inj]
503+
504+
@[simp, norm_cast] lemma is_compl_coe : is_compl (a : α) b ↔ is_compl a b :=
505+
by simp_rw [is_compl_iff, disjoint_coe, codisjoint_coe]
506+
507+
instance : complemented_lattice (complementeds α) :=
508+
⟨λ ⟨a, b, h⟩, ⟨⟨b, a, h.symm⟩, is_compl_coe.1 h⟩⟩
509+
510+
end complementeds
430511
end is_compl

0 commit comments

Comments
 (0)