-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(Order/ConditionallyCompleteLattice): ConditionallyCompleteSemiLatticeInf #38192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,73 @@ open Set | |
|
|
||
| variable {α β γ : Type*} {ι : Sort*} | ||
|
|
||
| /-- A conditionally complete semilattice is a semilattice in which every nonempty subset which is | ||
| bounded above has a least upper bound. | ||
|
|
||
| To differentiate the statements from the corresponding statements in (unconditional) | ||
| complete lattices, we prefix `sSup` by a `c` everywhere. The same statements should | ||
| hold in both worlds, sometimes with additional assumptions of nonemptiness or | ||
| boundedness. -/ | ||
| class ConditionallyCompleteSemiLatticeSup (α : Type*) extends SemilatticeSup α, SupSet α where | ||
| /-- Every nonempty subset which is bounded above has a least upper bound. -/ | ||
| isLUB_csSup : ∀ s : Set α, s.Nonempty → BddAbove s → IsLUB s (sSup s) | ||
|
|
||
| /-- A conditionally complete semilattice is a semilattice in which every nonempty subset which is | ||
| bounded below has a greatest lower bound. | ||
|
|
||
| To differentiate the statements from the corresponding statements in (unconditional) | ||
| complete lattices, we prefix `sInf` by a `c` everywhere. The same statements should | ||
| hold in both worlds, sometimes with additional assumptions of nonemptiness or | ||
| boundedness. -/ | ||
| @[to_dual] | ||
|
Jun2M marked this conversation as resolved.
Outdated
|
||
| class ConditionallyCompleteSemiLatticeInf (α : Type*) extends SemilatticeInf α, InfSet α where | ||
| /-- Every nonempty subset which is bounded below has a greatest lower bound. -/ | ||
| isGLB_csInf : ∀ s : Set α, s.Nonempty → BddBelow s → IsGLB s (sInf s) | ||
|
|
||
| attribute [to_dual existing] ConditionallyCompleteSemiLatticeInf.isGLB_csInf | ||
| ConditionallyCompleteSemiLatticeInf.toSemilatticeInf | ||
| ConditionallyCompleteSemiLatticeInf.toInfSet | ||
|
|
||
| @[to_dual] | ||
| instance OrderDual.instConditionallyCompleteSemiLatticeSup (α) | ||
| [h : ConditionallyCompleteSemiLatticeInf α] : ConditionallyCompleteSemiLatticeSup αᵒᵈ where | ||
| sSup := sInf (α := α) | ||
| isLUB_csSup := h.isGLB_csInf (α := α) | ||
|
|
||
| @[to_dual] | ||
| theorem isGLB_csInf [ConditionallyCompleteSemiLatticeInf α] {s : Set α} (hn : s.Nonempty) | ||
| (hb : BddBelow s := by bddDefault) : IsGLB s (sInf s) := | ||
| ConditionallyCompleteSemiLatticeInf.isGLB_csInf s hn hb | ||
|
|
||
| /-- A conditionally complete semilattice with `Top` is a semilattice with greatest element, in which | ||
| every nonempty subset (necessarily bounded above) has a supremum. | ||
|
|
||
| To differentiate the statements from the corresponding statements in (unconditional) | ||
| complete lattices, we prefix `sSup` by a `c` everywhere. The same statements should | ||
| hold in both worlds, sometimes with additional assumptions of nonemptiness or | ||
| boundedness. -/ | ||
| class ConditionallyCompleteSemiLatticeSupBot (α : Type*) extends | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could get rid of this by adding a requirement to conditionally complete (semi)lattices that if they have a bottom/top, then the supremum/infimum of the empty set equals to it. I think that'd be a worthwhile refactor which can be done independently of adding these semilattice instances.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not quite sure how I can say in Lean "if there is bottom/top, so and so is true". Could you spell out exactly what you are thinking?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ConditionallyCompleteSemiLatticeSup α, OrderBot α where | ||
| /-- The supremum of the empty set is `⊥`. -/ | ||
| csSup_empty : sSup ∅ = (⊥ : α) | ||
|
|
||
| /-- A conditionally complete semilattice with `Bot` is a semilattice with least element, in which | ||
| every nonempty subset (necessarily bounded below) has an infimum. | ||
|
|
||
| To differentiate the statements from the corresponding statements in (unconditional) | ||
| complete lattices, we prefix `sInf` by a `c` everywhere. The same statements should | ||
| hold in both worlds, sometimes with additional assumptions of nonemptiness or | ||
| boundedness. -/ | ||
| @[to_dual] | ||
| class ConditionallyCompleteSemiLatticeInfTop (α : Type*) extends | ||
| ConditionallyCompleteSemiLatticeInf α, OrderTop α where | ||
| /-- The infimum of the empty set is `⊥`. -/ | ||
| csInf_empty : sInf ∅ = (⊤ : α) | ||
|
|
||
| @[to_dual, simp] | ||
| theorem csSup_empty [ConditionallyCompleteSemiLatticeSupBot α] : sSup ∅ = (⊥ : α) := | ||
| ConditionallyCompleteSemiLatticeSupBot.csSup_empty | ||
|
|
||
| /-- A conditionally complete lattice is a lattice in which | ||
| every nonempty subset which is bounded above has a supremum, and | ||
| every nonempty subset which is bounded below has an infimum. | ||
|
|
@@ -43,15 +110,10 @@ To differentiate the statements from the corresponding statements in (unconditio | |
| complete lattices, we prefix `sInf` and `sSup` by a `c` everywhere. The same statements should | ||
| hold in both worlds, sometimes with additional assumptions of nonemptiness or | ||
| boundedness. -/ | ||
| class ConditionallyCompleteLattice (α : Type*) extends Lattice α, SupSet α, InfSet α where | ||
| /-- Every nonempty subset which is bounded above has a least upper bound. -/ | ||
| isLUB_csSup : ∀ s : Set α, s.Nonempty → BddAbove s → IsLUB s (sSup s) | ||
| /-- Every nonempty subset which is bounded below has a greatest lower bound. -/ | ||
| isGLB_csInf : ∀ s : Set α, s.Nonempty → BddBelow s → IsGLB s (sInf s) | ||
| class ConditionallyCompleteLattice (α : Type*) extends | ||
| ConditionallyCompleteSemiLatticeSup α, ConditionallyCompleteSemiLatticeInf α | ||
|
|
||
| attribute [to_dual self (reorder := 3 4, 5 6)] ConditionallyCompleteLattice.mk | ||
| attribute [to_dual existing] ConditionallyCompleteLattice.toSupSet | ||
| attribute [to_dual existing] ConditionallyCompleteLattice.isLUB_csSup | ||
| attribute [to_dual existing] ConditionallyCompleteLattice.toConditionallyCompleteSemiLatticeInf | ||
|
|
||
| /-- A conditionally complete linear order is a linear order in which | ||
| every nonempty subset which is bounded above has a supremum, and | ||
|
|
@@ -97,7 +159,46 @@ class ConditionallyCompleteLinearOrderBot (α : Type*) extends ConditionallyComp | |
| -- see Note [lower instance priority] | ||
| attribute [instance 100] ConditionallyCompleteLinearOrderBot.toOrderBot | ||
|
|
||
| /-- Create a `ConditionallyCompleteLattice` from a `PartialOrder` and `sup` function | ||
| instance [ConditionallyCompleteLinearOrderBot α] : ConditionallyCompleteSemiLatticeSupBot α where | ||
| csSup_empty := ConditionallyCompleteLinearOrderBot.csSup_empty | ||
|
|
||
| /-- Create a `ConditionallyCompleteSemiLatticeInf` from a `PartialOrder` and `sInf` function | ||
| that returns the greatest lower bound of a nonempty set which is bounded below. Usually this | ||
| constructor provides poor definitional equalities. If other fields are known explicitly, they | ||
| should be provided. -/ | ||
| @[to_dual (attr := implicit_reducible) | ||
| /-- Create a `ConditionallyCompleteSemiLatticeSup` from a `PartialOrder` and `sSup` function | ||
| that returns the least upper bound of a nonempty set which is bounded above. Usually this | ||
| constructor provides poor definitional equalities. If other fields are known explicitly, they | ||
| should be provided. -/] | ||
| def conditionallyCompleteSemiLatticeInfOfsInf (α : Type*) [H1 : PartialOrder α] [H2 : InfSet α] | ||
| (bddBelow_pair : ∀ a b : α, BddBelow ({a, b} : Set α)) | ||
| (isGLB_sInf : ∀ s : Set α, BddBelow s → s.Nonempty → IsGLB s (sInf s)) : | ||
| ConditionallyCompleteSemiLatticeInf α where | ||
| __ := H2 | ||
| __ := SemilatticeInf.ofIsGLB (fun a b ↦ sInf {a, b}) | ||
| (fun a b ↦ isGLB_sInf {a, b} (bddBelow_pair a b) (insert_nonempty _ _)) | ||
| isGLB_csInf _ hn hb := isGLB_sInf _ hb hn | ||
|
|
||
| /-- Create a `ConditionallyCompleteSemiLatticeInfBot` from a `PartialOrder`, `OrderBot` and `sInf` | ||
| function that returns the greatest lower bound of a nonempty set. Usually this constructor provides | ||
| poor definitional equalities. If other fields are known explicitly, they should be provided. -/ | ||
| @[to_dual (attr := implicit_reducible) | ||
| /-- Create a `ConditionallyCompleteSemiLatticeSupTop` from a `PartialOrder`, `OrderTop` and `sSup` | ||
| function that returns the least upper bound of a nonempty set. Usually this constructor provides | ||
| poor definitional equalities. If other fields are known explicitly, they should be provided. -/] | ||
| def conditionallyCompleteSemiLatticeInfOfsInfTop (α : Type*) [H1 : PartialOrder α] [H2 : InfSet α] | ||
| [H3 : OrderTop α] (sInf_empty : sInf ∅ = (⊤ : α)) | ||
| (isGLB_sInf : ∀ s : Set α, s.Nonempty → IsGLB s (sInf s)) : | ||
| ConditionallyCompleteSemiLatticeInfTop α where | ||
| __ := H2 | ||
| __ := H3 | ||
| __ := SemilatticeInf.ofIsGLB (fun a b ↦ sInf {a, b}) | ||
| (fun a b ↦ isGLB_sInf {a, b} (insert_nonempty _ _)) | ||
| isGLB_csInf _ hn _ := isGLB_sInf _ hn | ||
| csInf_empty := sInf_empty | ||
|
|
||
| /-- Create a `ConditionallyCompleteLattice` from a `PartialOrder` and `sSup` function | ||
| that returns the least upper bound of a nonempty set which is bounded above. Usually this | ||
| constructor provides poor definitional equalities. If other fields are known explicitly, they | ||
| should be provided; for example, if `inf` is known explicitly, construct the | ||
|
|
@@ -112,7 +213,7 @@ instance : ConditionallyCompleteLattice my_T where | |
| __ := conditionallyCompleteLatticeOfsSup my_T ... | ||
| ``` | ||
| -/ | ||
| @[to_dual (attr := implicit_reducible) (reorder := 4 5) | ||
| @[to_dual (attr := implicit_reducible) (reorder := H1 H2) | ||
| /-- Create a `ConditionallyCompleteLattice` from a `PartialOrder` and `sInf` function | ||
| that returns the greatest lower bound of a nonempty set which is bounded below. Usually this | ||
| constructor provides poor definitional equalities. If other fields are known explicitly, they | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.