l3lab/ntp-mathlib huggingface dataset:
lemma ofReal_cdf [IsProbabilityMeasure μ] (x : ℝ) : ENNReal.ofReal (cdf μ x) = μ (Iic x) := by
  have := IsProbabilityMeasure.toIsFiniteMeasure (Measure.prod (Measure.dirac ()) μ)
  

Proof state:
μ : Measure ℝ
inst✝ : IsProbabilityMeasure μ
x : ℝ
this : IsFiniteMeasure (Measure.prod (Measure.dirac ()) μ)
⊢ ENNReal.ofReal (↑(cdf μ) x) = ↑↑μ (Iic x)

Next tactic:
have h := lintegral_condCdf ((Measure.dirac Unit.unit).prod μ) x
lemma ofReal_cdf [IsProbabilityMeasure μ] (x : ℝ) : ENNReal.ofReal (cdf μ x) = μ (Iic x) := by
  have := IsProbabilityMeasure.toIsFiniteMeasure (Measure.prod (Measure.dirac ()) μ)
  have h := lintegral_condCdf ((Measure.dirac Unit.unit).prod μ) x
  

Proof state:
μ : Measure ℝ
inst✝ : IsProbabilityMeasure μ
x : ℝ
this : IsFiniteMeasure (Measure.prod (Measure.dirac ()) μ)
h :
  ∫⁻ (a : Unit),
      ENNReal.ofReal
        (↑(condCdf (Measure.prod (Measure.dirac ()) μ) a) x) ∂Measure.fst (Measure.prod (Measure.dirac ()) μ) =
    ↑↑(Measure.prod (Measure.dirac ()) μ) (univ ×ˢ Iic x)
⊢ ENNReal.ofReal (↑(cdf μ) x) = ↑↑μ (Iic x)

Next tactic:
simpa only [MeasureTheory.Measure.fst_prod, Measure.prod_prod, measure_univ, one_mul,
    lintegral_dirac] using h
lemma cdf_eq_toReal [IsProbabilityMeasure μ] (x : ℝ) : cdf μ x = (μ (Iic x)).toReal := by
  

Proof state:
μ : Measure ℝ
inst✝ : IsProbabilityMeasure μ
x : ℝ
⊢ ↑(cdf μ) x = ENNReal.toReal (↑↑μ (Iic x))

Next tactic:
rw [← ofReal_cdf μ x, ENNReal.toReal_ofReal (cdf_nonneg μ x)]
instance instIsProbabilityMeasurecdf : IsProbabilityMeasure (cdf μ).measure := by
  

Proof state:
μ : Measure ℝ
⊢ IsProbabilityMeasure (StieltjesFunction.measure (cdf μ))

Next tactic:
constructor
instance instIsProbabilityMeasurecdf : IsProbabilityMeasure (cdf μ).measure := by
  constructor
  

Proof state:
case measure_univ
μ : Measure ℝ
⊢ ↑↑(StieltjesFunction.measure (cdf μ)) univ = 1

Next tactic:
simp only [StieltjesFunction.measure_univ _ (tendsto_cdf_atBot μ) (tendsto_cdf_atTop μ), sub_zero,
    ENNReal.ofReal_one]
/-- The measure associated to the cdf of a probability measure is the same probability measure. -/
lemma measure_cdf [IsProbabilityMeasure μ] : (cdf μ).measure = μ := by
  

Proof state:
μ : Measure ℝ
inst✝ : IsProbabilityMeasure μ
⊢ StieltjesFunction.measure (cdf μ) = μ

Next tactic:
refine Measure.ext_of_Iic (cdf μ).measure μ (fun a ↦ ?_)
/-- The measure associated to the cdf of a probability measure is the same probability measure. -/
lemma measure_cdf [IsProbabilityMeasure μ] : (cdf μ).measure = μ := by
  refine Measure.ext_of_Iic (cdf μ).measure μ (fun a ↦ ?_)
  

Proof state:
μ : Measure ℝ
inst✝ : IsProbabilityMeasure μ
a : ℝ
⊢ ↑↑(StieltjesFunction.measure (cdf μ)) (Iic a) = ↑↑μ (Iic a)

