[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
⊢ ↑(↑(toFunBilinear R A) a) p = sum p fun n r => ↑(monomial n) (a * ↑(algebraMap R A) r)
[PROOFSTEP]
simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
⊢ (Finset.sum (support p) fun x => a • (↑(algebraMap R A[X]) (coeff p x) * X ^ x)) =
    Finset.sum (support p) fun x => ↑(monomial x) (a * ↑(algebraMap R A) (coeff p x))
[PROOFSTEP]
congr with i : 1
[GOAL]
case e_f.h
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
i : ℕ
⊢ a • (↑(algebraMap R A[X]) (coeff p i) * X ^ i) = ↑(monomial i) (a * ↑(algebraMap R A) (coeff p i))
[PROOFSTEP]
rw [← Algebra.smul_def, ← C_mul', mul_smul_comm, C_mul_X_pow_eq_monomial, ← Algebra.commutes, ← Algebra.smul_def,
  smul_monomial]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
⊢ (if ¬coeff p k = 0 then a * ↑(algebraMap R A) (coeff p k) else 0) = a * ↑(algebraMap R A) (coeff p k)
[PROOFSTEP]
classical split_ifs <;> simp [*]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
⊢ (if ¬coeff p k = 0 then a * ↑(algebraMap R A) (coeff p k) else 0) = a * ↑(algebraMap R A) (coeff p k)
[PROOFSTEP]
split_ifs
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
h✝ : coeff p k = 0
⊢ 0 = a * ↑(algebraMap R A) (coeff p k)
[PROOFSTEP]
simp [*]
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
h✝ : ¬coeff p k = 0
⊢ a * ↑(algebraMap R A) (coeff p k) = a * ↑(algebraMap R A) (coeff p k)
[PROOFSTEP]
simp [*]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      a₁ * ↑(algebraMap R A) (coeff p₁ x.fst) * (a₂ * ↑(algebraMap R A) (coeff p₂ x.snd))
[PROOFSTEP]
simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ a₁ * (a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k)) =
    a₁ *
      (a₂ *
        Finset.sum (Finset.Nat.antidiagonal k) fun x =>
          ↑(algebraMap R A) (coeff p₂ x.snd) * ↑(algebraMap R A) (coeff p₁ x.fst))
