l3lab/ntp-mathlib huggingface dataset:
/-- **Cantor's theorem** -/
theorem cantor (a : Cardinal.{u}) : a < 2 ^ a := by
  induction' a using Cardinal.inductionOn with α
  rw [← mk_set]
  refine' ⟨⟨⟨singleton, fun a b => singleton_eq_singleton_iff.1⟩⟩, _⟩
  rintro ⟨⟨f, hf⟩⟩
  

Proof state:
case h.intro.mk
α✝ β α : Type u
f : Set α → α
hf : Injective f
⊢ False

Next tactic:
exact cantor_injective f hf
theorem one_lt_iff_nontrivial {α : Type u} : 1 < #α ↔ Nontrivial α := by
  

Proof state:
α✝ β α : Type u
⊢ 1 < #α ↔ Nontrivial α

Next tactic:
rw [← not_le, le_one_iff_subsingleton, ← not_nontrivial_iff_subsingleton, Classical.not_not]
theorem power_le_max_power_one {a b c : Cardinal} (h : b ≤ c) : a ^ b ≤ max (a ^ c) 1 := by
  

Proof state:
α β : Type u
a b c : Cardinal.{u_1}
h : b ≤ c
⊢ a ^ b ≤ max (a ^ c) 1

Next tactic:
by_cases ha : a = 0
theorem power_le_max_power_one {a b c : Cardinal} (h : b ≤ c) : a ^ b ≤ max (a ^ c) 1 := by
  by_cases ha : a = 0
  · 

Proof state:
case pos
α β : Type u
a b c : Cardinal.{u_1}
h : b ≤ c
ha : a = 0
⊢ a ^ b ≤ max (a ^ c) 1

Next tactic:
simp [ha, zero_power_le]
theorem power_le_max_power_one {a b c : Cardinal} (h : b ≤ c) : a ^ b ≤ max (a ^ c) 1 := by
  by_cases ha : a = 0
  · simp [ha, zero_power_le]
  · 

Proof state:
case neg
α β : Type u
a b c : Cardinal.{u_1}
h : b ≤ c
ha : ¬a = 0
⊢ a ^ b ≤ max (a ^ c) 1

Next tactic:
exact (power_le_power_left ha h).trans (le_max_left _ _)
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      

Proof state:
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
⊢ False