Next tactic:
rw [StieltjesFunction.measure_Iic _ (tendsto_cdf_atBot μ), sub_zero, ofReal_cdf]
lemma cdf_measure_stieltjesFunction (f : StieltjesFunction) (hf0 : Tendsto f atBot (𝓝 0))
    (hf1 : Tendsto f atTop (𝓝 1)) :
    cdf f.measure = f := by
  

Proof state:
f : StieltjesFunction
hf0 : Tendsto (↑f) atBot (𝓝 0)
hf1 : Tendsto (↑f) atTop (𝓝 1)
⊢ cdf (StieltjesFunction.measure f) = f

Next tactic:
refine (cdf f.measure).eq_of_measure_of_tendsto_atBot f ?_ (tendsto_cdf_atBot _) hf0
lemma cdf_measure_stieltjesFunction (f : StieltjesFunction) (hf0 : Tendsto f atBot (𝓝 0))
    (hf1 : Tendsto f atTop (𝓝 1)) :
    cdf f.measure = f := by
  refine (cdf f.measure).eq_of_measure_of_tendsto_atBot f ?_ (tendsto_cdf_atBot _) hf0
  

Proof state:
f : StieltjesFunction
hf0 : Tendsto (↑f) atBot (𝓝 0)
hf1 : Tendsto (↑f) atTop (𝓝 1)
⊢ StieltjesFunction.measure (cdf (StieltjesFunction.measure f)) = StieltjesFunction.measure f

Next tactic:
have h_prob : IsProbabilityMeasure f.measure :=
    ⟨by rw [f.measure_univ hf0 hf1, sub_zero, ENNReal.ofReal_one]⟩
lemma cdf_measure_stieltjesFunction (f : StieltjesFunction) (hf0 : Tendsto f atBot (𝓝 0))
    (hf1 : Tendsto f atTop (𝓝 1)) :
    cdf f.measure = f := by
  refine (cdf f.measure).eq_of_measure_of_tendsto_atBot f ?_ (tendsto_cdf_atBot _) hf0
  have h_prob : IsProbabilityMeasure f.measure :=
    ⟨by 

Proof state:
f : StieltjesFunction
hf0 : Tendsto (↑f) atBot (𝓝 0)
hf1 : Tendsto (↑f) atTop (𝓝 1)
⊢ ↑↑(StieltjesFunction.measure f) univ = 1

Next tactic:
rw [f.measure_univ hf0 hf1, sub_zero, ENNReal.ofReal_one]
lemma cdf_measure_stieltjesFunction (f : StieltjesFunction) (hf0 : Tendsto f atBot (𝓝 0))
    (hf1 : Tendsto f atTop (𝓝 1)) :
    cdf f.measure = f := by
  refine (cdf f.measure).eq_of_measure_of_tendsto_atBot f ?_ (tendsto_cdf_atBot _) hf0
  have h_prob : IsProbabilityMeasure f.measure :=
    ⟨by rw [f.measure_univ hf0 hf1, sub_zero, ENNReal.ofReal_one]⟩
  

Proof state:
f : StieltjesFunction
hf0 : Tendsto (↑f) atBot (𝓝 0)
hf1 : Tendsto (↑f) atTop (𝓝 1)
h_prob : IsProbabilityMeasure (StieltjesFunction.measure f)
⊢ StieltjesFunction.measure (cdf (StieltjesFunction.measure f)) = StieltjesFunction.measure f

Next tactic:
exact measure_cdf f.measure
/-- If two real probability distributions have the same cdf, they are equal. -/
lemma MeasureTheory.Measure.eq_of_cdf (μ ν : Measure ℝ) [IsProbabilityMeasure μ]
    [IsProbabilityMeasure ν] (h : cdf μ = cdf ν) : μ = ν := by
  

Proof state:
μ ν : Measure ℝ
inst✝¹ : IsProbabilityMeasure μ
inst✝ : IsProbabilityMeasure ν
h : cdf μ = cdf ν
⊢ μ = ν

