Skip to content

Commit 69c8a06

Browse files
committed
chore: fix double conflicting instances of OmegaCompletePartialOrder on CompleteLattice (#38297)
Currently, we have a direct instance `CompleteLattice -> OmegaCompletePartialOrder` (in `OmegaCompletePartialOrder.lean`), and a path `CompleteLattice -> ChainCompletePartialOrder -> OmegaCompletePartialOrder` (in `BourbakiWitt.lean`). They are defeq, but not implicit-reducibly. To solve the diamond, we remove the first instance, and move everything that depends on it from the first file to the second file. Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
1 parent 31adfaf commit 69c8a06

6 files changed

Lines changed: 60 additions & 65 deletions

File tree

Mathlib/LinearAlgebra/Span/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public import Mathlib.Algebra.Module.Submodule.Equiv
1212
public import Mathlib.Algebra.Module.Submodule.Pointwise
1313
public import Mathlib.LinearAlgebra.Span.Defs
1414
public import Mathlib.Order.CompactlyGenerated.Basic
15-
public import Mathlib.Order.OmegaCompletePartialOrder
15+
public import Mathlib.Order.BourbakiWitt
1616

1717
import Mathlib.Algebra.Field.Basic
1818
import Mathlib.Algebra.Module.Submodule.EqLocus

Mathlib/Order/BourbakiWitt.lean

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The proof used can be found in [serge_lang_algebra]
3232

3333
public section
3434

35-
variable {α : Type*}
35+
variableβ : Type*} {ι : Sort*}
3636