Next tactic:
let ι := { c : Cardinal // ¬Acc (· < ·) c }
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      

Proof state:
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (?u.55300 + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
⊢ False

Next tactic:
let f : ι → Cardinal := Subtype.val
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      let f : ι → Cardinal := Subtype.val
      

Proof state:
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (?u.55300 + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
f : ι → Cardinal.{?u.55300} := Subtype.val
⊢ False

Next tactic:
haveI hι : Nonempty ι := ⟨⟨_, h⟩⟩
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      let f : ι → Cardinal := Subtype.val
      haveI hι : Nonempty ι := ⟨⟨_, h⟩⟩
      

Proof state:
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (u + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
f : ι → Cardinal.{u} := Subtype.val
hι : Nonempty ι
⊢ False

Next tactic:
obtain ⟨⟨c : Cardinal, hc : ¬Acc (· < ·) c⟩, ⟨h_1 : ∀ j, (f ⟨c, hc⟩).out ↪ (f j).out⟩⟩ :=
        Embedding.min_injective fun i => (f i).out
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      let f : ι → Cardinal := Subtype.val
      haveI hι : Nonempty ι := ⟨⟨_, h⟩⟩
      obtain ⟨⟨c : Cardinal, hc : ¬Acc (· < ·) c⟩, ⟨h_1 : ∀ j, (f ⟨c, hc⟩).out ↪ (f j).out⟩⟩ :=
        Embedding.min_injective fun i => (f i).out
      

Proof state:
case intro.mk.intro
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (u + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
f : ι → Cardinal.{u} := Subtype.val
hι : Nonempty ι
c : Cardinal.{u}
hc : ¬Acc (fun x x_1 => x < x_1) c
h_1 : (j : ι) → Quotient.out (f { val := c, property := hc }) ↪ Quotient.out (f j)
⊢ False

Next tactic:
refine hc (Acc.intro _ fun j h' => byContradiction fun hj => h'.2 ?_)
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      let f : ι → Cardinal := Subtype.val
      haveI hι : Nonempty ι := ⟨⟨_, h⟩⟩
      obtain ⟨⟨c : Cardinal, hc : ¬Acc (· < ·) c⟩, ⟨h_1 : ∀ j, (f ⟨c, hc⟩).out ↪ (f j).out⟩⟩ :=
        Embedding.min_injective fun i => (f i).out
      refine hc (Acc.intro _ fun j h' => byContradiction fun hj => h'.2 ?_)
      

Proof state:
case intro.mk.intro
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (u + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
f : ι → Cardinal.{u} := Subtype.val
hι : Nonempty ι
c : Cardinal.{u}
hc : ¬Acc (fun x x_1 => x < x_1) c
h_1 : (j : ι) → Quotient.out (f { val := c, property := hc }) ↪ Quotient.out (f j)
j : Cardinal.{u}
h' : j < c
hj : ¬Acc (fun x x_1 => x < x_1) j
⊢ Quotient.liftOn₂ c j (fun α β => Nonempty (α ↪ β)) instLECardinal.proof_1

Next tactic:
have : #_ ≤ #_ := ⟨h_1 ⟨j, hj⟩⟩
protected theorem lt_wf : @WellFounded Cardinal.{u} (· < ·) :=
  ⟨fun a =>
    byContradiction fun h => by
      let ι := { c : Cardinal // ¬Acc (· < ·) c }
      let f : ι → Cardinal := Subtype.val
      haveI hι : Nonempty ι := ⟨⟨_, h⟩⟩
      obtain ⟨⟨c : Cardinal, hc : ¬Acc (· < ·) c⟩, ⟨h_1 : ∀ j, (f ⟨c, hc⟩).out ↪ (f j).out⟩⟩ :=
        Embedding.min_injective fun i => (f i).out
      refine hc (Acc.intro _ fun j h' => byContradiction fun hj => h'.2 ?_)
      have : #_ ≤ #_ := ⟨h_1 ⟨j, hj⟩⟩
      

Proof state:
case intro.mk.intro
α β : Type u
a : Cardinal.{u}
h : ¬Acc (fun x x_1 => x < x_1) a
ι : Type (u + 1) := { c // ¬Acc (fun x x_1 => x < x_1) c }
f : ι → Cardinal.{u} := Subtype.val
hι : Nonempty ι
c : Cardinal.{u}
hc : ¬Acc (fun x x_1 => x < x_1) c
h_1 : (j : ι) → Quotient.out (f { val := c, property := hc }) ↪ Quotient.out (f j)
j : Cardinal.{u}
h' : j < c
hj : ¬Acc (fun x x_1 => x < x_1) j
this : #(Quotient.out (f { val := c, property := hc })) ≤ #(Quotient.out (f { val := j, property := hj }))
⊢ Quotient.liftOn₂ c j (fun α β => Nonempty (α ↪ β)) instLECardinal.proof_1

Next tactic:
simpa only [mk_out] using this
/-- Note that the successor of `c` is not the same as `c + 1` except in the case of finite `c`. -/
instance : SuccOrder Cardinal :=
  SuccOrder.ofSuccLeIff (fun c => sInf { c' | c < c' })
    -- Porting note: Needed to insert `by apply` in the next line
    ⟨by 

Proof state:
α β : Type u
a✝ b✝ : Cardinal.{?u.57942}
⊢ (fun c => sInf {c' | c < c'}) a✝ ≤ b✝ → a✝ < b✝

Next tactic:
apply lt_of_lt_of_le <| csInf_mem <| exists_gt _
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  

Proof state:
α β : Type u
c : Cardinal.{u}
⊢ c + 1 ≤ succ c

Next tactic:
have : Set.Nonempty { c' | c < c' } := exists_gt c
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  

Proof state:
α β : Type u
c : Cardinal.{u}
this : Set.Nonempty {c' | c < c'}
⊢ c + 1 ≤ succ c

Next tactic:
simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  

Proof state:
α β : Type u
c : Cardinal.{u}
this : Set.Nonempty {c' | c < c'}
⊢ ∀ (b : Cardinal.{u}), c < b → c + 1 ≤ b

Next tactic:
intro b hlt
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  

Proof state:
α β : Type u
c : Cardinal.{u}
this : Set.Nonempty {c' | c < c'}
b : Cardinal.{u}
hlt : c < b
⊢ c + 1 ≤ b

Next tactic:
rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
  

Proof state:
case mk.mk
α β✝ : Type u
c b : Cardinal.{u}
β γ : Type u
this : Set.Nonempty {c' | Quot.mk Setoid.r γ < c'}
hlt : Quot.mk Setoid.r γ < Quot.mk Setoid.r β
⊢ Quot.mk Setoid.r γ + 1 ≤ Quot.mk Setoid.r β

Next tactic:
cases' le_of_lt hlt with f
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
  cases' le_of_lt hlt with f
  

Proof state:
case mk.mk.intro
α β✝ : Type u
c b : Cardinal.{u}
β γ : Type u
this : Set.Nonempty {c' | Quot.mk Setoid.r γ < c'}
hlt : Quot.mk Setoid.r γ < Quot.mk Setoid.r β
f : γ ↪ β
⊢ Quot.mk Setoid.r γ + 1 ≤ Quot.mk Setoid.r β

Next tactic:
have : ¬Surjective f := fun hn => (not_le_of_lt hlt) (mk_le_of_surjective hn)
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
  cases' le_of_lt hlt with f
  have : ¬Surjective f := fun hn => (not_le_of_lt hlt) (mk_le_of_surjective hn)
  

Proof state:
case mk.mk.intro
α β✝ : Type u
c b : Cardinal.{u}
β γ : Type u
this✝ : Set.Nonempty {c' | Quot.mk Setoid.r γ < c'}
hlt : Quot.mk Setoid.r γ < Quot.mk Setoid.r β
f : γ ↪ β
this : ¬Surjective ⇑f
⊢ Quot.mk Setoid.r γ + 1 ≤ Quot.mk Setoid.r β

Next tactic:
simp only [Surjective, not_forall] at this
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
  cases' le_of_lt hlt with f
  have : ¬Surjective f := fun hn => (not_le_of_lt hlt) (mk_le_of_surjective hn)
  simp only [Surjective, not_forall] at this
  

Proof state:
case mk.mk.intro
α β✝ : Type u
c b : Cardinal.{u}
β γ : Type u
this✝ : Set.Nonempty {c' | Quot.mk Setoid.r γ < c'}
hlt : Quot.mk Setoid.r γ < Quot.mk Setoid.r β
f : γ ↪ β
this : ∃ x, ¬∃ a, f a = x
⊢ Quot.mk Setoid.r γ + 1 ≤ Quot.mk Setoid.r β

Next tactic:
rcases this with ⟨b, hb⟩
theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by
  -- Porting note: rewrote the next three lines to avoid defeq abuse.
  have : Set.Nonempty { c' | c < c' } := exists_gt c
  simp_rw [succ_def, le_csInf_iff'' this, mem_setOf]
  intro b hlt
  rcases b, c with ⟨⟨β⟩, ⟨γ⟩⟩
  cases' le_of_lt hlt with f
  have : ¬Surjective f := fun hn => (not_le_of_lt hlt) (mk_le_of_surjective hn)
  simp only [Surjective, not_forall] at this
  rcases this with ⟨b, hb⟩
  

Proof state:
case mk.mk.intro.intro
α β✝ : Type u
c b✝ : Cardinal.{u}
β γ : Type u
this : Set.Nonempty {c' | Quot.mk Setoid.r γ < c'}
hlt : Quot.mk Setoid.r γ < Quot.mk Setoid.r β
f : γ ↪ β
b : β
hb : ¬∃ a, f a = b
⊢ Quot.mk Setoid.r γ + 1 ≤ Quot.mk Setoid.r β

Next tactic:
calc
    #γ + 1 = #(Option γ) := mk_option.symm
    _ ≤ #β := (f.optionElim b hb).cardinal_le
theorem le_sum {ι} (f : ι → Cardinal) (i) : f i ≤ sum f := by
  

Proof state:
α β : Type u
ι : Type u_1
f : ι → Cardinal.{max u_1 u_2}
i : ι
⊢ f i ≤ sum f

Next tactic:
rw [← Quotient.out_eq (f i)]
theorem le_sum {ι} (f : ι → Cardinal) (i) : f i ≤ sum f := by
  rw [← Quotient.out_eq (f i)]
  

Proof state:
α β : Type u
ι : Type u_1
f : ι → Cardinal.{max u_1 u_2}
i : ι
⊢ ⟦Quotient.out (f i)⟧ ≤ sum f

Next tactic:
exact ⟨⟨fun a => ⟨i, a⟩, fun a b h => by injection h⟩⟩
theorem le_sum {ι} (f : ι → Cardinal) (i) : f i ≤ sum f := by
  rw [← Quotient.out_eq (f i)]
  exact ⟨⟨fun a => ⟨i, a⟩, fun a b h => by 

Proof state:
α β : Type u
ι : Type u_1
f : ι → Cardinal.{max u_1 u_2}
i : ι
a b : Quotient.out (f i)
h : (fun a => { fst := i, snd := a }) a = (fun a => { fst := i, snd := a }) b
⊢ a = b

Next tactic:
injection h
theorem sum_const' (ι : Type u) (a : Cardinal.{u}) : (sum fun _ : ι => a) = #ι * a := by 

Proof state:
α β ι : Type u
a : Cardinal.{u}
⊢ (sum fun x => a) = #ι * a

Next tactic:
simp
@[simp]
theorem sum_add_distrib {ι} (f g : ι → Cardinal) : sum (f + g) = sum f + sum g := by
  

Proof state:
α β : Type u
ι : Type u_1
f g : ι → Cardinal.{u_2}
⊢ sum (f + g) = sum f + sum g

Next tactic:
have := mk_congr (Equiv.sigmaSumDistrib (Quotient.out ∘ f) (Quotient.out ∘ g))
@[simp]
theorem sum_add_distrib {ι} (f g : ι → Cardinal) : sum (f + g) = sum f + sum g := by
  have := mk_congr (Equiv.sigmaSumDistrib (Quotient.out ∘ f) (Quotient.out ∘ g))
  

Proof state:
α β : Type u
ι : Type u_1
f g : ι → Cardinal.{u_2}
this :
  #((i : ι) × ((Quotient.out ∘ f) i ⊕ (Quotient.out ∘ g) i)) =
    #((i : ι) × (Quotient.out ∘ f) i ⊕ (i : ι) × (Quotient.out ∘ g) i)
⊢ sum (f + g) = sum f + sum g

Next tactic:
simp only [comp_apply, mk_sigma, mk_sum, mk_out, lift_id] at this
@[simp]
theorem sum_add_distrib {ι} (f g : ι → Cardinal) : sum (f + g) = sum f + sum g := by
  have := mk_congr (Equiv.sigmaSumDistrib (Quotient.out ∘ f) (Quotient.out ∘ g))
  simp only [comp_apply, mk_sigma, mk_sum, mk_out, lift_id] at this
  

Proof state:
α β : Type u
ι : Type u_1
f g : ι → Cardinal.{u_2}
this : (sum fun i => f i + g i) = (sum fun i => f i) + sum fun i => g i
⊢ sum (f + g) = sum f + sum g

Next tactic:
exact this
@[simp]
theorem lift_sum {ι : Type u} (f : ι → Cardinal.{v}) :
    Cardinal.lift.{w} (Cardinal.sum f) = Cardinal.sum fun i => Cardinal.lift.{w} (f i) :=
  Equiv.cardinal_eq <|
    Equiv.ulift.trans <|
      Equiv.sigmaCongrRight fun a =>
    -- Porting note: Inserted universe hint .{_,_,v} below
        Nonempty.some <| by 

Proof state:
α β ι : Type u
f : ι → Cardinal.{v}
a : ι
⊢ Nonempty (Quotient.out (f a) ≃ Quotient.out ((fun i => lift.{w, v} (f i)) a))

Next tactic:
rw [← lift_mk_eq.{_,_,v}, mk_out, mk_out, lift_lift]
theorem sum_le_sum {ι} (f g : ι → Cardinal) (H : ∀ i, f i ≤ g i) : sum f ≤ sum g :=
  ⟨(Embedding.refl _).sigmaMap fun i =>
      Classical.choice <| by 

Proof state:
α β : Type u
ι : Type u_1
f g : ι → Cardinal.{u_2}
H : ∀ (i : ι), f i ≤ g i
i : ι
⊢ Nonempty (Quotient.out (f i) ↪ Quotient.out (g ((Embedding.refl ι) i)))

Next tactic:
have := H i
theorem sum_le_sum {ι} (f g : ι → Cardinal) (H : ∀ i, f i ≤ g i) : sum f ≤ sum g :=
  ⟨(Embedding.refl _).sigmaMap fun i =>
      Classical.choice <| by have := H i; 

Proof state:
α β : Type u
ι : Type u_1
f g : ι → Cardinal.{u_2}
H : ∀ (i : ι), f i ≤ g i
i : ι
this : f i ≤ g i
⊢ Nonempty (Quotient.out (f i) ↪ Quotient.out (g ((Embedding.refl ι) i)))

Next tactic:
rwa [← Quot.out_eq (f i), ← Quot.out_eq (g i)] at this
theorem mk_le_mk_mul_of_mk_preimage_le {c : Cardinal} (f : α → β) (hf : ∀ b : β, #(f ⁻¹' {b}) ≤ c) :
    #α ≤ #β * c := by
  

Proof state:
α β : Type u
c : Cardinal.{u}
f : α → β
hf : ∀ (b : β), #↑(f ⁻¹' {b}) ≤ c
⊢ #α ≤ #β * c

Next tactic:
simpa only [← mk_congr (@Equiv.sigmaFiberEquiv α β f), mk_sigma, ← sum_const'] using
    sum_le_sum _ _ hf
theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v} {c : Cardinal}
    (f : α → β) (hf : ∀ b : β, lift.{v} #(f ⁻¹' {b}) ≤ c) : lift.{v} #α ≤ lift.{u} #β * c :=
  (mk_le_mk_mul_of_mk_preimage_le fun x : ULift.{v} α => ULift.up.{u} (f x.1)) <|
    ULift.forall.2 fun b =>
      (mk_congr <|
            (Equiv.ulift.image _).trans
              (Equiv.trans
                (by
                  

Proof state:
α✝ β✝ α : Type u
β : Type v
c : Cardinal.{max u v}
f : α → β
hf : ∀ (b : β), lift.{v, u} #↑(f ⁻¹' {b}) ≤ c
b : β
⊢ ↑(⇑Equiv.ulift '' ((fun x => { down := f x.down }) ⁻¹' {{ down := b }})) ≃ ↑(f ⁻¹' {b})

Next tactic:
rw [Equiv.image_eq_preimage]
theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v} {c : Cardinal}
    (f : α → β) (hf : ∀ b : β, lift.{v} #(f ⁻¹' {b}) ≤ c) : lift.{v} #α ≤ lift.{u} #β * c :=
  (mk_le_mk_mul_of_mk_preimage_le fun x : ULift.{v} α => ULift.up.{u} (f x.1)) <|
    ULift.forall.2 fun b =>
      (mk_congr <|
            (Equiv.ulift.image _).trans
              (Equiv.trans
                (by
                  rw [Equiv.image_eq_preimage]
                  /- Porting note: Need to insert the following `have` b/c bad fun coercion
                   behaviour for Equivs -/
                  

Proof state:
α✝ β✝ α : Type u
β : Type v
c : Cardinal.{max u v}
f : α → β
hf : ∀ (b : β), lift.{v, u} #↑(f ⁻¹' {b}) ≤ c
b : β
⊢ ↑(⇑Equiv.ulift.symm ⁻¹' ((fun x => { down := f x.down }) ⁻¹' {{ down := b }})) ≃ ↑(f ⁻¹' {b})

Next tactic:
have : FunLike.coe (Equiv.symm (Equiv.ulift (α := α))) = ULift.up (α := α) := rfl
theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v} {c : Cardinal}
    (f : α → β) (hf : ∀ b : β, lift.{v} #(f ⁻¹' {b}) ≤ c) : lift.{v} #α ≤ lift.{u} #β * c :=
  (mk_le_mk_mul_of_mk_preimage_le fun x : ULift.{v} α => ULift.up.{u} (f x.1)) <|
    ULift.forall.2 fun b =>
      (mk_congr <|
            (Equiv.ulift.image _).trans
              (Equiv.trans
                (by
                  rw [Equiv.image_eq_preimage]
                  /- Porting note: Need to insert the following `have` b/c bad fun coercion
                   behaviour for Equivs -/
                  have : FunLike.coe (Equiv.symm (Equiv.ulift (α := α))) = ULift.up (α := α) := rfl
                  

Proof state:
α✝ β✝ α : Type u
β : Type v
c : Cardinal.{max u v}
f : α → β
hf : ∀ (b : β), lift.{v, u} #↑(f ⁻¹' {b}) ≤ c
b : β
this : ⇑Equiv.ulift.symm = ULift.up
⊢ ↑(⇑Equiv.ulift.symm ⁻¹' ((fun x => { down := f x.down }) ⁻¹' {{ down := b }})) ≃ ↑(f ⁻¹' {b})

Next tactic:
rw [this]
theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v} {c : Cardinal}
    (f : α → β) (hf : ∀ b : β, lift.{v} #(f ⁻¹' {b}) ≤ c) : lift.{v} #α ≤ lift.{u} #β * c :=
  (mk_le_mk_mul_of_mk_preimage_le fun x : ULift.{v} α => ULift.up.{u} (f x.1)) <|
    ULift.forall.2 fun b =>
      (mk_congr <|
            (Equiv.ulift.image _).trans
              (Equiv.trans
                (by
                  rw [Equiv.image_eq_preimage]
                  /- Porting note: Need to insert the following `have` b/c bad fun coercion
                   behaviour for Equivs -/
                  have : FunLike.coe (Equiv.symm (Equiv.ulift (α := α))) = ULift.up (α := α) := rfl
                  rw [this]
                  

Proof state:
α✝ β✝ α : Type u
β : Type v
c : Cardinal.{max u v}
f : α → β
hf : ∀ (b : β), lift.{v, u} #↑(f ⁻¹' {b}) ≤ c
b : β
this : ⇑Equiv.ulift.symm = ULift.up
⊢ ↑(ULift.up ⁻¹' ((fun x => { down := f x.down }) ⁻¹' {{ down := b }})) ≃ ↑(f ⁻¹' {b})

Next tactic:
simp only [preimage, mem_singleton_iff, ULift.up_inj, mem_setOf_eq, coe_setOf]
theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v} {c : Cardinal}
    (f : α → β) (hf : ∀ b : β, lift.{v} #(f ⁻¹' {b}) ≤ c) : lift.{v} #α ≤ lift.{u} #β * c :=
  (mk_le_mk_mul_of_mk_preimage_le fun x : ULift.{v} α => ULift.up.{u} (f x.1)) <|
    ULift.forall.2 fun b =>
      (mk_congr <|
            (Equiv.ulift.image _).trans
              (Equiv.trans
                (by
                  rw [Equiv.image_eq_preimage]
                  /- Porting note: Need to insert the following `have` b/c bad fun coercion
                   behaviour for Equivs -/
                  have : FunLike.coe (Equiv.symm (Equiv.ulift (α := α))) = ULift.up (α := α) := rfl
                  rw [this]
                  simp only [preimage, mem_singleton_iff, ULift.up_inj, mem_setOf_eq, coe_setOf]
                  

Proof state:
α✝ β✝ α : Type u
β : Type v
c : Cardinal.{max u v}
f : α → β
hf : ∀ (b : β), lift.{v, u} #↑(f ⁻¹' {b}) ≤ c
b : β
this : ⇑Equiv.ulift.symm = ULift.up
⊢ { x // f x = b } ≃ { x // f x = b }

Next tactic:
exact Equiv.refl _
/-- The range of an indexed cardinal function, whose outputs live in a higher universe than the
    inputs, is always bounded above. -/
theorem bddAbove_range {ι : Type u} (f : ι → Cardinal.{max u v}) : BddAbove (Set.range f) :=
  ⟨_, by
    

Proof state:
α β ι : Type u
f : ι → Cardinal.{max u v}
⊢ ?m.74380 f ∈ upperBounds (range f)

Next tactic:
rintro a ⟨i, rfl⟩
/-- The range of an indexed cardinal function, whose outputs live in a higher universe than the
    inputs, is always bounded above. -/
theorem bddAbove_range {ι : Type u} (f : ι → Cardinal.{max u v}) : BddAbove (Set.range f) :=
  ⟨_, by
    rintro a ⟨i, rfl⟩
    -- Porting note: Added universe reference below
    

Proof state:
case intro
α β ι : Type u
f : ι → Cardinal.{max u v}
i : ι
⊢ f i ≤ ?m.74380 f

Next tactic:
exact le_sum.{v,u} f i
instance (a : Cardinal.{u}) : Small.{u} (Set.Iic a) := by
  

Proof state:
α β : Type u
a : Cardinal.{u}
⊢ Small.{u, u + 1} ↑(Iic a)

Next tactic:
rw [← mk_out a]
instance (a : Cardinal.{u}) : Small.{u} (Set.Iic a) := by
  rw [← mk_out a]
  

Proof state:
α β : Type u
a : Cardinal.{u}
⊢ Small.{u, u + 1} ↑(Iic #(Quotient.out a))

Next tactic:
apply @small_of_surjective (Set a.out) (Iic #a.out) _ fun x => ⟨#x, mk_set_le x⟩
instance (a : Cardinal.{u}) : Small.{u} (Set.Iic a) := by
  rw [← mk_out a]
  apply @small_of_surjective (Set a.out) (Iic #a.out) _ fun x => ⟨#x, mk_set_le x⟩
  

Proof state:
α β : Type u
a : Cardinal.{u}
⊢ Surjective fun x => { val := #↑x, property := (_ : #↑x ≤ #(Quotient.out a)) }

Next tactic:
rintro ⟨x, hx⟩
instance (a : Cardinal.{u}) : Small.{u} (Set.Iic a) := by
  rw [← mk_out a]
  apply @small_of_surjective (Set a.out) (Iic #a.out) _ fun x => ⟨#x, mk_set_le x⟩
  rintro ⟨x, hx⟩
  

Proof state:
case mk
α β : Type u
a x : Cardinal.{u}
hx : x ∈ Iic #(Quotient.out a)
⊢ ∃ a_1, (fun x => { val := #↑x, property := (_ : #↑x ≤ #(Quotient.out a)) }) a_1 = { val := x, property := hx }

Next tactic:
simpa using le_mk_iff_exists_set.1 hx
/-- A set of cardinals is bounded above iff it's small, i.e. it corresponds to a usual ZFC set. -/
theorem bddAbove_iff_small {s : Set Cardinal.{u}} : BddAbove s ↔ Small.{u} s :=
  ⟨fun ⟨a, ha⟩ => @small_subset _ (Iic a) s (fun x h => ha h) _, by
    

Proof state:
α β : Type u
s : Set Cardinal.{u}
⊢ Small.{u, u + 1} ↑s → BddAbove s

Next tactic:
rintro ⟨ι, ⟨e⟩⟩
/-- A set of cardinals is bounded above iff it's small, i.e. it corresponds to a usual ZFC set. -/
theorem bddAbove_iff_small {s : Set Cardinal.{u}} : BddAbove s ↔ Small.{u} s :=
  ⟨fun ⟨a, ha⟩ => @small_subset _ (Iic a) s (fun x h => ha h) _, by
    rintro ⟨ι, ⟨e⟩⟩
    

Proof state:
case mk.intro.intro
α β : Type u
s : Set Cardinal.{u}
ι : Type u
e : ↑s ≃ ι
⊢ BddAbove s

Next tactic:
suffices (range fun x : ι => (e.symm x).1) = s by
      rw [← this]
      apply bddAbove_range.{u, u}
/-- A set of cardinals is bounded above iff it's small, i.e. it corresponds to a usual ZFC set. -/
theorem bddAbove_iff_small {s : Set Cardinal.{u}} : BddAbove s ↔ Small.{u} s :=
  ⟨fun ⟨a, ha⟩ => @small_subset _ (Iic a) s (fun x h => ha h) _, by
    rintro ⟨ι, ⟨e⟩⟩
    suffices (range fun x : ι => (e.symm x).1) = s by
      

Proof state:
α β : Type u
s : Set Cardinal.{u}
ι : Type u
e : ↑s ≃ ι
this : (range fun x => ↑(e.symm x)) = s
⊢ BddAbove s

Next tactic:
rw [← this]
/-- A set of cardinals is bounded above iff it's small, i.e. it corresponds to a usual ZFC set. -/
theorem bddAbove_iff_small {s : Set Cardinal.{u}} : BddAbove s ↔ Small.{u} s :=
  ⟨fun ⟨a, ha⟩ => @small_subset _ (Iic a) s (fun x h => ha h) _, by
    rintro ⟨ι, ⟨e⟩⟩
    suffices (range fun x : ι => (e.symm x).1) = s by
      rw [← this]
      

Proof state:
α β : Type u
s : Set Cardinal.{u}
ι : Type u
e : ↑s ≃ ι
this : (range fun x => ↑(e.symm x)) = s
⊢ BddAbove (range fun x => ↑(e.symm x))

Next tactic:
apply bddAbove_range.{u, u}
/-- A set of cardinals is bounded above iff it's small, i.e. it corresponds to a usual ZFC set. -/
theorem bddAbove_iff_small {s : Set Cardinal.{u}} : BddAbove s ↔ Small.{u} s :=
  ⟨fun ⟨a, ha⟩ => @small_subset _ (Iic a) s (fun x h => ha h) _, by
    rintro ⟨ι, ⟨e⟩⟩
    suffices (range fun x : ι => (e.symm x).1) = s by
      rw [← this]
      apply bddAbove_range.{u, u}
    

Proof state:
case mk.intro.intro
α β : Type u
s : Set Cardinal.{u}
ι : Type u
e : ↑s ≃ ι
⊢ (range fun x => ↑(e.symm x)) = s

Next tactic:
ext x