Next tactic:
rw [← measure_cdf μ, ← measure_cdf ν, h]
@[simp] lemma MeasureTheory.Measure.cdf_eq_iff (μ ν : Measure ℝ) [IsProbabilityMeasure μ]
    [IsProbabilityMeasure ν] :
    cdf μ = cdf ν ↔ μ = ν :=
⟨MeasureTheory.Measure.eq_of_cdf μ ν, fun h ↦ by 

Proof state:
μ ν : Measure ℝ
inst✝¹ : IsProbabilityMeasure μ
inst✝ : IsProbabilityMeasure ν
h : μ = ν
⊢ cdf μ = cdf ν

Next tactic:
rw [h]
theorem ppow_mul_assoc (k m n : ℕ+) (x : M) :
    (x ^ k * x ^ m) * x ^ n = x ^ k * (x ^ m * x ^ n) := by
  

Proof state:
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
k m n : ℕ+
x : M
⊢ x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)

Next tactic:
simp only [← ppow_add, add_assoc]
theorem ppow_mul_comm (m n : ℕ+) (x : M) :
    x ^ m * x ^ n = x ^ n * x ^ m := by 

Proof state:
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
m n : ℕ+
x : M
⊢ x ^ m * x ^ n = x ^ n * x ^ m

Next tactic:
simp only [← ppow_add, add_comm]
theorem ppow_mul (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ m) ^ n := by
  

Proof state:
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n : ℕ+
⊢ x ^ (m * n) = (x ^ m) ^ n

Next tactic:
refine PNat.recOn n ?_ fun k hk ↦ ?_
theorem ppow_mul (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ m) ^ n := by
  refine PNat.recOn n ?_ fun k hk ↦ ?_
  

Proof state:
case refine_1
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n : ℕ+
⊢ x ^ (m * 1) = (x ^ m) ^ 1
case refine_2
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n k : ℕ+
hk : x ^ (m * k) = (x ^ m) ^ k
⊢ x ^ (m * (k + 1)) = (x ^ m) ^ (k + 1)

Next tactic:
rw [ppow_one, mul_one]
theorem ppow_mul (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ m) ^ n := by
  refine PNat.recOn n ?_ fun k hk ↦ ?_
  rw [ppow_one, mul_one]
  

Proof state:
case refine_2
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n k : ℕ+
hk : x ^ (m * k) = (x ^ m) ^ k
⊢ x ^ (m * (k + 1)) = (x ^ m) ^ (k + 1)

Next tactic:
rw [ppow_add, ppow_one, mul_add, ppow_add, mul_one, hk]
theorem ppow_mul' (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ n) ^ m := by
  

Proof state:
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n : ℕ+
⊢ x ^ (m * n) = (x ^ n) ^ m

Next tactic:
rw [mul_comm]
theorem ppow_mul' (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ n) ^ m := by
  rw [mul_comm]
  

Proof state:
M : Type u_1
inst✝² : Mul M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
m n : ℕ+
⊢ x ^ (n * m) = (x ^ n) ^ m

Next tactic:
exact ppow_mul x n m
instance Pi.instPNatPowAssoc {ι : Type*} {α : ι → Type*} [∀ i, Mul <| α i] [∀ i, Pow (α i) ℕ+]
    [∀ i, PNatPowAssoc <| α i] : PNatPowAssoc (∀ i, α i) where
    ppow_add _ _ _ := by 

Proof state:
M : Type u_1
ι : Type u_2
α : ι → Type u_3
inst✝² : (i : ι) → Mul (α i)
inst✝¹ : (i : ι) → Pow (α i) ℕ+
inst✝ : ∀ (i : ι), PNatPowAssoc (α i)
x✝² x✝¹ : ℕ+
x✝ : (i : ι) → α i
⊢ x✝ ^ (x✝² + x✝¹) = x✝ ^ x✝² * x✝ ^ x✝¹

Next tactic:
ext
instance Pi.instPNatPowAssoc {ι : Type*} {α : ι → Type*} [∀ i, Mul <| α i] [∀ i, Pow (α i) ℕ+]
    [∀ i, PNatPowAssoc <| α i] : PNatPowAssoc (∀ i, α i) where
    ppow_add _ _ _ := by ext; 