3737
/-- The type of nonempty chains of an order -/
3838
@[ext]
@@ -228,3 +228,56 @@ theorem nonempty_fixedPoints_of_inflationary [Nonempty α] (le_map : ∀ x, x
228228
exact ⟨(bot_isAdmissible le_map).cSup_mem _ (subset_refl _), rfl⟩
229229

230230
end ChainCompletePartialOrder
231+
232+
open OmegaCompletePartialOrder
233+
234+
namespace CompleteLattice
235+
236+
variable [OmegaCompletePartialOrder α] [CompleteLattice β] {f g : α → β}
237+
238+
lemma ωScottContinuous.iSup {f : ι → α → β} (hf : ∀ i, ωScottContinuous (f i)) :
239+
ωScottContinuous (⨆ i, f i) := by
240+
refine ωScottContinuous.of_monotone_map_ωSup
241+
⟨Monotone.iSup fun i ↦ (hf i).monotone, fun c ↦ eq_of_forall_ge_iff fun a ↦ ?_⟩
242+
simp +contextual [ωSup_le_iff, (hf _).map_ωSup, @forall_comm ι]
243+
244+
lemma ωScottContinuous.sSup {s : Set (α → β)} (hs : ∀ f ∈ s, ωScottContinuous f) :
245+
ωScottContinuous (sSup s) := by
246+
rw [sSup_eq_iSup]; apply ωScottContinuous.iSup fun f ↦ ωScottContinuous.iSup <| hs f
247+
248+
lemma ωScottContinuous.sup (hf : ωScottContinuous f) (hg : ωScottContinuous g) :
249+
ωScottContinuous (f ⊔ g) := by
250+
rw [← sSup_pair]
251+
apply ωScottContinuous.sSup
252+
rintro f (rfl | rfl | _) <;> assumption
253+
254+
lemma ωScottContinuous.top : ωScottContinuous (⊤ : α → β) :=
255+
ωScottContinuous.of_monotone_map_ωSup
256+
⟨monotone_const, fun c ↦ eq_of_forall_ge_iff fun a ↦ by simp⟩
257+
258+
lemma ωScottContinuous.bot : ωScottContinuous (⊥ : α → β) := by
259+
rw [← sSup_empty]; exact ωScottContinuous.sSup (by simp)
260+
261+
end CompleteLattice
262+
263+
namespace CompleteLattice
264+
265+
variable [OmegaCompletePartialOrder α] [CompleteLinearOrder β] {f g : α → β}
266+
267+
-- TODO Prove this result for `ScottContinuousOn` and deduce this as a special case
268+
-- Also consider if it holds in greater generality (e.g. finite sets)
269+
-- N.B. The Scott Topology coincides with the Upper Topology on a Complete Linear Order
270+
-- `Topology.IsScott.scott_eq_upper_of_completeLinearOrder`
271+
-- We have that the product topology coincides with the upper topology
272+
-- https://github.com/leanprover-community/mathlib4/pull/12133
273+
lemma ωScottContinuous.inf (hf : ωScottContinuous f) (hg : ωScottContinuous g) :
274+
ωScottContinuous (f ⊓ g) := by
275+
refine ωScottContinuous.of_monotone_map_ωSup
276+
⟨hf.monotone.inf hg.monotone, fun c ↦ eq_of_forall_ge_iff fun a ↦ ?_⟩
277+
simp only [Pi.inf_apply, hf.map_ωSup c, hg.map_ωSup c, inf_le_iff, ωSup_le_iff, Chain.coe_map,
278+
Function.comp, OrderHom.coe_mk, ← forall_or_left, ← forall_or_right]
279+
exact ⟨fun h _ ↦ h _ _, fun h i j ↦
280+
(h (max j i)).imp (le_trans <| hf.monotone <| c.mono <| le_max_left _ _)
281+
(le_trans <| hg.monotone <| c.mono <| le_max_right _ _)⟩
282+
283+
end CompleteLattice

Mathlib/Order/Category/OmegaCompletePartialOrder.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Simon Hudon
55
-/
66
module
77

8-
public import Mathlib.Order.OmegaCompletePartialOrder
8+
public import Mathlib.Order.BourbakiWitt
99
public import Mathlib.CategoryTheory.Limits.Shapes.Products
1010
public import Mathlib.CategoryTheory.Limits.Shapes.Equalizers
1111
public import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers

Mathlib/Order/FixedPoints.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module
77

88
public import Mathlib.Dynamics.FixedPoints.Basic
99
public import Mathlib.Order.Hom.Order
10-
public import Mathlib.Order.OmegaCompletePartialOrder
10+
public import Mathlib.Order.BourbakiWitt
1111

1212
/-!
1313
# Fixed point construction on complete lattices

Mathlib/Order/OmegaCompletePartialOrder.lean

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ supremum helps define the meaning of recursive procedures.
3333
## Instances of `OmegaCompletePartialOrder`
3434
3535
* `Part`
36-
* every `CompleteLattice`
36+
* every `CompleteLattice` (proved in `BourbakiWitt` as a special case of chain-complete
37+
partial orders)
3738
* pi-types
3839
* product types
3940
* `OrderHom`
@@ -460,65 +461,6 @@ lemma ωScottContinuous_snd : ωScottContinuous (Prod.snd : α × β → β) :=
460461

461462
end Prod
462463

463-
namespace CompleteLattice
464-
465-
-- see Note [lower instance priority]
466-
/-- Any complete lattice has an `ω`-CPO structure where the countable supremum is a special case
467-
of arbitrary suprema. -/
468-
instance (priority := 100) [CompleteLattice α] : OmegaCompletePartialOrder α where
469-
ωSup c := ⨆ i, c i
470-
ωSup_le := fun ⟨c, _⟩ s hs => by simpa only [iSup_le_iff]
471-
le_ωSup := fun ⟨c, _⟩ i => le_iSup_of_le i le_rfl
472-
473-
variable [OmegaCompletePartialOrder α] [CompleteLattice β] {f g : α → β}
474-
475-
lemma ωScottContinuous.iSup {f : ι → α → β} (hf : ∀ i, ωScottContinuous (f i)) :
476-
ωScottContinuous (⨆ i, f i) := by
477-
refine ωScottContinuous.of_monotone_map_ωSup
478-
⟨Monotone.iSup fun i ↦ (hf i).monotone, fun c ↦ eq_of_forall_ge_iff fun a ↦ ?_⟩
479-
simp +contextual [ωSup_le_iff, (hf _).map_ωSup, @forall_comm ι]
480-
481-
lemma ωScottContinuous.sSup {s : Set (α → β)} (hs : ∀ f ∈ s, ωScottContinuous f) :
482-
ωScottContinuous (sSup s) := by
483-
rw [sSup_eq_iSup]; exact ωScottContinuous.iSup fun f ↦ ωScottContinuous.iSup <| hs f
484-
485-
lemma ωScottContinuous.sup (hf : ωScottContinuous f) (hg : ωScottContinuous g) :
486-
ωScottContinuous (f ⊔ g) := by
487-
rw [← sSup_pair]
488-
apply ωScottContinuous.sSup
489-
rintro f (rfl | rfl | _) <;> assumption
490-
491-
lemma ωScottContinuous.top : ωScottContinuous (⊤ : α → β) :=
492-
ωScottContinuous.of_monotone_map_ωSup
493-
⟨monotone_const, fun c ↦ eq_of_forall_ge_iff fun a ↦ by simp⟩
494-
495-
lemma ωScottContinuous.bot : ωScottContinuous (⊥ : α → β) := by
496-
rw [← sSup_empty]; exact ωScottContinuous.sSup (by simp)
497-
498-
end CompleteLattice
499-
500-
namespace CompleteLattice
501-
502-
variable [OmegaCompletePartialOrder α] [CompleteLinearOrder β] {f g : α → β}
503-
504-
-- TODO Prove this result for `ScottContinuousOn` and deduce this as a special case
505-
-- Also consider if it holds in greater generality (e.g. finite sets)
506-
-- N.B. The Scott Topology coincides with the Upper Topology on a Complete Linear Order
507-
-- `Topology.IsScott.scott_eq_upper_of_completeLinearOrder`
508-
-- We have that the product topology coincides with the upper topology
509-
-- https://github.com/leanprover-community/mathlib4/pull/12133
510-
lemma ωScottContinuous.inf (hf : ωScottContinuous f) (hg : ωScottContinuous g) :
511-
ωScottContinuous (f ⊓ g) := by
512-
refine ωScottContinuous.of_monotone_map_ωSup
513-
⟨hf.monotone.inf hg.monotone, fun c ↦ eq_of_forall_ge_iff fun a ↦ ?_⟩
514-
simp only [Pi.inf_apply, hf.map_ωSup c, hg.map_ωSup c, inf_le_iff, ωSup_le_iff, Chain.coe_map,
515-
Function.comp, OrderHom.coe_mk, ← forall_or_left, ← forall_or_right]
516-
exact ⟨fun h _ ↦ h _ _, fun h i j ↦
517-
(h (max j i)).imp (le_trans <| hf.monotone <| c.mono <| le_max_left _ _)
518-
(le_trans <| hg.monotone <| c.mono <| le_max_right _ _)⟩
519-
520-
end CompleteLattice
521-
522464
namespace OmegaCompletePartialOrder
523465
variable [OmegaCompletePartialOrder α] [OmegaCompletePartialOrder β]
524466
variable [OmegaCompletePartialOrder γ] [OmegaCompletePartialOrder δ]

Mathlib/Topology/OmegaCompletePartialOrder.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Simon Hudon
55
-/
66
module
77

8-
public import Mathlib.Order.OmegaCompletePartialOrder
8+
public import Mathlib.Order.BourbakiWitt
99
public import Mathlib.Topology.Order.ScottTopology
1010

1111
/-!

0 commit comments

Comments
 (0)