[PROOFSTEP]
congr
[GOAL]
case e_a.e_a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ ↑(algebraMap R A) (coeff (p₁ * p₂) k) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      ↑(algebraMap R A) (coeff p₂ x.snd) * ↑(algebraMap R A) (coeff p₁ x.fst)
[PROOFSTEP]
simp_rw [Algebra.commutes (coeff p₂ _), coeff_mul, map_sum, RingHom.map_mul]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ ↑(toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = ↑(toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * ↑(toFunLinear R A) (a₂ ⊗ₜ[R] p₂)
[PROOFSTEP]
classical
simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum]
ext k
simp_rw [coeff_sum, coeff_monomial, sum_def, Finset.sum_ite_eq', mem_support_iff, Ne.def]
conv_rhs => rw [coeff_mul]
simp_rw [finset_sum_coeff, coeff_monomial, Finset.sum_ite_eq', mem_support_iff, Ne.def, mul_ite, mul_zero, ite_mul,
  zero_mul]
simp_rw [ite_mul_zero_left (¬coeff p₁ _ = 0) (a₁ * (algebraMap R A) (coeff p₁ _))]
simp_rw [ite_mul_zero_right (¬coeff p₂ _ = 0) _ (_ * _)]
simp_rw [toFunLinear_mul_tmul_mul_aux_1, toFunLinear_mul_tmul_mul_aux_2]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ ↑(toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = ↑(toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * ↑(toFunLinear R A) (a₂ ⊗ₜ[R] p₂)
[PROOFSTEP]
simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ (sum (p₁ * p₂) fun n r => ↑(monomial n) (a₁ * a₂ * ↑(algebraMap R A) r)) =
    (sum p₁ fun n r => ↑(monomial n) (a₁ * ↑(algebraMap R A) r)) *
      sum p₂ fun n r => ↑(monomial n) (a₂ * ↑(algebraMap R A) r)
[PROOFSTEP]
ext k
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ coeff (sum (p₁ * p₂) fun n r => ↑(monomial n) (a₁ * a₂ * ↑(algebraMap R A) r)) k =
    coeff
      ((sum p₁ fun n r => ↑(monomial n) (a₁ * ↑(algebraMap R A) r)) *
        sum p₂ fun n r => ↑(monomial n) (a₂ * ↑(algebraMap R A) r))
      k
[PROOFSTEP]
simp_rw [coeff_sum, coeff_monomial, sum_def, Finset.sum_ite_eq', mem_support_iff, Ne.def]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ (if ¬coeff (p₁ * p₂) k = 0 then a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) else 0) =
    coeff
      ((Finset.sum (support p₁) fun n => ↑(monomial n) (a₁ * ↑(algebraMap R A) (coeff p₁ n))) *
        Finset.sum (support p₂) fun n => ↑(monomial n) (a₂ * ↑(algebraMap R A) (coeff p₂ n)))
      k
[PROOFSTEP]
conv_rhs => rw [coeff_mul]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
| coeff
    ((Finset.sum (support p₁) fun n => ↑(monomial n) (a₁ * ↑(algebraMap R A) (coeff p₁ n))) *
      Finset.sum (support p₂) fun n => ↑(monomial n) (a₂ * ↑(algebraMap R A) (coeff p₂ n)))
    k
[PROOFSTEP]
rw [coeff_mul]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
| coeff
    ((Finset.sum (support p₁) fun n => ↑(monomial n) (a₁ * ↑(algebraMap R A) (coeff p₁ n))) *
      Finset.sum (support p₂) fun n => ↑(monomial n) (a₂ * ↑(algebraMap R A) (coeff p₂ n)))
    k
[PROOFSTEP]
rw [coeff_mul]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
| coeff
    ((Finset.sum (support p₁) fun n => ↑(monomial n) (a₁ * ↑(algebraMap R A) (coeff p₁ n))) *
      Finset.sum (support p₂) fun n => ↑(monomial n) (a₂ * ↑(algebraMap R A) (coeff p₂ n)))
    k
[PROOFSTEP]
rw [coeff_mul]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ (if ¬coeff (p₁ * p₂) k = 0 then a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) else 0) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      coeff (Finset.sum (support p₁) fun n => ↑(monomial n) (a₁ * ↑(algebraMap R A) (coeff p₁ n))) x.fst *
        coeff (Finset.sum (support p₂) fun n => ↑(monomial n) (a₂ * ↑(algebraMap R A) (coeff p₂ n))) x.snd
[PROOFSTEP]
simp_rw [finset_sum_coeff, coeff_monomial, Finset.sum_ite_eq', mem_support_iff, Ne.def, mul_ite, mul_zero, ite_mul,
  zero_mul]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ (if ¬coeff (p₁ * p₂) k = 0 then a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) else 0) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      if ¬coeff p₂ x.snd = 0 then
        if ¬coeff p₁ x.fst = 0 then a₁ * ↑(algebraMap R A) (coeff p₁ x.fst) * (a₂ * ↑(algebraMap R A) (coeff p₂ x.snd))
        else 0
      else 0
[PROOFSTEP]
simp_rw [ite_mul_zero_left (¬coeff p₁ _ = 0) (a₁ * (algebraMap R A) (coeff p₁ _))]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ (if ¬coeff (p₁ * p₂) k = 0 then a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) else 0) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      if ¬coeff p₂ x.snd = 0 then
        (if ¬coeff p₁ x.fst = 0 then a₁ * ↑(algebraMap R A) (coeff p₁ x.fst) else 0) *
          (a₂ * ↑(algebraMap R A) (coeff p₂ x.snd))
      else 0
[PROOFSTEP]
simp_rw [ite_mul_zero_right (¬coeff p₂ _ = 0) _ (_ * _)]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
k : ℕ
⊢ (if ¬coeff (p₁ * p₂) k = 0 then a₁ * a₂ * ↑(algebraMap R A) (coeff (p₁ * p₂) k) else 0) =
    Finset.sum (Finset.Nat.antidiagonal k) fun x =>
      (if ¬coeff p₁ x.fst = 0 then a₁ * ↑(algebraMap R A) (coeff p₁ x.fst) else 0) *
        if ¬coeff p₂ x.snd = 0 then a₂ * ↑(algebraMap R A) (coeff p₂ x.snd) else 0
[PROOFSTEP]
simp_rw [toFunLinear_mul_tmul_mul_aux_1, toFunLinear_mul_tmul_mul_aux_2]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
r : R
⊢ ↑(toFunLinear R A) (↑(algebraMap R A) r ⊗ₜ[R] 1) = ↑(algebraMap R A[X]) r
[PROOFSTEP]
rw [toFunLinear_tmul_apply, toFunBilinear_apply_apply, Polynomial.aeval_one, algebraMap_smul,
  Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one]
  -- porting note: had to
    -- add extra `Algebra.algebraMap_eq_smul_one`
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p q : A[X]
⊢ invFun R A (p + q) = invFun R A p + invFun R A q
[PROOFSTEP]
simp only [invFun, eval₂_add]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
⊢ invFun R A (↑(toFunAlgHom R A) x) = x
[PROOFSTEP]
refine TensorProduct.induction_on x ?_ ?_ ?_
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
⊢ invFun R A (↑(toFunAlgHom R A) 0) = 0
[PROOFSTEP]
simp [invFun]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
⊢ ∀ (x : A) (y : R[X]), invFun R A (↑(toFunAlgHom R A) (x ⊗ₜ[R] y)) = x ⊗ₜ[R] y
[PROOFSTEP]
intro a p
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ invFun R A (↑(toFunAlgHom R A) (a ⊗ₜ[R] p)) = a ⊗ₜ[R] p
[PROOFSTEP]
dsimp only [invFun]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ eval₂ (↑includeLeft) (1 ⊗ₜ[R] X) (↑(toFunAlgHom R A) (a ⊗ₜ[R] p)) = a ⊗ₜ[R] p
[PROOFSTEP]
rw [toFunAlgHom_apply_tmul, eval₂_sum]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ (sum p fun n a_1 => eval₂ (↑includeLeft) (1 ⊗ₜ[R] X) (↑(monomial n) (a * ↑(algebraMap R A) a_1))) = a ⊗ₜ[R] p
[PROOFSTEP]
simp_rw [eval₂_monomial, AlgHom.coe_toRingHom, Algebra.TensorProduct.tmul_pow, one_pow,
  Algebra.TensorProduct.includeLeft_apply, Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul, ← Algebra.commutes, ←
  Algebra.smul_def, smul_tmul, sum_def, ← tmul_sum]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ (a ⊗ₜ[R] Finset.sum (support p) fun a => coeff p a • X ^ a) = a ⊗ₜ[R] p
[PROOFSTEP]
conv_rhs => rw [← sum_C_mul_X_pow_eq p]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
| a ⊗ₜ[R] p
[PROOFSTEP]
rw [← sum_C_mul_X_pow_eq p]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
| a ⊗ₜ[R] p
[PROOFSTEP]
rw [← sum_C_mul_X_pow_eq p]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
| a ⊗ₜ[R] p
[PROOFSTEP]
rw [← sum_C_mul_X_pow_eq p]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ (a ⊗ₜ[R] Finset.sum (support p) fun a => coeff p a • X ^ a) = a ⊗ₜ[R] sum p fun n a => ↑C a * X ^ n
[PROOFSTEP]
simp only [Algebra.smul_def]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
a : A
p : R[X]
⊢ (a ⊗ₜ[R] Finset.sum (support p) fun x => ↑(algebraMap R R[X]) (coeff p x) * X ^ x) =
    a ⊗ₜ[R] sum p fun n a => ↑C a * X ^ n
[PROOFSTEP]
rfl
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A ⊗[R] R[X]
⊢ ∀ (x y : A ⊗[R] R[X]),
    invFun R A (↑(toFunAlgHom R A) x) = x →
      invFun R A (↑(toFunAlgHom R A) y) = y → invFun R A (↑(toFunAlgHom R A) (x + y)) = x + y
[PROOFSTEP]
intro p q hp hq
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x p q : A ⊗[R] R[X]
hp : invFun R A (↑(toFunAlgHom R A) p) = p
hq : invFun R A (↑(toFunAlgHom R A) q) = q
⊢ invFun R A (↑(toFunAlgHom R A) (p + q)) = p + q
[PROOFSTEP]
simp only [AlgHom.map_add, invFun_add, hp, hq]
[GOAL]
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
⊢ ↑(toFunAlgHom R A) (invFun R A x) = x
[PROOFSTEP]
refine Polynomial.induction_on' x ?_ ?_
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
⊢ ∀ (p q : A[X]),
    ↑(toFunAlgHom R A) (invFun R A p) = p →
      ↑(toFunAlgHom R A) (invFun R A q) = q → ↑(toFunAlgHom R A) (invFun R A (p + q)) = p + q
[PROOFSTEP]
intro p q hp hq
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x p q : A[X]
hp : ↑(toFunAlgHom R A) (invFun R A p) = p
hq : ↑(toFunAlgHom R A) (invFun R A q) = q
⊢ ↑(toFunAlgHom R A) (invFun R A (p + q)) = p + q
[PROOFSTEP]
simp only [invFun_add, AlgHom.map_add, hp, hq]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
⊢ ∀ (n : ℕ) (a : A), ↑(toFunAlgHom R A) (invFun R A (↑(monomial n) a)) = ↑(monomial n) a
[PROOFSTEP]
intro n a
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
n : ℕ
a : A
⊢ ↑(toFunAlgHom R A) (invFun R A (↑(monomial n) a)) = ↑(monomial n) a
[PROOFSTEP]
rw [invFun_monomial, Algebra.TensorProduct.tmul_pow, one_pow, Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul,
  toFunAlgHom_apply_tmul, X_pow_eq_monomial, sum_monomial_index]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
n : ℕ
a : A
⊢ ↑(monomial n) (a * ↑(algebraMap R A) 1) = ↑(monomial n) a
[PROOFSTEP]
simp
[GOAL]
case refine_2.hf
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
x : A[X]
n : ℕ
a : A
⊢ ↑(monomial n) (a * ↑(algebraMap R A) 0) = 0
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ ↑matPolyEquiv (stdBasisMatrix i j (↑(monomial k) x)) = ↑(monomial k) (stdBasisMatrix i j x)
[PROOFSTEP]
simp only [matPolyEquiv, AlgEquiv.trans_apply, matrixEquivTensor_apply_std_basis]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ ↑(AlgEquiv.symm (polyEquivTensor R (Matrix n n R)))
      (↑(Algebra.TensorProduct.comm R R[X] (Matrix n n R)) (↑(monomial k) x ⊗ₜ[R] stdBasisMatrix i j 1)) =
    ↑(monomial k) (stdBasisMatrix i j x)
[PROOFSTEP]
apply (polyEquivTensor R (Matrix n n R)).injective
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ ↑(polyEquivTensor R (Matrix n n R))
      (↑(AlgEquiv.symm (polyEquivTensor R (Matrix n n R)))
        (↑(Algebra.TensorProduct.comm R R[X] (Matrix n n R)) (↑(monomial k) x ⊗ₜ[R] stdBasisMatrix i j 1))) =
    ↑(polyEquivTensor R (Matrix n n R)) (↑(monomial k) (stdBasisMatrix i j x))
[PROOFSTEP]
simp only [AlgEquiv.apply_symm_apply, Algebra.TensorProduct.comm_tmul, polyEquivTensor_apply, eval₂_monomial]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ stdBasisMatrix i j 1 ⊗ₜ[R] ↑(monomial k) x = ↑↑includeLeft (stdBasisMatrix i j x) * 1 ⊗ₜ[R] X ^ k
[PROOFSTEP]
simp only [Algebra.TensorProduct.tmul_mul_tmul, one_pow, one_mul, Matrix.mul_one, Algebra.TensorProduct.tmul_pow,
  Algebra.TensorProduct.includeLeft_apply]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ stdBasisMatrix i j 1 ⊗ₜ[R] ↑(monomial k) x = ↑↑includeLeft (stdBasisMatrix i j x) * 1 ⊗ₜ[R] (X ^ k)
[PROOFSTEP]
rw [← smul_X_eq_monomial, ← TensorProduct.smul_tmul]
[GOAL]
case a
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
⊢ (x • stdBasisMatrix i j 1) ⊗ₜ[R] (X ^ k) = ↑↑includeLeft (stdBasisMatrix i j x) * 1 ⊗ₜ[R] (X ^ k)
[PROOFSTEP]
congr with i'
[GOAL]
case a.e_m.a.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
i' x✝ : n
⊢ (x • stdBasisMatrix i j 1) i' x✝ = ↑(LinearMap.mulLeft R (stdBasisMatrix i j x, 1).fst) (1, X ^ k).fst i' x✝
[PROOFSTEP]
simp [stdBasisMatrix]
[GOAL]
case a.e_n.a
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
k : ℕ
x : R
i' : ℕ
⊢ coeff (X ^ k) i' = coeff (↑(LinearMap.mulLeft R (stdBasisMatrix i j x, 1).snd) (1, X ^ k).snd) i'
[PROOFSTEP]
simp [stdBasisMatrix]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k : ℕ
⊢ coeff (↑matPolyEquiv (stdBasisMatrix i j p)) k = stdBasisMatrix i j (coeff p k)
[PROOFSTEP]
refine Polynomial.induction_on' p ?_ ?_
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k : ℕ
⊢ ∀ (p q : R[X]),
    coeff (↑matPolyEquiv (stdBasisMatrix i j p)) k = stdBasisMatrix i j (coeff p k) →
      coeff (↑matPolyEquiv (stdBasisMatrix i j q)) k = stdBasisMatrix i j (coeff q k) →
        coeff (↑matPolyEquiv (stdBasisMatrix i j (p + q))) k = stdBasisMatrix i j (coeff (p + q) k)
[PROOFSTEP]
intro p q hp hq
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p✝ : R[X]
k : ℕ
p q : R[X]
hp : coeff (↑matPolyEquiv (stdBasisMatrix i j p)) k = stdBasisMatrix i j (coeff p k)
hq : coeff (↑matPolyEquiv (stdBasisMatrix i j q)) k = stdBasisMatrix i j (coeff q k)
⊢ coeff (↑matPolyEquiv (stdBasisMatrix i j (p + q))) k = stdBasisMatrix i j (coeff (p + q) k)
[PROOFSTEP]
ext
[GOAL]
case refine_1.a.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p✝ : R[X]
k : ℕ
p q : R[X]
hp : coeff (↑matPolyEquiv (stdBasisMatrix i j p)) k = stdBasisMatrix i j (coeff p k)
hq : coeff (↑matPolyEquiv (stdBasisMatrix i j q)) k = stdBasisMatrix i j (coeff q k)
i✝ x✝ : n
⊢ coeff (↑matPolyEquiv (stdBasisMatrix i j (p + q))) k i✝ x✝ = stdBasisMatrix i j (coeff (p + q) k) i✝ x✝
[PROOFSTEP]
simp [hp, hq, coeff_add, DMatrix.add_apply, stdBasisMatrix_add]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k : ℕ
⊢ ∀ (n_1 : ℕ) (a : R),
    coeff (↑matPolyEquiv (stdBasisMatrix i j (↑(monomial n_1) a))) k = stdBasisMatrix i j (coeff (↑(monomial n_1) a) k)
[PROOFSTEP]
intro k x
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
⊢ coeff (↑matPolyEquiv (stdBasisMatrix i j (↑(monomial k) x))) k✝ = stdBasisMatrix i j (coeff (↑(monomial k) x) k✝)
[PROOFSTEP]
simp only [matPolyEquiv_coeff_apply_aux_1, coeff_monomial]
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
⊢ (if k = k✝ then stdBasisMatrix i j x else 0) = stdBasisMatrix i j (if k = k✝ then x else 0)
[PROOFSTEP]
split_ifs
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
h✝ : k = k✝
⊢ stdBasisMatrix i j x = stdBasisMatrix i j x
[PROOFSTEP]
funext
[GOAL]
case pos.h.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
h✝ : k = k✝
x✝¹ x✝ : n
⊢ stdBasisMatrix i j x x✝¹ x✝ = stdBasisMatrix i j x x✝¹ x✝
[PROOFSTEP]
simp
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
h✝ : ¬k = k✝
⊢ 0 = stdBasisMatrix i j 0
[PROOFSTEP]
funext
[GOAL]
case neg.h.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
i j : n
p : R[X]
k✝ k : ℕ
x : R
h✝ : ¬k = k✝
x✝¹ x✝ : n
⊢ OfNat.ofNat 0 x✝¹ x✝ = stdBasisMatrix i j 0 x✝¹ x✝
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j : n
⊢ coeff (↑matPolyEquiv m) k i j = coeff (m i j) k
[PROOFSTEP]
refine Matrix.induction_on' m ?_ ?_ ?_
[GOAL]
case refine_1
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j : n
⊢ coeff (↑matPolyEquiv 0) k i j = coeff (OfNat.ofNat 0 i j) k
[PROOFSTEP]
simp
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j : n
⊢ ∀ (p q : Matrix n n R[X]),
    coeff (↑matPolyEquiv p) k i j = coeff (p i j) k →
      coeff (↑matPolyEquiv q) k i j = coeff (q i j) k → coeff (↑matPolyEquiv (p + q)) k i j = coeff ((p + q) i j) k
[PROOFSTEP]
intro p q hp hq
[GOAL]
case refine_2
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j : n
p q : Matrix n n R[X]
hp : coeff (↑matPolyEquiv p) k i j = coeff (p i j) k
hq : coeff (↑matPolyEquiv q) k i j = coeff (q i j) k
⊢ coeff (↑matPolyEquiv (p + q)) k i j = coeff ((p + q) i j) k
[PROOFSTEP]
simp [hp, hq]
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j : n
⊢ ∀ (i_1 j_1 : n) (x : R[X]),
    coeff (↑matPolyEquiv (stdBasisMatrix i_1 j_1 x)) k i j = coeff (stdBasisMatrix i_1 j_1 x i j) k
[PROOFSTEP]
intro i' j' x
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
⊢ coeff (↑matPolyEquiv (stdBasisMatrix i' j' x)) k i j = coeff (stdBasisMatrix i' j' x i j) k
[PROOFSTEP]
erw [matPolyEquiv_coeff_apply_aux_2]
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
⊢ stdBasisMatrix i' j' (coeff x k) i j = coeff (stdBasisMatrix i' j' x i j) k
[PROOFSTEP]
dsimp [stdBasisMatrix]
[GOAL]
case refine_3
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
⊢ (if i' = i ∧ j' = j then coeff x k else 0) = coeff (if i' = i ∧ j' = j then x else 0) k
[PROOFSTEP]
split_ifs
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
h✝ : i' = i ∧ j' = j
⊢ coeff x k = coeff x k
[PROOFSTEP]
rename_i h
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
h✝ : ¬(i' = i ∧ j' = j)
⊢ 0 = coeff 0 k
[PROOFSTEP]
rename_i h
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
h : i' = i ∧ j' = j
⊢ coeff x k = coeff x k
[PROOFSTEP]
rcases h with ⟨rfl, rfl⟩
[GOAL]
case pos.intro
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i' j' : n
x : R[X]
⊢ coeff x k = coeff x k
[PROOFSTEP]
simp [stdBasisMatrix]
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
k : ℕ
i j i' j' : n
x : R[X]
h : ¬(i' = i ∧ j' = j)
⊢ 0 = coeff 0 k
[PROOFSTEP]
simp [stdBasisMatrix, h]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
⊢ coeff (↑(AlgEquiv.symm matPolyEquiv) p i j) k = coeff p k i j
[PROOFSTEP]
have t : p = matPolyEquiv (matPolyEquiv.symm p) := by simp
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
⊢ p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
t : p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
⊢ coeff (↑(AlgEquiv.symm matPolyEquiv) p i j) k = coeff p k i j
[PROOFSTEP]
conv_rhs => rw [t]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
t : p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
| coeff p k i j
[PROOFSTEP]
rw [t]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
t : p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
| coeff p k i j
[PROOFSTEP]
rw [t]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
t : p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
| coeff p k i j
[PROOFSTEP]
rw [t]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : (Matrix n n R)[X]
i j : n
k : ℕ
t : p = ↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)
⊢ coeff (↑(AlgEquiv.symm matPolyEquiv) p i j) k = coeff (↑matPolyEquiv (↑(AlgEquiv.symm matPolyEquiv) p)) k i j
[PROOFSTEP]
simp only [matPolyEquiv_coeff_apply]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
⊢ ↑matPolyEquiv (p • 1) = Polynomial.map (algebraMap R (Matrix n n R)) p
[PROOFSTEP]
ext m i j
[GOAL]
case a.a.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
⊢ coeff (↑matPolyEquiv (p • 1)) m i j = coeff (Polynomial.map (algebraMap R (Matrix n n R)) p) m i j
[PROOFSTEP]
simp only [coeff_map, one_apply, algebraMap_matrix_apply, mul_boole, Pi.smul_apply, matPolyEquiv_coeff_apply]
[GOAL]
case a.a.h
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
⊢ coeff ((p • 1) i j) m = if i = j then ↑(algebraMap R R) (coeff p m) else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h✝ : i = j
⊢ coeff ((p • 1) i j) m = ↑(algebraMap R R) (coeff p m)
[PROOFSTEP]
simp
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h✝ : ¬i = j
⊢ coeff ((p • 1) i j) m = 0
[PROOFSTEP]
simp
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h✝ : i = j
⊢ coeff (p * OfNat.ofNat 1 i j) m = coeff p m
[PROOFSTEP]
rename_i h
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h✝ : ¬i = j
⊢ coeff (p * OfNat.ofNat 1 i j) m = 0
[PROOFSTEP]
rename_i h
[GOAL]
case pos
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h : i = j
⊢ coeff (p * OfNat.ofNat 1 i j) m = coeff p m
[PROOFSTEP]
simp [h]
[GOAL]
case neg
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
p : R[X]
m : ℕ
i j : n
h : ¬i = j
⊢ coeff (p * OfNat.ofNat 1 i j) m = 0
[PROOFSTEP]
simp [h]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
⊢ support (m i j) ⊆ support (↑matPolyEquiv m)
[PROOFSTEP]
intro k
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
k : ℕ
⊢ k ∈ support (m i j) → k ∈ support (↑matPolyEquiv m)
[PROOFSTEP]
contrapose
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
k : ℕ
⊢ ¬k ∈ support (↑matPolyEquiv m) → ¬k ∈ support (m i j)
[PROOFSTEP]
simp only [not_mem_support_iff]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
k : ℕ
⊢ coeff (↑matPolyEquiv m) k = 0 → coeff (m i j) k = 0
[PROOFSTEP]
intro hk
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
k : ℕ
hk : coeff (↑matPolyEquiv m) k = 0
⊢ coeff (m i j) k = 0
[PROOFSTEP]
rw [← matPolyEquiv_coeff_apply, hk]
[GOAL]
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
m : Matrix n n R[X]
i j : n
k : ℕ
hk : coeff (↑matPolyEquiv m) k = 0
⊢ OfNat.ofNat 0 i j = 0
[PROOFSTEP]
rfl


[GOAL]
α : Type u_1
l : List α
x : α
h : x ∈+ l
⊢ x ∈ l
[PROOFSTEP]
induction' h with l' _ y l' _ hm
[GOAL]
case cons_mem
α : Type u_1
l : List α
x : α
l' : List α
a✝ : x ∈ l'
⊢ x ∈ x :: l'
[PROOFSTEP]
exact mem_cons_self _ _
[GOAL]
case cons_duplicate
α : Type u_1
l : List α
x y : α
l' : List α
a✝ : x ∈+ l'
hm : x ∈ l'
⊢ x ∈ y :: l'
[PROOFSTEP]
exact mem_cons_of_mem _ hm
[GOAL]
α : Type u_1
l : List α
x : α
h : x ∈+ x :: l
⊢ x ∈ l
[PROOFSTEP]
cases' h with _ h _ _ h
[GOAL]
case cons_mem
α : Type u_1
l : List α
x : α
h : x ∈ l
⊢ x ∈ l
[PROOFSTEP]
exact h
[GOAL]
case cons_duplicate
α : Type u_1
l : List α
x : α
h : x ∈+ l
⊢ x ∈ l
[PROOFSTEP]
exact h.mem
[GOAL]
α : Type u_1
l : List α
x : α
h : x ∈+ l
y : α
⊢ l ≠ [y]
[PROOFSTEP]
induction' h with l' h z l' h _
[GOAL]
case cons_mem
α : Type u_1
l : List α
x y : α
l' : List α
h : x ∈ l'
⊢ x :: l' ≠ [y]
[PROOFSTEP]
simp [ne_nil_of_mem h]
[GOAL]
case cons_duplicate
α : Type u_1
l : List α
x y z : α
l' : List α
h : x ∈+ l'
a_ih✝ : l' ≠ [y]
⊢ z :: l' ≠ [y]
[PROOFSTEP]
simp [ne_nil_of_mem h.mem]
[GOAL]
α : Type u_1
l : List α
x y : α
⊢ x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l
[PROOFSTEP]
refine' ⟨fun h => _, fun h => _⟩
[GOAL]
case refine'_1
α : Type u_1
l : List α
x y : α
h : x ∈+ y :: l
⊢ y = x ∧ x ∈ l ∨ x ∈+ l
[PROOFSTEP]
cases' h with _ hm _ _ hm
[GOAL]
case refine'_1.cons_mem
α : Type u_1
l : List α
x : α
hm : x ∈ l
⊢ x = x ∧ x ∈ l ∨ x ∈+ l
[PROOFSTEP]
exact Or.inl ⟨rfl, hm⟩
[GOAL]
case refine'_1.cons_duplicate
α : Type u_1
l : List α
x y : α
hm : x ∈+ l
⊢ y = x ∧ x ∈ l ∨ x ∈+ l
[PROOFSTEP]
exact Or.inr hm
[GOAL]
case refine'_2
α : Type u_1
l : List α
x y : α
h : y = x ∧ x ∈ l ∨ x ∈+ l
⊢ x ∈+ y :: l
[PROOFSTEP]
rcases h with (⟨rfl | h⟩ | h)
[GOAL]
case refine'_2.inl.intro.refl
α : Type u_1
l : List α
x : α
right✝ : x ∈ l
⊢ x ∈+ x :: l
[PROOFSTEP]
simpa
[GOAL]
case refine'_2.inr
α : Type u_1
l : List α
x y : α
h : x ∈+ l
⊢ x ∈+ y :: l
[PROOFSTEP]
exact h.cons_duplicate
[GOAL]
α : Type u_1
l : List α
x y : α
h : x ∈+ y :: l
hx : x ≠ y
⊢ x ∈+ l
[PROOFSTEP]
simpa [duplicate_cons_iff, hx.symm] using h
[GOAL]
α : Type u_1
l : List α
x y : α
hne : x ≠ y
⊢ x ∈+ y :: l ↔ x ∈+ l
[PROOFSTEP]
simp [duplicate_cons_iff, hne.symm]
[GOAL]
α : Type u_1
l : List α
x : α
l' : List α
hx : x ∈+ l
h : l <+ l'
⊢ x ∈+ l'
[PROOFSTEP]
induction' h with l₁ l₂ y _ IH l₁ l₂ y h IH
[GOAL]
case slnil
α : Type u_1
l : List α
x : α
l' : List α
hx✝ : x ∈+ l
hx : x ∈+ []
⊢ x ∈+ []
[PROOFSTEP]
exact hx
[GOAL]
case cons
α : Type u_1
l : List α
x : α
l' : List α
hx✝ : x ∈+ l
l₁ l₂ : List α
y : α
a✝ : l₁ <+ l₂
IH : x ∈+ l₁ → x ∈+ l₂
hx : x ∈+ l₁
⊢ x ∈+ y :: l₂
[PROOFSTEP]
exact (IH hx).duplicate_cons _
[GOAL]
case cons₂
α : Type u_1
l : List α
x : α
l' : List α
hx✝ : x ∈+ l
l₁ l₂ : List α
y : α
h : l₁ <+ l₂
IH : x ∈+ l₁ → x ∈+ l₂
hx : x ∈+ y :: l₁
⊢ x ∈+ y :: l₂
[PROOFSTEP]
rw [duplicate_cons_iff] at hx ⊢
[GOAL]
case cons₂
α : Type u_1
l : List α
x : α
l' : List α
hx✝ : x ∈+ l
l₁ l₂ : List α
y : α
h : l₁ <+ l₂
IH : x ∈+ l₁ → x ∈+ l₂
hx : y = x ∧ x ∈ l₁ ∨ x ∈+ l₁
⊢ y = x ∧ x ∈ l₂ ∨ x ∈+ l₂
[PROOFSTEP]
rcases hx with (⟨rfl, hx⟩ | hx)
[GOAL]
case cons₂.inl.intro
α : Type u_1
l l' l₁ l₂ : List α
y : α
h : l₁ <+ l₂
hx✝ : y ∈+ l
IH : y ∈+ l₁ → y ∈+ l₂
hx : y ∈ l₁
⊢ y = y ∧ y ∈ l₂ ∨ y ∈+ l₂
[PROOFSTEP]
simp [h.subset hx]
[GOAL]
case cons₂.inr
α : Type u_1
l : List α
x : α
l' : List α
hx✝ : x ∈+ l
l₁ l₂ : List α
y : α
h : l₁ <+ l₂
IH : x ∈+ l₁ → x ∈+ l₂
hx : x ∈+ l₁
⊢ y = x ∧ x ∈ l₂ ∨ x ∈+ l₂
[PROOFSTEP]
simp [IH hx]
[GOAL]
α : Type u_1
l : List α
x : α
⊢ x ∈+ l ↔ [x, x] <+ l
[PROOFSTEP]
induction' l with y l IH
[GOAL]
case nil
α : Type u_1
l : List α
x : α
⊢ x ∈+ [] ↔ [x, x] <+ []
[PROOFSTEP]
simp
[GOAL]
case cons
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
⊢ x ∈+ y :: l ↔ [x, x] <+ y :: l
[PROOFSTEP]
by_cases hx : x = y
[GOAL]
case pos
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : x = y
⊢ x ∈+ y :: l ↔ [x, x] <+ y :: l
[PROOFSTEP]
simp [hx, cons_sublist_cons_iff, singleton_sublist]
[GOAL]
case neg
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : ¬x = y
⊢ x ∈+ y :: l ↔ [x, x] <+ y :: l
[PROOFSTEP]
rw [duplicate_cons_iff_of_ne hx, IH]
[GOAL]
case neg
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : ¬x = y
⊢ [x, x] <+ l ↔ [x, x] <+ y :: l
[PROOFSTEP]
refine' ⟨sublist_cons_of_sublist y, fun h => _⟩
[GOAL]
case neg
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : ¬x = y
h : [x, x] <+ y :: l
⊢ [x, x] <+ l
[PROOFSTEP]
cases h
[GOAL]
case neg.cons
α : Type u_1
l✝ : List α
x y : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : ¬x = y
a✝ : [x, x] <+ l
⊢ [x, x] <+ l
[PROOFSTEP]
assumption
[GOAL]
case neg.cons₂
α : Type u_1
l✝ : List α
x : α
l : List α
IH : x ∈+ l ↔ [x, x] <+ l
hx : ¬x = x
a✝ : [x] <+ l
⊢ [x, x] <+ l
[PROOFSTEP]
contradiction
[GOAL]
α : Type u_1
l : List α
x : α
⊢ Nodup l ↔ ∀ (x : α), ¬x ∈+ l
[PROOFSTEP]
simp_rw [nodup_iff_sublist, duplicate_iff_sublist]
[GOAL]
α : Type u_1
l : List α
x : α
⊢ (∃ x, x ∈+ l) ↔ ¬Nodup l
[PROOFSTEP]
simp [nodup_iff_forall_not_duplicate]
[GOAL]
α : Type u_1
l : List α
x : α
inst✝ : DecidableEq α
⊢ x ∈+ l ↔ 2 ≤ count x l
[PROOFSTEP]
simp [duplicate_iff_sublist, le_count_iff_replicate_sublist]
[GOAL]
α : Type u_1
l✝ : List α
x✝ : α
inst✝ : DecidableEq α
x y : α
l : List α
h : ¬x ∈+ l
hx : ¬(y = x ∧ x ∈ l)
⊢ ¬x ∈+ y :: l
[PROOFSTEP]
simpa [duplicate_cons_iff, h] using hx


[GOAL]
l : List Bool
b : Bool
⊢ count (!b) l + count b l = length l
[PROOFSTEP]
simp only [length_eq_countp_add_countp (· == !b), count, add_right_inj]
[GOAL]
l : List Bool
b : Bool
⊢ countp (fun x => x == b) l = countp (fun a => decide ¬(a == !b) = true) l
[PROOFSTEP]
suffices : (fun x => x == b) = (fun a => decide ¬(a == !b) = true)
[GOAL]
l : List Bool
b : Bool
this : (fun x => x == b) = fun a => decide ¬(a == !b) = true
⊢ countp (fun x => x == b) l = countp (fun a => decide ¬(a == !b) = true) l
case this l : List Bool b : Bool ⊢ (fun x => x == b) = fun a => decide ¬(a == !b) = true
[PROOFSTEP]
rw [this]
[GOAL]
case this
l : List Bool
b : Bool
⊢ (fun x => x == b) = fun a => decide ¬(a == !b) = true
[PROOFSTEP]
ext x
[GOAL]
case this.h
l : List Bool
b x : Bool
⊢ (x == b) = decide ¬(x == !b) = true
[PROOFSTEP]
cases x
[GOAL]
case this.h.false
l : List Bool
b : Bool
⊢ (false == b) = decide ¬(false == !b) = true
[PROOFSTEP]
cases b
[GOAL]
case this.h.true
l : List Bool
b : Bool
⊢ (true == b) = decide ¬(true == !b) = true
[PROOFSTEP]
cases b
[GOAL]
case this.h.false.false
l : List Bool
⊢ (false == false) = decide ¬(false == !false) = true
[PROOFSTEP]
rfl
[GOAL]
case this.h.false.true
l : List Bool
⊢ (false == true) = decide ¬(false == !true) = true
[PROOFSTEP]
rfl
[GOAL]
case this.h.true.false
l : List Bool
⊢ (true == false) = decide ¬(true == !false) = true
[PROOFSTEP]
rfl
[GOAL]
case this.h.true.true
l : List Bool
⊢ (true == true) = decide ¬(true == !true) = true
[PROOFSTEP]
rfl
[GOAL]
l : List Bool
b : Bool
⊢ count b l + count (!b) l = length l
[PROOFSTEP]
rw [add_comm, count_not_add_count]
[GOAL]
b x : Bool
l : List Bool
h : Chain (fun x x_1 => x ≠ x_1) b (x :: l)
⊢ count (!b) (x :: l) = count b (x :: l) + length (x :: l) % 2
[PROOFSTEP]
obtain rfl : b = !x := Bool.eq_not_iff.2 (rel_of_chain_cons h)
[GOAL]
x : Bool
l : List Bool
h : Chain (fun x x_1 => x ≠ x_1) (!x) (x :: l)
⊢ count (!!x) (x :: l) = count (!x) (x :: l) + length (x :: l) % 2
[PROOFSTEP]
rw [Bool.not_not, count_cons_self, count_cons_of_ne x.not_ne_self, Chain.count_not (chain_of_chain_cons h), length,
  add_assoc, Nat.mod_two_add_succ_mod_two]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
h2 : Even (length l)
b : Bool
⊢ count (!b) l = count b l
[PROOFSTEP]
cases' l with x l
[GOAL]
case nil
b : Bool
hl : Chain' (fun x x_1 => x ≠ x_1) []
h2 : Even (length [])
⊢ count (!b) [] = count b []
[PROOFSTEP]
rfl
[GOAL]
case cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : Even (length (x :: l))
⊢ count (!b) (x :: l) = count b (x :: l)
[PROOFSTEP]
rw [length_cons, Nat.even_add_one, Nat.not_even_iff] at h2
[GOAL]
case cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : length l % 2 = 1
⊢ count (!b) (x :: l) = count b (x :: l)
[PROOFSTEP]
suffices count (!x) (x :: l) = count x (x :: l) by
  -- Porting note: old proof is
      -- cases b <;> cases x <;> try exact this;cases b <;> cases x <;> revert this <;>
          simp only [Bool.not_false, Bool.not_true] <;>
        intro this <;>
      (try exact this) <;>
    exact this.symm
[GOAL]
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : length l % 2 = 1
this : count (!x) (x :: l) = count x (x :: l)
⊢ count (!b) (x :: l) = count b (x :: l)
[PROOFSTEP]
cases b
[GOAL]
case false
x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : length l % 2 = 1
this : count (!x) (x :: l) = count x (x :: l)
⊢ count (!false) (x :: l) = count false (x :: l)
[PROOFSTEP]
cases x
[GOAL]
case true
x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : length l % 2 = 1
this : count (!x) (x :: l) = count x (x :: l)
⊢ count (!true) (x :: l) = count true (x :: l)
[PROOFSTEP]
cases x
[GOAL]
case false.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count (!false) (false :: l) = count false (false :: l)
⊢ count (!false) (false :: l) = count false (false :: l)
[PROOFSTEP]
revert this
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count (!true) (true :: l) = count true (true :: l)
⊢ count (!false) (true :: l) = count false (true :: l)
[PROOFSTEP]
revert this
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count (!false) (false :: l) = count false (false :: l)
⊢ count (!true) (false :: l) = count true (false :: l)
[PROOFSTEP]
revert this
[GOAL]
case true.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count (!true) (true :: l) = count true (true :: l)
⊢ count (!true) (true :: l) = count true (true :: l)
[PROOFSTEP]
revert this
[GOAL]
case false.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
⊢ count (!false) (false :: l) = count false (false :: l) → count (!false) (false :: l) = count false (false :: l)
[PROOFSTEP]
simp only [Bool.not_false, Bool.not_true]
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
⊢ count (!true) (true :: l) = count true (true :: l) → count (!false) (true :: l) = count false (true :: l)
[PROOFSTEP]
simp only [Bool.not_false, Bool.not_true]
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
⊢ count (!false) (false :: l) = count false (false :: l) → count (!true) (false :: l) = count true (false :: l)
[PROOFSTEP]
simp only [Bool.not_false, Bool.not_true]
[GOAL]
case true.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
⊢ count (!true) (true :: l) = count true (true :: l) → count (!true) (true :: l) = count true (true :: l)
[PROOFSTEP]
simp only [Bool.not_false, Bool.not_true]
[GOAL]
case false.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
⊢ count true (false :: l) = count false (false :: l) → count true (false :: l) = count false (false :: l)
[PROOFSTEP]
intro this
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
⊢ count false (true :: l) = count true (true :: l) → count true (true :: l) = count false (true :: l)
[PROOFSTEP]
intro this
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
⊢ count true (false :: l) = count false (false :: l) → count false (false :: l) = count true (false :: l)
[PROOFSTEP]
intro this
[GOAL]
case true.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
⊢ count false (true :: l) = count true (true :: l) → count false (true :: l) = count true (true :: l)
[PROOFSTEP]
intro this
[GOAL]
case false.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count true (false :: l) = count false (false :: l)
⊢ count true (false :: l) = count false (false :: l)
[PROOFSTEP]
try exact this
[GOAL]
case false.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count true (false :: l) = count false (false :: l)
⊢ count true (false :: l) = count false (false :: l)
[PROOFSTEP]
exact this
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count false (true :: l) = count true (true :: l)
⊢ count true (true :: l) = count false (true :: l)
[PROOFSTEP]
try exact this
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count false (true :: l) = count true (true :: l)
⊢ count true (true :: l) = count false (true :: l)
[PROOFSTEP]
exact this
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count true (false :: l) = count false (false :: l)
⊢ count false (false :: l) = count true (false :: l)
[PROOFSTEP]
try exact this
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count true (false :: l) = count false (false :: l)
⊢ count false (false :: l) = count true (false :: l)
[PROOFSTEP]
exact this
[GOAL]
case true.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count false (true :: l) = count true (true :: l)
⊢ count false (true :: l) = count true (true :: l)
[PROOFSTEP]
try exact this
[GOAL]
case true.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count false (true :: l) = count true (true :: l)
⊢ count false (true :: l) = count true (true :: l)
[PROOFSTEP]
exact this
[GOAL]
case false.true
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (true :: l)
this : count false (true :: l) = count true (true :: l)
⊢ count true (true :: l) = count false (true :: l)
[PROOFSTEP]
exact this.symm
[GOAL]
case true.false
l : List Bool
h2 : length l % 2 = 1
hl : Chain' (fun x x_1 => x ≠ x_1) (false :: l)
this : count true (false :: l) = count false (false :: l)
⊢ count false (false :: l) = count true (false :: l)
[PROOFSTEP]
exact this.symm
[GOAL]
case cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : length l % 2 = 1
⊢ count (!x) (x :: l) = count x (x :: l)
[PROOFSTEP]
rw [count_cons_of_ne x.not_ne_self, hl.count_not, h2, count_cons_self]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ count (!b) l ≤ count b l + 1
[PROOFSTEP]
cases' l with x l
[GOAL]
case nil
b : Bool
hl : Chain' (fun x x_1 => x ≠ x_1) []
⊢ count (!b) [] ≤ count b [] + 1
[PROOFSTEP]
exact zero_le _
[GOAL]
case cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
⊢ count (!b) (x :: l) ≤ count b (x :: l) + 1
[PROOFSTEP]
obtain rfl | rfl : b = x ∨ b = !x := by simp only [Bool.eq_not_iff, em]
[GOAL]
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
⊢ b = x ∨ b = !x
[PROOFSTEP]
simp only [Bool.eq_not_iff, em]
[GOAL]
case cons.inl
b : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (b :: l)
⊢ count (!b) (b :: l) ≤ count b (b :: l) + 1
[PROOFSTEP]
rw [count_cons_of_ne b.not_ne_self, count_cons_self, hl.count_not, add_assoc]
[GOAL]
case cons.inl
b : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (b :: l)
⊢ count b l + length l % 2 ≤ count b l + (1 + 1)
[PROOFSTEP]
exact add_le_add_left (Nat.mod_lt _ two_pos).le _
[GOAL]
case cons.inr
x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
⊢ count (!!x) (x :: l) ≤ count (!x) (x :: l) + 1
[PROOFSTEP]
rw [Bool.not_not, count_cons_self, count_cons_of_ne x.not_ne_self, hl.count_not]
[GOAL]
case cons.inr
x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
⊢ count x l + 1 ≤ count x l + length l % 2 + 1
[PROOFSTEP]
exact add_le_add_right (le_add_right le_rfl) _
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
h2 : Even (length l)
b : Bool
⊢ 2 * count b l = length l
[PROOFSTEP]
rw [← count_not_add_count l b, hl.count_not_eq_count h2, two_mul]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ 2 * count b l =
    if Even (length l) then length l else if (some b == head? l) = true then length l + 1 else length l - 1
[PROOFSTEP]
by_cases h2 : Even (length l)
[GOAL]
case pos
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h2 : Even (length l)
⊢ 2 * count b l =
    if Even (length l) then length l else if (some b == head? l) = true then length l + 1 else length l - 1
[PROOFSTEP]
rw [if_pos h2, hl.two_mul_count_bool_of_even h2]
[GOAL]
case neg
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h2 : ¬Even (length l)
⊢ 2 * count b l =
    if Even (length l) then length l else if (some b == head? l) = true then length l + 1 else length l - 1
[PROOFSTEP]
cases' l with x l
[GOAL]
case neg.nil
b : Bool
hl : Chain' (fun x x_1 => x ≠ x_1) []
h2 : ¬Even (length [])
⊢ 2 * count b [] =
    if Even (length []) then length [] else if (some b == head? []) = true then length [] + 1 else length [] - 1
[PROOFSTEP]
exact (h2 even_zero).elim
[GOAL]
case neg.cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : ¬Even (length (x :: l))
⊢ 2 * count b (x :: l) =
    if Even (length (x :: l)) then length (x :: l)
    else if (some b == head? (x :: l)) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
simp only [if_neg h2, count_cons', mul_add, head?, Option.mem_some_iff, @eq_comm _ x]
[GOAL]
case neg.cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : ¬Even (length (x :: l))
⊢ (2 * count b l + 2 * if b = x then 1 else 0) =
    if (some b == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
rw [length_cons, Nat.even_add_one, not_not] at h2
[GOAL]
case neg.cons
b x : Bool
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) (x :: l)
h2 : Even (length l)
⊢ (2 * count b l + 2 * if b = x then 1 else 0) =
    if (some b == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
replace hl : l.Chain' (· ≠ ·) := hl.tail
[GOAL]
case neg.cons
b x : Bool
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (2 * count b l + 2 * if b = x then 1 else 0) =
    if (some b == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
rw [hl.two_mul_count_bool_of_even h2]
[GOAL]
case neg.cons
b x : Bool
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if b = x then 1 else 0) =
    if (some b == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
cases b
[GOAL]
case neg.cons.false
x : Bool
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if false = x then 1 else 0) =
    if (some false == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
cases x
[GOAL]
case neg.cons.true
x : Bool
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if true = x then 1 else 0) =
    if (some true == some x) = true then length (x :: l) + 1 else length (x :: l) - 1
[PROOFSTEP]
cases x
[GOAL]
case neg.cons.false.false
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if false = false then 1 else 0) =
    if (some false == some false) = true then length (false :: l) + 1 else length (false :: l) - 1
[PROOFSTEP]
split_ifs
[GOAL]
case neg.cons.false.true
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if false = true then 1 else 0) =
    if (some false == some true) = true then length (true :: l) + 1 else length (true :: l) - 1
[PROOFSTEP]
split_ifs
[GOAL]
case neg.cons.true.false
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if true = false then 1 else 0) =
    if (some true == some false) = true then length (false :: l) + 1 else length (false :: l) - 1