Proof state:
case h
M : Type u_1
ι : Type u_2
α : ι → Type u_3
inst✝² : (i : ι) → Mul (α i)
inst✝¹ : (i : ι) → Pow (α i) ℕ+
inst✝ : ∀ (i : ι), PNatPowAssoc (α i)
x✝³ x✝² : ℕ+
x✝¹ : (i : ι) → α i
x✝ : ι
⊢ (x✝¹ ^ (x✝³ + x✝²)) x✝ = (x✝¹ ^ x✝³ * x✝¹ ^ x✝²) x✝

Next tactic:
simp [ppow_add]
instance Pi.instPNatPowAssoc {ι : Type*} {α : ι → Type*} [∀ i, Mul <| α i] [∀ i, Pow (α i) ℕ+]
    [∀ i, PNatPowAssoc <| α i] : PNatPowAssoc (∀ i, α i) where
    ppow_add _ _ _ := by ext; simp [ppow_add]
    ppow_one _ := by 

Proof state:
M : Type u_1
ι : Type u_2
α : ι → Type u_3
inst✝² : (i : ι) → Mul (α i)
inst✝¹ : (i : ι) → Pow (α i) ℕ+
inst✝ : ∀ (i : ι), PNatPowAssoc (α i)
x✝ : (i : ι) → α i
⊢ x✝ ^ 1 = x✝

Next tactic:
ext
instance Pi.instPNatPowAssoc {ι : Type*} {α : ι → Type*} [∀ i, Mul <| α i] [∀ i, Pow (α i) ℕ+]
    [∀ i, PNatPowAssoc <| α i] : PNatPowAssoc (∀ i, α i) where
    ppow_add _ _ _ := by ext; simp [ppow_add]
    ppow_one _ := by ext; 

Proof state:
case h
M : Type u_1
ι : Type u_2
α : ι → Type u_3
inst✝² : (i : ι) → Mul (α i)
inst✝¹ : (i : ι) → Pow (α i) ℕ+
inst✝ : ∀ (i : ι), PNatPowAssoc (α i)
x✝¹ : (i : ι) → α i
x✝ : ι
⊢ (x✝¹ ^ 1) x✝ = x✝¹ x✝

Next tactic:
simp
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by 

Proof state:
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝² x✝¹ : ℕ+
x✝ : M × N
⊢ x✝ ^ (x✝² + x✝¹) = x✝ ^ x✝² * x✝ ^ x✝¹

Next tactic:
ext
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by ext <;> 

Proof state:
case a
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝² x✝¹ : ℕ+
x✝ : M × N
⊢ (x✝ ^ (x✝² + x✝¹)).1 = (x✝ ^ x✝² * x✝ ^ x✝¹).1

Next tactic:
simp [ppow_add]
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by ext <;> 

Proof state:
case a
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝² x✝¹ : ℕ+
x✝ : M × N
⊢ (x✝ ^ (x✝² + x✝¹)).2 = (x✝ ^ x✝² * x✝ ^ x✝¹).2

Next tactic:
simp [ppow_add]
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by ext <;> simp [ppow_add]
  ppow_one _ := by 

Proof state:
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝ : M × N
⊢ x✝ ^ 1 = x✝

Next tactic:
ext
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by ext <;> simp [ppow_add]
  ppow_one _ := by ext <;> 

Proof state:
case a
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝ : M × N
⊢ (x✝ ^ 1).1 = x✝.1

Next tactic:
simp
instance Prod.instPNatPowAssoc {N : Type*} [Mul M] [Pow M ℕ+] [PNatPowAssoc M] [Mul N] [Pow N ℕ+]
    [PNatPowAssoc N] : PNatPowAssoc (M × N) where
  ppow_add _ _ _ := by ext <;> simp [ppow_add]
  ppow_one _ := by ext <;> 

