l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem typein_apply {α β} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r] [IsWellOrder β s]
    (f : r ≼i s) (a : α) : Ordinal.typein s (f a) = Ordinal.typein r a :=
  Eq.symm <|
    Quotient.sound
      ⟨RelIso.ofSurjective
        (RelEmbedding.codRestrict _ ((Subrel.relEmbedding _ _).trans f) fun ⟨x, h⟩ => by
          rw [RelEmbedding.trans_apply]; exact f.toRelEmbedding.map_rel_iff.2 h)
          fun ⟨y, h⟩ => by
            

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u_3
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≼i s
a : α
x✝ : ↑{b | s b (f a)}
y : β
h : y ∈ {b | s b (f a)}
⊢ ∃ a_1,
    (RelEmbedding.codRestrict {b | s b (f a)} (RelEmbedding.trans (Subrel.relEmbedding r {b | r b a}) f.toRelEmbedding)
          (_ :
            ∀ (x : ↑{b | r b a}),
              (RelEmbedding.trans (Subrel.relEmbedding r {b | r b a}) f.toRelEmbedding) x ∈ {b | s b (f a)}))
        a_1 =
      { val := y, property := h }

Next tactic:
rcases f.init h with ⟨a, rfl⟩
@[simp]
theorem typein_apply {α β} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r] [IsWellOrder β s]
    (f : r ≼i s) (a : α) : Ordinal.typein s (f a) = Ordinal.typein r a :=
  Eq.symm <|
    Quotient.sound
      ⟨RelIso.ofSurjective
        (RelEmbedding.codRestrict _ ((Subrel.relEmbedding _ _).trans f) fun ⟨x, h⟩ => by
          rw [RelEmbedding.trans_apply]; exact f.toRelEmbedding.map_rel_iff.2 h)
          fun ⟨y, h⟩ => by
            rcases f.init h with ⟨a, rfl⟩
            

Proof state:
case intro
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u_3
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≼i s
a✝ : α
x✝ : ↑{b | s b (f a✝)}
a : α
h : f a ∈ {b | s b (f a✝)}
⊢ ∃ a_1,
    (RelEmbedding.codRestrict {b | s b (f a✝)}
          (RelEmbedding.trans (Subrel.relEmbedding r {b | r b a✝}) f.toRelEmbedding)
          (_ :
            ∀ (x : ↑{b | r b a✝}),
              (RelEmbedding.trans (Subrel.relEmbedding r {b | r b a✝}) f.toRelEmbedding) x ∈ {b | s b (f a✝)}))
        a_1 =
      { val := f a, property := h }

Next tactic:
exact ⟨⟨a, f.toRelEmbedding.map_rel_iff.1 h⟩,
              Subtype.eq <| RelEmbedding.trans_apply _ _ _⟩
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
⊢ r a b

Next tactic:
have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      have : g'.top = f'.top := by rw [Subsingleton.elim f' g']
      exact this
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
⊢ ↑f.top = a

Next tactic:
let f' := PrincipalSeg.ofElement r a
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
f' : Subrel r {b | r b a} ≺i r := PrincipalSeg.ofElement r a
⊢ ↑f.top = a

Next tactic:
let g' := f.trans (PrincipalSeg.ofElement r b)
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
f' : Subrel r {b | r b a} ≺i r := PrincipalSeg.ofElement r a
g' : Subrel r {b | r b a} ≺i r := PrincipalSeg.trans f (PrincipalSeg.ofElement r b)
⊢ ↑f.top = a

Next tactic:
have : g'.top = f'.top := by rw [Subsingleton.elim f' g']
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      have : g'.top = f'.top := by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
f' : Subrel r {b | r b a} ≺i r := PrincipalSeg.ofElement r a
g' : Subrel r {b | r b a} ≺i r := PrincipalSeg.trans f (PrincipalSeg.ofElement r b)
⊢ g'.top = f'.top

Next tactic:
rw [Subsingleton.elim f' g']
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      have : g'.top = f'.top := by rw [Subsingleton.elim f' g']
      

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
f' : Subrel r {b | r b a} ≺i r := PrincipalSeg.ofElement r a
g' : Subrel r {b | r b a} ≺i r := PrincipalSeg.trans f (PrincipalSeg.ofElement r b)
this : g'.top = f'.top
⊢ ↑f.top = a

Next tactic:
exact this
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      have : g'.top = f'.top := by rw [Subsingleton.elim f' g']
      exact this
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
this : ↑f.top = a
⊢ r a b

