@@ -67,42 +67,52 @@ namespace OmegaCompletePartialOrder
6767
6868/-- A chain is a monotone sequence.
6969
70+ This is made a one-field structure around order homomorphisms `ℕ →o α` because we want to endow
71+ chains with the domination order rather than the pointwise order. See `Chain.instLE`.
72+
7073See the definition on page 114 of [ gunter1992 ] . -/
71- def Chain (α : Type u) [Preorder α] :=
72- ℕ →o α
74+ structure Chain (α : Type u) [Preorder α] extends ℕ →o α
7375
7476namespace Chain
7577variable [Preorder α] [Preorder β] [Preorder γ]
7678
77- instance : FunLike (Chain α) ℕ α := inferInstanceAs <| FunLike (ℕ →o α) ℕ α
78- instance : OrderHomClass (Chain α) ℕ α := inferInstanceAs <| OrderHomClass (ℕ →o α) ℕ α
79+ instance : FunLike (Chain α) ℕ α where
80+ coe c := c.toOrderHom
81+ coe_injective' := by rintro ⟨f, hf⟩; congr!
82+
83+ initialize_simps_projections Chain (toFun → apply)
84+
85+ instance : OrderHomClass (Chain α) ℕ α where
86+ map_rel c _m _n hmn := c.monotone hmn
7987
8088/-- See note [partially-applied ext lemmas]. -/
8189@[ext] lemma ext ⦃f g : Chain α⦄ (h : ⇑f = ⇑g) : f = g := DFunLike.ext' h
8290
91+ @[simp] lemma coe_toOrderHom (c : Chain α) : ⇑c.toOrderHom = c := rfl
92+
8393instance [Inhabited α] : Inhabited (Chain α) :=
8494 ⟨⟨default, fun _ _ _ => le_rfl⟩⟩
8595
86- instance : Membership α (Chain α) :=
87- ⟨ fun (c : ℕ →o α) a => ∃ i, a = c i⟩
96+ instance : Membership α (Chain α) where
97+ mem c a := ∃ i, a = c i
8898
8999variable (c c' : Chain α)
90100variable (f : α →o β)
91101variable (g : β →o γ)
92102
93- instance : LE (Chain α) where le x y := ∀ i, ∃ j, x i ≤ y j
103+ instance instLE : LE (Chain α) where le x y := ∀ i, ∃ j, x i ≤ y j
94104
95105lemma isChain_range : IsChain (· ≤ ·) (Set.range c) := Monotone.isChain_range (OrderHomClass.mono c)
96106
97107lemma directed : Directed (· ≤ ·) c := directedOn_range.2 c.isChain_range.directedOn
98108
99109/-- `map` function for `Chain` -/
100- -- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain β = ℕ →o β`,
101- -- but then we'd get the `FunLike` instance for `OrderHom` instead.
102- def map : Chain β :=
103- f.comp c
110+ @ [simps toOrderHom]
111+ def map : Chain β where toOrderHom := f.comp c.toOrderHom
104112
105- @[simp] theorem map_coe : ⇑(map c f) = f ∘ c := rfl
113+ @[simp] lemma coe_map : ⇑(c.map f) = f ∘ c := rfl
114+
115+ @ [deprecated (since := "2026-03-27" )] alias map_coe := coe_map
106116
107117variable {f}
108118
@@ -119,25 +129,23 @@ theorem mem_map_iff {b : β} : b ∈ c.map f ↔ ∃ a, a ∈ c ∧ f a = b :=
119129 subst b
120130 apply mem_map c _ h⟩
121131
122- @[simp]
123- theorem map_id : c.map OrderHom.id = c :=
124- OrderHom.comp_id _
132+ @[simp] lemma map_id : c.map OrderHom.id = c := by ext; simp
125133
126134theorem map_comp : (c.map f).map g = c.map (g.comp f) :=
127135 rfl
128136
129137@[mono]
130- theorem map_le_map {g : α →o β} (h : f ≤ g) : c.map f ≤ c.map g :=
131- fun i => by simp only [map_coe, Function.comp_apply]; exists i; apply h
138+ theorem map_le_map {g : α →o β} (h : f ≤ g) : c.map f ≤ c.map g := fun _ ↦ ⟨_, h _⟩
132139
133140/-- `OmegaCompletePartialOrder.Chain.zip` pairs up the elements of two chains
134141that have the same index. -/
135- -- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain β = ℕ →o β`,
136- -- but then we'd get the `FunLike` instance for `OrderHom` instead.
137- def zip (c₀ : Chain α) (c₁ : Chain β) : Chain (α × β) :=
138- OrderHom.prod c₀ c₁
142+ @ [simps toOrderHom]
143+ def zip (c₀ : Chain α) (c₁ : Chain β) : Chain (α × β) where
144+ toOrderHom := c₀.toOrderHom.prod c₁.toOrderHom
145+
146+ @[simp] lemma zip_apply (c₀ : Chain α) (c₁ : Chain β) (n : ℕ) : c₀.zip c₁ n = (c₀ n, c₁ n) := rfl
139147
140- @[simp] theorem zip_coe (c₀ : Chain α) (c₁ : Chain β) (n : ℕ) : c₀.zip c₁ n = (c₀ n, c₁ n) := rfl
148+ @ [deprecated (since := "2026-03-27" )] alias zip_coe := zip_apply
141149
142150/-- An example of a `Chain` constructed from an ordered pair. -/
143151def pair (a b : α) (hab : a ≤ b) : Chain α where
@@ -154,7 +162,7 @@ def pair (a b : α) (hab : a ≤ b) : Chain α where
154162
155163@[simp] lemma pair_zip_pair (a₁ a₂ : α) (b₁ b₂ : β) (ha hb) :
156164 (pair a₁ a₂ ha).zip (pair b₁ b₂ hb) = pair (a₁, b₁) (a₂, b₂) (Prod.le_def.2 ⟨ha, hb⟩) := by
157- unfold Chain; ext n : 2 ; cases n <;> rfl
165+ ext n : 2 ; cases n <;> rfl
158166
159167end Chain
160168
@@ -263,7 +271,7 @@ lemma ωScottContinuous.monotone (h : ωScottContinuous f) : Monotone f :=
263271
264272lemma ωScottContinuous.isLUB {c : Chain α} (hf : ωScottContinuous f) :
265273 IsLUB (Set.range (c.map ⟨f, hf.monotone⟩)) (f (ωSup c)) := by
266- simpa [map_coe, OrderHom.coe_mk, Set.range_comp]
274+ simpa [Set.range_comp]
267275 using hf (by simp) (Set.range_nonempty _) (isChain_range c).directedOn (isLUB_range_ωSup c)
268276
269277@ [fun_prop, to_fun (attr := simp)]
@@ -278,7 +286,7 @@ lemma ωScottContinuous_iff_monotone_map_ωSup :
278286 refine ⟨fun hf ↦ ⟨hf.monotone, hf.map_ωSup⟩, ?_⟩
279287 intro hf _ ⟨c, hc⟩ _ _ _ hda
280288 convert isLUB_range_ωSup (c.map { toFun := f, monotone' := hf.1 })
281- · rw [map_coe, OrderHom.coe_mk, ← hc, ← (Set.range_comp f ⇑c)]
289+ · simp [ ← hc, ← (Set.range_comp f ⇑c)]
282290 · rw [← hc] at hda
283291 rw [← hf.2 c, ωSup_eq_of_isLUB hda]
284292
@@ -504,7 +512,7 @@ lemma ωScottContinuous.inf (hf : ωScottContinuous f) (hg : ωScottContinuous g
504512 ωScottContinuous (f ⊓ g) := by
505513 refine ωScottContinuous.of_monotone_map_ωSup
506514 ⟨hf.monotone.inf hg.monotone, fun c ↦ eq_of_forall_ge_iff fun a ↦ ?_⟩
507- simp only [Pi.inf_apply, hf.map_ωSup c, hg.map_ωSup c, inf_le_iff, ωSup_le_iff, Chain.map_coe ,
515+ simp only [Pi.inf_apply, hf.map_ωSup c, hg.map_ωSup c, inf_le_iff, ωSup_le_iff, Chain.coe_map ,
508516 Function.comp, OrderHom.coe_mk, ← forall_or_left, ← forall_or_right]
509517 exact ⟨fun h _ ↦ h _ _, fun h i j ↦
510518 (h (max j i)).imp (le_trans <| hf.monotone <| c.mono <| le_max_left _ _)
@@ -606,15 +614,15 @@ theorem ωSup_bind {β γ : Type v} (c : Chain α) (f : α →o Part β) (g : α
606614 simp only [Part.mem_ωSup] at hb
607615 rcases hb with ⟨j, hb⟩
608616 replace hb := hb.symm
609- simp only [Part.eq_some_iff, Chain.map_coe , Function.comp_apply] at hy hb
617+ simp only [Part.eq_some_iff, Chain.coe_map , Function.comp_apply] at hy hb
610618 replace hb : b ∈ f (c (max i j)) := f.mono (c.mono (le_max_right i j)) _ hb
611619 replace hy : y ∈ g (c (max i j)) b := g.mono (c.mono (le_max_left i j)) _ _ hy
612620 apply h''' (max i j)
613- simp only [Part.mem_bind_iff, Chain.map_coe ,
621+ simp only [Part.mem_bind_iff, Chain.coe_map ,
614622 Function.comp_apply, OrderHom.partBind_coe]
615623 exact ⟨_, hb, hy⟩
616624 · intro i y hy
617- simp only [Part.mem_bind_iff, Chain.map_coe ,
625+ simp only [Part.mem_bind_iff, Chain.coe_map ,
618626 Function.comp_apply, OrderHom.partBind_coe] at hy
619627 rcases hy with ⟨b, hb₀, hb₁⟩
620628 apply h''' b _
@@ -808,7 +816,7 @@ theorem ωSup_iterate_mem_fixedPoint (h : x ≤ f x) :
808816 apply le_antisymm
809817 · apply ωSup_le
810818 intro n
811- simp only [Chain.map_coe , OrderHomClass.coe_coe, comp_apply]
819+ simp only [Chain.coe_map , OrderHomClass.coe_coe, comp_apply]
812820 have : iterateChain f x h (n.succ) = f (iterateChain f x h n) :=
813821 Function.iterate_succ_apply' ..
814822 rw [← this]
0 commit comments