Proof state:
case a
M : Type u_1
N : Type u_2
inst✝⁵ : Mul M
inst✝⁴ : Pow M ℕ+
inst✝³ : PNatPowAssoc M
inst✝² : Mul N
inst✝¹ : Pow N ℕ+
inst✝ : PNatPowAssoc N
x✝ : M × N
⊢ (x✝ ^ 1).2 = x✝.2

Next tactic:
simp
theorem ppow_eq_pow [Monoid M] [Pow M ℕ+] [PNatPowAssoc M] (x : M) (n : ℕ+) :
    x ^ n = x ^ (n : ℕ) := by
  

Proof state:
M : Type u_1
inst✝² : Monoid M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
n : ℕ+
⊢ x ^ n = x ^ ↑n

Next tactic:
refine PNat.recOn n ?_ fun k hk ↦ ?_
theorem ppow_eq_pow [Monoid M] [Pow M ℕ+] [PNatPowAssoc M] (x : M) (n : ℕ+) :
    x ^ n = x ^ (n : ℕ) := by
  refine PNat.recOn n ?_ fun k hk ↦ ?_
  

Proof state:
case refine_1
M : Type u_1
inst✝² : Monoid M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
n : ℕ+
⊢ x ^ 1 = x ^ ↑1
case refine_2
M : Type u_1
inst✝² : Monoid M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
n k : ℕ+
hk : x ^ k = x ^ ↑k
⊢ x ^ (k + 1) = x ^ ↑(k + 1)

Next tactic:
rw [ppow_one, PNat.one_coe, pow_one]
theorem ppow_eq_pow [Monoid M] [Pow M ℕ+] [PNatPowAssoc M] (x : M) (n : ℕ+) :
    x ^ n = x ^ (n : ℕ) := by
  refine PNat.recOn n ?_ fun k hk ↦ ?_
  rw [ppow_one, PNat.one_coe, pow_one]
  

Proof state:
case refine_2
M : Type u_1
inst✝² : Monoid M
inst✝¹ : Pow M ℕ+
inst✝ : PNatPowAssoc M
x : M
n k : ℕ+
hk : x ^ k = x ^ ↑k
⊢ x ^ (k + 1) = x ^ ↑(k + 1)

Next tactic:
rw [ppow_add, ppow_one, PNat.add_coe, pow_add, PNat.one_coe, pow_one, ← hk]
/-- The antidiagonal of a natural number `n` is
    the finset of pairs `(i, j)` such that `i + j = n`. -/
instance instHasAntidiagonal : HasAntidiagonal ℕ where
  antidiagonal n := ⟨Multiset.Nat.antidiagonal n, Multiset.Nat.nodup_antidiagonal n⟩
  mem_antidiagonal {n} {xy} := by
    

Proof state:
n : ℕ
xy : ℕ × ℕ
⊢ xy ∈
      (fun n => { val := Multiset.Nat.antidiagonal n, nodup := (_ : Multiset.Nodup (Multiset.Nat.antidiagonal n)) }) n ↔
    xy.1 + xy.2 = n

Next tactic:
rw [mem_def, Multiset.Nat.mem_antidiagonal]
/-- The cardinality of the antidiagonal of `n` is `n + 1`. -/
@[simp]
theorem card_antidiagonal (n : ℕ) : (antidiagonal n).card = n + 1 := by 

Proof state:
n : ℕ
⊢ card (antidiagonal n) = n + 1