Next tactic:
rw [← this]
@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
    typein r a < typein r b ↔ r a b :=
  ⟨fun ⟨f⟩ => by
    have : f.top.1 = a := by
      let f' := PrincipalSeg.ofElement r a
      let g' := f.trans (PrincipalSeg.ofElement r b)
      have : g'.top = f'.top := by rw [Subsingleton.elim f' g']
      exact this
    rw [← this]
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
a b : α
x✝ : typein r a < typein r b
f : Subrel r {b | r b a} ≺i Subrel r {b_1 | r b_1 b}
this : ↑f.top = a
⊢ r (↑f.top) b

Next tactic:
exact f.top.2
theorem enum_lt_enum {r : α → α → Prop} [IsWellOrder α r] {o₁ o₂ : Ordinal} (h₁ : o₁ < type r)
    (h₂ : o₂ < type r) : r (enum r o₁ h₁) (enum r o₂ h₂) ↔ o₁ < o₂ := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
o₁ o₂ : Ordinal.{u}
h₁ : o₁ < type r
h₂ : o₂ < type r
⊢ r (enum r o₁ h₁) (enum r o₂ h₂) ↔ o₁ < o₂

Next tactic:
rw [← typein_lt_typein r, typein_enum, typein_enum]
theorem relIso_enum' {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) :
    ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs := by
  

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
⊢ ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs

Next tactic:
refine' inductionOn o _
theorem relIso_enum' {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) :
    ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs := by
  refine' inductionOn o _; 

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
⊢ ∀ (α_1 : Type u) (r_1 : α_1 → α_1 → Prop) [inst : IsWellOrder α_1 r_1] (hr : type r_1 < type r)
    (hs : type r_1 < type s), f (enum r (type r_1) hr) = enum s (type r_1) hs

Next tactic:
rintro γ t wo ⟨g⟩ ⟨h⟩
theorem relIso_enum' {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) :
    ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs := by
  refine' inductionOn o _; rintro γ t wo ⟨g⟩ ⟨h⟩
  

Proof state:
case intro.intro
α✝ : Type u
β✝ : Type u_1
γ✝ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ✝ → γ✝ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
γ : Type u
t : γ → γ → Prop
wo : IsWellOrder γ t
g : t ≺i r
h : t ≺i s
⊢ f (enum r (type t) (_ : Nonempty (t ≺i r))) = enum s (type t) (_ : Nonempty (t ≺i s))

Next tactic:
skip
theorem relIso_enum' {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) :
    ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs := by
  refine' inductionOn o _; rintro γ t wo ⟨g⟩ ⟨h⟩
  skip; 

Proof state:
case intro.intro
α✝ : Type u
β✝ : Type u_1
γ✝ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ✝ → γ✝ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
γ : Type u
t : γ → γ → Prop
wo : IsWellOrder γ t
g : t ≺i r
h : t ≺i s
⊢ f (enum r (type t) (_ : Nonempty (t ≺i r))) = enum s (type t) (_ : Nonempty (t ≺i s))

Next tactic:
rw [enum_type g, enum_type (PrincipalSeg.ltEquiv g f)]
theorem relIso_enum' {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) :
    ∀ (hr : o < type r) (hs : o < type s), f (enum r o hr) = enum s o hs := by
  refine' inductionOn o _; rintro γ t wo ⟨g⟩ ⟨h⟩
  skip; rw [enum_type g, enum_type (PrincipalSeg.ltEquiv g f)]; 

Proof state:
case intro.intro
α✝ : Type u
β✝ : Type u_1
γ✝ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ✝ → γ✝ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
γ : Type u
t : γ → γ → Prop
wo : IsWellOrder γ t
g : t ≺i r
h : t ≺i s
⊢ f g.top = (PrincipalSeg.ltEquiv g f).top

