Theorem: Cardinal.cantorFunction_injective
File: Mathlib/Data/Real/Cardinality.lean

tactic: intro f g hfg
state_before: c : ℝ
f g : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
⊢ Function.Injective (cantorFunction c)
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
hfg : cantorFunction c f = cantorFunction c g
⊢ f = g

tactic: by_contra h
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
hfg : cantorFunction c f = cantorFunction c g
⊢ f = g
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
hfg : cantorFunction c f = cantorFunction c g
h : ¬f = g
⊢ False

tactic: revert hfg
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
hfg : cantorFunction c f = cantorFunction c g
h : ¬f = g
⊢ False
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
⊢ cantorFunction c f = cantorFunction c g → False

tactic: have : ∃ n, f n ≠ g n := by
  rw [← not_forall]
  intro h'
  apply h
  ext
  apply h'
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
⊢ cantorFunction c f = cantorFunction c g → False
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
⊢ cantorFunction c f = cantorFunction c g → False

tactic: let n := Nat.find this
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
⊢ cantorFunction c f = cantorFunction c g → False
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
⊢ cantorFunction c f = cantorFunction c g → False

tactic: have hn : ∀ k : ℕ, k < n → f k = g k := by
  intro k hk
  apply of_not_not
  exact Nat.find_min this hk
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
⊢ cantorFunction c f = cantorFunction c g → False
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
⊢ cantorFunction c f = cantorFunction c g → False

tactic: cases fn : f n
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
⊢ cantorFunction c f = cantorFunction c g → False
state_after: case false
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ cantorFunction c f = cantorFunction c g → False

case true
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ cantorFunction c f = cantorFunction c g → False

tactic: rw [← not_forall]
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
⊢ ∃ n, f n ≠ g n
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
⊢ ¬∀ (x : ℕ), f x = g x

tactic: intro h'
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
⊢ ¬∀ (x : ℕ), f x = g x
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
⊢ False

tactic: apply h
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
⊢ False
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
⊢ f = g

tactic: ext
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
⊢ f = g
state_after: case h
c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
x✝ : ℕ
⊢ f x✝ = g x✝

tactic: apply h'
state_before: case h
c : ℝ
f✝ g✝ : ℕ → Bool
n : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
h' : ∀ (x : ℕ), f x = g x
x✝ : ℕ
⊢ f x✝ = g x✝
state_after: no goals

tactic: intro k hk
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
⊢ ∀ k < n, f k = g k
state_after: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
k : ℕ
hk : k < n
⊢ f k = g k

tactic: apply of_not_not
state_before: c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
k : ℕ
hk : k < n
⊢ f k = g k
state_after: case a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
k : ℕ
hk : k < n
⊢ ¬¬f k = g k

tactic: exact Nat.find_min this hk
state_before: case a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
k : ℕ
hk : k < n
⊢ ¬¬f k = g k
state_after: no goals

tactic: apply _root_.ne_of_lt
state_before: case false
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ cantorFunction c f = cantorFunction c g → False
state_after: case false.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ cantorFunction c f < cantorFunction c g

tactic: refine increasing_cantorFunction h1 h2 hn fn ?_
state_before: case false.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ cantorFunction c f < cantorFunction c g
state_after: case false.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ g n = true

tactic: apply Bool.eq_true_of_not_eq_false
state_before: case false.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ g n = true
state_after: case false.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ ¬g n = false

tactic: rw [← fn]
state_before: case false.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ ¬g n = false
state_after: case false.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ ¬g n = f n

tactic: apply Ne.symm
state_before: case false.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ ¬g n = f n
state_after: case false.h.a.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ f n ≠ g n

tactic: exact Nat.find_spec this
state_before: case false.h.a.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = false
⊢ f n ≠ g n
state_after: no goals

tactic: apply _root_.ne_of_gt
state_before: case true
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ cantorFunction c f = cantorFunction c g → False
state_after: case true.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ cantorFunction c g < cantorFunction c f

tactic: refine increasing_cantorFunction h1 h2 (fun k hk => (hn k hk).symm) ?_ fn
state_before: case true.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ cantorFunction c g < cantorFunction c f
state_after: case true.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ g n = false

tactic: apply Bool.eq_false_of_not_eq_true
state_before: case true.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ g n = false
state_after: case true.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ ¬g n = true

tactic: rw [← fn]
state_before: case true.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ ¬g n = true
state_after: case true.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ ¬g n = f n

tactic: apply Ne.symm
state_before: case true.h.a
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ ¬g n = f n
state_after: case true.h.a.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ f n ≠ g n

tactic: exact Nat.find_spec this
state_before: case true.h.a.h
c : ℝ
f✝ g✝ : ℕ → Bool
n✝ : ℕ
h1 : 0 < c
h2 : c < 1 / 2
f g : ℕ → Bool
h : ¬f = g
this : ∃ n, f n ≠ g n
n : ℕ := Nat.find this
hn : ∀ k < n, f k = g k
fn : f n = true
⊢ f n ≠ g n
state_after: no goals