Next tactic:
simp [antidiagonal]
theorem antidiagonal_succ (n : ℕ) :
    antidiagonal (n + 1) =
      cons (0, n + 1)
        ((antidiagonal n).map
          (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ (Embedding.refl _)))
        (by 

Proof state:
n : ℕ
⊢ (0, n + 1) ∉
    map (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (antidiagonal n)

Next tactic:
simp
theorem antidiagonal_succ (n : ℕ) :
    antidiagonal (n + 1) =
      cons (0, n + 1)
        ((antidiagonal n).map
          (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ (Embedding.refl _)))
        (by simp) := by
  

Proof state:
n : ℕ
⊢ antidiagonal (n + 1) =
    cons (0, n + 1)
      (map (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (antidiagonal n))
      (_ :
        (0, n + 1) ∉
          map (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (antidiagonal n))

Next tactic:
apply eq_of_veq
theorem antidiagonal_succ (n : ℕ) :
    antidiagonal (n + 1) =
      cons (0, n + 1)
        ((antidiagonal n).map
          (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ (Embedding.refl _)))
        (by simp) := by
  apply eq_of_veq
  

Proof state:
case a
n : ℕ
⊢ (antidiagonal (n + 1)).val =
    (cons (0, n + 1)
        (map (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (antidiagonal n))
        (_ :
          (0, n + 1) ∉
            map (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ))
              (antidiagonal n))).val

Next tactic:
rw [cons_val, map_val]
theorem antidiagonal_succ (n : ℕ) :
    antidiagonal (n + 1) =
      cons (0, n + 1)
        ((antidiagonal n).map
          (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ (Embedding.refl _)))
        (by simp) := by
  apply eq_of_veq
  rw [cons_val, map_val]
  · 

Proof state:
case a
n : ℕ
⊢ (antidiagonal (n + 1)).val =
    (0, n + 1) ::ₘ
      Multiset.map (⇑(Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)))
        (antidiagonal n).val

Next tactic:
apply Multiset.Nat.antidiagonal_succ
theorem antidiagonal_succ' (n : ℕ) :
    antidiagonal (n + 1) =
      cons (n + 1, 0)
        ((antidiagonal n).map
          (Embedding.prodMap (Embedding.refl _) ⟨Nat.succ, Nat.succ_injective⟩))
        (by 

Proof state:
n : ℕ
⊢ (n + 1, 0) ∉
    map (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective }) (antidiagonal n)

Next tactic:
simp
theorem antidiagonal_succ' (n : ℕ) :
    antidiagonal (n + 1) =
      cons (n + 1, 0)
        ((antidiagonal n).map
          (Embedding.prodMap (Embedding.refl _) ⟨Nat.succ, Nat.succ_injective⟩))
        (by simp) := by
  

Proof state:
n : ℕ
⊢ antidiagonal (n + 1) =
    cons (n + 1, 0)
      (map (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective }) (antidiagonal n))
      (_ :
        (n + 1, 0) ∉
          map (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective }) (antidiagonal n))

Next tactic:
apply eq_of_veq
theorem antidiagonal_succ' (n : ℕ) :
    antidiagonal (n + 1) =
      cons (n + 1, 0)
        ((antidiagonal n).map
          (Embedding.prodMap (Embedding.refl _) ⟨Nat.succ, Nat.succ_injective⟩))
        (by simp) := by
  apply eq_of_veq
  

Proof state:
case a
n : ℕ
⊢ (antidiagonal (n + 1)).val =
    (cons (n + 1, 0)
        (map (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective }) (antidiagonal n))
        (_ :
          (n + 1, 0) ∉
            map (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective })
              (antidiagonal n))).val

Next tactic:
rw [cons_val, map_val]
theorem antidiagonal_succ' (n : ℕ) :
    antidiagonal (n + 1) =
      cons (n + 1, 0)
        ((antidiagonal n).map
          (Embedding.prodMap (Embedding.refl _) ⟨Nat.succ, Nat.succ_injective⟩))
        (by simp) := by
  apply eq_of_veq
  rw [cons_val, map_val]
  

Proof state:
case a
n : ℕ
⊢ (antidiagonal (n + 1)).val =
    (n + 1, 0) ::ₘ
      Multiset.map (⇑(Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective }))
        (antidiagonal n).val