[PROOFSTEP]
split_ifs
[GOAL]
case neg.cons.true.true
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
⊢ (length l + 2 * if true = true then 1 else 0) =
    if (some true == some true) = true then length (true :: l) + 1 else length (true :: l) - 1
[PROOFSTEP]
split_ifs
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : false = false
h✝ : (some false == some false) = true
⊢ length l + 2 * 1 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : false = false
h✝ : ¬(some false == some false) = true
⊢ length l + 2 * 1 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬false = false
h✝ : (some false == some false) = true
⊢ length l + 2 * 0 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬false = false
h✝ : ¬(some false == some false) = true
⊢ length l + 2 * 0 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : False
h✝ : (some false == some true) = true
⊢ length l + 2 * 1 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : False
h✝ : ¬(some false == some true) = true
⊢ length l + 2 * 1 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : ¬False
h✝ : (some false == some true) = true
⊢ length l + 2 * 0 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : ¬False
h✝ : ¬(some false == some true) = true
⊢ length l + 2 * 0 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : False
h✝ : (some false == some true) = true
⊢ length l + 2 * 1 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : False
h✝ : ¬(some false == some true) = true
⊢ length l + 2 * 1 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : ¬False
h✝ : (some false == some true) = true
⊢ length l + 2 * 0 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : ¬False
h✝ : ¬(some false == some true) = true
⊢ length l + 2 * 0 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : False
h✝ : (some true == some false) = true
⊢ length l + 2 * 1 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : False
h✝ : ¬(some true == some false) = true
⊢ length l + 2 * 1 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : ¬False
h✝ : (some true == some false) = true
⊢ length l + 2 * 0 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : ¬False
h✝ : ¬(some true == some false) = true
⊢ length l + 2 * 0 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : False
h✝ : (some true == some false) = true
⊢ length l + 2 * 1 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : False
h✝ : ¬(some true == some false) = true
⊢ length l + 2 * 1 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : ¬False
h✝ : (some true == some false) = true
⊢ length l + 2 * 0 = length (false :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : ¬False
h✝ : ¬(some true == some false) = true
⊢ length l + 2 * 0 = length (false :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : true = true
h✝ : (some true == some true) = true
⊢ length l + 2 * 1 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : true = true
h✝ : ¬(some true == some true) = true
⊢ length l + 2 * 1 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬true = true
h✝ : (some true == some true) = true
⊢ length l + 2 * 0 = length (true :: l) + 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬true = true
h✝ : ¬(some true == some true) = true
⊢ length l + 2 * 0 = length (true :: l) - 1
[PROOFSTEP]
simp
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : false = false
h✝ : ¬(some false == some false) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬false = false
h✝ : (some false == some false) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : False
h✝ : ¬(some false == some true) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : false = true
h✝¹ : ¬False
h✝ : (some false == some true) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : False
h✝ : ¬(some false == some true) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬false = true
h✝¹ : ¬False
h✝ : (some false == some true) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : False
h✝ : ¬(some true == some false) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : true = false
h✝¹ : ¬False
h✝ : (some true == some false) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : False
h✝ : ¬(some true == some false) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝² : ¬true = false
h✝¹ : ¬False
h✝ : (some true == some false) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
case neg
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : true = true
h✝ : ¬(some true == some true) = true
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
l : List Bool
h2 : Even (length l)
hl : Chain' (fun x x_1 => x ≠ x_1) l
h✝¹ : ¬true = true
h✝ : (some true == some true) = true
⊢ length l = Nat.succ (length l) + 1
[PROOFSTEP]
contradiction
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ length l - 1 ≤ 2 * count b l
[PROOFSTEP]
rw [hl.two_mul_count_bool_eq_ite]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ length l - 1 ≤ if Even (length l) then length l else if (some b == head? l) = true then length l + 1 else length l - 1
[PROOFSTEP]
split_ifs
[GOAL]
case pos
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝ : Even (length l)
⊢ length l - 1 ≤ length l
[PROOFSTEP]
simp [le_tsub_add, Nat.le_succ_of_le]
[GOAL]
case pos
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝¹ : ¬Even (length l)
h✝ : (some b == head? l) = true
⊢ length l - 1 ≤ length l + 1
[PROOFSTEP]
simp [le_tsub_add, Nat.le_succ_of_le]
[GOAL]
case neg
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝¹ : ¬Even (length l)
h✝ : ¬(some b == head? l) = true
⊢ length l - 1 ≤ length l - 1
[PROOFSTEP]
simp [le_tsub_add, Nat.le_succ_of_le]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ length l / 2 ≤ count b l
[PROOFSTEP]
rw [Nat.div_le_iff_le_mul_add_pred two_pos, ← tsub_le_iff_right]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ length l - (2 - 1) ≤ 2 * count b l
[PROOFSTEP]
exact length_sub_one_le_two_mul_count_bool hl b
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ 2 * count b l ≤ length l + 1
[PROOFSTEP]
rw [hl.two_mul_count_bool_eq_ite]
[GOAL]
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
⊢ (if Even (length l) then length l else if (some b == head? l) = true then length l + 1 else length l - 1) ≤
    length l + 1
[PROOFSTEP]
split_ifs
[GOAL]
case pos
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝ : Even (length l)
⊢ length l ≤ length l + 1
[PROOFSTEP]
simp [Nat.le_succ_of_le]
[GOAL]
case pos
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝¹ : ¬Even (length l)
h✝ : (some b == head? l) = true
⊢ length l + 1 ≤ length l + 1
[PROOFSTEP]
simp [Nat.le_succ_of_le]
[GOAL]
case neg
l : List Bool
hl : Chain' (fun x x_1 => x ≠ x_1) l
b : Bool
h✝¹ : ¬Even (length l)
h✝ : ¬(some b == head? l) = true
⊢ length l - 1 ≤ length l + 1
[PROOFSTEP]
simp [Nat.le_succ_of_le]