@@ -52,10 +52,12 @@ def SuperChain (s t : Set α) : Prop :=
52
52
def IsMaxChain (s : Set α) : Prop :=
53
53
IsChain r s ∧ ∀ ⦃t⦄, IsChain r t → s ⊆ t → s = t
54
54
55
- variable {r} {c c₁ c₂ s t : Set α} {a x y : α}
55
+ variable {r} {c c₁ c₂ s t : Set α} {a b x y : α}
56
56
57
- theorem isChain_empty : IsChain r ∅ :=
58
- Set.pairwise_empty _
57
+ @[simp] lemma IsChain.empty : IsChain r ∅ := pairwise_empty _
58
+ @[simp] lemma IsChain.singleton : IsChain r {a} := pairwise_singleton ..
59
+
60
+ @[deprecated (since := "2024-11-25")] alias isChain_empty := IsChain.empty
59
61
60
62
theorem Set.Subsingleton.isChain (hs : s.Subsingleton) : IsChain r s :=
61
63
hs.pairwise _
@@ -78,6 +80,9 @@ protected theorem IsChain.insert (hs : IsChain r s) (ha : ∀ b ∈ s, a ≠ b
78
80
IsChain r (insert a s) :=
79
81
hs.insert_of_symmetric (fun _ _ => Or.symm) ha
80
82
83
+ lemma IsChain.pair (h : r a b) : IsChain r {a, b} :=
84
+ IsChain.singleton.insert fun _ hb _ ↦ .inl <| (eq_of_mem_singleton hb).symm.recOn ‹_›
85
+
81
86
theorem isChain_univ_iff : IsChain r (univ : Set α) ↔ IsTrichotomous α r := by
82
87
refine ⟨fun h => ⟨fun a b => ?_⟩, fun h => @isChain_of_trichotomous _ _ h univ⟩
83
88
rw [or_left_comm, or_iff_not_imp_left]
@@ -136,6 +141,14 @@ theorem IsMaxChain.bot_mem [LE α] [OrderBot α] (h : IsMaxChain (· ≤ ·) s)
136
141
theorem IsMaxChain.top_mem [LE α] [OrderTop α] (h : IsMaxChain (· ≤ ·) s) : ⊤ ∈ s :=
137
142
(h.2 (h.1 .insert fun _ _ _ => Or.inr le_top) <| subset_insert _ _).symm ▸ mem_insert _ _
138
143
144
+ lemma IsMaxChain.image {s : β → β → Prop } (e : r ≃r s) {c : Set α} (hc : IsMaxChain r c) :
145
+ IsMaxChain s (e '' c) where
146
+ left := hc.isChain.image _ _ _ fun _ _ ↦ by exact e.map_rel_iff.2
147
+ right t ht hf := by
148
+ rw [← e.coe_fn_toEquiv, ← e.toEquiv.eq_preimage_iff_image_eq, preimage_equiv_eq_image_symm]
149
+ exact hc.2 (ht.image _ _ _ fun _ _ ↦ by exact e.symm.map_rel_iff.2 )
150
+ ((e.toEquiv.subset_symm_image _ _).2 hf)
151
+
139
152
open Classical in
140
153
/-- Given a set `s`, if there exists a chain `t` strictly including `s`, then `SuccChain s`
141
154
is one of these chains. Otherwise it is `s`. -/
@@ -302,11 +315,17 @@ theorem top_mem [OrderTop α] (s : Flag α) : (⊤ : α) ∈ s :=
302
315
theorem bot_mem [OrderBot α] (s : Flag α) : (⊥ : α) ∈ s :=
303
316
s.maxChain.bot_mem
304
317
318
+ /-- Reinterpret a maximal chain as a flag. -/
319
+ def ofIsMaxChain (c : Set α) (hc : IsMaxChain (· ≤ ·) c) : Flag α := ⟨c, hc.isChain, hc.2 ⟩
320
+
321
+ @[simp, norm_cast]
322
+ lemma coe_ofIsMaxChain (c : Set α) (hc) : ofIsMaxChain c hc = c := rfl
323
+
305
324
end LE
306
325
307
326
section Preorder
308
327
309
- variable [Preorder α] {a b : α}
328
+ variable [Preorder α] [Preorder β] {a b : α} {s : Flag α}
310
329
311
330
protected theorem le_or_le (s : Flag α) (ha : a ∈ s) (hb : b ∈ s) : a ≤ b ∨ b ≤ a :=
312
331
s.chain_le.total ha hb
@@ -320,6 +339,24 @@ instance [OrderBot α] (s : Flag α) : OrderBot s :=
320
339
instance [BoundedOrder α] (s : Flag α) : BoundedOrder s :=
321
340
Subtype.boundedOrder s.bot_mem s.top_mem
322
341
342
+ lemma mem_iff_forall_le_or_ge : a ∈ s ↔ ∀ ⦃b⦄, b ∈ s → a ≤ b ∨ b ≤ a :=
343
+ ⟨fun ha b => s.le_or_le ha, fun hb =>
344
+ of_not_not fun ha =>
345
+ Set.ne_insert_of_not_mem _ ‹_› <|
346
+ s.maxChain.2 (s.chain_le.insert fun c hc _ => hb hc) <| Set.subset_insert _ _⟩
347
+
348
+ /-- Flags are preserved under order isomorphisms. -/
349
+ def map (e : α ≃o β) : Flag α ≃ Flag β
350
+ where
351
+ toFun s := ofIsMaxChain _ (s.maxChain.image e)
352
+ invFun s := ofIsMaxChain _ (s.maxChain.image e.symm)
353
+ left_inv s := ext <| e.symm_image_image s
354
+ right_inv s := ext <| e.image_symm_image s
355
+
356
+ @[simp, norm_cast] lemma coe_map (e : α ≃o β) (s : Flag α) : ↑(map e s) = e '' s := rfl
357
+
358
+ @[simp] lemma symm_map (e : α ≃o β) : (map e).symm = map e.symm := rfl
359
+
323
360
end Preorder
324
361
325
362
section PartialOrder
0 commit comments