Next tactic:
exact Multiset.Nat.antidiagonal_succ'
theorem antidiagonal_succ_succ' {n : ℕ} :
    antidiagonal (n + 2) =
      cons (0, n + 2)
        (cons (n + 2, 0)
            ((antidiagonal n).map
              (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩
                ⟨Nat.succ, Nat.succ_injective⟩)) <|
          by 

Proof state:
n : ℕ
⊢ (n + 2, 0) ∉
    map
      (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
        { toFun := Nat.succ, inj' := Nat.succ_injective })
      (antidiagonal n)

Next tactic:
simp
theorem antidiagonal_succ_succ' {n : ℕ} :
    antidiagonal (n + 2) =
      cons (0, n + 2)
        (cons (n + 2, 0)
            ((antidiagonal n).map
              (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩
                ⟨Nat.succ, Nat.succ_injective⟩)) <|
          by simp)
        (by 

Proof state:
n : ℕ
⊢ (0, n + 2) ∉
    cons (n + 2, 0)
      (map
        (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
          { toFun := Nat.succ, inj' := Nat.succ_injective })
        (antidiagonal n))
      (_ :
        (n + 2, 0) ∉
          map
            (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
              { toFun := Nat.succ, inj' := Nat.succ_injective })
            (antidiagonal n))

Next tactic:
simp
theorem antidiagonal_succ_succ' {n : ℕ} :
    antidiagonal (n + 2) =
      cons (0, n + 2)
        (cons (n + 2, 0)
            ((antidiagonal n).map
              (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩
                ⟨Nat.succ, Nat.succ_injective⟩)) <|
          by simp)
        (by simp) := by
  

Proof state:
n : ℕ
⊢ antidiagonal (n + 2) =
    cons (0, n + 2)
      (cons (n + 2, 0)
        (map
          (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
            { toFun := Nat.succ, inj' := Nat.succ_injective })
          (antidiagonal n))
        (_ :
          (n + 2, 0) ∉
            map
              (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                { toFun := Nat.succ, inj' := Nat.succ_injective })
              (antidiagonal n)))
      (_ :
        (0, n + 2) ∉
          cons (n + 2, 0)
            (map
              (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                { toFun := Nat.succ, inj' := Nat.succ_injective })
              (antidiagonal n))
            (_ :
              (n + 2, 0) ∉
                map
                  (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                    { toFun := Nat.succ, inj' := Nat.succ_injective })
                  (antidiagonal n)))

Next tactic:
simp_rw [antidiagonal_succ (n + 1), antidiagonal_succ', Finset.map_cons, map_map]
theorem antidiagonal_succ_succ' {n : ℕ} :
    antidiagonal (n + 2) =
      cons (0, n + 2)
        (cons (n + 2, 0)
            ((antidiagonal n).map
              (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩
                ⟨Nat.succ, Nat.succ_injective⟩)) <|
          by simp)
        (by simp) := by
  simp_rw [antidiagonal_succ (n + 1), antidiagonal_succ', Finset.map_cons, map_map]
  

Proof state:
n : ℕ
⊢ cons (0, n + 1 + 1)
      (cons ((Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (n + 1, 0))
        (map
          (Embedding.trans (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective })
            (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)))
          (antidiagonal n))
        (_ :
          (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (n + 1, 0) ∉
            map
              (Embedding.trans (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective })
                (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)))
              (antidiagonal n)))
      (_ :
        (0, n + 1 + 1) ∉
          cons ((Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (n + 1, 0))
            (map
              (Embedding.trans (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective })
                (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)))
              (antidiagonal n))
            (_ :
              (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)) (n + 1, 0) ∉
                map
                  (Embedding.trans
                    (Embedding.prodMap (Embedding.refl ℕ) { toFun := Nat.succ, inj' := Nat.succ_injective })
                    (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective } (Embedding.refl ℕ)))
                  (antidiagonal n))) =
    cons (0, n + 2)
      (cons (n + 2, 0)
        (map
          (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
            { toFun := Nat.succ, inj' := Nat.succ_injective })
          (antidiagonal n))
        (_ :
          (n + 2, 0) ∉
            map
              (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                { toFun := Nat.succ, inj' := Nat.succ_injective })
              (antidiagonal n)))
      (_ :
        (0, n + 2) ∉
          cons (n + 2, 0)
            (map
              (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                { toFun := Nat.succ, inj' := Nat.succ_injective })
              (antidiagonal n))
            (_ :
              (n + 2, 0) ∉
                map
                  (Embedding.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective }
                    { toFun := Nat.succ, inj' := Nat.succ_injective })
                  (antidiagonal n)))

Next tactic:
rfl