Next tactic:
rfl
theorem relIso_enum {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) (hr : o < type r) :
    f (enum r o hr) =
      enum s o
        (by
          

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
hr : o < type r
⊢ o < type s

Next tactic:
convert hr using 1
theorem relIso_enum {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) (hr : o < type r) :
    f (enum r o hr) =
      enum s o
        (by
          convert hr using 1
          

Proof state:
case h.e'_4
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
hr : o < type r
⊢ type s = type r

Next tactic:
apply Quotient.sound
theorem relIso_enum {α β : Type u} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
    [IsWellOrder β s] (f : r ≃r s) (o : Ordinal) (hr : o < type r) :
    f (enum r o hr) =
      enum s o
        (by
          convert hr using 1
          apply Quotient.sound
          

Proof state:
case h.e'_4.a
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
f : r ≃r s
o : Ordinal.{u}
hr : o < type r
⊢ { α := β, r := s, wo := inst✝ } ≈ { α := α, r := r, wo := inst✝¹ }

Next tactic:
exact ⟨f.symm⟩
theorem lt_wf : @WellFounded Ordinal (· < ·) :=
/-
  wellFounded_iff_wellFounded_subrel.mpr (·.induction_on fun ⟨_, r, wo⟩ ↦
    RelHomClass.wellFounded (typein.principalSeg r).subrelIso wo.wf)
-/
  ⟨fun a =>
    inductionOn a fun α r wo =>
      suffices ∀ a, Acc (· < ·) (typein r a) from
        ⟨_, fun o h =>
          let ⟨a, e⟩ := typein_surj r h
          e ▸ this a⟩
      fun a =>
      Acc.recOn (wo.wf.apply a) fun x _ IH =>
        ⟨_, fun o h => by
          

Proof state:
α✝ : Type u
β : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
a✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
wo : IsWellOrder α r
a x : α
x✝ : ∀ (y : α), r y x → Acc r y
IH : ∀ (y : α), r y x → Acc (fun x x_1 => x < x_1) (typein r y)
o : Ordinal.{u_3}
h : o < typein r x
⊢ Acc (fun x x_1 => x < x_1) o

Next tactic:
rcases typein_surj r (lt_trans h (typein_lt_type r _)) with ⟨b, rfl⟩
theorem lt_wf : @WellFounded Ordinal (· < ·) :=
/-
  wellFounded_iff_wellFounded_subrel.mpr (·.induction_on fun ⟨_, r, wo⟩ ↦
    RelHomClass.wellFounded (typein.principalSeg r).subrelIso wo.wf)
-/
  ⟨fun a =>
    inductionOn a fun α r wo =>
      suffices ∀ a, Acc (· < ·) (typein r a) from
        ⟨_, fun o h =>
          let ⟨a, e⟩ := typein_surj r h
          e ▸ this a⟩
      fun a =>
      Acc.recOn (wo.wf.apply a) fun x _ IH =>
        ⟨_, fun o h => by
          rcases typein_surj r (lt_trans h (typein_lt_type r _)) with ⟨b, rfl⟩
          

Proof state:
case intro
α✝ : Type u
β : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
a✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
wo : IsWellOrder α r
a x : α
x✝ : ∀ (y : α), r y x → Acc r y
IH : ∀ (y : α), r y x → Acc (fun x x_1 => x < x_1) (typein r y)
b : α
h : typein r b < typein r x
⊢ Acc (fun x x_1 => x < x_1) (typein r b)

Next tactic:
exact IH _ ((typein_lt_typein r).1 h)
@[simp]
theorem card_eq_zero {o} : card o = 0 ↔ o = 0 :=
  ⟨inductionOn o fun α r _ h => by
      

Proof state:
α✝ : Type u
β : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
x✝ : IsWellOrder α r
h : card (type r) = 0
⊢ type r = 0

Next tactic:
haveI := Cardinal.mk_eq_zero_iff.1 h
@[simp]
theorem card_eq_zero {o} : card o = 0 ↔ o = 0 :=
  ⟨inductionOn o fun α r _ h => by
      haveI := Cardinal.mk_eq_zero_iff.1 h
      

Proof state:
α✝ : Type u
β : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
x✝ : IsWellOrder α r
h : card (type r) = 0
this : IsEmpty { α := α, r := r, wo := x✝ }.α
⊢ type r = 0

Next tactic:
apply type_eq_zero_of_empty
@[simp]
theorem card_eq_zero {o} : card o = 0 ↔ o = 0 :=
  ⟨inductionOn o fun α r _ h => by
      haveI := Cardinal.mk_eq_zero_iff.1 h
      apply type_eq_zero_of_empty,
    fun e => by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
e : o = 0
⊢ card o = 0

Next tactic:
simp only [e, card_zero]
theorem type_uLift (r : α → α → Prop) [IsWellOrder α r] :
    type (ULift.down.{v,u} ⁻¹'o r) = lift.{v} (type r) := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ type (ULift.down ⁻¹'o r) = lift.{v, u} (type r)

Next tactic:
simp (config := { unfoldPartialApp := true })
theorem type_uLift (r : α → α → Prop) [IsWellOrder α r] :
    type (ULift.down.{v,u} ⁻¹'o r) = lift.{v} (type r) := by
  simp (config := { unfoldPartialApp := true })
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ (type fun x y => r x.down y.down) = lift.{v, u} (type r)

Next tactic:
rfl
theorem lift_type_lt {α : Type u} {β : Type v} {r s} [IsWellOrder α r] [IsWellOrder β s] :
    lift.{max v w} (type r) < lift.{max u w} (type s) ↔ Nonempty (r ≺i s) := by
  

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
⊢ lift.{max v w, u} (type r) < lift.{max u w, v} (type s) ↔ Nonempty (r ≺i s)

Next tactic:
haveI := @RelEmbedding.isWellOrder _ _ (@Equiv.ulift.{max v w} α ⁻¹'o r) r
    (RelIso.preimage Equiv.ulift.{max v w} r) _
theorem lift_type_lt {α : Type u} {β : Type v} {r s} [IsWellOrder α r] [IsWellOrder β s] :
    lift.{max v w} (type r) < lift.{max u w} (type s) ↔ Nonempty (r ≺i s) := by
  haveI := @RelEmbedding.isWellOrder _ _ (@Equiv.ulift.{max v w} α ⁻¹'o r) r
    (RelIso.preimage Equiv.ulift.{max v w} r) _
  

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
this : IsWellOrder (ULift.{max v w, u} α) (⇑Equiv.ulift ⁻¹'o r)
⊢ lift.{max v w, u} (type r) < lift.{max u w, v} (type s) ↔ Nonempty (r ≺i s)

Next tactic:
haveI := @RelEmbedding.isWellOrder _ _ (@Equiv.ulift.{max u w} β ⁻¹'o s) s
    (RelIso.preimage Equiv.ulift.{max u w} s) _
theorem lift_type_lt {α : Type u} {β : Type v} {r s} [IsWellOrder α r] [IsWellOrder β s] :
    lift.{max v w} (type r) < lift.{max u w} (type s) ↔ Nonempty (r ≺i s) := by
  haveI := @RelEmbedding.isWellOrder _ _ (@Equiv.ulift.{max v w} α ⁻¹'o r) r
    (RelIso.preimage Equiv.ulift.{max v w} r) _
  haveI := @RelEmbedding.isWellOrder _ _ (@Equiv.ulift.{max u w} β ⁻¹'o s) s
    (RelIso.preimage Equiv.ulift.{max u w} s) _
  

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
this✝ : IsWellOrder (ULift.{max v w, u} α) (⇑Equiv.ulift ⁻¹'o r)
this : IsWellOrder (ULift.{max u w, v} β) (⇑Equiv.ulift ⁻¹'o s)
⊢ lift.{max v w, u} (type r) < lift.{max u w, v} (type s) ↔ Nonempty (r ≺i s)

Next tactic:
exact ⟨fun ⟨f⟩ =>
    ⟨(f.equivLT (RelIso.preimage Equiv.ulift r).symm).ltLe
        (InitialSeg.ofIso (RelIso.preimage Equiv.ulift s))⟩,
    fun ⟨f⟩ =>
    ⟨(f.equivLT (RelIso.preimage Equiv.ulift r)).ltLe
        (InitialSeg.ofIso (RelIso.preimage Equiv.ulift s).symm)⟩⟩
@[simp]
theorem lift_le {a b : Ordinal} : lift.{u,v} a ≤ lift.{u,v} b ↔ a ≤ b :=
  inductionOn a fun α r _ =>
    inductionOn b fun β s _ => by
      

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a b : Ordinal.{v}
α : Type v
r : α → α → Prop
x✝¹ : IsWellOrder α r
β : Type v
s : β → β → Prop
x✝ : IsWellOrder β s
⊢ lift.{u, v} (type r) ≤ lift.{u, v} (type s) ↔ type r ≤ type s

Next tactic:
rw [← lift_umax]
@[simp]
theorem lift_le {a b : Ordinal} : lift.{u,v} a ≤ lift.{u,v} b ↔ a ≤ b :=
  inductionOn a fun α r _ =>
    inductionOn b fun β s _ => by
      rw [← lift_umax]
      

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a b : Ordinal.{v}
α : Type v
r : α → α → Prop
x✝¹ : IsWellOrder α r
β : Type v
s : β → β → Prop
x✝ : IsWellOrder β s
⊢ lift.{max v u, v} (type r) ≤ lift.{max v u, v} (type s) ↔ type r ≤ type s

Next tactic:
exact lift_type_le.{_,_,u}
@[simp]
theorem lift_inj {a b : Ordinal} : lift.{u,v} a = lift.{u,v} b ↔ a = b := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a b : Ordinal.{v}
⊢ lift.{u, v} a = lift.{u, v} b ↔ a = b

Next tactic:
simp only [le_antisymm_iff, lift_le]
@[simp]
theorem lift_lt {a b : Ordinal} : lift.{u,v} a < lift.{u,v} b ↔ a < b := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a b : Ordinal.{v}
⊢ lift.{u, v} a < lift.{u, v} b ↔ a < b

Next tactic:
simp only [lt_iff_le_not_le, lift_le]
theorem lift_down' {a : Cardinal.{u}} {b : Ordinal.{max u v}}
    (h : card.{max u v} b ≤ Cardinal.lift.{v,u} a) : ∃ a', lift.{v,u} a' = b :=
  let ⟨c, e⟩ := Cardinal.lift_down h
  Cardinal.inductionOn c
    (fun α =>
      inductionOn b fun β s _ e' => by
        

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a : Cardinal.{u}
b : Ordinal.{max u v}
h : card b ≤ Cardinal.lift.{v, u} a
c : Cardinal.{u}
e : Cardinal.lift.{v, u} c = card b
α : Type u
β : Type (max u v)
s : β → β → Prop
x✝ : IsWellOrder β s
e' : Cardinal.lift.{v, u} #α = card (type s)
⊢ ∃ a', lift.{v, u} a' = type s

Next tactic:
rw [card_type, ← Cardinal.lift_id'.{max u v, u} #β, ← Cardinal.lift_umax.{u, v},
          lift_mk_eq.{u, max u v, max u v}] at e'
theorem lift_down' {a : Cardinal.{u}} {b : Ordinal.{max u v}}
    (h : card.{max u v} b ≤ Cardinal.lift.{v,u} a) : ∃ a', lift.{v,u} a' = b :=
  let ⟨c, e⟩ := Cardinal.lift_down h
  Cardinal.inductionOn c
    (fun α =>
      inductionOn b fun β s _ e' => by
        rw [card_type, ← Cardinal.lift_id'.{max u v, u} #β, ← Cardinal.lift_umax.{u, v},
          lift_mk_eq.{u, max u v, max u v}] at e'
        

Proof state:
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a : Cardinal.{u}
b : Ordinal.{max u v}
h : card b ≤ Cardinal.lift.{v, u} a
c : Cardinal.{u}
e : Cardinal.lift.{v, u} c = card b
α : Type u
β : Type (max u v)
s : β → β → Prop
x✝ : IsWellOrder β s
e' : Nonempty (α ≃ β)
⊢ ∃ a', lift.{v, u} a' = type s

Next tactic:
cases' e' with f
theorem lift_down' {a : Cardinal.{u}} {b : Ordinal.{max u v}}
    (h : card.{max u v} b ≤ Cardinal.lift.{v,u} a) : ∃ a', lift.{v,u} a' = b :=
  let ⟨c, e⟩ := Cardinal.lift_down h
  Cardinal.inductionOn c
    (fun α =>
      inductionOn b fun β s _ e' => by
        rw [card_type, ← Cardinal.lift_id'.{max u v, u} #β, ← Cardinal.lift_umax.{u, v},
          lift_mk_eq.{u, max u v, max u v}] at e'
        cases' e' with f
        

Proof state:
case intro
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a : Cardinal.{u}
b : Ordinal.{max u v}
h : card b ≤ Cardinal.lift.{v, u} a
c : Cardinal.{u}
e : Cardinal.lift.{v, u} c = card b
α : Type u
β : Type (max u v)
s : β → β → Prop
x✝ : IsWellOrder β s
f : α ≃ β
⊢ ∃ a', lift.{v, u} a' = type s

Next tactic:
have g := RelIso.preimage f s
theorem lift_down' {a : Cardinal.{u}} {b : Ordinal.{max u v}}
    (h : card.{max u v} b ≤ Cardinal.lift.{v,u} a) : ∃ a', lift.{v,u} a' = b :=
  let ⟨c, e⟩ := Cardinal.lift_down h
  Cardinal.inductionOn c
    (fun α =>
      inductionOn b fun β s _ e' => by
        rw [card_type, ← Cardinal.lift_id'.{max u v, u} #β, ← Cardinal.lift_umax.{u, v},
          lift_mk_eq.{u, max u v, max u v}] at e'
        cases' e' with f
        have g := RelIso.preimage f s
        

Proof state:
case intro
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t : γ → γ → Prop
a : Cardinal.{u}
b : Ordinal.{max u v}
h : card b ≤ Cardinal.lift.{v, u} a
c : Cardinal.{u}
e : Cardinal.lift.{v, u} c = card b
α : Type u
β : Type (max u v)
s : β → β → Prop
x✝ : IsWellOrder β s
f : α ≃ β
g : ⇑f ⁻¹'o s ≃r s
⊢ ∃ a', lift.{v, u} a' = type s

Next tactic:
haveI := (g : f ⁻¹'o s ↪r s).isWellOrder