order.initial_segMathlib.Order.InitialSeg

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

chore(set_theory/ordinal/basic): golf (#18547)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 -/
 
+import logic.equiv.set
 import order.rel_iso.set
 import order.well_founded
 
@@ -311,6 +312,22 @@ def of_element {α : Type*} (r : α → α → Prop) (a : α) : subrel r {b | r
 @[simp] theorem of_element_top {α : Type*} (r : α → α → Prop) (a : α) :
   (of_element r a).top = a := rfl
 
+/-- For any principal segment `r ≺i s`, there is a `subrel` of `s` order isomorphic to `r`. -/
+@[simps symm_apply]
+noncomputable def subrel_iso (f : r ≺i s) : subrel s {b | s b f.top} ≃r r :=
+rel_iso.symm
+{ to_equiv := ((equiv.of_injective f f.injective).trans (equiv.set_congr
+    (funext (λ x, propext f.down.symm)))),
+  map_rel_iff' := λ a₁ a₂, f.map_rel_iff }
+
+@[simp] theorem apply_subrel_iso (f : r ≺i s) (b : {b | s b f.top}) :
+  f (f.subrel_iso b) = b :=
+equiv.apply_of_injective_symm f.injective _
+
+@[simp] theorem subrel_iso_apply (f : r ≺i s) (a : α) :
+  f.subrel_iso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
+equiv.of_injective_symm_apply f.injective _
+
 /-- Restrict the codomain of a principal segment -/
 def cod_restrict (p : set β) (f : r ≺i s)
   (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i subrel s p :=

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

chore(order/initial_seg): tweak subsingleton_of_trichotomous_of_irrefl (#18749)

We rename it, turn it into an instance, and golf the next instance with it.

Diff
@@ -107,19 +107,18 @@ end⟩
 
 @[simp] theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (f a) := rfl
 
-theorem unique_of_trichotomous_of_irrefl [is_trichotomous β s] [is_irrefl β s] :
-  well_founded r → subsingleton (r ≼i s) | ⟨h⟩ :=
+instance subsingleton_of_trichotomous_of_irrefl [is_trichotomous β s] [is_irrefl β s]
+  [is_well_founded α r] : subsingleton (r ≼i s) :=
 ⟨λ f g, begin
   ext a,
-  have := h a, induction this with a H IH,
+  apply is_well_founded.induction r a (λ b IH, _),
   refine extensional_of_trichotomous_of_irrefl s (λ x, _),
-  simp only [f.init_iff, g.init_iff],
+  rw [f.init_iff, g.init_iff],
   exact exists_congr (λ x, and_congr_left $ λ hx, IH _ hx ▸ iff.rfl)
 end⟩
 
 instance [is_well_order β s] : subsingleton (r ≼i s) :=
-⟨λ a, @subsingleton.elim _ (unique_of_trichotomous_of_irrefl
-  (@rel_embedding.well_founded _ _ r s a is_well_founded.wf)) a⟩
+⟨λ a, by { letI := a.is_well_founded, apply subsingleton.elim }⟩
 
 protected theorem eq [is_well_order β s] (f g : r ≼i s) (a) : f a = g a :=
 by rw subsingleton.elim f g

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(order/initial_seg): add lemmas about acc and well_founded (#18527)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -168,6 +168,13 @@ def le_add (r : α → α → Prop) (s : β → β → Prop) : r ≼i sum.lex r
 @[simp] theorem le_add_apply (r : α → α → Prop) (s : β → β → Prop)
   (a) : le_add r s a = sum.inl a := rfl
 
+protected theorem acc (f : r ≼i s) (a : α) : acc r a ↔ acc s (f a) :=
+⟨begin
+    refine λ h, acc.rec_on h (λ a _ ha, acc.intro _ (λ b hb, _)),
+    obtain ⟨a', rfl⟩ := f.init hb,
+    exact ha _ (f.map_rel_iff.mp hb),
+  end, f.to_rel_embedding.acc a⟩
+
 end initial_seg
 
 /-!
@@ -331,8 +338,32 @@ def of_is_empty (r : α → α → Prop) [is_empty α] {b : β} (H : ∀ b', ¬
 @[reducible] def pempty_to_punit : @empty_relation pempty ≺i @empty_relation punit :=
 @of_is_empty _ _ empty_relation _ _ punit.star $ λ x, not_false
 
+protected theorem acc [is_trans β s] (f : r ≺i s) (a : α) : acc r a ↔ acc s (f a) :=
+(f : r ≼i s).acc a
+
 end principal_seg
 
+/--
+A relation is well-founded iff every principal segment of it is well-founded.
+
+In this lemma we use `subrel` to indicate its principal segments because it's usually more
+convenient to use.
+-/
+theorem well_founded_iff_well_founded_subrel {β : Type*} {s : β → β → Prop} [is_trans β s] :
+  well_founded s ↔ (∀ b, well_founded (subrel s {b' | s b' b})) :=
+begin
+  refine ⟨λ wf b, ⟨λ b', ((principal_seg.of_element _ b).acc b').mpr (wf.apply b')⟩,
+    λ wf, ⟨λ b, acc.intro _ (λ b' hb', _)⟩⟩,
+  let f := principal_seg.of_element s b,
+  obtain ⟨b', rfl⟩ := f.down.mp ((principal_seg.of_element_top s b).symm ▸ hb' : s b' f.top),
+  exact (f.acc b').mp ((wf b).apply b'),
+end
+
+theorem {u} well_founded_iff_principal_seg {β : Type u} {s : β → β → Prop} [is_trans β s] :
+  well_founded s ↔ (∀ (α : Type u) (r : α → α → Prop) (f : r ≺i s), well_founded r) :=
+⟨λ wf α r f, rel_hom_class.well_founded f.to_rel_embedding wf,
+  λ h, well_founded_iff_well_founded_subrel.mpr (λ b, h _ _ (principal_seg.of_element s b))⟩
+
 /-! ### Properties of initial and principal segments -/
 
 /-- To an initial segment taking values in a well order, one can associate either a principal

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

chore(set_theory/ordinal/initial_seg): swap the names of init and init' (#18534)

The former init was stated with the non-preferred to_embedding spelling, and the primed init' used coe_fn. Swapping them around is consistent with how most other bundled morphisms are handled.

mathlib4 PR: https://github.com/leanprover-community/mathlib4/pull/2581

Diff
@@ -49,7 +49,7 @@ open function
 embedding whose range is an initial segment. That is, whenever `b < f a` in `β` then `b` is in the
 range of `f`. -/
 structure initial_seg {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s :=
-(init : ∀ a b, s b (to_rel_embedding a) → ∃ a', to_rel_embedding a' = b)
+(init' : ∀ a b, s b (to_rel_embedding a) → ∃ a', to_rel_embedding a' = b)
 
 localized "infix (name := initial_seg) ` ≼i `:25 := initial_seg" in initial_seg
 
@@ -76,13 +76,13 @@ instance : embedding_like (r ≼i s) α β :=
 
 @[simp] theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f := rfl
 
-theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
-f.init _ _
+theorem init (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
+f.init' _ _
 
 theorem map_rel_iff (f : r ≼i s) {a b : α} : s (f a) (f b) ↔ r a b := f.1.map_rel_iff
 
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
-⟨λ h, let ⟨a', e⟩ := f.init' h in ⟨a', e, f.map_rel_iff.1 (e.symm ▸ h)⟩,
+⟨λ h, let ⟨a', e⟩ := f.init h in ⟨a', e, f.map_rel_iff.1 (e.symm ▸ h)⟩,
  λ ⟨a', e, h⟩, e ▸ f.map_rel_iff.2 h⟩
 
 /-- An order isomorphism is an initial segment -/
@@ -147,12 +147,12 @@ acc.rec_on (is_well_founded.wf.apply b : acc s b) $ λ x H IH,
 not_forall_not.1 $ λ hn,
 h ⟨x, λ y, ⟨(IH _), λ ⟨a, e⟩, by rw ← e; exact
   (trichotomous _ _).resolve_right
-  (not_or (hn a) (λ hl, not_exists.2 hn (f.init' hl)))⟩⟩
+  (not_or (hn a) (λ hl, not_exists.2 hn (f.init hl)))⟩⟩
 
 /-- Restrict the codomain of an initial segment -/
 def cod_restrict (p : set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i subrel s p :=
 ⟨rel_embedding.cod_restrict p f H, λ a ⟨b, m⟩ (h : s b (f a)),
-  let ⟨a', e⟩ := f.init' h in ⟨a', by clear _let_match; subst e; refl⟩⟩
+  let ⟨a', e⟩ := f.init h in ⟨a', by clear _let_match; subst e; refl⟩⟩
 
 @[simp] theorem cod_restrict_apply (p) (f : r ≼i s) (H a) : cod_restrict p f H a = ⟨f a, H a⟩ := rfl
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(data/pequiv,order/initial_seg): use fun_like, embedding_like (#18198)

This is a backport of leanprover-community/mathlib4#1488.

Diff
@@ -56,7 +56,18 @@ localized "infix (name := initial_seg) ` ≼i `:25 := initial_seg" in initial_se
 namespace initial_seg
 
 instance : has_coe (r ≼i s) (r ↪r s) := ⟨initial_seg.to_rel_embedding⟩
-instance : has_coe_to_fun (r ≼i s) (λ _, α → β) := ⟨λ f x, (f : r ↪r s) x⟩
+
+instance : embedding_like (r ≼i s) α β :=
+{ coe := λ f, f.to_fun,
+  coe_injective' :=
+    begin
+      rintro ⟨f, hf⟩ ⟨g, hg⟩ h,
+      congr' with x,
+      exact congr_fun h x
+    end,
+  injective' := λ f, f.inj' }
+
+@[ext] lemma ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g := fun_like.ext f g h
 
 @[simp] theorem coe_fn_mk (f : r ↪r s) (o) :
   (@initial_seg.mk _ _ r s f o : α → β) = f := rfl
@@ -68,9 +79,11 @@ instance : has_coe_to_fun (r ≼i s) (λ _, α → β) := ⟨λ f x, (f : r ↪r
 theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
 f.init _ _
 
+theorem map_rel_iff (f : r ≼i s) {a b : α} : s (f a) (f b) ↔ r a b := f.1.map_rel_iff
+
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
-⟨λ h, let ⟨a', e⟩ := f.init' h in ⟨a', e, (f : r ↪r s).map_rel_iff.1 (e.symm ▸ h)⟩,
- λ ⟨a', e, h⟩, e ▸ (f : r ↪r s).map_rel_iff.2 h⟩
+⟨λ h, let ⟨a', e⟩ := f.init' h in ⟨a', e, f.map_rel_iff.1 (e.symm ▸ h)⟩,
+ λ ⟨a', e, h⟩, e ▸ f.map_rel_iff.2 h⟩
 
 /-- An order isomorphism is an initial segment -/
 def of_iso (f : r ≃r s) : r ≼i s :=
@@ -86,7 +99,7 @@ instance (r : α → α → Prop) : inhabited (r ≼i r) := ⟨initial_seg.refl
 @[trans] protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
 ⟨f.1.trans g.1, λ a c h, begin
   simp at h ⊢,
-  rcases g.2 _ _ h with ⟨b, rfl⟩, have h := g.1.map_rel_iff.1 h,
+  rcases g.2 _ _ h with ⟨b, rfl⟩, have h := g.map_rel_iff.1 h,
   rcases f.2 _ _ h with ⟨a', rfl⟩, exact ⟨a', rfl⟩
 end⟩
 
@@ -97,14 +110,11 @@ end⟩
 theorem unique_of_trichotomous_of_irrefl [is_trichotomous β s] [is_irrefl β s] :
   well_founded r → subsingleton (r ≼i s) | ⟨h⟩ :=
 ⟨λ f g, begin
-  suffices : (f : α → β) = g, { cases f, cases g,
-    congr, exact rel_embedding.coe_fn_injective this },
-  funext a, have := h a, induction this with a H IH,
-  refine extensional_of_trichotomous_of_irrefl s (λ x, ⟨λ h, _, λ h, _⟩),
-  { rcases f.init_iff.1 h with ⟨y, rfl, h'⟩,
-    rw IH _ h', exact (g : r ↪r s).map_rel_iff.2 h' },
-  { rcases g.init_iff.1 h with ⟨y, rfl, h'⟩,
-    rw ← IH _ h', exact (f : r ↪r s).map_rel_iff.2 h' }
+  ext a,
+  have := h a, induction this with a H IH,
+  refine extensional_of_trichotomous_of_irrefl s (λ x, _),
+  simp only [f.init_iff, g.init_iff],
+  exact exists_congr (λ x, and_congr_left $ λ hx, IH _ hx ▸ iff.rfl)
 end⟩
 
 instance [is_well_order β s] : subsingleton (r ≼i s) :=

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -366,7 +366,7 @@ theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔
 theorem irrefl {r : α → α → Prop} [IsWellOrder α r] (f : r ≺i r) : False :=
   by
   have := f.lt_top f.top
-  rw [show f f.top = f.top from InitialSeg.eq (↑f) (InitialSeg.refl r) f.top] at this 
+  rw [show f f.top = f.top from InitialSeg.eq (↑f) (InitialSeg.refl r) f.top] at this
   exact irrefl _ this
 #align principal_seg.irrefl PrincipalSeg.irrefl
 -/
Diff
@@ -76,7 +76,7 @@ instance : EmbeddingLike (r ≼i s) α β where
 #print InitialSeg.ext /-
 @[ext]
 theorem ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
-  FunLike.ext f g h
+  DFunLike.ext f g h
 #align initial_seg.ext InitialSeg.ext
 -/
 
Diff
@@ -215,7 +215,7 @@ theorem antisymm_symm [IsWellOrder α r] [IsWellOrder β s] (f : r ≼i s) (g :
 #print InitialSeg.eq_or_principal /-
 theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
     Surjective f ∨ ∃ b, ∀ x, s x b ↔ ∃ y, f y = x :=
-  or_iff_not_imp_right.2 fun h b =>
+  Classical.or_iff_not_imp_right.2 fun h b =>
     Acc.recOn (IsWellFounded.wf.apply b : Acc s b) fun x H IH =>
       not_forall_not.1 fun hn =>
         h
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 -/
-import Mathbin.Logic.Equiv.Set
-import Mathbin.Order.RelIso.Set
-import Mathbin.Order.WellFounded
+import Logic.Equiv.Set
+import Order.RelIso.Set
+import Order.WellFounded
 
 #align_import order.initial_seg from "leanprover-community/mathlib"@"8ea5598db6caeddde6cb734aa179cc2408dbd345"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
-
-! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 8ea5598db6caeddde6cb734aa179cc2408dbd345
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Logic.Equiv.Set
 import Mathbin.Order.RelIso.Set
 import Mathbin.Order.WellFounded
 
+#align_import order.initial_seg from "leanprover-community/mathlib"@"8ea5598db6caeddde6cb734aa179cc2408dbd345"
+
 /-!
 # Initial and principal segments
 
@@ -507,6 +504,7 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 -/
 
+#print PrincipalSeg.subrelIso /-
 /-- For any principal segment `r ≺i s`, there is a `subrel` of `s` order isomorphic to `r`. -/
 @[simps symm_apply]
 noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
@@ -516,16 +514,21 @@ noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
           (Equiv.setCongr (funext fun x => propext f.down.symm))
       map_rel_iff' := fun a₁ a₂ => f.map_rel_iff }
 #align principal_seg.subrel_iso PrincipalSeg.subrelIso
+-/
 
+#print PrincipalSeg.apply_subrelIso /-
 @[simp]
 theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) : f (f.subrelIso b) = b :=
   Equiv.apply_ofInjective_symm f.Injective _
 #align principal_seg.apply_subrel_iso PrincipalSeg.apply_subrelIso
+-/
 
+#print PrincipalSeg.subrelIso_apply /-
 @[simp]
 theorem subrelIso_apply (f : r ≺i s) (a : α) : f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
   Equiv.ofInjective_symm_apply f.Injective _
 #align principal_seg.subrel_iso_apply PrincipalSeg.subrelIso_apply
+-/
 
 #print PrincipalSeg.codRestrict /-
 /-- Restrict the codomain of a principal segment -/
Diff
@@ -4,10 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
+! leanprover-community/mathlib commit 8ea5598db6caeddde6cb734aa179cc2408dbd345
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.Logic.Equiv.Set
 import Mathbin.Order.RelIso.Set
 import Mathbin.Order.WellFounded
 
@@ -506,6 +507,26 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 -/
 
+/-- For any principal segment `r ≺i s`, there is a `subrel` of `s` order isomorphic to `r`. -/
+@[simps symm_apply]
+noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
+  RelIso.symm
+    { toEquiv :=
+        (Equiv.ofInjective f f.Injective).trans
+          (Equiv.setCongr (funext fun x => propext f.down.symm))
+      map_rel_iff' := fun a₁ a₂ => f.map_rel_iff }
+#align principal_seg.subrel_iso PrincipalSeg.subrelIso
+
+@[simp]
+theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) : f (f.subrelIso b) = b :=
+  Equiv.apply_ofInjective_symm f.Injective _
+#align principal_seg.apply_subrel_iso PrincipalSeg.apply_subrelIso
+
+@[simp]
+theorem subrelIso_apply (f : r ≺i s) (a : α) : f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
+  Equiv.ofInjective_symm_apply f.Injective _
+#align principal_seg.subrel_iso_apply PrincipalSeg.subrelIso_apply
+
 #print PrincipalSeg.codRestrict /-
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
Diff
@@ -60,7 +60,6 @@ structure InitialSeg {α β : Type _} (r : α → α → Prop) (s : β → β 
 #align initial_seg InitialSeg
 -/
 
--- mathport name: initial_seg
 scoped[InitialSeg] infixl:25 " ≼i " => InitialSeg
 
 namespace InitialSeg
@@ -76,10 +75,12 @@ instance : EmbeddingLike (r ≼i s) α β where
     exact congr_fun h x
   injective' f := f.inj'
 
+#print InitialSeg.ext /-
 @[ext]
 theorem ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
   FunLike.ext f g h
 #align initial_seg.ext InitialSeg.ext
+-/
 
 @[simp]
 theorem coeFn_mk (f : r ↪r s) (o) : (@InitialSeg.mk _ _ r s f o : α → β) = f :=
@@ -91,25 +92,33 @@ theorem coeFn_toRelEmbedding (f : r ≼i s) : (f.toRelEmbedding : α → β) = f
   rfl
 #align initial_seg.coe_fn_to_rel_embedding InitialSeg.coeFn_toRelEmbedding
 
+#print InitialSeg.coe_coe_fn /-
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align initial_seg.coe_coe_fn InitialSeg.coe_coe_fn
+-/
 
+#print InitialSeg.init /-
 theorem init (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
   f.init' _ _
 #align initial_seg.init InitialSeg.init
+-/
 
+#print InitialSeg.map_rel_iff /-
 theorem map_rel_iff (f : r ≼i s) {a b : α} : s (f a) (f b) ↔ r a b :=
   f.1.map_rel_iff
 #align initial_seg.map_rel_iff InitialSeg.map_rel_iff
+-/
 
+#print InitialSeg.init_iff /-
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   ⟨fun h =>
     let ⟨a', e⟩ := f.dropLast h
     ⟨a', e, f.map_rel_iff.1 (e.symm ▸ h)⟩,
     fun ⟨a', e, h⟩ => e ▸ f.map_rel_iff.2 h⟩
 #align initial_seg.init_iff InitialSeg.init_iff
+-/
 
 #print InitialSeg.ofIso /-
 /-- An order isomorphism is an initial segment -/
@@ -140,15 +149,19 @@ protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
 #align initial_seg.trans InitialSeg.trans
 -/
 
+#print InitialSeg.refl_apply /-
 @[simp]
 theorem refl_apply (x : α) : InitialSeg.refl r x = x :=
   rfl
 #align initial_seg.refl_apply InitialSeg.refl_apply
+-/
 
+#print InitialSeg.trans_apply /-
 @[simp]
 theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (f a) :=
   rfl
 #align initial_seg.trans_apply InitialSeg.trans_apply
+-/
 
 #print InitialSeg.subsingleton_of_trichotomous_of_irrefl /-
 instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s]
@@ -165,13 +178,17 @@ instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
   ⟨fun a => by letI := a.is_well_founded; apply Subsingleton.elim⟩
 
+#print InitialSeg.eq /-
 protected theorem eq [IsWellOrder β s] (f g : r ≼i s) (a) : f a = g a := by
   rw [Subsingleton.elim f g]
 #align initial_seg.eq InitialSeg.eq
+-/
 
+#print InitialSeg.Antisymm.aux /-
 theorem Antisymm.aux [IsWellOrder α r] (f : r ≼i s) (g : s ≼i r) : LeftInverse g f :=
   InitialSeg.eq (f.trans g) (InitialSeg.refl _)
 #align initial_seg.antisymm.aux InitialSeg.Antisymm.aux
+-/
 
 #print InitialSeg.antisymm /-
 /-- If we have order embeddings between `α` and `β` whose images are initial segments, and `β`
@@ -182,17 +199,22 @@ def antisymm [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : r ≃r s :=
 #align initial_seg.antisymm InitialSeg.antisymm
 -/
 
+#print InitialSeg.antisymm_toFun /-
 @[simp]
 theorem antisymm_toFun [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : (antisymm f g : α → β) = f :=
   rfl
 #align initial_seg.antisymm_to_fun InitialSeg.antisymm_toFun
+-/
 
+#print InitialSeg.antisymm_symm /-
 @[simp]
 theorem antisymm_symm [IsWellOrder α r] [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) :
     (antisymm f g).symm = antisymm g f :=
   RelIso.coe_fn_injective rfl
 #align initial_seg.antisymm_symm InitialSeg.antisymm_symm
+-/
 
+#print InitialSeg.eq_or_principal /-
 theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
     Surjective f ∨ ∃ b, ∀ x, s x b ↔ ∃ y, f y = x :=
   or_iff_not_imp_right.2 fun h b =>
@@ -206,18 +228,23 @@ theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
                   (trichotomous _ _).resolve_right
                     (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init hl))⟩⟩
 #align initial_seg.eq_or_principal InitialSeg.eq_or_principal
+-/
 
+#print InitialSeg.codRestrict /-
 /-- Restrict the codomain of an initial segment -/
 def codRestrict (p : Set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, fun a ⟨b, m⟩ (h : s b (f a)) =>
     let ⟨a', e⟩ := f.dropLast h
     ⟨a', by clear _let_match <;> subst e <;> rfl⟩⟩
 #align initial_seg.cod_restrict InitialSeg.codRestrict
+-/
 
+#print InitialSeg.codRestrict_apply /-
 @[simp]
 theorem codRestrict_apply (p) (f : r ≼i s) (H a) : codRestrict p f H a = ⟨f a, H a⟩ :=
   rfl
 #align initial_seg.cod_restrict_apply InitialSeg.codRestrict_apply
+-/
 
 #print InitialSeg.ofIsEmpty /-
 /-- Initial segment from an empty type. -/
@@ -234,17 +261,21 @@ def leAdd (r : α → α → Prop) (s : β → β → Prop) : r ≼i Sum.Lex r s
 #align initial_seg.le_add InitialSeg.leAdd
 -/
 
+#print InitialSeg.leAdd_apply /-
 @[simp]
 theorem leAdd_apply (r : α → α → Prop) (s : β → β → Prop) (a) : leAdd r s a = Sum.inl a :=
   rfl
 #align initial_seg.le_add_apply InitialSeg.leAdd_apply
+-/
 
+#print InitialSeg.acc /-
 protected theorem acc (f : r ≼i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   ⟨by
     refine' fun h => Acc.recOn h fun a _ ha => Acc.intro _ fun b hb => _
     obtain ⟨a', rfl⟩ := f.init hb
     exact ha _ (f.map_rel_iff.mp hb), f.toRelEmbedding.Acc a⟩
 #align initial_seg.acc InitialSeg.acc
+-/
 
 end InitialSeg
 
@@ -269,7 +300,6 @@ structure PrincipalSeg {α β : Type _} (r : α → α → Prop) (s : β → β
 #align principal_seg PrincipalSeg
 -/
 
--- mathport name: principal_seg
 scoped[InitialSeg] infixl:25 " ≺i " => PrincipalSeg
 
 namespace PrincipalSeg
@@ -280,10 +310,12 @@ instance : Coe (r ≺i s) (r ↪r s) :=
 instance : CoeFun (r ≺i s) fun _ => α → β :=
   ⟨fun f => f⟩
 
+#print PrincipalSeg.coe_fn_mk /-
 @[simp]
 theorem coe_fn_mk (f : r ↪r s) (t o) : (@PrincipalSeg.mk _ _ r s f t o : α → β) = f :=
   rfl
 #align principal_seg.coe_fn_mk PrincipalSeg.coe_fn_mk
+-/
 
 @[simp]
 theorem coeFn_toRelEmbedding (f : r ≺i s) : (f.toRelEmbedding : α → β) = f :=
@@ -295,17 +327,23 @@ theorem coe_coeFn (f : r ≺i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align principal_seg.coe_coe_fn PrincipalSeg.coe_coeFn
 
+#print PrincipalSeg.down /-
 theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
   f.down'
 #align principal_seg.down PrincipalSeg.down
+-/
 
+#print PrincipalSeg.lt_top /-
 theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
   f.down.2 ⟨_, rfl⟩
 #align principal_seg.lt_top PrincipalSeg.lt_top
+-/
 
+#print PrincipalSeg.init /-
 theorem init [IsTrans β s] (f : r ≺i s) {a : α} {b : β} (h : s b (f a)) : ∃ a', f a' = b :=
   f.down.1 <| trans h <| f.lt_top _
 #align principal_seg.init PrincipalSeg.init
+-/
 
 #print PrincipalSeg.hasCoeInitialSeg /-
 /-- A principal segment is in particular an initial segment. -/
@@ -314,13 +352,17 @@ instance hasCoeInitialSeg [IsTrans β s] : Coe (r ≺i s) (r ≼i s) :=
 #align principal_seg.has_coe_initial_seg PrincipalSeg.hasCoeInitialSeg
 -/
 
+#print PrincipalSeg.coe_coe_fn' /-
 theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β) = f :=
   rfl
 #align principal_seg.coe_coe_fn' PrincipalSeg.coe_coe_fn'
+-/
 
+#print PrincipalSeg.init_iff /-
 theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   @InitialSeg.init_iff α β r s f a b
 #align principal_seg.init_iff PrincipalSeg.init_iff
+-/
 
 #print PrincipalSeg.irrefl /-
 theorem irrefl {r : α → α → Prop} [IsWellOrder α r] (f : r ≺i r) : False :=
@@ -344,15 +386,19 @@ def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
 #align principal_seg.lt_le PrincipalSeg.ltLe
 -/
 
+#print PrincipalSeg.lt_le_apply /-
 @[simp]
 theorem lt_le_apply (f : r ≺i s) (g : s ≼i t) (a : α) : (f.ltLe g) a = g (f a) :=
   RelEmbedding.trans_apply _ _ _
 #align principal_seg.lt_le_apply PrincipalSeg.lt_le_apply
+-/
 
+#print PrincipalSeg.lt_le_top /-
 @[simp]
 theorem lt_le_top (f : r ≺i s) (g : s ≼i t) : (f.ltLe g).top = g f.top :=
   rfl
 #align principal_seg.lt_le_top PrincipalSeg.lt_le_top
+-/
 
 #print PrincipalSeg.trans /-
 /-- Composition of two principal segments as a principal segment -/
@@ -362,15 +408,19 @@ protected def trans [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : r ≺i t :=
 #align principal_seg.trans PrincipalSeg.trans
 -/
 
+#print PrincipalSeg.trans_apply /-
 @[simp]
 theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.trans g) a = g (f a) :=
   lt_le_apply _ _ _
 #align principal_seg.trans_apply PrincipalSeg.trans_apply
+-/
 
+#print PrincipalSeg.trans_top /-
 @[simp]
 theorem trans_top [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : (f.trans g).top = g f.top :=
   rfl
 #align principal_seg.trans_top PrincipalSeg.trans_top
+-/
 
 #print PrincipalSeg.equivLT /-
 /-- Composition of an order isomorphism with a principal segment, as a principal segment -/
@@ -394,15 +444,19 @@ def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ →
 #align principal_seg.lt_equiv PrincipalSeg.ltEquiv
 -/
 
+#print PrincipalSeg.equivLT_apply /-
 @[simp]
 theorem equivLT_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLT f g) a = g (f a) :=
   RelEmbedding.trans_apply _ _ _
 #align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_apply
+-/
 
+#print PrincipalSeg.equivLT_top /-
 @[simp]
 theorem equivLT_top (f : r ≃r s) (g : s ≺i t) : (equivLT f g).top = g.top :=
   rfl
 #align principal_seg.equiv_lt_top PrincipalSeg.equivLT_top
+-/
 
 /-- Given a well order `s`, there is a most one principal segment embedding of `r` into `s`. -/
 instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
@@ -418,14 +472,18 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
     cases f; cases g
     have := RelEmbedding.coe_fn_injective ef <;> congr⟩
 
+#print PrincipalSeg.top_eq /-
 theorem top_eq [IsWellOrder γ t] (e : r ≃r s) (f : r ≺i t) (g : s ≺i t) : f.top = g.top := by
   rw [Subsingleton.elim f (PrincipalSeg.equivLT e g)] <;> rfl
 #align principal_seg.top_eq PrincipalSeg.top_eq
+-/
 
+#print PrincipalSeg.topLTTop /-
 theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
     (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top := by
   rw [Subsingleton.elim h (f.trans g)]; apply PrincipalSeg.lt_top
 #align principal_seg.top_lt_top PrincipalSeg.topLTTop
+-/
 
 #print PrincipalSeg.ofElement /-
 /-- Any element of a well order yields a principal segment -/
@@ -434,10 +492,12 @@ def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r {b | r
 #align principal_seg.of_element PrincipalSeg.ofElement
 -/
 
+#print PrincipalSeg.ofElement_apply /-
 @[simp]
 theorem ofElement_apply {α : Type _} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
 #align principal_seg.of_element_apply PrincipalSeg.ofElement_apply
+-/
 
 #print PrincipalSeg.ofElement_top /-
 @[simp]
@@ -446,22 +506,28 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 -/
 
+#print PrincipalSeg.codRestrict /-
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, ⟨f.top, H₂⟩, fun ⟨b, h⟩ =>
     f.down.trans <|
       exists_congr fun a => show (⟨f a, H a⟩ : p).1 = _ ↔ _ from ⟨Subtype.eq, congr_arg _⟩⟩
 #align principal_seg.cod_restrict PrincipalSeg.codRestrict
+-/
 
+#print PrincipalSeg.codRestrict_apply /-
 @[simp]
 theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂ a = ⟨f a, H a⟩ :=
   rfl
 #align principal_seg.cod_restrict_apply PrincipalSeg.codRestrict_apply
+-/
 
+#print PrincipalSeg.codRestrict_top /-
 @[simp]
 theorem codRestrict_top (p) (f : r ≺i s) (H H₂) : (codRestrict p f H H₂).top = ⟨f.top, H₂⟩ :=
   rfl
 #align principal_seg.cod_restrict_top PrincipalSeg.codRestrict_top
+-/
 
 #print PrincipalSeg.ofIsEmpty /-
 /-- Principal segment from an empty type into a type with a minimal element. -/
@@ -472,11 +538,13 @@ def ofIsEmpty (r : α → α → Prop) [IsEmpty α] {b : β} (H : ∀ b', ¬s b'
 #align principal_seg.of_is_empty PrincipalSeg.ofIsEmpty
 -/
 
+#print PrincipalSeg.ofIsEmpty_top /-
 @[simp]
 theorem ofIsEmpty_top (r : α → α → Prop) [IsEmpty α] {b : β} (H : ∀ b', ¬s b' b) :
     (ofIsEmpty r H).top = b :=
   rfl
 #align principal_seg.of_is_empty_top PrincipalSeg.ofIsEmpty_top
+-/
 
 #print PrincipalSeg.pemptyToPunit /-
 /-- Principal segment from the empty relation on `pempty` to the empty relation on `punit`. -/
@@ -486,9 +554,11 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 #align principal_seg.pempty_to_punit PrincipalSeg.pemptyToPunit
 -/
 
+#print PrincipalSeg.acc /-
 protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   (f : r ≼i s).Acc a
 #align principal_seg.acc PrincipalSeg.acc
+-/
 
 end PrincipalSeg
 
@@ -534,15 +604,19 @@ noncomputable def InitialSeg.ltOrEq [IsWellOrder β s] (f : r ≼i s) : Sum (r 
 #align initial_seg.lt_or_eq InitialSeg.ltOrEq
 -/
 
+#print InitialSeg.ltOrEq_apply_left /-
 theorem InitialSeg.ltOrEq_apply_left [IsWellOrder β s] (f : r ≼i s) (g : r ≺i s) (a : α) :
     g a = f a :=
   @InitialSeg.eq α β r s _ g f a
 #align initial_seg.lt_or_eq_apply_left InitialSeg.ltOrEq_apply_left
+-/
 
+#print InitialSeg.ltOrEq_apply_right /-
 theorem InitialSeg.ltOrEq_apply_right [IsWellOrder β s] (f : r ≼i s) (g : r ≃r s) (a : α) :
     g a = f a :=
   InitialSeg.eq (InitialSeg.ofIso g) f a
 #align initial_seg.lt_or_eq_apply_right InitialSeg.ltOrEq_apply_right
+-/
 
 #print InitialSeg.leLT /-
 /-- Composition of an initial segment taking values in a well order and a principal segment. -/
@@ -554,6 +628,7 @@ noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i
 #align initial_seg.le_lt InitialSeg.leLT
 -/
 
+#print InitialSeg.leLT_apply /-
 @[simp]
 theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
     (f.leLT g) a = g (f a) := by
@@ -561,9 +636,11 @@ theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (
   · simp only [PrincipalSeg.trans_apply, f.lt_or_eq_apply_left]
   · simp only [PrincipalSeg.equivLT_apply, f.lt_or_eq_apply_right]
 #align initial_seg.le_lt_apply InitialSeg.leLT_apply
+-/
 
 namespace RelEmbedding
 
+#print RelEmbedding.collapseF /-
 /-- Given an order embedding into a well order, collapse the order embedding by filling the
 gaps, to obtain an initial segment. Here, we construct the collapsed order embedding pointwise,
 but the proof of the fact that it is an initial segment will be given in `collapse`. -/
@@ -577,6 +654,7 @@ noncomputable def collapseF [IsWellOrder β s] (f : r ↪r s) : ∀ a, { b // ¬
         fun h' => (IH a' h).2 <| h' ▸ f.map_rel_iff.2 h
     exact ⟨is_well_founded.wf.min S ⟨_, this⟩, is_well_founded.wf.not_lt_min _ _ this⟩
 #align rel_embedding.collapse_F RelEmbedding.collapseF
+-/
 
 #print RelEmbedding.collapseF.lt /-
 theorem collapseF.lt [IsWellOrder β s] (f : r ↪r s) {a : α} :
@@ -619,9 +697,11 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
 #align rel_embedding.collapse RelEmbedding.collapse
 -/
 
+#print RelEmbedding.collapse_apply /-
 theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (collapseF f a).1 :=
   rfl
 #align rel_embedding.collapse_apply RelEmbedding.collapse_apply
+-/
 
 end RelEmbedding
 
Diff
@@ -429,7 +429,7 @@ theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → 
 
 #print PrincipalSeg.ofElement /-
 /-- Any element of a well order yields a principal segment -/
-def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r b a } ≺i r :=
+def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r {b | r b a} ≺i r :=
   ⟨Subrel.relEmbedding _ _, a, fun b => ⟨fun h => ⟨⟨_, h⟩, rfl⟩, fun ⟨⟨_, h⟩, rfl⟩ => h⟩⟩
 #align principal_seg.of_element PrincipalSeg.ofElement
 -/
@@ -499,7 +499,7 @@ In this lemma we use `subrel` to indicate its principal segments because it's us
 convenient to use.
 -/
 theorem wellFounded_iff_wellFounded_subrel {β : Type _} {s : β → β → Prop} [IsTrans β s] :
-    WellFounded s ↔ ∀ b, WellFounded (Subrel s { b' | s b' b }) :=
+    WellFounded s ↔ ∀ b, WellFounded (Subrel s {b' | s b' b}) :=
   by
   refine'
     ⟨fun wf b => ⟨fun b' => ((PrincipalSeg.ofElement _ b).Acc b').mpr (wf.apply b')⟩, fun wf =>
@@ -570,7 +570,7 @@ but the proof of the fact that it is an initial segment will be given in `collap
 noncomputable def collapseF [IsWellOrder β s] (f : r ↪r s) : ∀ a, { b // ¬s (f a) b } :=
   (RelEmbedding.wellFounded f <| IsWellFounded.wf).fix fun a IH =>
     by
-    let S := { b | ∀ a h, s (IH a h).1 b }
+    let S := {b | ∀ a h, s (IH a h).1 b}
     have : f a ∈ S := fun a' h =>
       ((trichotomous _ _).resolve_left fun h' =>
             (IH a' h).2 <| trans (f.map_rel_iff.2 h) h').resolve_left
@@ -581,7 +581,7 @@ noncomputable def collapseF [IsWellOrder β s] (f : r ↪r s) : ∀ a, { b // ¬
 #print RelEmbedding.collapseF.lt /-
 theorem collapseF.lt [IsWellOrder β s] (f : r ↪r s) {a : α} :
     ∀ {a'}, r a' a → s (collapseF f a').1 (collapseF f a).1 :=
-  show (collapseF f a).1 ∈ { b | ∀ (a') (h : r a' a), s (collapseF f a').1 b }
+  show (collapseF f a).1 ∈ {b | ∀ (a') (h : r a' a), s (collapseF f a').1 b}
     by
     unfold collapse_F; rw [WellFounded.fix_eq]
     apply WellFounded.min_mem _ _
@@ -595,7 +595,7 @@ theorem collapseF.not_lt [IsWellOrder β s] (f : r ↪r s) (a : α) {b}
   unfold collapse_F; rw [WellFounded.fix_eq]
   exact
     WellFounded.not_lt_min _ _ _
-      (show b ∈ { b | ∀ (a') (h : r a' a), s (collapse_F f a').1 b } from h)
+      (show b ∈ {b | ∀ (a') (h : r a' a), s (collapse_F f a').1 b} from h)
 #align rel_embedding.collapse_F.not_lt RelEmbedding.collapseF.not_lt
 -/
 
@@ -607,7 +607,7 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
   ⟨RelEmbedding.ofMonotone (fun a => (collapse_F f a).1) fun a b => collapse_F.lt f, fun a b =>
     Acc.recOn (is_well_founded.wf.apply b : Acc s b)
       (fun b H IH a h => by
-        let S := { a | ¬s (collapse_F f a).1 b }
+        let S := {a | ¬s (collapse_F f a).1 b}
         have : S.nonempty := ⟨_, asymm h⟩
         exists (IsWellFounded.wf : WellFounded r).min S this
         refine' ((@trichotomous _ s _ _ _).resolve_left _).resolve_right _
Diff
@@ -134,7 +134,7 @@ instance (r : α → α → Prop) : Inhabited (r ≼i r) :=
 @[trans]
 protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
   ⟨f.1.trans g.1, fun a c h => by
-    simp at h⊢
+    simp at h ⊢
     rcases g.2 _ _ h with ⟨b, rfl⟩; have h := g.map_rel_iff.1 h
     rcases f.2 _ _ h with ⟨a', rfl⟩; exact ⟨a', rfl⟩⟩
 #align initial_seg.trans InitialSeg.trans
@@ -230,7 +230,7 @@ def ofIsEmpty (r : α → α → Prop) (s : β → β → Prop) [IsEmpty α] : r
 /-- Initial segment embedding of an order `r` into the disjoint union of `r` and `s`. -/
 def leAdd (r : α → α → Prop) (s : β → β → Prop) : r ≼i Sum.Lex r s :=
   ⟨⟨⟨Sum.inl, fun _ _ => Sum.inl.inj⟩, fun a b => Sum.lex_inl_inl⟩, fun a b => by
-    cases b <;> [exact fun _ => ⟨_, rfl⟩;exact False.elim ∘ Sum.lex_inr_inl]⟩
+    cases b <;> [exact fun _ => ⟨_, rfl⟩; exact False.elim ∘ Sum.lex_inr_inl]⟩
 #align initial_seg.le_add InitialSeg.leAdd
 -/
 
@@ -326,7 +326,7 @@ theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔
 theorem irrefl {r : α → α → Prop} [IsWellOrder α r] (f : r ≺i r) : False :=
   by
   have := f.lt_top f.top
-  rw [show f f.top = f.top from InitialSeg.eq (↑f) (InitialSeg.refl r) f.top] at this
+  rw [show f f.top = f.top from InitialSeg.eq (↑f) (InitialSeg.refl r) f.top] at this 
   exact irrefl _ this
 #align principal_seg.irrefl PrincipalSeg.irrefl
 -/
@@ -416,7 +416,7 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
       refine' extensional_of_trichotomous_of_irrefl s fun x => _
       simp only [f.down, g.down, ef, coe_fn_to_rel_embedding]
     cases f; cases g
-    have := RelEmbedding.coe_fn_injective ef <;> congr ⟩
+    have := RelEmbedding.coe_fn_injective ef <;> congr⟩
 
 theorem top_eq [IsWellOrder γ t] (e : r ≃r s) (f : r ≺i t) (g : s ≺i t) : f.top = g.top := by
   rw [Subsingleton.elim f (PrincipalSeg.equivLT e g)] <;> rfl
Diff
@@ -76,12 +76,6 @@ instance : EmbeddingLike (r ≼i s) α β where
     exact congr_fun h x
   injective' f := f.inj'
 
-/- warning: initial_seg.ext -> InitialSeg.ext is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {f : InitialSeg.{u1, u2} α β r s} {g : InitialSeg.{u1, u2} α β r s}, (forall (x : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f x) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) g x)) -> (Eq.{max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) f g)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {f : InitialSeg.{u2, u1} α β r s} {g : InitialSeg.{u2, u1} α β r s}, (forall (x : α), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) g x)) -> (Eq.{max (succ u2) (succ u1)} (InitialSeg.{u2, u1} α β r s) f g)
-Case conversion may be inaccurate. Consider using '#align initial_seg.ext InitialSeg.extₓ'. -/
 @[ext]
 theorem ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
   FunLike.ext f g h
@@ -97,43 +91,19 @@ theorem coeFn_toRelEmbedding (f : r ≼i s) : (f.toRelEmbedding : α → β) = f
   rfl
 #align initial_seg.coe_fn_to_rel_embedding InitialSeg.coeFn_toRelEmbedding
 
-/- warning: initial_seg.coe_coe_fn -> InitialSeg.coe_coe_fn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (InitialSeg.toRelEmbedding.{u2, u1} α β r s f)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
-Case conversion may be inaccurate. Consider using '#align initial_seg.coe_coe_fn InitialSeg.coe_coe_fnₓ'. -/
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align initial_seg.coe_coe_fn InitialSeg.coe_coe_fn
 
-/- warning: initial_seg.init -> InitialSeg.init is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a') b))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a)) -> (Exists.{succ u2} α (fun (a' : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a') b))
-Case conversion may be inaccurate. Consider using '#align initial_seg.init InitialSeg.initₓ'. -/
 theorem init (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
   f.init' _ _
 #align initial_seg.init InitialSeg.init
 
-/- warning: initial_seg.map_rel_iff -> InitialSeg.map_rel_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) {a : α} {b : α}, Iff (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f b)) (r a b)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {f : α} {a : α} (b : InitialSeg.{u2, u1} α β r s), Iff (s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) b f) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) b a)) (r f a)
-Case conversion may be inaccurate. Consider using '#align initial_seg.map_rel_iff InitialSeg.map_rel_iffₓ'. -/
 theorem map_rel_iff (f : r ≼i s) {a b : α} : s (f a) (f b) ↔ r a b :=
   f.1.map_rel_iff
 #align initial_seg.map_rel_iff InitialSeg.map_rel_iff
 
-/- warning: initial_seg.init_iff -> InitialSeg.init_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a') b) (r a' a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a)) (Exists.{succ u2} α (fun (a' : α) => And (Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a') b) (r a' a)))
-Case conversion may be inaccurate. Consider using '#align initial_seg.init_iff InitialSeg.init_iffₓ'. -/
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   ⟨fun h =>
     let ⟨a', e⟩ := f.dropLast h
@@ -170,23 +140,11 @@ protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
 #align initial_seg.trans InitialSeg.trans
 -/
 
-/- warning: initial_seg.refl_apply -> InitialSeg.refl_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {r : α -> α -> Prop} (x : α), Eq.{succ u1} α (coeFn.{succ u1, succ u1} (InitialSeg.{u1, u1} α α r r) (fun (_x : InitialSeg.{u1, u1} α α r r) => α -> α) (FunLike.hasCoeToFun.{succ u1, succ u1, succ u1} (InitialSeg.{u1, u1} α α r r) α (fun (_x : α) => α) (EmbeddingLike.toFunLike.{succ u1, succ u1, succ u1} (InitialSeg.{u1, u1} α α r r) α α (InitialSeg.embeddingLike.{u1, u1} α α r r))) (InitialSeg.refl.{u1} α r) x) x
-but is expected to have type
-  forall {α : Type.{u1}} {r : α -> α -> Prop} (x : α), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => α) x) (FunLike.coe.{succ u1, succ u1, succ u1} (InitialSeg.{u1, u1} α α r r) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => α) _x) (EmbeddingLike.toFunLike.{succ u1, succ u1, succ u1} (InitialSeg.{u1, u1} α α r r) α α (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u1} α α r r)) (InitialSeg.refl.{u1} α r) x) x
-Case conversion may be inaccurate. Consider using '#align initial_seg.refl_apply InitialSeg.refl_applyₓ'. -/
 @[simp]
 theorem refl_apply (x : α) : InitialSeg.refl r x = x :=
   rfl
 #align initial_seg.refl_apply InitialSeg.refl_apply
 
-/- warning: initial_seg.trans_apply -> InitialSeg.trans_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (InitialSeg.{u1, u3} α γ r t) (fun (_x : InitialSeg.{u1, u3} α γ r t) => α -> γ) (FunLike.hasCoeToFun.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α γ r t) α (fun (_x : α) => γ) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α γ r t) α γ (InitialSeg.embeddingLike.{u1, u3} α γ r t))) (InitialSeg.trans.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (InitialSeg.{u2, u3} β γ s t) (fun (_x : InitialSeg.{u2, u3} β γ s t) => β -> γ) (FunLike.hasCoeToFun.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β (fun (_x : β) => γ) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β γ (InitialSeg.embeddingLike.{u2, u3} β γ s t))) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : InitialSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (InitialSeg.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u1), succ u3, succ u1} (InitialSeg.{u3, u1} α γ r t) α γ (InitialSeg.instEmbeddingLikeInitialSeg.{u3, u1} α γ r t)) (InitialSeg.trans.{u3, u2, u1} α β γ r s t f g) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (InitialSeg.{u3, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u2), succ u3, succ u2} (InitialSeg.{u3, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u3, u2} α β r s)) f a))
-Case conversion may be inaccurate. Consider using '#align initial_seg.trans_apply InitialSeg.trans_applyₓ'. -/
 @[simp]
 theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (f a) :=
   rfl
@@ -207,22 +165,10 @@ instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
   ⟨fun a => by letI := a.is_well_founded; apply Subsingleton.elim⟩
 
-/- warning: initial_seg.eq -> InitialSeg.eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) g a)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) g a)
-Case conversion may be inaccurate. Consider using '#align initial_seg.eq InitialSeg.eqₓ'. -/
 protected theorem eq [IsWellOrder β s] (f g : r ≼i s) (a) : f a = g a := by
   rw [Subsingleton.elim f g]
 #align initial_seg.eq InitialSeg.eq
 
-/- warning: initial_seg.antisymm.aux -> InitialSeg.Antisymm.aux is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u1} α r] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Function.LeftInverse.{succ u1, succ u2} α β (coeFn.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (InitialSeg.{u2, u1} β α s r) (fun (_x : InitialSeg.{u2, u1} β α s r) => β -> α) (FunLike.hasCoeToFun.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β α s r) β (fun (_x : β) => α) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β α s r) β α (InitialSeg.embeddingLike.{u2, u1} β α s r))) g) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} α r] (f : InitialSeg.{u2, u1} α β r s) (g : InitialSeg.{u1, u2} β α s r), Function.LeftInverse.{succ u2, succ u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (InitialSeg.{u1, u2} β α s r) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => α) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u1, succ u2} (InitialSeg.{u1, u2} β α s r) β α (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} β α s r)) g) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
-Case conversion may be inaccurate. Consider using '#align initial_seg.antisymm.aux InitialSeg.Antisymm.auxₓ'. -/
 theorem Antisymm.aux [IsWellOrder α r] (f : r ≼i s) (g : s ≼i r) : LeftInverse g f :=
   InitialSeg.eq (f.trans g) (InitialSeg.refl _)
 #align initial_seg.antisymm.aux InitialSeg.Antisymm.aux
@@ -236,35 +182,17 @@ def antisymm [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : r ≃r s :=
 #align initial_seg.antisymm InitialSeg.antisymm
 -/
 
-/- warning: initial_seg.antisymm_to_fun -> InitialSeg.antisymm_toFun is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u1) (succ u2)} ((fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u1) (succ u2)} (α -> β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelIso.{u1, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelIso.{u1, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u1, u2} α β r s)) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f)
-Case conversion may be inaccurate. Consider using '#align initial_seg.antisymm_to_fun InitialSeg.antisymm_toFunₓ'. -/
 @[simp]
 theorem antisymm_toFun [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : (antisymm f g : α → β) = f :=
   rfl
 #align initial_seg.antisymm_to_fun InitialSeg.antisymm_toFun
 
-/- warning: initial_seg.antisymm_symm -> InitialSeg.antisymm_symm is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u1} α r] [_inst_2 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u2) (succ u1)} (RelIso.{u2, u1} β α s r) (RelIso.symm.{u1, u2} α β r s (InitialSeg.antisymm.{u1, u2} α β r s _inst_2 f g)) (InitialSeg.antisymm.{u2, u1} β α s r _inst_1 g f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} α r] [_inst_2 : IsWellOrder.{u1} β s] (f : InitialSeg.{u2, u1} α β r s) (g : InitialSeg.{u1, u2} β α s r), Eq.{max (succ u2) (succ u1)} (RelIso.{u1, u2} β α s r) (RelIso.symm.{u2, u1} α β r s (InitialSeg.antisymm.{u2, u1} α β r s _inst_2 f g)) (InitialSeg.antisymm.{u1, u2} β α s r _inst_1 g f)
-Case conversion may be inaccurate. Consider using '#align initial_seg.antisymm_symm InitialSeg.antisymm_symmₓ'. -/
 @[simp]
 theorem antisymm_symm [IsWellOrder α r] [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) :
     (antisymm f g).symm = antisymm g f :=
   RelIso.coe_fn_injective rfl
 #align initial_seg.antisymm_symm InitialSeg.antisymm_symm
 
-/- warning: initial_seg.eq_or_principal -> InitialSeg.eq_or_principal is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s), Or (Function.Surjective.{succ u1, succ u2} α β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)) (Exists.{succ u2} β (fun (b : β) => forall (x : β), Iff (s x b) (Exists.{succ u1} α (fun (y : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f y) x))))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s), Or (Function.Surjective.{succ u1, succ u2} α β (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f)) (Exists.{succ u2} β (fun (b : β) => forall (x : β), Iff (s x b) (Exists.{succ u1} α (fun (y : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) y) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f y) x))))
-Case conversion may be inaccurate. Consider using '#align initial_seg.eq_or_principal InitialSeg.eq_or_principalₓ'. -/
 theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
     Surjective f ∨ ∃ b, ∀ x, s x b ↔ ∃ y, f y = x :=
   or_iff_not_imp_right.2 fun h b =>
@@ -279,12 +207,6 @@ theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
                     (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init hl))⟩⟩
 #align initial_seg.eq_or_principal InitialSeg.eq_or_principal
 
-/- warning: initial_seg.cod_restrict -> InitialSeg.codRestrict is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : InitialSeg.{u1, u2} α β r s), (forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a) p) -> (InitialSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : InitialSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a) p) -> (InitialSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
-Case conversion may be inaccurate. Consider using '#align initial_seg.cod_restrict InitialSeg.codRestrictₓ'. -/
 /-- Restrict the codomain of an initial segment -/
 def codRestrict (p : Set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, fun a ⟨b, m⟩ (h : s b (f a)) =>
@@ -292,12 +214,6 @@ def codRestrict (p : Set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i Subr
     ⟨a', by clear _let_match <;> subst e <;> rfl⟩⟩
 #align initial_seg.cod_restrict InitialSeg.codRestrict
 
-/- warning: initial_seg.cod_restrict_apply -> InitialSeg.codRestrict_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : InitialSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a) p) (a : α), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (fun (_x : InitialSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) => α -> (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p)) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) α (fun (_x : α) => coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (InitialSeg.embeddingLike.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)))) (InitialSeg.codRestrict.{u1, u2} α β r s p f H) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a) (H a))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : InitialSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Set.Elem.{u2} β p) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (Set.Elem.{u2} β p) (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))) (InitialSeg.codRestrict.{u1, u2} α β r s p f H) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a) (H a))
-Case conversion may be inaccurate. Consider using '#align initial_seg.cod_restrict_apply InitialSeg.codRestrict_applyₓ'. -/
 @[simp]
 theorem codRestrict_apply (p) (f : r ≼i s) (H a) : codRestrict p f H a = ⟨f a, H a⟩ :=
   rfl
@@ -318,23 +234,11 @@ def leAdd (r : α → α → Prop) (s : β → β → Prop) : r ≼i Sum.Lex r s
 #align initial_seg.le_add InitialSeg.leAdd
 -/
 
-/- warning: initial_seg.le_add_apply -> InitialSeg.leAdd_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> α -> Prop) (s : β -> β -> Prop) (a : α), Eq.{max (succ u1) (succ u2)} (Sum.{u1, u2} α β) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (InitialSeg.{u1, max u1 u2} α (Sum.{u1, u2} α β) r (Sum.Lex.{u1, u2} α β r s)) (fun (_x : InitialSeg.{u1, max u1 u2} α (Sum.{u1, u2} α β) r (Sum.Lex.{u1, u2} α β r s)) => α -> (Sum.{u1, u2} α β)) (FunLike.hasCoeToFun.{max (succ u1) (succ (max u1 u2)), succ u1, succ (max u1 u2)} (InitialSeg.{u1, max u1 u2} α (Sum.{u1, u2} α β) r (Sum.Lex.{u1, u2} α β r s)) α (fun (_x : α) => Sum.{u1, u2} α β) (EmbeddingLike.toFunLike.{max (succ u1) (succ (max u1 u2)), succ u1, succ (max u1 u2)} (InitialSeg.{u1, max u1 u2} α (Sum.{u1, u2} α β) r (Sum.Lex.{u1, u2} α β r s)) α (Sum.{u1, u2} α β) (InitialSeg.embeddingLike.{u1, max u1 u2} α (Sum.{u1, u2} α β) r (Sum.Lex.{u1, u2} α β r s)))) (InitialSeg.leAdd.{u1, u2} α β r s) a) (Sum.inl.{u1, u2} α β a)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> α -> Prop) (s : β -> β -> Prop) (a : α), Eq.{max (succ u2) (succ u1)} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Sum.{u2, u1} α β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (InitialSeg.{u2, max u1 u2} α (Sum.{u2, u1} α β) r (Sum.Lex.{u2, u1} α β r s)) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Sum.{u2, u1} α β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (InitialSeg.{u2, max u1 u2} α (Sum.{u2, u1} α β) r (Sum.Lex.{u2, u1} α β r s)) α (Sum.{u2, u1} α β) (InitialSeg.instEmbeddingLikeInitialSeg.{u2, max u2 u1} α (Sum.{u2, u1} α β) r (Sum.Lex.{u2, u1} α β r s))) (InitialSeg.leAdd.{u2, u1} α β r s) a) (Sum.inl.{u2, u1} α β a)
-Case conversion may be inaccurate. Consider using '#align initial_seg.le_add_apply InitialSeg.leAdd_applyₓ'. -/
 @[simp]
 theorem leAdd_apply (r : α → α → Prop) (s : β → β → Prop) (a) : leAdd r s a = Sum.inl a :=
   rfl
 #align initial_seg.le_add_apply InitialSeg.leAdd_apply
 
-/- warning: initial_seg.acc -> InitialSeg.acc is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) (a : α), Iff (Acc.{succ u2} α r a) (Acc.{succ u1} β s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a))
-Case conversion may be inaccurate. Consider using '#align initial_seg.acc InitialSeg.accₓ'. -/
 protected theorem acc (f : r ≼i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   ⟨by
     refine' fun h => Acc.recOn h fun a _ ha => Acc.intro _ fun b hb => _
@@ -376,12 +280,6 @@ instance : Coe (r ≺i s) (r ↪r s) :=
 instance : CoeFun (r ≺i s) fun _ => α → β :=
   ⟨fun f => f⟩
 
-/- warning: principal_seg.coe_fn_mk -> PrincipalSeg.coe_fn_mk is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u1, u2} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))), Eq.{max (succ u1) (succ u2)} ((fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u2, u1} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f a) b))), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s (PrincipalSeg.mk.{u2, u1} α β r s f t o))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f)
-Case conversion may be inaccurate. Consider using '#align principal_seg.coe_fn_mk PrincipalSeg.coe_fn_mkₓ'. -/
 @[simp]
 theorem coe_fn_mk (f : r ↪r s) (t o) : (@PrincipalSeg.mk _ _ r s f t o : α → β) = f :=
   rfl
@@ -397,32 +295,14 @@ theorem coe_coeFn (f : r ≺i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align principal_seg.coe_coe_fn PrincipalSeg.coe_coeFn
 
-/- warning: principal_seg.down -> PrincipalSeg.down is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u1, u2} α β r s f)) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) b))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u2, u1} α β r s f)) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) b))
-Case conversion may be inaccurate. Consider using '#align principal_seg.down PrincipalSeg.downₓ'. -/
 theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
   f.down'
 #align principal_seg.down PrincipalSeg.down
 
-/- warning: principal_seg.lt_top -> PrincipalSeg.lt_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (a : α), s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (PrincipalSeg.top.{u1, u2} α β r s f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) (a : α), s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) (PrincipalSeg.top.{u2, u1} α β r s f)
-Case conversion may be inaccurate. Consider using '#align principal_seg.lt_top PrincipalSeg.lt_topₓ'. -/
 theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
   f.down.2 ⟨_, rfl⟩
 #align principal_seg.lt_top PrincipalSeg.lt_top
 
-/- warning: principal_seg.init -> PrincipalSeg.init is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b))
-Case conversion may be inaccurate. Consider using '#align principal_seg.init PrincipalSeg.initₓ'. -/
 theorem init [IsTrans β s] (f : r ≺i s) {a : α} {b : β} (h : s b (f a)) : ∃ a', f a' = b :=
   f.down.1 <| trans h <| f.lt_top _
 #align principal_seg.init PrincipalSeg.init
@@ -434,22 +314,10 @@ instance hasCoeInitialSeg [IsTrans β s] : Coe (r ≺i s) (r ≼i s) :=
 #align principal_seg.has_coe_initial_seg PrincipalSeg.hasCoeInitialSeg
 -/
 
-/- warning: principal_seg.coe_coe_fn' -> PrincipalSeg.coe_coe_fn' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (InitialSeg.mk.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) (PrincipalSeg.hasCoeInitialSeg.proof_1.{u1, u2} α β r s _inst_1 f))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f))
-Case conversion may be inaccurate. Consider using '#align principal_seg.coe_coe_fn' PrincipalSeg.coe_coe_fn'ₓ'. -/
 theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β) = f :=
   rfl
 #align principal_seg.coe_coe_fn' PrincipalSeg.coe_coe_fn'
 
-/- warning: principal_seg.init_iff -> PrincipalSeg.init_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b) (r a' a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b) (r a' a)))
-Case conversion may be inaccurate. Consider using '#align principal_seg.init_iff PrincipalSeg.init_iffₓ'. -/
 theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   @InitialSeg.init_iff α β r s f a b
 #align principal_seg.init_iff PrincipalSeg.init_iff
@@ -476,23 +344,11 @@ def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
 #align principal_seg.lt_le PrincipalSeg.ltLe
 -/
 
-/- warning: principal_seg.lt_le_apply -> PrincipalSeg.lt_le_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.ltLe.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (InitialSeg.{u2, u3} β γ s t) (fun (_x : InitialSeg.{u2, u3} β γ s t) => β -> γ) (FunLike.hasCoeToFun.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β (fun (_x : β) => γ) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β γ (InitialSeg.embeddingLike.{u2, u3} β γ s t))) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u3, u2} α β r s f) a))
-Case conversion may be inaccurate. Consider using '#align principal_seg.lt_le_apply PrincipalSeg.lt_le_applyₓ'. -/
 @[simp]
 theorem lt_le_apply (f : r ≺i s) (g : s ≼i t) (a : α) : (f.ltLe g) a = g (f a) :=
   RelEmbedding.trans_apply _ _ _
 #align principal_seg.lt_le_apply PrincipalSeg.lt_le_apply
 
-/- warning: principal_seg.lt_le_top -> PrincipalSeg.lt_le_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t (PrincipalSeg.ltLe.{u1, u2, u3} α β γ r s t f g)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (InitialSeg.{u2, u3} β γ s t) (fun (_x : InitialSeg.{u2, u3} β γ s t) => β -> γ) (FunLike.hasCoeToFun.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β (fun (_x : β) => γ) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β γ (InitialSeg.embeddingLike.{u2, u3} β γ s t))) g (PrincipalSeg.top.{u1, u2} α β r s f))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t), Eq.{succ u1} γ (PrincipalSeg.top.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (PrincipalSeg.top.{u3, u2} α β r s f))
-Case conversion may be inaccurate. Consider using '#align principal_seg.lt_le_top PrincipalSeg.lt_le_topₓ'. -/
 @[simp]
 theorem lt_le_top (f : r ≺i s) (g : s ≼i t) : (f.ltLe g).top = g f.top :=
   rfl
@@ -506,23 +362,11 @@ protected def trans [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : r ≺i t :=
 #align principal_seg.trans PrincipalSeg.trans
 -/
 
-/- warning: principal_seg.trans_apply -> PrincipalSeg.trans_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t) (a : α), Eq.{succ u3} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (RelEmbedding.{u2, u3} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u2 u3, u2, u3} (RelEmbedding.{u2, u3} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u3} α γ r t)) (PrincipalSeg.toRelEmbedding.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) a) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a))
-Case conversion may be inaccurate. Consider using '#align principal_seg.trans_apply PrincipalSeg.trans_applyₓ'. -/
 @[simp]
 theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.trans g) a = g (f a) :=
   lt_le_apply _ _ _
 #align principal_seg.trans_apply PrincipalSeg.trans_apply
 
-/- warning: principal_seg.trans_top -> PrincipalSeg.trans_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (PrincipalSeg.top.{u1, u2} α β r s f))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (PrincipalSeg.top.{u2, u1} α β r s f))
-Case conversion may be inaccurate. Consider using '#align principal_seg.trans_top PrincipalSeg.trans_topₓ'. -/
 @[simp]
 theorem trans_top [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : (f.trans g).top = g f.top :=
   rfl
@@ -550,23 +394,11 @@ def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ →
 #align principal_seg.lt_equiv PrincipalSeg.ltEquiv
 -/
 
-/- warning: principal_seg.equiv_lt_apply -> PrincipalSeg.equivLT_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.equivLT.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) f a))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} β γ s t)) (PrincipalSeg.toRelEmbedding.{u2, u1} β γ s t g) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelIso.{u3, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelIso.{u3, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u3, u2} α β r s)) f a))
-Case conversion may be inaccurate. Consider using '#align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_applyₓ'. -/
 @[simp]
 theorem equivLT_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLT f g) a = g (f a) :=
   RelEmbedding.trans_apply _ _ _
 #align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_apply
 
-/- warning: principal_seg.equiv_lt_top -> PrincipalSeg.equivLT_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t (PrincipalSeg.equivLT.{u1, u2, u3} α β γ r s t f g)) (PrincipalSeg.top.{u2, u3} β γ s t g)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t), Eq.{succ u1} γ (PrincipalSeg.top.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g)) (PrincipalSeg.top.{u2, u1} β γ s t g)
-Case conversion may be inaccurate. Consider using '#align principal_seg.equiv_lt_top PrincipalSeg.equivLT_topₓ'. -/
 @[simp]
 theorem equivLT_top (f : r ≃r s) (g : s ≺i t) : (equivLT f g).top = g.top :=
   rfl
@@ -586,22 +418,10 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
     cases f; cases g
     have := RelEmbedding.coe_fn_injective ef <;> congr ⟩
 
-/- warning: principal_seg.top_eq -> PrincipalSeg.top_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} γ t], (RelIso.{u1, u2} α β r s) -> (forall (f : PrincipalSeg.{u1, u3} α γ r t) (g : PrincipalSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t f) (PrincipalSeg.top.{u2, u3} β γ s t g))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} γ t], (RelIso.{u2, u1} α β r s) -> (forall (f : PrincipalSeg.{u2, u3} α γ r t) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t f) (PrincipalSeg.top.{u1, u3} β γ s t g))
-Case conversion may be inaccurate. Consider using '#align principal_seg.top_eq PrincipalSeg.top_eqₓ'. -/
 theorem top_eq [IsWellOrder γ t] (e : r ≃r s) (f : r ≺i t) (g : s ≺i t) : f.top = g.top := by
   rw [Subsingleton.elim f (PrincipalSeg.equivLT e g)] <;> rfl
 #align principal_seg.top_eq PrincipalSeg.top_eq
 
-/- warning: principal_seg.top_lt_top -> PrincipalSeg.topLTTop is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} γ t], (PrincipalSeg.{u1, u2} α β r s) -> (forall (g : PrincipalSeg.{u2, u3} β γ s t) (h : PrincipalSeg.{u1, u3} α γ r t), t (PrincipalSeg.top.{u1, u3} α γ r t h) (PrincipalSeg.top.{u2, u3} β γ s t g))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} γ t], (PrincipalSeg.{u2, u1} α β r s) -> (forall (g : PrincipalSeg.{u1, u3} β γ s t) (h : PrincipalSeg.{u2, u3} α γ r t), t (PrincipalSeg.top.{u2, u3} α γ r t h) (PrincipalSeg.top.{u1, u3} β γ s t g))
-Case conversion may be inaccurate. Consider using '#align principal_seg.top_lt_top PrincipalSeg.topLTTopₓ'. -/
 theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
     (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top := by
   rw [Subsingleton.elim h (f.trans g)]; apply PrincipalSeg.lt_top
@@ -614,12 +434,6 @@ def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r
 #align principal_seg.of_element PrincipalSeg.ofElement
 -/
 
-/- warning: principal_seg.of_element_apply -> PrincipalSeg.ofElement_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} α (coeFn.{succ u1, succ u1} (PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (fun (_x : PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) => (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) -> α) (PrincipalSeg.hasCoeToFun.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (PrincipalSeg.ofElement.{u1} α r a) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
-but is expected to have type
-  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) b) (FunLike.coe.{succ u1, succ u1, succ u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) (fun (_x : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) _x) (RelHomClass.toFunLike.{u1, u1, u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (RelEmbedding.instRelHomClassRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r)) (PrincipalSeg.toRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.ofElement.{u1} α r a)) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
-Case conversion may be inaccurate. Consider using '#align principal_seg.of_element_apply PrincipalSeg.ofElement_applyₓ'. -/
 @[simp]
 theorem ofElement_apply {α : Type _} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
@@ -632,12 +446,6 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 -/
 
-/- warning: principal_seg.cod_restrict -> PrincipalSeg.codRestrict is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) -> (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) -> (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
-Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict PrincipalSeg.codRestrictₓ'. -/
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, ⟨f.top, H₂⟩, fun ⟨b, h⟩ =>
@@ -645,23 +453,11 @@ def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top
       exists_congr fun a => show (⟨f a, H a⟩ : p).1 = _ ↔ _ from ⟨Subtype.eq, congr_arg _⟩⟩
 #align principal_seg.cod_restrict PrincipalSeg.codRestrict
 
-/- warning: principal_seg.cod_restrict_apply -> PrincipalSeg.codRestrict_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (fun (_x : PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) => α -> (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p)) (PrincipalSeg.hasCoeToFun.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (H a))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => Set.Elem.{u2} β p) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))) (PrincipalSeg.toRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) (H a))
-Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_apply PrincipalSeg.codRestrict_applyₓ'. -/
 @[simp]
 theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂ a = ⟨f a, H a⟩ :=
   rfl
 #align principal_seg.cod_restrict_apply PrincipalSeg.codRestrict_apply
 
-/- warning: principal_seg.cod_restrict_top -> PrincipalSeg.codRestrict_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (PrincipalSeg.top.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (Set.Elem.{u2} β p) (PrincipalSeg.top.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
-Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_top PrincipalSeg.codRestrict_topₓ'. -/
 @[simp]
 theorem codRestrict_top (p) (f : r ≺i s) (H H₂) : (codRestrict p f H H₂).top = ⟨f.top, H₂⟩ :=
   rfl
@@ -676,12 +472,6 @@ def ofIsEmpty (r : α → α → Prop) [IsEmpty α] {b : β} (H : ∀ b', ¬s b'
 #align principal_seg.of_is_empty PrincipalSeg.ofIsEmpty
 -/
 
-/- warning: principal_seg.of_is_empty_top -> PrincipalSeg.ofIsEmpty_top is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {s : β -> β -> Prop} (r : α -> α -> Prop) [_inst_1 : IsEmpty.{succ u1} α] {b : β} (H : forall (b' : β), Not (s b' b)), Eq.{succ u2} β (PrincipalSeg.top.{u1, u2} α β r s (PrincipalSeg.ofIsEmpty.{u1, u2} α β s r _inst_1 b H)) b
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {s : β -> β -> Prop} (r : α -> α -> Prop) [_inst_1 : IsEmpty.{succ u2} α] {b : β} (H : forall (b' : β), Not (s b' b)), Eq.{succ u1} β (PrincipalSeg.top.{u2, u1} α β r (fun (b' : β) => s b') (PrincipalSeg.ofIsEmpty.{u2, u1} α β (fun (b' : β) => s b') r _inst_1 b H)) b
-Case conversion may be inaccurate. Consider using '#align principal_seg.of_is_empty_top PrincipalSeg.ofIsEmpty_topₓ'. -/
 @[simp]
 theorem ofIsEmpty_top (r : α → α → Prop) [IsEmpty α] {b : β} (H : ∀ b', ¬s b' b) :
     (ofIsEmpty r H).top = b :=
@@ -696,12 +486,6 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 #align principal_seg.pempty_to_punit PrincipalSeg.pemptyToPunit
 -/
 
-/- warning: principal_seg.acc -> PrincipalSeg.acc is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a))
-Case conversion may be inaccurate. Consider using '#align principal_seg.acc PrincipalSeg.accₓ'. -/
 protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   (f : r ≼i s).Acc a
 #align principal_seg.acc PrincipalSeg.acc
@@ -750,23 +534,11 @@ noncomputable def InitialSeg.ltOrEq [IsWellOrder β s] (f : r ≼i s) : Sum (r 
 #align initial_seg.lt_or_eq InitialSeg.ltOrEq
 -/
 
-/- warning: initial_seg.lt_or_eq_apply_left -> InitialSeg.ltOrEq_apply_left is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) g a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s g) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
-Case conversion may be inaccurate. Consider using '#align initial_seg.lt_or_eq_apply_left InitialSeg.ltOrEq_apply_leftₓ'. -/
 theorem InitialSeg.ltOrEq_apply_left [IsWellOrder β s] (f : r ≼i s) (g : r ≺i s) (a : α) :
     g a = f a :=
   @InitialSeg.eq α β r s _ g f a
 #align initial_seg.lt_or_eq_apply_left InitialSeg.ltOrEq_apply_left
 
-/- warning: initial_seg.lt_or_eq_apply_right -> InitialSeg.ltOrEq_apply_right is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : RelIso.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) g a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : RelIso.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelIso.{u1, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelIso.{u1, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u1, u2} α β r s)) g a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
-Case conversion may be inaccurate. Consider using '#align initial_seg.lt_or_eq_apply_right InitialSeg.ltOrEq_apply_rightₓ'. -/
 theorem InitialSeg.ltOrEq_apply_right [IsWellOrder β s] (f : r ≼i s) (g : r ≃r s) (a : α) :
     g a = f a :=
   InitialSeg.eq (InitialSeg.ofIso g) f a
@@ -782,12 +554,6 @@ noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i
 #align initial_seg.le_lt InitialSeg.leLT
 -/
 
-/- warning: initial_seg.le_lt_apply -> InitialSeg.leLT_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u2} β s] [_inst_2 : IsTrans.{u3} γ t] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (InitialSeg.leLT.{u1, u2, u3} α β γ r s t _inst_1 _inst_2 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} β s] [_inst_2 : IsTrans.{u2} γ t] (f : InitialSeg.{u1, u3} α β r s) (g : PrincipalSeg.{u3, u2} β γ s t) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α γ r t)) (PrincipalSeg.toRelEmbedding.{u1, u2} α γ r t (InitialSeg.leLT.{u1, u3, u2} α β γ r s t _inst_1 _inst_2 f g)) a) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} β γ s t)) (PrincipalSeg.toRelEmbedding.{u3, u2} β γ s t g) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u3} α β r s)) f a))
-Case conversion may be inaccurate. Consider using '#align initial_seg.le_lt_apply InitialSeg.leLT_applyₓ'. -/
 @[simp]
 theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
     (f.leLT g) a = g (f a) := by
@@ -798,12 +564,6 @@ theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (
 
 namespace RelEmbedding
 
-/- warning: rel_embedding.collapse_F -> RelEmbedding.collapseF is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b))
-Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_F RelEmbedding.collapseFₓ'. -/
 /-- Given an order embedding into a well order, collapse the order embedding by filling the
 gaps, to obtain an initial segment. Here, we construct the collapsed order embedding pointwise,
 but the proof of the fact that it is an initial segment will be given in `collapse`. -/
@@ -859,12 +619,6 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
 #align rel_embedding.collapse RelEmbedding.collapse
 -/
 
-/- warning: rel_embedding.collapse_apply -> RelEmbedding.collapse_apply is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
-Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_apply RelEmbedding.collapse_applyₓ'. -/
 theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (collapseF f a).1 :=
   rfl
 #align rel_embedding.collapse_apply RelEmbedding.collapse_apply
Diff
@@ -205,9 +205,7 @@ instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl
 -/
 
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
-  ⟨fun a => by
-    letI := a.is_well_founded
-    apply Subsingleton.elim⟩
+  ⟨fun a => by letI := a.is_well_founded; apply Subsingleton.elim⟩
 
 /- warning: initial_seg.eq -> InitialSeg.eq is a dubious translation:
 lean 3 declaration is
@@ -580,14 +578,12 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
     by
     have ef : (f : α → β) = g := by
       show ((f : r ≼i s) : α → β) = g
-      rw [@Subsingleton.elim _ _ (f : r ≼i s) g]
-      rfl
+      rw [@Subsingleton.elim _ _ (f : r ≼i s) g]; rfl
     have et : f.top = g.top :=
       by
       refine' extensional_of_trichotomous_of_irrefl s fun x => _
       simp only [f.down, g.down, ef, coe_fn_to_rel_embedding]
-    cases f
-    cases g
+    cases f; cases g
     have := RelEmbedding.coe_fn_injective ef <;> congr ⟩
 
 /- warning: principal_seg.top_eq -> PrincipalSeg.top_eq is a dubious translation:
@@ -607,10 +603,8 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} γ t], (PrincipalSeg.{u2, u1} α β r s) -> (forall (g : PrincipalSeg.{u1, u3} β γ s t) (h : PrincipalSeg.{u2, u3} α γ r t), t (PrincipalSeg.top.{u2, u3} α γ r t h) (PrincipalSeg.top.{u1, u3} β γ s t g))
 Case conversion may be inaccurate. Consider using '#align principal_seg.top_lt_top PrincipalSeg.topLTTopₓ'. -/
 theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
-    (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top :=
-  by
-  rw [Subsingleton.elim h (f.trans g)]
-  apply PrincipalSeg.lt_top
+    (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top := by
+  rw [Subsingleton.elim h (f.trans g)]; apply PrincipalSeg.lt_top
 #align principal_seg.top_lt_top PrincipalSeg.topLTTop
 
 #print PrincipalSeg.ofElement /-
Diff
@@ -316,7 +316,7 @@ def ofIsEmpty (r : α → α → Prop) (s : β → β → Prop) [IsEmpty α] : r
 /-- Initial segment embedding of an order `r` into the disjoint union of `r` and `s`. -/
 def leAdd (r : α → α → Prop) (s : β → β → Prop) : r ≼i Sum.Lex r s :=
   ⟨⟨⟨Sum.inl, fun _ _ => Sum.inl.inj⟩, fun a b => Sum.lex_inl_inl⟩, fun a b => by
-    cases b <;> [exact fun _ => ⟨_, rfl⟩, exact False.elim ∘ Sum.lex_inr_inl]⟩
+    cases b <;> [exact fun _ => ⟨_, rfl⟩;exact False.elim ∘ Sum.lex_inr_inl]⟩
 #align initial_seg.le_add InitialSeg.leAdd
 -/
 
Diff
@@ -101,7 +101,7 @@ theorem coeFn_toRelEmbedding (f : r ≼i s) : (f.toRelEmbedding : α → β) = f
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (InitialSeg.toRelEmbedding.{u2, u1} α β r s f)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (InitialSeg.toRelEmbedding.{u2, u1} α β r s f)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
 Case conversion may be inaccurate. Consider using '#align initial_seg.coe_coe_fn InitialSeg.coe_coe_fnₓ'. -/
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
@@ -382,7 +382,7 @@ instance : CoeFun (r ≺i s) fun _ => α → β :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u1, u2} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))), Eq.{max (succ u1) (succ u2)} ((fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u2, u1} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f a) b))), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s (PrincipalSeg.mk.{u2, u1} α β r s f t o))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f)
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u2, u1} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f a) b))), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s (PrincipalSeg.mk.{u2, u1} α β r s f t o))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f)
 Case conversion may be inaccurate. Consider using '#align principal_seg.coe_fn_mk PrincipalSeg.coe_fn_mkₓ'. -/
 @[simp]
 theorem coe_fn_mk (f : r ↪r s) (t o) : (@PrincipalSeg.mk _ _ r s f t o : α → β) = f :=
@@ -403,7 +403,7 @@ theorem coe_coeFn (f : r ≺i s) : ((f : r ↪r s) : α → β) = f :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u1, u2} α β r s f)) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) b))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u2, u1} α β r s f)) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) b))
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u2, u1} α β r s f)) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) b))
 Case conversion may be inaccurate. Consider using '#align principal_seg.down PrincipalSeg.downₓ'. -/
 theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
   f.down'
@@ -413,7 +413,7 @@ theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (a : α), s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (PrincipalSeg.top.{u1, u2} α β r s f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) (a : α), s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) (PrincipalSeg.top.{u2, u1} α β r s f)
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) (a : α), s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) (PrincipalSeg.top.{u2, u1} α β r s f)
 Case conversion may be inaccurate. Consider using '#align principal_seg.lt_top PrincipalSeg.lt_topₓ'. -/
 theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
   f.down.2 ⟨_, rfl⟩
@@ -423,7 +423,7 @@ theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b))
 Case conversion may be inaccurate. Consider using '#align principal_seg.init PrincipalSeg.initₓ'. -/
 theorem init [IsTrans β s] (f : r ≺i s) {a : α} {b : β} (h : s b (f a)) : ∃ a', f a' = b :=
   f.down.1 <| trans h <| f.lt_top _
@@ -440,7 +440,7 @@ instance hasCoeInitialSeg [IsTrans β s] : Coe (r ≺i s) (r ≼i s) :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (InitialSeg.mk.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) (PrincipalSeg.hasCoeInitialSeg.proof_1.{u1, u2} α β r s _inst_1 f))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (InitialSeg.mk.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) (PrincipalSeg.hasCoeInitialSeg.proof_1.{u1, u2} α β r s _inst_1 f))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f))
 Case conversion may be inaccurate. Consider using '#align principal_seg.coe_coe_fn' PrincipalSeg.coe_coe_fn'ₓ'. -/
 theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β) = f :=
   rfl
@@ -450,7 +450,7 @@ theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β)
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b) (r a' a)))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b) (r a' a)))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b) (r a' a)))
 Case conversion may be inaccurate. Consider using '#align principal_seg.init_iff PrincipalSeg.init_iffₓ'. -/
 theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   @InitialSeg.init_iff α β r s f a b
@@ -482,7 +482,7 @@ def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.ltLe.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (InitialSeg.{u2, u3} β γ s t) (fun (_x : InitialSeg.{u2, u3} β γ s t) => β -> γ) (FunLike.hasCoeToFun.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β (fun (_x : β) => γ) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β γ (InitialSeg.embeddingLike.{u2, u3} β γ s t))) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u3, u2} α β r s f) a))
+  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u3, u2} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.lt_le_apply PrincipalSeg.lt_le_applyₓ'. -/
 @[simp]
 theorem lt_le_apply (f : r ≺i s) (g : s ≼i t) (a : α) : (f.ltLe g) a = g (f a) :=
@@ -512,7 +512,7 @@ protected def trans [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : r ≺i t :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t) (a : α), Eq.{succ u3} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (RelEmbedding.{u2, u3} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u2 u3, u2, u3} (RelEmbedding.{u2, u3} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u3} α γ r t)) (PrincipalSeg.toRelEmbedding.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) a) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a))
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t) (a : α), Eq.{succ u3} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (RelEmbedding.{u2, u3} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u2 u3, u2, u3} (RelEmbedding.{u2, u3} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u3} α γ r t)) (PrincipalSeg.toRelEmbedding.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) a) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.trans_apply PrincipalSeg.trans_applyₓ'. -/
 @[simp]
 theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.trans g) a = g (f a) :=
@@ -523,7 +523,7 @@ theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.t
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (PrincipalSeg.top.{u1, u2} α β r s f))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (PrincipalSeg.top.{u2, u1} α β r s f))
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (PrincipalSeg.top.{u2, u1} α β r s f))
 Case conversion may be inaccurate. Consider using '#align principal_seg.trans_top PrincipalSeg.trans_topₓ'. -/
 @[simp]
 theorem trans_top [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : (f.trans g).top = g f.top :=
@@ -556,7 +556,7 @@ def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ →
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.equivLT.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} β γ s t)) (PrincipalSeg.toRelEmbedding.{u2, u1} β γ s t g) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelIso.{u3, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelIso.{u3, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u3, u2} α β r s)) f a))
+  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} β γ s t)) (PrincipalSeg.toRelEmbedding.{u2, u1} β γ s t g) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelIso.{u3, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelIso.{u3, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u3, u2} α β r s)) f a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_applyₓ'. -/
 @[simp]
 theorem equivLT_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLT f g) a = g (f a) :=
@@ -624,7 +624,7 @@ def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r
 lean 3 declaration is
   forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} α (coeFn.{succ u1, succ u1} (PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (fun (_x : PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) => (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) -> α) (PrincipalSeg.hasCoeToFun.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (PrincipalSeg.ofElement.{u1} α r a) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
 but is expected to have type
-  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) b) (FunLike.coe.{succ u1, succ u1, succ u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) (fun (_x : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) _x) (RelHomClass.toFunLike.{u1, u1, u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (RelEmbedding.instRelHomClassRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r)) (PrincipalSeg.toRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.ofElement.{u1} α r a)) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
+  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) b) (FunLike.coe.{succ u1, succ u1, succ u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) (fun (_x : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) _x) (RelHomClass.toFunLike.{u1, u1, u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (RelEmbedding.instRelHomClassRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r)) (PrincipalSeg.toRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.ofElement.{u1} α r a)) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
 Case conversion may be inaccurate. Consider using '#align principal_seg.of_element_apply PrincipalSeg.ofElement_applyₓ'. -/
 @[simp]
 theorem ofElement_apply {α : Type _} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
@@ -642,7 +642,7 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) -> (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) -> (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) -> (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict PrincipalSeg.codRestrictₓ'. -/
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
@@ -655,7 +655,7 @@ def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (fun (_x : PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) => α -> (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p)) (PrincipalSeg.hasCoeToFun.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (H a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => Set.Elem.{u2} β p) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))) (PrincipalSeg.toRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) (H a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => Set.Elem.{u2} β p) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))) (PrincipalSeg.toRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) (H a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_apply PrincipalSeg.codRestrict_applyₓ'. -/
 @[simp]
 theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂ a = ⟨f a, H a⟩ :=
@@ -666,7 +666,7 @@ theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (PrincipalSeg.top.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (Set.Elem.{u2} β p) (PrincipalSeg.top.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (Set.Elem.{u2} β p) (PrincipalSeg.top.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_top PrincipalSeg.codRestrict_topₓ'. -/
 @[simp]
 theorem codRestrict_top (p) (f : r ≺i s) (H H₂) : (codRestrict p f H H₂).top = ⟨f.top, H₂⟩ :=
@@ -706,7 +706,7 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.acc PrincipalSeg.accₓ'. -/
 protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   (f : r ≼i s).Acc a
@@ -760,7 +760,7 @@ noncomputable def InitialSeg.ltOrEq [IsWellOrder β s] (f : r ≼i s) : Sum (r 
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) g a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s g) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s g) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
 Case conversion may be inaccurate. Consider using '#align initial_seg.lt_or_eq_apply_left InitialSeg.ltOrEq_apply_leftₓ'. -/
 theorem InitialSeg.ltOrEq_apply_left [IsWellOrder β s] (f : r ≼i s) (g : r ≺i s) (a : α) :
     g a = f a :=
@@ -792,7 +792,7 @@ noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u2} β s] [_inst_2 : IsTrans.{u3} γ t] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (InitialSeg.leLT.{u1, u2, u3} α β γ r s t _inst_1 _inst_2 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} β s] [_inst_2 : IsTrans.{u2} γ t] (f : InitialSeg.{u1, u3} α β r s) (g : PrincipalSeg.{u3, u2} β γ s t) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α γ r t)) (PrincipalSeg.toRelEmbedding.{u1, u2} α γ r t (InitialSeg.leLT.{u1, u3, u2} α β γ r s t _inst_1 _inst_2 f g)) a) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} β γ s t)) (PrincipalSeg.toRelEmbedding.{u3, u2} β γ s t g) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u3} α β r s)) f a))
+  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} β s] [_inst_2 : IsTrans.{u2} γ t] (f : InitialSeg.{u1, u3} α β r s) (g : PrincipalSeg.{u3, u2} β γ s t) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => γ) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α γ r t)) (PrincipalSeg.toRelEmbedding.{u1, u2} α γ r t (InitialSeg.leLT.{u1, u3, u2} α β γ r s t _inst_1 _inst_2 f g)) a) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : β) => γ) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} β γ s t)) (PrincipalSeg.toRelEmbedding.{u3, u2} β γ s t g) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u3} α β r s)) f a))
 Case conversion may be inaccurate. Consider using '#align initial_seg.le_lt_apply InitialSeg.leLT_applyₓ'. -/
 @[simp]
 theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
@@ -808,7 +808,7 @@ namespace RelEmbedding
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b))
 Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_F RelEmbedding.collapseFₓ'. -/
 /-- Given an order embedding into a well order, collapse the order embedding by filling the
 gaps, to obtain an initial segment. Here, we construct the collapsed order embedding pointwise,
@@ -869,7 +869,7 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.869 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
 Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_apply RelEmbedding.collapse_applyₓ'. -/
 theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (collapseF f a).1 :=
   rfl
Diff
@@ -192,6 +192,7 @@ theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (
   rfl
 #align initial_seg.trans_apply InitialSeg.trans_apply
 
+#print InitialSeg.subsingleton_of_trichotomous_of_irrefl /-
 instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s]
     [IsWellFounded α r] : Subsingleton (r ≼i s) :=
   ⟨fun f g => by
@@ -201,6 +202,7 @@ instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl
     rw [f.init_iff, g.init_iff]
     exact exists_congr fun x => and_congr_left fun hx => IH _ hx ▸ Iff.rfl⟩
 #align initial_seg.subsingleton_of_trichotomous_of_irrefl InitialSeg.subsingleton_of_trichotomous_of_irrefl
+-/
 
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
   ⟨fun a => by
Diff
@@ -101,7 +101,7 @@ theorem coeFn_toRelEmbedding (f : r ≼i s) : (f.toRelEmbedding : α → β) = f
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (RelEmbedding.{u1, u2} α β r s) (InitialSeg.RelEmbedding.hasCoe.{u1, u2} α β r s)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s (InitialSeg.toRelEmbedding.{u2, u1} α β r s f))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (InitialSeg.toRelEmbedding.{u2, u1} α β r s f)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f)
 Case conversion may be inaccurate. Consider using '#align initial_seg.coe_coe_fn InitialSeg.coe_coe_fnₓ'. -/
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
@@ -240,7 +240,7 @@ def antisymm [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : r ≃r s :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u1) (succ u2)} ((fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (RelIso.toRelEmbedding.{u1, u2} α β r s (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u1} β α s r), Eq.{max (succ u1) (succ u2)} (α -> β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelIso.{u1, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelIso.{u1, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u1, u2} α β r s)) (InitialSeg.antisymm.{u1, u2} α β r s _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f)
 Case conversion may be inaccurate. Consider using '#align initial_seg.antisymm_to_fun InitialSeg.antisymm_toFunₓ'. -/
 @[simp]
 theorem antisymm_toFun [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : (antisymm f g : α → β) = f :=
@@ -380,7 +380,7 @@ instance : CoeFun (r ≺i s) fun _ => α → β :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u1, u2} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))), Eq.{max (succ u1) (succ u2)} ((fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) (PrincipalSeg.mk.{u1, u2} α β r s f t o)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u2, u1} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s f) a) b))), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s (PrincipalSeg.mk.{u2, u1} α β r s f t o)))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s f))
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : RelEmbedding.{u2, u1} α β r s) (t : β) (o : forall (b : β), Iff (s b t) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f a) b))), Eq.{max (succ u2) (succ u1)} (forall (a : α), (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s (PrincipalSeg.mk.{u2, u1} α β r s f t o))) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) f)
 Case conversion may be inaccurate. Consider using '#align principal_seg.coe_fn_mk PrincipalSeg.coe_fn_mkₓ'. -/
 @[simp]
 theorem coe_fn_mk (f : r ↪r s) (t o) : (@PrincipalSeg.mk _ _ r s f t o : α → β) = f :=
@@ -401,7 +401,7 @@ theorem coe_coeFn (f : r ≺i s) : ((f : r ↪r s) : α → β) = f :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u1, u2} α β r s f)) (Exists.{succ u1} α (fun (a : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) b))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u2, u1} α β r s f)) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f)) a) b))
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) {b : β}, Iff (s b (PrincipalSeg.top.{u2, u1} α β r s f)) (Exists.{succ u2} α (fun (a : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) b))
 Case conversion may be inaccurate. Consider using '#align principal_seg.down PrincipalSeg.downₓ'. -/
 theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
   f.down'
@@ -411,7 +411,7 @@ theorem down (f : r ≺i s) : ∀ {b : β}, s b f.top ↔ ∃ a, f a = b :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (a : α), s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (PrincipalSeg.top.{u1, u2} α β r s f)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) (a : α), s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f)) a) (PrincipalSeg.top.{u2, u1} α β r s f)
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : PrincipalSeg.{u2, u1} α β r s) (a : α), s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a) (PrincipalSeg.top.{u2, u1} α β r s f)
 Case conversion may be inaccurate. Consider using '#align principal_seg.lt_top PrincipalSeg.lt_topₓ'. -/
 theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
   f.down.2 ⟨_, rfl⟩
@@ -421,7 +421,7 @@ theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a') b))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b))
 Case conversion may be inaccurate. Consider using '#align principal_seg.init PrincipalSeg.initₓ'. -/
 theorem init [IsTrans β s] (f : r ≺i s) {a : α} {b : β} (h : s b (f a)) : ∃ a', f a' = b :=
   f.down.1 <| trans h <| f.lt_top _
@@ -438,7 +438,7 @@ instance hasCoeInitialSeg [IsTrans β s] : Coe (r ≺i s) (r ≼i s) :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} ((fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) ((fun (a : Sort.{max (succ u1) (succ u2)}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{max (succ u1) (succ u2), max (succ u1) (succ u2)} a b] => self.0) (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (HasLiftT.mk.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (CoeTCₓ.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (coeBase.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (InitialSeg.{u1, u2} α β r s) (PrincipalSeg.hasCoeInitialSeg.{u1, u2} α β r s _inst_1)))) f)) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (InitialSeg.mk.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) (PrincipalSeg.hasCoeInitialSeg.proof_1.{u1, u2} α β r s _inst_1 f))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s), Eq.{max (succ u1) (succ u2)} (forall (a : α), (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (InitialSeg.mk.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) (PrincipalSeg.hasCoeInitialSeg.proof_1.{u1, u2} α β r s _inst_1 f))) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f))
 Case conversion may be inaccurate. Consider using '#align principal_seg.coe_coe_fn' PrincipalSeg.coe_coe_fn'ₓ'. -/
 theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β) = f :=
   rfl
@@ -448,7 +448,7 @@ theorem coe_coe_fn' [IsTrans β s] (f : r ≺i s) : ((f : r ≼i s) : α → β)
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a') b) (r a' a)))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a') b) (r a' a)))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) {a : α} {b : β}, Iff (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a)) (Exists.{succ u1} α (fun (a' : α) => And (Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a') b) (r a' a)))
 Case conversion may be inaccurate. Consider using '#align principal_seg.init_iff PrincipalSeg.init_iffₓ'. -/
 theorem init_iff [IsTrans β s] (f : r ≺i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   @InitialSeg.init_iff α β r s f a b
@@ -480,7 +480,7 @@ def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u1, u2} α β r s) (g : InitialSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.ltLe.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (InitialSeg.{u2, u3} β γ s t) (fun (_x : InitialSeg.{u2, u3} β γ s t) => β -> γ) (FunLike.hasCoeToFun.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β (fun (_x : β) => γ) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (InitialSeg.{u2, u3} β γ s t) β γ (InitialSeg.embeddingLike.{u2, u3} β γ s t))) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (Function.Embedding.{succ u3, succ u1} α γ) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u1), succ u3, succ u1} (Function.Embedding.{succ u3, succ u1} α γ) α γ (Function.instEmbeddingLikeEmbedding.{succ u3, succ u1} α γ)) (RelEmbedding.toEmbedding.{u3, u1} α γ r t (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g))) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u3, succ u2} α β)) (RelEmbedding.toEmbedding.{u3, u2} α β r s (PrincipalSeg.toRelEmbedding.{u3, u2} α β r s f)) a))
+  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : PrincipalSeg.{u3, u2} α β r s) (g : InitialSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.ltLe.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} β γ s t) β γ (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} β γ s t)) g (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u3, u2} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.lt_le_apply PrincipalSeg.lt_le_applyₓ'. -/
 @[simp]
 theorem lt_le_apply (f : r ≺i s) (g : s ≼i t) (a : α) : (f.ltLe g) a = g (f a) :=
@@ -510,7 +510,7 @@ protected def trans [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : r ≺i t :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t) (a : α), Eq.{succ u3} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) a) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Function.Embedding.{succ u2, succ u3} α γ) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u3), succ u2, succ u3} (Function.Embedding.{succ u2, succ u3} α γ) α γ (Function.instEmbeddingLikeEmbedding.{succ u2, succ u3} α γ)) (RelEmbedding.toEmbedding.{u2, u3} α γ r t (PrincipalSeg.toRelEmbedding.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g))) a) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (Function.Embedding.{succ u1, succ u3} β γ) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (Function.Embedding.{succ u1, succ u3} β γ) β γ (Function.instEmbeddingLikeEmbedding.{succ u1, succ u3} β γ)) (RelEmbedding.toEmbedding.{u1, u3} β γ s t (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} α β)) (RelEmbedding.toEmbedding.{u2, u1} α β r s (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f)) a))
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t) (a : α), Eq.{succ u3} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (RelEmbedding.{u2, u3} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u2 u3, u2, u3} (RelEmbedding.{u2, u3} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u3} α γ r t)) (PrincipalSeg.toRelEmbedding.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) a) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} α β r s)) (PrincipalSeg.toRelEmbedding.{u2, u1} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.trans_apply PrincipalSeg.trans_applyₓ'. -/
 @[simp]
 theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.trans g) a = g (f a) :=
@@ -521,7 +521,7 @@ theorem trans_apply [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) (a : α) : (f.t
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u1, u3} α γ r t (PrincipalSeg.trans.{u1, u2, u3} α β γ r s t _inst_1 f g)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (PrincipalSeg.top.{u1, u2} α β r s f))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (Function.Embedding.{succ u1, succ u3} β γ) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (Function.Embedding.{succ u1, succ u3} β γ) β γ (Function.instEmbeddingLikeEmbedding.{succ u1, succ u3} β γ)) (RelEmbedding.toEmbedding.{u1, u3} β γ s t (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g)) (PrincipalSeg.top.{u2, u1} α β r s f))
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsTrans.{u3} γ t] (f : PrincipalSeg.{u2, u1} α β r s) (g : PrincipalSeg.{u1, u3} β γ s t), Eq.{succ u3} γ (PrincipalSeg.top.{u2, u3} α γ r t (PrincipalSeg.trans.{u2, u1, u3} α β γ r s t _inst_1 f g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (RelEmbedding.{u1, u3} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u1 u3, u1, u3} (RelEmbedding.{u1, u3} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u3} β γ s t)) (PrincipalSeg.toRelEmbedding.{u1, u3} β γ s t g) (PrincipalSeg.top.{u2, u1} α β r s f))
 Case conversion may be inaccurate. Consider using '#align principal_seg.trans_top PrincipalSeg.trans_topₓ'. -/
 @[simp]
 theorem trans_top [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : (f.trans g).top = g f.top :=
@@ -554,7 +554,7 @@ def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ →
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (PrincipalSeg.equivLT.{u1, u2, u3} α β γ r s t f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (Function.Embedding.{succ u3, succ u1} α γ) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u1), succ u3, succ u1} (Function.Embedding.{succ u3, succ u1} α γ) α γ (Function.instEmbeddingLikeEmbedding.{succ u3, succ u1} α γ)) (RelEmbedding.toEmbedding.{u3, u1} α γ r t (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g))) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} β γ) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (Function.Embedding.{succ u2, succ u1} β γ) β γ (Function.instEmbeddingLikeEmbedding.{succ u2, succ u1} β γ)) (RelEmbedding.toEmbedding.{u2, u1} β γ s t (PrincipalSeg.toRelEmbedding.{u2, u1} β γ s t g)) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u3, succ u2} α β)) (RelEmbedding.toEmbedding.{u3, u2} α β r s (RelIso.toRelEmbedding.{u3, u2} α β r s f)) a))
+  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} (f : RelIso.{u3, u2} α β r s) (g : PrincipalSeg.{u2, u1} β γ s t) (a : α), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u3) (succ u1), succ u3, succ u1} (RelEmbedding.{u3, u1} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u3 u1, u3, u1} (RelEmbedding.{u3, u1} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u1} α γ r t)) (PrincipalSeg.toRelEmbedding.{u3, u1} α γ r t (PrincipalSeg.equivLT.{u3, u2, u1} α β γ r s t f g)) a) (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (RelEmbedding.{u2, u1} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u2 u1, u2, u1} (RelEmbedding.{u2, u1} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u2, u1} β γ s t)) (PrincipalSeg.toRelEmbedding.{u2, u1} β γ s t g) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelIso.{u3, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelIso.{u3, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u3, u2} α β r s)) f a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_applyₓ'. -/
 @[simp]
 theorem equivLT_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLT f g) a = g (f a) :=
@@ -622,7 +622,7 @@ def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r
 lean 3 declaration is
   forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} α (coeFn.{succ u1, succ u1} (PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (fun (_x : PrincipalSeg.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) => (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) -> α) (PrincipalSeg.hasCoeToFun.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (PrincipalSeg.ofElement.{u1} α r a) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
 but is expected to have type
-  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) b) (FunLike.coe.{succ u1, succ u1, succ u1} (Function.Embedding.{succ u1, succ u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) (fun (_x : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) _x) (EmbeddingLike.toFunLike.{succ u1, succ u1, succ u1} (Function.Embedding.{succ u1, succ u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Function.instEmbeddingLikeEmbedding.{succ u1, succ u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α)) (RelEmbedding.toEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.toRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.ofElement.{u1} α r a))) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
+  forall {α : Type.{u1}} (r : α -> α -> Prop) (a : α) (b : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))), Eq.{succ u1} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) b) (FunLike.coe.{succ u1, succ u1, succ u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) (fun (_x : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) => α) _x) (RelHomClass.toFunLike.{u1, u1, u1} (RelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r) (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (RelEmbedding.instRelHomClassRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r)) (PrincipalSeg.toRelEmbedding.{u1, u1} (Set.Elem.{u1} α (setOf.{u1} α (fun (b : α) => r b a))) α (Subrel.{u1} α r (setOf.{u1} α (fun (b : α) => r b a))) r (PrincipalSeg.ofElement.{u1} α r a)) b) (Subtype.val.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (setOf.{u1} α (fun (b : α) => r b a))) b)
 Case conversion may be inaccurate. Consider using '#align principal_seg.of_element_apply PrincipalSeg.ofElement_applyₓ'. -/
 @[simp]
 theorem ofElement_apply {α : Type _} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
@@ -640,7 +640,7 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) -> (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a) p) -> (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s), (forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) -> (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) -> (PrincipalSeg.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict PrincipalSeg.codRestrictₓ'. -/
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
@@ -653,7 +653,7 @@ def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (fun (_x : PrincipalSeg.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) => α -> (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p)) (PrincipalSeg.hasCoeToFun.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p)) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) (H a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α (Set.Elem.{u2} β p)) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => Set.Elem.{u2} β p) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α (Set.Elem.{u2} β p)) α (Set.Elem.{u2} β p) (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α (Set.Elem.{u2} β p))) (RelEmbedding.toEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.toRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂))) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a) (H a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => Set.Elem.{u2} β p) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => Set.Elem.{u2} β p) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p)) α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p))) (PrincipalSeg.toRelEmbedding.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) a) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) (H a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_apply PrincipalSeg.codRestrict_applyₓ'. -/
 @[simp]
 theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂ a = ⟨f a, H a⟩ :=
@@ -664,7 +664,7 @@ theorem codRestrict_apply (p) (f : r ≺i s) (H H₂ a) : codRestrict p f H H₂
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a) p) (H₂ : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) (PrincipalSeg.top.{u1, u2} α (coeSort.{succ u2, succ (succ u2)} (Set.{u2} β) Type.{u2} (Set.hasCoeToSort.{u2} β) p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (Set.Elem.{u2} β p) (PrincipalSeg.top.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (p : Set.{u2} β) (f : PrincipalSeg.{u1, u2} α β r s) (H : forall (a : α), Membership.mem.{u2, u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (Set.{u2} β) (Set.instMembershipSet.{u2} β) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a) p) (H₂ : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) (PrincipalSeg.top.{u1, u2} α β r s f) p), Eq.{succ u2} (Set.Elem.{u2} β p) (PrincipalSeg.top.{u1, u2} α (Set.Elem.{u2} β p) r (Subrel.{u2} β s p) (PrincipalSeg.codRestrict.{u1, u2} α β r s p f H H₂)) (Subtype.mk.{succ u2} β (fun (x : β) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) x p) (PrincipalSeg.top.{u1, u2} α β r s f) H₂)
 Case conversion may be inaccurate. Consider using '#align principal_seg.cod_restrict_top PrincipalSeg.codRestrict_topₓ'. -/
 @[simp]
 theorem codRestrict_top (p) (f : r ≺i s) (H H₂) : (codRestrict p f H H₂).top = ⟨f.top, H₂⟩ :=
@@ -704,7 +704,7 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f) a))
 Case conversion may be inaccurate. Consider using '#align principal_seg.acc PrincipalSeg.accₓ'. -/
 protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   (f : r ≼i s).Acc a
@@ -758,7 +758,7 @@ noncomputable def InitialSeg.ltOrEq [IsWellOrder β s] (f : r ≼i s) : Sum (r 
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) g a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s g)) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s g) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
 Case conversion may be inaccurate. Consider using '#align initial_seg.lt_or_eq_apply_left InitialSeg.ltOrEq_apply_leftₓ'. -/
 theorem InitialSeg.ltOrEq_apply_left [IsWellOrder β s] (f : r ≼i s) (g : r ≺i s) (a : α) :
     g a = f a :=
@@ -769,7 +769,7 @@ theorem InitialSeg.ltOrEq_apply_left [IsWellOrder β s] (f : r ≼i s) (g : r 
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : RelIso.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelIso.{u1, u2} α β r s) (fun (_x : RelIso.{u1, u2} α β r s) => α -> β) (RelIso.hasCoeToFun.{u1, u2} α β r s) g a) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : RelIso.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (RelIso.toRelEmbedding.{u1, u2} α β r s g)) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : InitialSeg.{u1, u2} α β r s) (g : RelIso.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelIso.{u1, u2} α β r s) α (fun (_x : α) => β) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelIso.{u1, u2} α β r s) α β r s (RelIso.instRelHomClassRelIso.{u1, u2} α β r s)) g a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) f a)
 Case conversion may be inaccurate. Consider using '#align initial_seg.lt_or_eq_apply_right InitialSeg.ltOrEq_apply_rightₓ'. -/
 theorem InitialSeg.ltOrEq_apply_right [IsWellOrder β s] (f : r ≼i s) (g : r ≃r s) (a : α) :
     g a = f a :=
@@ -790,7 +790,7 @@ noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u2} β s] [_inst_2 : IsTrans.{u3} γ t] (f : InitialSeg.{u1, u2} α β r s) (g : PrincipalSeg.{u2, u3} β γ s t) (a : α), Eq.{succ u3} γ (coeFn.{max (succ u1) (succ u3), max (succ u1) (succ u3)} (PrincipalSeg.{u1, u3} α γ r t) (fun (_x : PrincipalSeg.{u1, u3} α γ r t) => α -> γ) (PrincipalSeg.hasCoeToFun.{u1, u3} α γ r t) (InitialSeg.leLT.{u1, u2, u3} α β γ r s t _inst_1 _inst_2 f g) a) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (PrincipalSeg.{u2, u3} β γ s t) (fun (_x : PrincipalSeg.{u2, u3} β γ s t) => β -> γ) (PrincipalSeg.hasCoeToFun.{u2, u3} β γ s t) g (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} β s] [_inst_2 : IsTrans.{u2} γ t] (f : InitialSeg.{u1, u3} α β r s) (g : PrincipalSeg.{u3, u2} β γ s t) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α γ) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α γ) α γ (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α γ)) (RelEmbedding.toEmbedding.{u1, u2} α γ r t (PrincipalSeg.toRelEmbedding.{u1, u2} α γ r t (InitialSeg.leLT.{u1, u3, u2} α β γ r s t _inst_1 _inst_2 f g))) a) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} β γ) β (fun (_x : β) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : β) => γ) _x) (EmbeddingLike.toFunLike.{max (succ u3) (succ u2), succ u3, succ u2} (Function.Embedding.{succ u3, succ u2} β γ) β γ (Function.instEmbeddingLikeEmbedding.{succ u3, succ u2} β γ)) (RelEmbedding.toEmbedding.{u3, u2} β γ s t (PrincipalSeg.toRelEmbedding.{u3, u2} β γ s t g)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u3} α β r s)) f a))
+  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} {t : γ -> γ -> Prop} [_inst_1 : IsWellOrder.{u3} β s] [_inst_2 : IsTrans.{u2} γ t] (f : InitialSeg.{u1, u3} α β r s) (g : PrincipalSeg.{u3, u2} β γ s t) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α γ r t) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => γ) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α γ r t) α γ r t (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α γ r t)) (PrincipalSeg.toRelEmbedding.{u1, u2} α γ r t (InitialSeg.leLT.{u1, u3, u2} α β γ r s t _inst_1 _inst_2 f g)) a) (FunLike.coe.{max (succ u3) (succ u2), succ u3, succ u2} (RelEmbedding.{u3, u2} β γ s t) β (fun (_x : β) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : β) => γ) _x) (RelHomClass.toFunLike.{max u3 u2, u3, u2} (RelEmbedding.{u3, u2} β γ s t) β γ s t (RelEmbedding.instRelHomClassRelEmbedding.{u3, u2} β γ s t)) (PrincipalSeg.toRelEmbedding.{u3, u2} β γ s t g) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u3), succ u1, succ u3} (InitialSeg.{u1, u3} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u3} α β r s)) f a))
 Case conversion may be inaccurate. Consider using '#align initial_seg.le_lt_apply InitialSeg.leLT_applyₓ'. -/
 @[simp]
 theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
@@ -806,7 +806,7 @@ namespace RelEmbedding
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s f) a) b))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Subtype.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b))
 Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_F RelEmbedding.collapseFₓ'. -/
 /-- Given an order embedding into a well order, collapse the order embedding by filling the
 gaps, to obtain an initial segment. Here, we construct the collapsed order embedding pointwise,
@@ -867,7 +867,7 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RelEmbedding.{u1, u2} α β r s) (fun (_x : RelEmbedding.{u1, u2} α β r s) => α -> β) (RelEmbedding.hasCoeToFun.{u1, u2} α β r s) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s f) a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsWellOrder.{u2} β s] (f : RelEmbedding.{u1, u2} α β r s) (a : α), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u1, u2} α β r s)) (RelEmbedding.collapse.{u1, u2} α β r s _inst_1 f) a) (Subtype.val.{succ u2} β (fun (b : β) => Not (s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RelEmbedding.{u1, u2} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Order.RelIso.Basic._hyg.867 : α) => β) _x) (RelHomClass.toFunLike.{max u1 u2, u1, u2} (RelEmbedding.{u1, u2} α β r s) α β r s (RelEmbedding.instRelHomClassRelEmbedding.{u1, u2} α β r s)) f a) b)) (RelEmbedding.collapseF.{u1, u2} α β r s _inst_1 f a))
 Case conversion may be inaccurate. Consider using '#align rel_embedding.collapse_apply RelEmbedding.collapse_applyₓ'. -/
 theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (collapseF f a).1 :=
   rfl
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
+! leanprover-community/mathlib commit 730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -192,23 +192,20 @@ theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (
   rfl
 #align initial_seg.trans_apply InitialSeg.trans_apply
 
-#print InitialSeg.unique_of_trichotomous_of_irrefl /-
-theorem unique_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s] :
-    WellFounded r → Subsingleton (r ≼i s)
-  | ⟨h⟩ =>
-    ⟨fun f g => by
-      ext a
-      have := h a; induction' this with a H IH
-      refine' extensional_of_trichotomous_of_irrefl s fun x => _
-      simp only [f.init_iff, g.init_iff]
-      exact exists_congr fun x => and_congr_left fun hx => IH _ hx ▸ Iff.rfl⟩
-#align initial_seg.unique_of_trichotomous_of_irrefl InitialSeg.unique_of_trichotomous_of_irrefl
--/
+instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s]
+    [IsWellFounded α r] : Subsingleton (r ≼i s) :=
+  ⟨fun f g => by
+    ext a
+    apply IsWellFounded.induction r a fun b IH => _
+    refine' extensional_of_trichotomous_of_irrefl s fun x => _
+    rw [f.init_iff, g.init_iff]
+    exact exists_congr fun x => and_congr_left fun hx => IH _ hx ▸ Iff.rfl⟩
+#align initial_seg.subsingleton_of_trichotomous_of_irrefl InitialSeg.subsingleton_of_trichotomous_of_irrefl
 
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
-  ⟨fun a =>
-    @Subsingleton.elim _
-      (unique_of_trichotomous_of_irrefl (@RelEmbedding.wellFounded _ _ r s a IsWellFounded.wf)) a⟩
+  ⟨fun a => by
+    letI := a.is_well_founded
+    apply Subsingleton.elim⟩
 
 /- warning: initial_seg.eq -> InitialSeg.eq is a dubious translation:
 lean 3 declaration is
Diff
@@ -332,6 +332,12 @@ theorem leAdd_apply (r : α → α → Prop) (s : β → β → Prop) (a) : leAd
   rfl
 #align initial_seg.le_add_apply InitialSeg.leAdd_apply
 
+/- warning: initial_seg.acc -> InitialSeg.acc is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) (a : α), Iff (Acc.{succ u2} α r a) (Acc.{succ u1} β s (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a))
+Case conversion may be inaccurate. Consider using '#align initial_seg.acc InitialSeg.accₓ'. -/
 protected theorem acc (f : r ≼i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   ⟨by
     refine' fun h => Acc.recOn h fun a _ ha => Acc.intro _ fun b hb => _
@@ -697,12 +703,19 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 #align principal_seg.pempty_to_punit PrincipalSeg.pemptyToPunit
 -/
 
+/- warning: principal_seg.acc -> PrincipalSeg.acc is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (PrincipalSeg.{u1, u2} α β r s) (fun (_x : PrincipalSeg.{u1, u2} α β r s) => α -> β) (PrincipalSeg.hasCoeToFun.{u1, u2} α β r s) f a))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} [_inst_1 : IsTrans.{u2} β s] (f : PrincipalSeg.{u1, u2} α β r s) (a : α), Iff (Acc.{succ u1} α r a) (Acc.{succ u2} β s (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (PrincipalSeg.toRelEmbedding.{u1, u2} α β r s f)) a))
+Case conversion may be inaccurate. Consider using '#align principal_seg.acc PrincipalSeg.accₓ'. -/
 protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
   (f : r ≼i s).Acc a
 #align principal_seg.acc PrincipalSeg.acc
 
 end PrincipalSeg
 
+#print wellFounded_iff_wellFounded_subrel /-
 /-- A relation is well-founded iff every principal segment of it is well-founded.
 
 In this lemma we use `subrel` to indicate its principal segments because it's usually more
@@ -718,12 +731,15 @@ theorem wellFounded_iff_wellFounded_subrel {β : Type _} {s : β → β → Prop
   obtain ⟨b', rfl⟩ := f.down.mp ((PrincipalSeg.ofElement_top s b).symm ▸ hb' : s b' f.top)
   exact (f.acc b').mp ((wf b).apply b')
 #align well_founded_iff_well_founded_subrel wellFounded_iff_wellFounded_subrel
+-/
 
+#print wellFounded_iff_principalSeg /-
 theorem wellFounded_iff_principalSeg.{u} {β : Type u} {s : β → β → Prop} [IsTrans β s] :
     WellFounded s ↔ ∀ (α : Type u) (r : α → α → Prop) (f : r ≺i s), WellFounded r :=
   ⟨fun wf α r f => RelHomClass.wellFounded f.toRelEmbedding wf, fun h =>
     wellFounded_iff_wellFounded_subrel.mpr fun b => h _ _ (PrincipalSeg.ofElement s b)⟩
 #align well_founded_iff_principal_seg wellFounded_iff_principalSeg
+-/
 
 /-! ### Properties of initial and principal segments -/
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 8da9e30545433fdd8fe55a0d3da208e5d9263f03
+! leanprover-community/mathlib commit 1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -332,6 +332,13 @@ theorem leAdd_apply (r : α → α → Prop) (s : β → β → Prop) (a) : leAd
   rfl
 #align initial_seg.le_add_apply InitialSeg.leAdd_apply
 
+protected theorem acc (f : r ≼i s) (a : α) : Acc r a ↔ Acc s (f a) :=
+  ⟨by
+    refine' fun h => Acc.recOn h fun a _ ha => Acc.intro _ fun b hb => _
+    obtain ⟨a', rfl⟩ := f.init hb
+    exact ha _ (f.map_rel_iff.mp hb), f.toRelEmbedding.Acc a⟩
+#align initial_seg.acc InitialSeg.acc
+
 end InitialSeg
 
 /-!
@@ -690,8 +697,34 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
 #align principal_seg.pempty_to_punit PrincipalSeg.pemptyToPunit
 -/
 
+protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
+  (f : r ≼i s).Acc a
+#align principal_seg.acc PrincipalSeg.acc
+
 end PrincipalSeg
 
+/-- A relation is well-founded iff every principal segment of it is well-founded.
+
+In this lemma we use `subrel` to indicate its principal segments because it's usually more
+convenient to use.
+-/
+theorem wellFounded_iff_wellFounded_subrel {β : Type _} {s : β → β → Prop} [IsTrans β s] :
+    WellFounded s ↔ ∀ b, WellFounded (Subrel s { b' | s b' b }) :=
+  by
+  refine'
+    ⟨fun wf b => ⟨fun b' => ((PrincipalSeg.ofElement _ b).Acc b').mpr (wf.apply b')⟩, fun wf =>
+      ⟨fun b => Acc.intro _ fun b' hb' => _⟩⟩
+  let f := PrincipalSeg.ofElement s b
+  obtain ⟨b', rfl⟩ := f.down.mp ((PrincipalSeg.ofElement_top s b).symm ▸ hb' : s b' f.top)
+  exact (f.acc b').mp ((wf b).apply b')
+#align well_founded_iff_well_founded_subrel wellFounded_iff_wellFounded_subrel
+
+theorem wellFounded_iff_principalSeg.{u} {β : Type u} {s : β → β → Prop} [IsTrans β s] :
+    WellFounded s ↔ ∀ (α : Type u) (r : α → α → Prop) (f : r ≺i s), WellFounded r :=
+  ⟨fun wf α r f => RelHomClass.wellFounded f.toRelEmbedding wf, fun h =>
+    wellFounded_iff_wellFounded_subrel.mpr fun b => h _ _ (PrincipalSeg.ofElement s b)⟩
+#align well_founded_iff_principal_seg wellFounded_iff_principalSeg
+
 /-! ### Properties of initial and principal segments -/
 
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4
+! leanprover-community/mathlib commit 8da9e30545433fdd8fe55a0d3da208e5d9263f03
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -56,7 +56,7 @@ open Function
 embedding whose range is an initial segment. That is, whenever `b < f a` in `β` then `b` is in the
 range of `f`. -/
 structure InitialSeg {α β : Type _} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
-  dropLast : ∀ a b, s b (to_rel_embedding a) → ∃ a', to_rel_embedding a' = b
+  init' : ∀ a b, s b (to_rel_embedding a) → ∃ a', to_rel_embedding a' = b
 #align initial_seg InitialSeg
 -/
 
@@ -108,15 +108,15 @@ theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align initial_seg.coe_coe_fn InitialSeg.coe_coe_fn
 
-/- warning: initial_seg.init' -> InitialSeg.init' is a dubious translation:
+/- warning: initial_seg.init -> InitialSeg.init is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a') b))
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) (a : α) (b : β), (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (InitialSeg.toRelEmbedding.{u1, u2} α β r s f)) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (InitialSeg.toRelEmbedding.{u1, u2} α β r s f)) a') b))
-Case conversion may be inaccurate. Consider using '#align initial_seg.init' InitialSeg.init'ₓ'. -/
-theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
-  f.dropLast _ _
-#align initial_seg.init' InitialSeg.init'
+  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a)) -> (Exists.{succ u2} α (fun (a' : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a') b))
+Case conversion may be inaccurate. Consider using '#align initial_seg.init InitialSeg.initₓ'. -/
+theorem init (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
+  f.init' _ _
+#align initial_seg.init InitialSeg.init
 
 /- warning: initial_seg.map_rel_iff -> InitialSeg.map_rel_iff is a dubious translation:
 lean 3 declaration is
@@ -136,7 +136,7 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align initial_seg.init_iff InitialSeg.init_iffₓ'. -/
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   ⟨fun h =>
-    let ⟨a', e⟩ := f.init' h
+    let ⟨a', e⟩ := f.dropLast h
     ⟨a', e, f.map_rel_iff.1 (e.symm ▸ h)⟩,
     fun ⟨a', e, h⟩ => e ▸ f.map_rel_iff.2 h⟩
 #align initial_seg.init_iff InitialSeg.init_iff
@@ -279,7 +279,7 @@ theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
               rw [← e] <;>
                 exact
                   (trichotomous _ _).resolve_right
-                    (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init' hl))⟩⟩
+                    (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init hl))⟩⟩
 #align initial_seg.eq_or_principal InitialSeg.eq_or_principal
 
 /- warning: initial_seg.cod_restrict -> InitialSeg.codRestrict is a dubious translation:
@@ -291,7 +291,7 @@ Case conversion may be inaccurate. Consider using '#align initial_seg.cod_restri
 /-- Restrict the codomain of an initial segment -/
 def codRestrict (p : Set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, fun a ⟨b, m⟩ (h : s b (f a)) =>
-    let ⟨a', e⟩ := f.init' h
+    let ⟨a', e⟩ := f.dropLast h
     ⟨a', by clear _let_match <;> subst e <;> rfl⟩⟩
 #align initial_seg.cod_restrict InitialSeg.codRestrict
 
Diff
@@ -112,7 +112,7 @@ theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) {a : α} {b : β}, (s b (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} β (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (InitialSeg.{u1, u2} α β r s) (fun (_x : InitialSeg.{u1, u2} α β r s) => α -> β) (FunLike.hasCoeToFun.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α (fun (_x : α) => β) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (InitialSeg.{u1, u2} α β r s) α β (InitialSeg.embeddingLike.{u1, u2} α β r s))) f a') b))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u2, u1} α β r s) {a : α} {b : β}, (s b (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a)) -> (Exists.{succ u2} α (fun (a' : α) => Eq.{succ u1} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u2) (succ u1), succ u2, succ u1} (InitialSeg.{u2, u1} α β r s) α β (InitialSeg.instEmbeddingLikeInitialSeg.{u2, u1} α β r s)) f a') b))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : α -> α -> Prop} {s : β -> β -> Prop} (f : InitialSeg.{u1, u2} α β r s) (a : α) (b : β), (s b (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (InitialSeg.toRelEmbedding.{u1, u2} α β r s f)) a)) -> (Exists.{succ u1} α (fun (a' : α) => Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) a') (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : α) => β) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (Function.Embedding.{succ u1, succ u2} α β) α β (Function.instEmbeddingLikeEmbedding.{succ u1, succ u2} α β)) (RelEmbedding.toEmbedding.{u1, u2} α β r s (InitialSeg.toRelEmbedding.{u1, u2} α β r s f)) a') b))
 Case conversion may be inaccurate. Consider using '#align initial_seg.init' InitialSeg.init'ₓ'. -/
 theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
   f.dropLast _ _

Changes in mathlib4

mathlib3
mathlib4
chore: more squeeze_simps arising from linter (#11259)

The squeezing continues! All found by the linter at #11246.

Diff
@@ -118,7 +118,7 @@ instance (r : α → α → Prop) : Inhabited (r ≼i r) :=
 @[trans]
 protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
   ⟨f.1.trans g.1, fun a c h => by
-    simp at h ⊢
+    simp only [RelEmbedding.coe_trans, coe_coe_fn, comp_apply] at h ⊢
     rcases g.2 _ _ h with ⟨b, rfl⟩; have h := g.map_rel_iff.1 h
     rcases f.2 _ _ h with ⟨a', rfl⟩; exact ⟨a', rfl⟩⟩
 #align initial_seg.trans InitialSeg.trans
chore: change from plural to singular in porting notes (#10761)
Diff
@@ -55,7 +55,7 @@ structure InitialSeg {α β : Type*} (r : α → α → Prop) (s : β → β →
   init' : ∀ a b, s b (toRelEmbedding a) → ∃ a', toRelEmbedding a' = b
 #align initial_seg InitialSeg
 
--- Porting notes: Deleted `scoped[InitialSeg]`
+-- Porting note: Deleted `scoped[InitialSeg]`
 /-- If `r` is a relation on `α` and `s` in a relation on `β`, then `f : r ≼i s` is an order
 embedding whose range is an initial segment. That is, whenever `b < f a` in `β` then `b` is in the
 range of `f`. -/
@@ -243,7 +243,7 @@ structure PrincipalSeg {α β : Type*} (r : α → α → Prop) (s : β → β 
   down' : ∀ b, s b top ↔ ∃ a, toRelEmbedding a = b
 #align principal_seg PrincipalSeg
 
--- Porting notes: deleted `scoped[InitialSeg]`
+-- Porting note: deleted `scoped[InitialSeg]`
 /-- If `r` is a relation on `α` and `s` in a relation on `β`, then `f : r ≺i s` is an order
 embedding whose range is an open interval `(-∞, top)` for some element `top` of `β`. Such order
 embeddings are called principal segments -/
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -66,13 +66,15 @@ namespace InitialSeg
 instance : Coe (r ≼i s) (r ↪r s) :=
   ⟨InitialSeg.toRelEmbedding⟩
 
-instance : EmbeddingLike (r ≼i s) α β :=
-  { coe := fun f => f.toFun
-    coe_injective' := by
-      rintro ⟨f, hf⟩ ⟨g, hg⟩ h
-      congr with x
-      exact congr_fun h x,
-    injective' := fun f => f.inj' }
+instance : FunLike (r ≼i s) α β where
+  coe f := f.toFun
+  coe_injective' := by
+    rintro ⟨f, hf⟩ ⟨g, hg⟩ h
+    congr with x
+    exact congr_fun h x
+
+instance : EmbeddingLike (r ≼i s) α β where
+  injective' f := f.inj'
 
 @[ext] lemma ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
   DFunLike.ext f g h
chore(*): rename FunLike to DFunLike (#9785)

This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.

This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:

sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean     
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -75,7 +75,7 @@ instance : EmbeddingLike (r ≼i s) α β :=
     injective' := fun f => f.inj' }
 
 @[ext] lemma ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
-  FunLike.ext f g h
+  DFunLike.ext f g h
 #align initial_seg.ext InitialSeg.ext
 
 @[simp]
chore: remove unused cases' names (#9451)

These unused names will soon acquire a linter warning. Easiest to clean them up pre-emptively.

(Thanks to @nomeata for fixing these on nightly-testing.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -513,7 +513,7 @@ noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i
 @[simp]
 theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
     (f.leLT g) a = g (f a) := by
-  delta InitialSeg.leLT; cases' h : f.ltOrEq with f' f'
+  delta InitialSeg.leLT; cases' f.ltOrEq with f' f'
   · simp only [PrincipalSeg.trans_apply, f.ltOrEq_apply_left]
   · simp only [PrincipalSeg.equivLT_apply, f.ltOrEq_apply_right]
 #align initial_seg.le_lt_apply InitialSeg.leLT_apply
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -382,7 +382,8 @@ def ofElement {α : Type*} (r : α → α → Prop) (a : α) : Subrel r { b | r
   ⟨Subrel.relEmbedding _ _, a, fun _ => ⟨fun h => ⟨⟨_, h⟩, rfl⟩, fun ⟨⟨_, h⟩, rfl⟩ => h⟩⟩
 #align principal_seg.of_element PrincipalSeg.ofElement
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem ofElement_apply {α : Type*} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
 #align principal_seg.of_element_apply PrincipalSeg.ofElement_apply
@@ -400,12 +401,17 @@ noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
       (funext fun _ ↦ propext f.down.symm))),
     map_rel_iff' := f.map_rel_iff }
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+attribute [nolint simpNF] PrincipalSeg.subrelIso_symm_apply
+
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) :
     f (f.subrelIso b) = b :=
   Equiv.apply_ofInjective_symm f.injective _
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem subrelIso_apply (f : r ≺i s) (a : α) :
     f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
   Equiv.ofInjective_symm_apply f.injective _
@@ -567,3 +573,5 @@ theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (c
 #align rel_embedding.collapse_apply RelEmbedding.collapse_apply
 
 end RelEmbedding
+attribute [nolint simpNF] PrincipalSeg.ofElement_apply PrincipalSeg.subrelIso_symm_apply
+  PrincipalSeg.apply_subrelIso PrincipalSeg.subrelIso_apply
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -382,8 +382,7 @@ def ofElement {α : Type*} (r : α → α → Prop) (a : α) : Subrel r { b | r
   ⟨Subrel.relEmbedding _ _, a, fun _ => ⟨fun h => ⟨⟨_, h⟩, rfl⟩, fun ⟨⟨_, h⟩, rfl⟩ => h⟩⟩
 #align principal_seg.of_element PrincipalSeg.ofElement
 
--- This lemma was always bad, but the linter only noticed after lean4#2644
-@[simp, nolint simpNF]
+@[simp]
 theorem ofElement_apply {α : Type*} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
 #align principal_seg.of_element_apply PrincipalSeg.ofElement_apply
@@ -401,17 +400,12 @@ noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
       (funext fun _ ↦ propext f.down.symm))),
     map_rel_iff' := f.map_rel_iff }
 
--- This lemma was always bad, but the linter only noticed after lean4#2644
-attribute [nolint simpNF] PrincipalSeg.subrelIso_symm_apply
-
--- This lemma was always bad, but the linter only noticed after lean4#2644
-@[simp, nolint simpNF]
+@[simp]
 theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) :
     f (f.subrelIso b) = b :=
   Equiv.apply_ofInjective_symm f.injective _
 
--- This lemma was always bad, but the linter only noticed after lean4#2644
-@[simp, nolint simpNF]
+@[simp]
 theorem subrelIso_apply (f : r ≺i s) (a : α) :
     f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
   Equiv.ofInjective_symm_apply f.injective _
@@ -573,5 +567,3 @@ theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (c
 #align rel_embedding.collapse_apply RelEmbedding.collapse_apply
 
 end RelEmbedding
-attribute [nolint simpNF] PrincipalSeg.ofElement_apply PrincipalSeg.subrelIso_symm_apply
-  PrincipalSeg.apply_subrelIso PrincipalSeg.subrelIso_apply
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -382,7 +382,8 @@ def ofElement {α : Type*} (r : α → α → Prop) (a : α) : Subrel r { b | r
   ⟨Subrel.relEmbedding _ _, a, fun _ => ⟨fun h => ⟨⟨_, h⟩, rfl⟩, fun ⟨⟨_, h⟩, rfl⟩ => h⟩⟩
 #align principal_seg.of_element PrincipalSeg.ofElement
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem ofElement_apply {α : Type*} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
 #align principal_seg.of_element_apply PrincipalSeg.ofElement_apply
@@ -400,12 +401,17 @@ noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
       (funext fun _ ↦ propext f.down.symm))),
     map_rel_iff' := f.map_rel_iff }
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+attribute [nolint simpNF] PrincipalSeg.subrelIso_symm_apply
+
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) :
     f (f.subrelIso b) = b :=
   Equiv.apply_ofInjective_symm f.injective _
 
-@[simp]
+-- This lemma was always bad, but the linter only noticed after lean4#2644
+@[simp, nolint simpNF]
 theorem subrelIso_apply (f : r ≺i s) (a : α) :
     f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
   Equiv.ofInjective_symm_apply f.injective _
@@ -567,3 +573,5 @@ theorem collapse_apply [IsWellOrder β s] (f : r ↪r s) (a) : collapse f a = (c
 #align rel_embedding.collapse_apply RelEmbedding.collapse_apply
 
 end RelEmbedding
+attribute [nolint simpNF] PrincipalSeg.ofElement_apply PrincipalSeg.subrelIso_symm_apply
+  PrincipalSeg.apply_subrelIso PrincipalSeg.subrelIso_apply
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -39,6 +39,8 @@ any `b' < b` also belongs to the range). The type of these embeddings from `r` t
 `InitialSeg r s`, and denoted by `r ≼i s`.
 -/
 
+set_option autoImplicit true
+
 
 variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop}
   {t : γ → γ → Prop}
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -40,7 +40,7 @@ any `b' < b` also belongs to the range). The type of these embeddings from `r` t
 -/
 
 
-variable {α : Type _} {β : Type _} {γ : Type _} {r : α → α → Prop} {s : β → β → Prop}
+variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop}
   {t : γ → γ → Prop}
 
 open Function
@@ -48,7 +48,7 @@ open Function
 /-- If `r` is a relation on `α` and `s` in a relation on `β`, then `f : r ≼i s` is an order
 embedding whose range is an initial segment. That is, whenever `b < f a` in `β` then `b` is in the
 range of `f`. -/
-structure InitialSeg {α β : Type _} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
+structure InitialSeg {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
   /-- The order embedding is an initial segment -/
   init' : ∀ a b, s b (toRelEmbedding a) → ∃ a', toRelEmbedding a' = b
 #align initial_seg InitialSeg
@@ -232,7 +232,7 @@ segments.
 /-- If `r` is a relation on `α` and `s` in a relation on `β`, then `f : r ≺i s` is an order
 embedding whose range is an open interval `(-∞, top)` for some element `top` of `β`. Such order
 embeddings are called principal segments -/
-structure PrincipalSeg {α β : Type _} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
+structure PrincipalSeg {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
   /-- The supremum of the principal segment -/
   top : β
   /-- The image of the order embedding is the set of elements `b` such that `s b top` -/
@@ -376,17 +376,17 @@ theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → 
 #align principal_seg.top_lt_top PrincipalSeg.topLTTop
 
 /-- Any element of a well order yields a principal segment -/
-def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r b a } ≺i r :=
+def ofElement {α : Type*} (r : α → α → Prop) (a : α) : Subrel r { b | r b a } ≺i r :=
   ⟨Subrel.relEmbedding _ _, a, fun _ => ⟨fun h => ⟨⟨_, h⟩, rfl⟩, fun ⟨⟨_, h⟩, rfl⟩ => h⟩⟩
 #align principal_seg.of_element PrincipalSeg.ofElement
 
 @[simp]
-theorem ofElement_apply {α : Type _} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
+theorem ofElement_apply {α : Type*} (r : α → α → Prop) (a : α) (b) : ofElement r a b = b.1 :=
   rfl
 #align principal_seg.of_element_apply PrincipalSeg.ofElement_apply
 
 @[simp]
-theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofElement r a).top = a :=
+theorem ofElement_top {α : Type*} (r : α → α → Prop) (a : α) : (ofElement r a).top = a :=
   rfl
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 
@@ -455,7 +455,7 @@ end PrincipalSeg
 In this lemma we use `Subrel` to indicate its principal segments because it's usually more
 convenient to use.
 -/
-theorem wellFounded_iff_wellFounded_subrel {β : Type _} {s : β → β → Prop} [IsTrans β s] :
+theorem wellFounded_iff_wellFounded_subrel {β : Type*} {s : β → β → Prop} [IsTrans β s] :
     WellFounded s ↔ ∀ b, WellFounded (Subrel s { b' | s b' b }) := by
   refine'
     ⟨fun wf b => ⟨fun b' => ((PrincipalSeg.ofElement _ b).acc b').mpr (wf.apply b')⟩, fun wf =>
chore: golf set_theory/ordinal/basic (#5581)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -3,10 +3,11 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 -/
+import Mathlib.Logic.Equiv.Set
 import Mathlib.Order.RelIso.Set
 import Mathlib.Order.WellFounded
 
-#align_import order.initial_seg from "leanprover-community/mathlib"@"730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba"
+#align_import order.initial_seg from "leanprover-community/mathlib"@"8ea5598db6caeddde6cb734aa179cc2408dbd345"
 /-!
 # Initial and principal segments
 
@@ -389,6 +390,24 @@ theorem ofElement_top {α : Type _} (r : α → α → Prop) (a : α) : (ofEleme
   rfl
 #align principal_seg.of_element_top PrincipalSeg.ofElement_top
 
+/-- For any principal segment `r ≺i s`, there is a `Subrel` of `s` order isomorphic to `r`. -/
+@[simps! symm_apply]
+noncomputable def subrelIso (f : r ≺i s) : Subrel s {b | s b f.top} ≃r r :=
+  RelIso.symm
+  { toEquiv := ((Equiv.ofInjective f f.injective).trans (Equiv.setCongr
+      (funext fun _ ↦ propext f.down.symm))),
+    map_rel_iff' := f.map_rel_iff }
+
+@[simp]
+theorem apply_subrelIso (f : r ≺i s) (b : {b | s b f.top}) :
+    f (f.subrelIso b) = b :=
+  Equiv.apply_ofInjective_symm f.injective _
+
+@[simp]
+theorem subrelIso_apply (f : r ≺i s) (a : α) :
+    f.subrelIso ⟨f a, f.down.mpr ⟨a, rfl⟩⟩ = a :=
+  Equiv.ofInjective_symm_apply f.injective _
+
 /-- Restrict the codomain of a principal segment -/
 def codRestrict (p : Set β) (f : r ≺i s) (H : ∀ a, f a ∈ p) (H₂ : f.top ∈ p) : r ≺i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, ⟨f.top, H₂⟩, fun ⟨_, _⟩ =>
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
-
-! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Order.RelIso.Set
 import Mathlib.Order.WellFounded
+
+#align_import order.initial_seg from "leanprover-community/mathlib"@"730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba"
 /-!
 # Initial and principal segments
 
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -116,7 +116,7 @@ instance (r : α → α → Prop) : Inhabited (r ≼i r) :=
 @[trans]
 protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
   ⟨f.1.trans g.1, fun a c h => by
-    simp at h⊢
+    simp at h ⊢
     rcases g.2 _ _ h with ⟨b, rfl⟩; have h := g.map_rel_iff.1 h
     rcases f.2 _ _ h with ⟨a', rfl⟩; exact ⟨a', rfl⟩⟩
 #align initial_seg.trans InitialSeg.trans
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -422,7 +422,7 @@ theorem ofIsEmpty_top (r : α → α → Prop) [IsEmpty α] {b : β} (H : ∀ b'
   rfl
 #align principal_seg.of_is_empty_top PrincipalSeg.ofIsEmpty_top
 
-/-- Principal segment from the empty relation on `pempty` to the empty relation on `punit`. -/
+/-- Principal segment from the empty relation on `PEmpty` to the empty relation on `PUnit`. -/
 @[reducible]
 def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
   (@ofIsEmpty _ _ EmptyRelation _ _ PUnit.unit) fun _ => not_false
chore: update std 05-22 (#4248)

The main breaking change is that tac <;> [t1, t2] is now written tac <;> [t1; t2], to avoid clashing with tactics like cases and use that take comma-separated lists.

Diff
@@ -204,7 +204,7 @@ def ofIsEmpty (r : α → α → Prop) (s : β → β → Prop) [IsEmpty α] : r
 /-- Initial segment embedding of an order `r` into the disjoint union of `r` and `s`. -/
 def leAdd (r : α → α → Prop) (s : β → β → Prop) : r ≼i Sum.Lex r s :=
   ⟨⟨⟨Sum.inl, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩, fun a b => by
-    cases b <;> [exact fun _ => ⟨_, rfl⟩, exact False.elim ∘ Sum.lex_inr_inl]⟩
+    cases b <;> [exact fun _ => ⟨_, rfl⟩; exact False.elim ∘ Sum.lex_inr_inl]⟩
 #align initial_seg.le_add InitialSeg.leAdd
 
 @[simp]
chore: tweak subsingleton_of_trichotomous_of_irrefl (#3749)

Match https://github.com/leanprover-community/mathlib/pull/18749

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
+! leanprover-community/mathlib commit 730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -131,21 +131,18 @@ theorem trans_apply (f : r ≼i s) (g : s ≼i t) (a : α) : (f.trans g) a = g (
   rfl
 #align initial_seg.trans_apply InitialSeg.trans_apply
 
-theorem unique_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s] :
-    WellFounded r → Subsingleton (r ≼i s)
-  | ⟨h⟩ =>
-    ⟨fun f g => by
-      ext a
-      induction' h a with a _ IH
-      refine extensional_of_trichotomous_of_irrefl s fun x => ?_
-      simp only [f.init_iff, g.init_iff]
-      exact exists_congr fun y => and_congr_left fun h => IH _ h ▸ Iff.rfl⟩
-#align initial_seg.unique_of_trichotomous_of_irrefl InitialSeg.unique_of_trichotomous_of_irrefl
+instance subsingleton_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s]
+    [IsWellFounded α r] : Subsingleton (r ≼i s) :=
+  ⟨fun f g => by
+    ext a
+    refine' IsWellFounded.induction r a fun b IH =>
+      extensional_of_trichotomous_of_irrefl s fun x => _
+    rw [f.init_iff, g.init_iff]
+    exact exists_congr fun x => and_congr_left fun hx => IH _ hx ▸ Iff.rfl⟩
+#align initial_seg.subsingleton_of_trichotomous_of_irrefl InitialSeg.subsingleton_of_trichotomous_of_irrefl
 
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
-  ⟨fun a =>
-    @Subsingleton.elim _
-      (unique_of_trichotomous_of_irrefl (@RelEmbedding.wellFounded _ _ r s a IsWellFounded.wf)) a⟩
+  ⟨fun a => by let _ := a.isWellFounded; exact Subsingleton.elim a⟩
 
 protected theorem eq [IsWellOrder β s] (f g : r ≼i s) (a) : f a = g a := by
   rw [Subsingleton.elim f g]
golf: Order.InitialSeg (#3212)

Probably not worth backporting to Mathlib 3.

Diff
@@ -509,7 +509,7 @@ noncomputable def collapseF [IsWellOrder β s] (f : r ↪r s) : ∀ a, { b // ¬
       ((trichotomous _ _).resolve_left fun h' =>
             (IH a' h).2 <| _root_.trans (f.map_rel_iff.2 h) h').resolve_left
         fun h' => (IH a' h).2 <| h' ▸ f.map_rel_iff.2 h
-    exact ⟨IsWellFounded.wf.min S ⟨_, this⟩, IsWellFounded.wf.not_lt_min _ _ this⟩
+    exact ⟨_, IsWellFounded.wf.not_lt_min _ ⟨_, this⟩ this⟩
 set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F RelEmbedding.collapseF
 
@@ -524,12 +524,10 @@ set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F.lt RelEmbedding.collapseF.lt
 
 theorem collapseF.not_lt [IsWellOrder β s] (f : r ↪r s) (a : α) {b}
-    (h : ∀ (a') (_ : r a' a), s (collapseF f a').1 b) : ¬s b (collapseF f a).1 := by
+    (h : ∀ a' (_ : r a' a), s (collapseF f a').1 b) : ¬s b (collapseF f a).1 := by
   unfold collapseF; rw [WellFounded.fix_eq]
   dsimp only
-  exact
-    WellFounded.not_lt_min _ _ _
-      (show b ∈ { b | ∀ (a') (_ : r a' a), s (collapseF f a').1 b } from h)
+  exact WellFounded.not_lt_min _ _ _ h
 set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F.not_lt RelEmbedding.collapseF.not_lt
 
@@ -540,14 +538,12 @@ noncomputable def collapse [IsWellOrder β s] (f : r ↪r s) : r ≼i s :=
   ⟨RelEmbedding.ofMonotone (fun a => (collapseF f a).1) fun a b => collapseF.lt f, fun a b =>
     Acc.recOn (IsWellFounded.wf.apply b : Acc s b)
       (fun b _ _ a h => by
-        let S := { a | ¬s (collapseF f a).1 b }
-        have : S.Nonempty := ⟨_, asymm h⟩
-        exists (IsWellFounded.wf : WellFounded r).min S this
-        refine' ((@trichotomous _ s _ _ _).resolve_left _).resolve_right _
-        · exact (IsWellFounded.wf : WellFounded r).min_mem S this
-        · refine' collapseF.not_lt f _ fun a' h' => _
-          by_contra hn
-          exact IsWellFounded.wf.not_lt_min S this hn h')
+        rcases (@IsWellFounded.wf _ r).has_min { a | ¬s (collapseF f a).1 b }
+          ⟨_, asymm h⟩ with ⟨m, hm, hm'⟩
+        refine' ⟨m, ((@trichotomous _ s _ _ _).resolve_left hm).resolve_right
+          (collapseF.not_lt f _ fun a' h' => _)⟩
+        by_contra hn
+        exact hm' _ hn h')
       a⟩
 #align rel_embedding.collapse RelEmbedding.collapse
 
feat: port #18527 (#3190)

Mathlib 3: https://github.com/leanprover-community/mathlib/pull/18527

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 8da9e30545433fdd8fe55a0d3da208e5d9263f03
+! leanprover-community/mathlib commit 1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -215,6 +215,13 @@ theorem leAdd_apply (r : α → α → Prop) (s : β → β → Prop) (a) : leAd
   rfl
 #align initial_seg.le_add_apply InitialSeg.leAdd_apply
 
+protected theorem acc (f : r ≼i s) (a : α) : Acc r a ↔ Acc s (f a) :=
+  ⟨by
+    refine' fun h => Acc.recOn h fun a _ ha => Acc.intro _ fun b hb => _
+    obtain ⟨a', rfl⟩ := f.init hb
+    exact ha _ (f.map_rel_iff.mp hb), f.toRelEmbedding.acc a⟩
+#align initial_seg.acc InitialSeg.acc
+
 end InitialSeg
 
 /-!
@@ -424,8 +431,33 @@ def pemptyToPunit : @EmptyRelation PEmpty ≺i @EmptyRelation PUnit :=
   (@ofIsEmpty _ _ EmptyRelation _ _ PUnit.unit) fun _ => not_false
 #align principal_seg.pempty_to_punit PrincipalSeg.pemptyToPunit
 
+protected theorem acc [IsTrans β s] (f : r ≺i s) (a : α) : Acc r a ↔ Acc s (f a) :=
+  (f : r ≼i s).acc a
+#align principal_seg.acc PrincipalSeg.acc
+
 end PrincipalSeg
 
+/-- A relation is well-founded iff every principal segment of it is well-founded.
+
+In this lemma we use `Subrel` to indicate its principal segments because it's usually more
+convenient to use.
+-/
+theorem wellFounded_iff_wellFounded_subrel {β : Type _} {s : β → β → Prop} [IsTrans β s] :
+    WellFounded s ↔ ∀ b, WellFounded (Subrel s { b' | s b' b }) := by
+  refine'
+    ⟨fun wf b => ⟨fun b' => ((PrincipalSeg.ofElement _ b).acc b').mpr (wf.apply b')⟩, fun wf =>
+      ⟨fun b => Acc.intro _ fun b' hb' => _⟩⟩
+  let f := PrincipalSeg.ofElement s b
+  obtain ⟨b', rfl⟩ := f.down.mp ((PrincipalSeg.ofElement_top s b).symm ▸ hb' : s b' f.top)
+  exact (f.acc b').mp ((wf b).apply b')
+#align well_founded_iff_well_founded_subrel wellFounded_iff_wellFounded_subrel
+
+theorem wellFounded_iff_principalSeg.{u} {β : Type u} {s : β → β → Prop} [IsTrans β s] :
+    WellFounded s ↔ ∀ (α : Type u) (r : α → α → Prop) (_ : r ≺i s), WellFounded r :=
+  ⟨fun wf _ _ f => RelHomClass.wellFounded f.toRelEmbedding wf, fun h =>
+    wellFounded_iff_wellFounded_subrel.mpr fun b => h _ _ (PrincipalSeg.ofElement s b)⟩
+#align well_founded_iff_principal_seg wellFounded_iff_principalSeg
+
 /-! ### Properties of initial and principal segments -/
 
 
chore: swap the names of InitialSeg.init and InitialSeg.init' (#2581)

mathlib3 PR: https://github.com/leanprover-community/mathlib/pull/18534

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit 7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4
+! leanprover-community/mathlib commit 8da9e30545433fdd8fe55a0d3da208e5d9263f03
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -52,7 +52,7 @@ embedding whose range is an initial segment. That is, whenever `b < f a` in `β`
 range of `f`. -/
 structure InitialSeg {α β : Type _} (r : α → α → Prop) (s : β → β → Prop) extends r ↪r s where
   /-- The order embedding is an initial segment -/
-  init : ∀ a b, s b (toRelEmbedding a) → ∃ a', toRelEmbedding a' = b
+  init' : ∀ a b, s b (toRelEmbedding a) → ∃ a', toRelEmbedding a' = b
 #align initial_seg InitialSeg
 
 -- Porting notes: Deleted `scoped[InitialSeg]`
@@ -83,9 +83,9 @@ theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
   rfl
 #align initial_seg.coe_coe_fn InitialSeg.coe_coe_fn
 
-theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
-  f.init _ _
-#align initial_seg.init' InitialSeg.init'
+theorem init (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b :=
+  f.init' _ _
+#align initial_seg.init InitialSeg.init
 
 theorem map_rel_iff (f : r ≼i s) : s (f a) (f b) ↔ r a b :=
   f.map_rel_iff'
@@ -93,7 +93,7 @@ theorem map_rel_iff (f : r ≼i s) : s (f a) (f b) ↔ r a b :=
 
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   ⟨fun h => by
-    rcases f.init' h with ⟨a', rfl⟩
+    rcases f.init h with ⟨a', rfl⟩
     exact ⟨a', rfl, f.map_rel_iff.1 h⟩,
     fun ⟨a', e, h⟩ => e ▸ f.map_rel_iff.2 h⟩
 #align initial_seg.init_iff InitialSeg.init_iff
@@ -184,13 +184,13 @@ theorem eq_or_principal [IsWellOrder β s] (f : r ≼i s) :
               rw [← e];
                 exact
                   (trichotomous _ _).resolve_right
-                    (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init' hl))⟩⟩
+                    (not_or_of_not (hn a) fun hl => not_exists.2 hn (f.init hl))⟩⟩
 #align initial_seg.eq_or_principal InitialSeg.eq_or_principal
 
 /-- Restrict the codomain of an initial segment -/
 def codRestrict (p : Set β) (f : r ≼i s) (H : ∀ a, f a ∈ p) : r ≼i Subrel s p :=
   ⟨RelEmbedding.codRestrict p f H, fun a ⟨b, m⟩ h =>
-    let ⟨a', e⟩ := f.init' h
+    let ⟨a', e⟩ := f.init h
     ⟨a', by subst e; rfl⟩⟩
 #align initial_seg.cod_restrict InitialSeg.codRestrict
 
chore: update SHA of already forward-ported files (#2181)

Update some SHAs of files that changed in mathlib3.

These 17 files need mainly only updated SHA as they've been only touched by backports or already have been forward-ported.

The relevant changes are:

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
 
 ! This file was ported from Lean 3 source module order.initial_seg
-! leanprover-community/mathlib commit ee0c179cd3c8a45aa5bffbf1b41d8dbede452865
+! leanprover-community/mathlib commit 7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -76,6 +76,7 @@ instance : EmbeddingLike (r ≼i s) α β :=
 
 @[ext] lemma ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
   FunLike.ext f g h
+#align initial_seg.ext InitialSeg.ext
 
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
@@ -88,6 +89,7 @@ theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b
 
 theorem map_rel_iff (f : r ≼i s) : s (f a) (f b) ↔ r a b :=
   f.map_rel_iff'
+#align initial_seg.map_rel_iff InitialSeg.map_rel_iff
 
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
   ⟨fun h => by
feat: add uppercase lean 3 linter (#1796)

Implements a linter for lean 3 declarations containing capital letters (as suggested on Zulip).

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -476,6 +476,7 @@ noncomputable def collapseF [IsWellOrder β s] (f : r ↪r s) : ∀ a, { b // ¬
             (IH a' h).2 <| _root_.trans (f.map_rel_iff.2 h) h').resolve_left
         fun h' => (IH a' h).2 <| h' ▸ f.map_rel_iff.2 h
     exact ⟨IsWellFounded.wf.min S ⟨_, this⟩, IsWellFounded.wf.not_lt_min _ _ this⟩
+set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F RelEmbedding.collapseF
 
 theorem collapseF.lt [IsWellOrder β s] (f : r ↪r s) {a : α} :
@@ -485,6 +486,7 @@ theorem collapseF.lt [IsWellOrder β s] (f : r ↪r s) {a : α} :
   unfold collapseF; rw [WellFounded.fix_eq]
   dsimp only
   apply WellFounded.min_mem _ _
+set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F.lt RelEmbedding.collapseF.lt
 
 theorem collapseF.not_lt [IsWellOrder β s] (f : r ↪r s) (a : α) {b}
@@ -494,6 +496,7 @@ theorem collapseF.not_lt [IsWellOrder β s] (f : r ↪r s) (a : α) {b}
   exact
     WellFounded.not_lt_min _ _ _
       (show b ∈ { b | ∀ (a') (_ : r a' a), s (collapseF f a').1 b } from h)
+set_option linter.uppercaseLean3 false in
 #align rel_embedding.collapse_F.not_lt RelEmbedding.collapseF.not_lt
 
 /-- Construct an initial segment from an order embedding into a well order, by collapsing it
Feat: prove IsTrans α r → Trans r r r and Trans r r r → IsTrans α r (#1522)

Now Trans.trans conflicts with _root_.trans.

Diff
@@ -263,7 +263,7 @@ theorem lt_top (f : r ≺i s) (a : α) : s (f a) f.top :=
 #align principal_seg.lt_top PrincipalSeg.lt_top
 
 theorem init [IsTrans β s] (f : r ≺i s) {a : α} {b : β} (h : s b (f a)) : ∃ a', f a' = b :=
-  f.down.1 <| trans h <| f.lt_top _
+  f.down.1 <| _root_.trans h <| f.lt_top _
 #align principal_seg.init PrincipalSeg.init
 
 /-- A principal segment is in particular an initial segment. -/
Feat: add a FunLike and an EmbeddingLike instance (#1488)

Backported in leanprover-community/mathlib#18198.

Diff
@@ -66,8 +66,16 @@ namespace InitialSeg
 instance : Coe (r ≼i s) (r ↪r s) :=
   ⟨InitialSeg.toRelEmbedding⟩
 
-instance : CoeFun (r ≼i s) fun _ => α → β :=
-  ⟨fun f x => (f : r ↪r s) x⟩
+instance : EmbeddingLike (r ≼i s) α β :=
+  { coe := fun f => f.toFun
+    coe_injective' := by
+      rintro ⟨f, hf⟩ ⟨g, hg⟩ h
+      congr with x
+      exact congr_fun h x,
+    injective' := fun f => f.inj' }
+
+@[ext] lemma ext {f g : r ≼i s} (h : ∀ x, f x = g x) : f = g :=
+  FunLike.ext f g h
 
 @[simp]
 theorem coe_coe_fn (f : r ≼i s) : ((f : r ↪r s) : α → β) = f :=
@@ -78,11 +86,14 @@ theorem init' (f : r ≼i s) {a : α} {b : β} : s b (f a) → ∃ a', f a' = b
   f.init _ _
 #align initial_seg.init' InitialSeg.init'
 
+theorem map_rel_iff (f : r ≼i s) : s (f a) (f b) ↔ r a b :=
+  f.map_rel_iff'
+
 theorem init_iff (f : r ≼i s) {a : α} {b : β} : s b (f a) ↔ ∃ a', f a' = b ∧ r a' a :=
-  ⟨fun h =>
-    let ⟨a', e⟩ := f.init' h
-    ⟨a', e, (f : r ↪r s).map_rel_iff.1 (by dsimp only at e; rw [e]; exact h)⟩,
-    fun ⟨a', e, h⟩ => e ▸ (f : r ↪r s).map_rel_iff.2 h⟩
+  ⟨fun h => by
+    rcases f.init' h with ⟨a', rfl⟩
+    exact ⟨a', rfl, f.map_rel_iff.1 h⟩,
+    fun ⟨a', e, h⟩ => e ▸ f.map_rel_iff.2 h⟩
 #align initial_seg.init_iff InitialSeg.init_iff
 
 /-- An order isomorphism is an initial segment -/
@@ -104,7 +115,7 @@ instance (r : α → α → Prop) : Inhabited (r ≼i r) :=
 protected def trans (f : r ≼i s) (g : s ≼i t) : r ≼i t :=
   ⟨f.1.trans g.1, fun a c h => by
     simp at h⊢
-    rcases g.2 _ _ h with ⟨b, rfl⟩; have h := g.1.map_rel_iff.1 h
+    rcases g.2 _ _ h with ⟨b, rfl⟩; have h := g.map_rel_iff.1 h
     rcases f.2 _ _ h with ⟨a', rfl⟩; exact ⟨a', rfl⟩⟩
 #align initial_seg.trans InitialSeg.trans
 
@@ -122,23 +133,11 @@ theorem unique_of_trichotomous_of_irrefl [IsTrichotomous β s] [IsIrrefl β s] :
     WellFounded r → Subsingleton (r ≼i s)
   | ⟨h⟩ =>
     ⟨fun f g => by
-      suffices (f : α → β) = g by
-        cases f
-        cases g
-        congr
-        exact RelEmbedding.coe_fn_injective this
-      funext a
-      have := h a
-      induction' this with a _ IH
-      refine' extensional_of_trichotomous_of_irrefl s fun x => ⟨fun h => _, fun h => _⟩
-      · rcases f.init_iff.1 h with ⟨y, rfl, h'⟩
-        dsimp only
-        rw [IH _ h']
-        exact (g : r ↪r s).map_rel_iff.2 h'
-      · rcases g.init_iff.1 h with ⟨y, rfl, h'⟩
-        dsimp only
-        rw [← IH _ h']
-        exact (f : r ↪r s).map_rel_iff.2 h'⟩
+      ext a
+      induction' h a with a _ IH
+      refine extensional_of_trichotomous_of_irrefl s fun x => ?_
+      simp only [f.init_iff, g.init_iff]
+      exact exists_congr fun y => and_congr_left fun h => IH _ h ▸ Iff.rfl⟩
 #align initial_seg.unique_of_trichotomous_of_irrefl InitialSeg.unique_of_trichotomous_of_irrefl
 
 instance [IsWellOrder β s] : Subsingleton (r ≼i s) :=
@@ -293,7 +292,7 @@ instance (r : α → α → Prop) [IsWellOrder α r] : IsEmpty (r ≺i r) :=
 def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
   ⟨@RelEmbedding.trans _ _ _ r s t f g, g f.top, fun a => by
     simp only [g.init_iff, PrincipalSeg.down, exists_and_left.symm, exists_swap,
-        RelEmbedding.trans_apply, exists_eq_right']⟩
+        RelEmbedding.trans_apply, exists_eq_right', InitialSeg.coe_coe_fn]⟩
 #align principal_seg.lt_le PrincipalSeg.ltLe
 
 @[simp]
@@ -353,7 +352,7 @@ theorem equivLT_top (f : r ≃r s) (g : s ≺i t) : (equivLT f g).top = g.top :=
 instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
   ⟨fun f g => by
     have ef : (f : α → β) = g := by
-      show ((f : r ≼i s) : α → β) = g
+      show ((f : r ≼i s) : α → β) = (g : r ≼i s)
       rw [@Subsingleton.elim _ _ (f : r ≼i s) g]
     have et : f.top = g.top := by
       refine' extensional_of_trichotomous_of_irrefl s fun x => _
chore: remove iff_self from simp only after lean4#1933 (#1406)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -357,7 +357,7 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
       rw [@Subsingleton.elim _ _ (f : r ≼i s) g]
     have et : f.top = g.top := by
       refine' extensional_of_trichotomous_of_irrefl s fun x => _
-      simp only [PrincipalSeg.down, ef, iff_self]
+      simp only [PrincipalSeg.down, ef]
     cases f
     cases g
     have := RelEmbedding.coe_fn_injective ef; congr ⟩
chore: fix more casing errors per naming scheme (#1232)

I've avoided anything under Tactic or test.

In correcting the names, I found Option.isNone_iff_eq_none duplicated between Std and Mathlib, so the Mathlib one has been removed.

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -323,12 +323,12 @@ theorem trans_top [IsTrans γ t] (f : r ≺i s) (g : s ≺i t) : (f.trans g).top
 #align principal_seg.trans_top PrincipalSeg.trans_top
 
 /-- Composition of an order isomorphism with a principal segment, as a principal segment -/
-def equivLt (f : r ≃r s) (g : s ≺i t) : r ≺i t :=
+def equivLT (f : r ≃r s) (g : s ≺i t) : r ≺i t :=
   ⟨@RelEmbedding.trans _ _ _ r s t f g, g.top, fun c =>
     suffices (∃ a : β, g a = c) ↔ ∃ a : α, g (f a) = c by simpa [PrincipalSeg.down]
     ⟨fun ⟨b, h⟩ => ⟨f.symm b, by simp only [h, RelIso.apply_symm_apply]⟩,
       fun ⟨a, h⟩ => ⟨f a, h⟩⟩⟩
-#align principal_seg.equiv_lt PrincipalSeg.equivLt
+#align principal_seg.equiv_lt PrincipalSeg.equivLT
 
 /-- Composition of a principal segment with an order isomorphism, as a principal segment -/
 def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} (f : PrincipalSeg r s)
@@ -340,14 +340,14 @@ def ltEquiv {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ →
 #align principal_seg.lt_equiv PrincipalSeg.ltEquiv
 
 @[simp]
-theorem equivLt_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLt f g) a = g (f a) :=
+theorem equivLT_apply (f : r ≃r s) (g : s ≺i t) (a : α) : (equivLT f g) a = g (f a) :=
   RelEmbedding.trans_apply _ _ _
-#align principal_seg.equiv_lt_apply PrincipalSeg.equivLt_apply
+#align principal_seg.equiv_lt_apply PrincipalSeg.equivLT_apply
 
 @[simp]
-theorem equivLt_top (f : r ≃r s) (g : s ≺i t) : (equivLt f g).top = g.top :=
+theorem equivLT_top (f : r ≃r s) (g : s ≺i t) : (equivLT f g).top = g.top :=
   rfl
-#align principal_seg.equiv_lt_top PrincipalSeg.equivLt_top
+#align principal_seg.equiv_lt_top PrincipalSeg.equivLT_top
 
 /-- Given a well order `s`, there is a most one principal segment embedding of `r` into `s`. -/
 instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
@@ -363,14 +363,14 @@ instance [IsWellOrder β s] : Subsingleton (r ≺i s) :=
     have := RelEmbedding.coe_fn_injective ef; congr ⟩
 
 theorem top_eq [IsWellOrder γ t] (e : r ≃r s) (f : r ≺i t) (g : s ≺i t) : f.top = g.top := by
-  rw [Subsingleton.elim f (PrincipalSeg.equivLt e g)]; rfl
+  rw [Subsingleton.elim f (PrincipalSeg.equivLT e g)]; rfl
 #align principal_seg.top_eq PrincipalSeg.top_eq
 
-theorem topLtTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
+theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
     (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top := by
   rw [Subsingleton.elim h (f.trans g)]
   apply PrincipalSeg.lt_top
-#align principal_seg.top_lt_top PrincipalSeg.topLtTop
+#align principal_seg.top_lt_top PrincipalSeg.topLTTop
 
 /-- Any element of a well order yields a principal segment -/
 def ofElement {α : Type _} (r : α → α → Prop) (a : α) : Subrel r { b | r b a } ≺i r :=
@@ -449,20 +449,20 @@ theorem InitialSeg.ltOrEq_apply_right [IsWellOrder β s] (f : r ≼i s) (g : r 
 #align initial_seg.lt_or_eq_apply_right InitialSeg.ltOrEq_apply_right
 
 /-- Composition of an initial segment taking values in a well order and a principal segment. -/
-noncomputable def InitialSeg.leLt [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) :
+noncomputable def InitialSeg.leLT [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) :
     r ≺i t :=
   match f.ltOrEq with
   | Sum.inl f' => f'.trans g
-  | Sum.inr f' => PrincipalSeg.equivLt f' g
-#align initial_seg.le_lt InitialSeg.leLt
+  | Sum.inr f' => PrincipalSeg.equivLT f' g
+#align initial_seg.le_lt InitialSeg.leLT
 
 @[simp]
-theorem InitialSeg.leLt_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
-    (f.leLt g) a = g (f a) := by
-  delta InitialSeg.leLt; cases' h : f.ltOrEq with f' f'
+theorem InitialSeg.leLT_apply [IsWellOrder β s] [IsTrans γ t] (f : r ≼i s) (g : s ≺i t) (a : α) :
+    (f.leLT g) a = g (f a) := by
+  delta InitialSeg.leLT; cases' h : f.ltOrEq with f' f'
   · simp only [PrincipalSeg.trans_apply, f.ltOrEq_apply_left]
-  · simp only [PrincipalSeg.equivLt_apply, f.ltOrEq_apply_right]
-#align initial_seg.le_lt_apply InitialSeg.leLt_apply
+  · simp only [PrincipalSeg.equivLT_apply, f.ltOrEq_apply_right]
+#align initial_seg.le_lt_apply InitialSeg.leLT_apply
 
 namespace RelEmbedding
 
chore: fix casing per naming scheme (#1183)

Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2, add_monoid_hom --> AddMonoidHom

Remove \n from to_additive docstrings that were inserted by mathport.

Move files and directories with Gcd and Smul to GCD and SMul

Diff
@@ -162,9 +162,9 @@ def antisymm [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : r ≃r s :=
 #align initial_seg.antisymm InitialSeg.antisymm
 
 @[simp]
-theorem antisymm_to_fun [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : (antisymm f g : α → β) = f :=
+theorem antisymm_toFun [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) : (antisymm f g : α → β) = f :=
   rfl
-#align initial_seg.antisymm_to_fun InitialSeg.antisymm_to_fun
+#align initial_seg.antisymm_to_fun InitialSeg.antisymm_toFun
 
 @[simp]
 theorem antisymm_symm [IsWellOrder α r] [IsWellOrder β s] (f : r ≼i s) (g : s ≼i r) :
chore: bump to 2022-12-22 (#1157)
Diff
@@ -244,7 +244,7 @@ infixl:25 " ≺i " => PrincipalSeg
 
 namespace PrincipalSeg
 
-instance : Coe (r ≺i s) (r ↪r s) :=
+instance : CoeOut (r ≺i s) (r ↪r s) :=
   ⟨PrincipalSeg.toRelEmbedding⟩
 
 instance : CoeFun (r ≺i s) fun _ => α → β :=
chore: update lean4/std4 (#1096)
Diff
@@ -293,8 +293,7 @@ instance (r : α → α → Prop) [IsWellOrder α r] : IsEmpty (r ≺i r) :=
 def ltLe (f : r ≺i s) (g : s ≼i t) : r ≺i t :=
   ⟨@RelEmbedding.trans _ _ _ r s t f g, g f.top, fun a => by
     simp only [g.init_iff, PrincipalSeg.down, exists_and_left.symm, exists_swap,
-        RelEmbedding.trans_apply, exists_eq_right']
-    rfl⟩
+        RelEmbedding.trans_apply, exists_eq_right']⟩
 #align principal_seg.lt_le PrincipalSeg.ltLe
 
 @[simp]
chore: add source headers to ported theory files (#1094)

The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md

Diff
@@ -2,6 +2,11 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Floris van Doorn
+
+! This file was ported from Lean 3 source module order.initial_seg
+! leanprover-community/mathlib commit ee0c179cd3c8a45aa5bffbf1b41d8dbede452865
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
 -/
 import Mathlib.Order.RelIso.Set
 import Mathlib.Order.WellFounded

Dependencies 46

47 files ported (100.0%)
25378 lines ported (100.0%)

All dependencies are ported!