Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CompPoly/Bivariate/Deriv.lean
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ theorem partialDerivX_mul [CommSemiring R] [BEq R] [LawfulBEq R] [Nontrivial R]
partialDerivX (f * g) = partialDerivX f * g + f * partialDerivX g := by
apply CBivariate.ringEquiv.injective
show toPoly (partialDerivX (f * g)) = toPoly (partialDerivX f * g + f * partialDerivX g)
apply Polynomial.ext; intro j
ext j : 2
rw [partialDerivX_toPoly, toPoly_mul, Polynomial.coeff_mul,
toPoly_add, Polynomial.coeff_add, toPoly_mul, toPoly_mul,
Polynomial.coeff_mul, Polynomial.coeff_mul]
Expand Down Expand Up @@ -288,8 +288,7 @@ theorem shiftX_toPoly [CommSemiring R] [BEq R] [LawfulBEq R] [Nontrivial R] [Dec
(a : R) (P : CBivariate R) :
(shiftX a P).toPoly
= (P.toPoly).map (Polynomial.compRingHom (Polynomial.X + Polynomial.C a)) := by
apply Polynomial.ext
intro j
ext j : 2
rw [toPoly_coeff, outerCoeff_shiftX, CPolynomial.taylor_toPoly, Polynomial.coeff_map,
Polynomial.coe_compRingHom_apply, ← Polynomial.taylor_apply, toPoly_coeff]

Expand Down
3 changes: 1 addition & 2 deletions CompPoly/Bivariate/Factor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ theorem divByLinearY_spec [CommRing R] [BEq R] [LawfulBEq R] [Nontrivial R] [Dec
Polynomial.C (rem.toPoly) := by
classical
dsimp
apply Polynomial.ext
intro n
ext n : 2
cases n with
| zero =>
-- coefficient 0: from the remainder formula `rem = a₀ + f · quot₀`
Expand Down
6 changes: 3 additions & 3 deletions CompPoly/Bivariate/GuruswamiSudan/CoreCorrectness.lean
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ private theorem coeff_coeffwise_hasseDeriv_sum {F : Type*} [Field F]
rw [Polynomial.sum_def]
by_cases hj : j ∈ P.support
· rw [Finset.sum_eq_single j]
· rw [Polynomial.coeff_monomial, ite_eq_left rfl]
· rw [Polynomial.coeff_monomial_apply, ite_eq_left rfl]
· intro k _hk hkj
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]
· intro hjnot
contradiction
· rw [Finset.sum_eq_zero]
Expand All @@ -331,7 +331,7 @@ private theorem coeff_coeffwise_hasseDeriv_sum {F : Type*} [Field F]
have hkj : k ≠ j := by
intro h
exact hj (h ▸ hk)
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]

/-- The executable bivariate Hasse derivative matches the Mathlib-side
coefficientwise inner Hasse derivative of the outer Hasse derivative. -/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,13 @@ private theorem toPoly_ofCoeffRow_eq_sum (row : PolynomialRow F) :
rw [CBivariate.toPoly_coeff, Polynomial.finsetSum_coeff]
by_cases hn : n < row.size
· rw [Finset.sum_eq_single n
(fun k _hk hkn ↦ by rw [Polynomial.coeff_monomial, ite_eq_right hkn])
(fun k _hk hkn ↦ by rw [Polynomial.coeff_monomial_apply, ite_eq_right hkn])
(fun hnotin ↦ absurd (Finset.mem_range.mpr hn) hnotin)]
rw [Polynomial.coeff_monomial, ite_eq_left rfl, CBivariate.ofCoeffRow,
rw [Polynomial.coeff_monomial_apply, ite_eq_left rfl, CBivariate.ofCoeffRow,
CPolynomial.coeff_ofArray]
· rw [Finset.sum_eq_zero
(fun k hk ↦ by
rw [Polynomial.coeff_monomial,
rw [Polynomial.coeff_monomial_apply,
ite_eq_right (by rcases Finset.mem_range.mp hk with h; omega)])]
rw [CBivariate.ofCoeffRow, CPolynomial.coeff_ofArray,
Array.getD_eq_getD_getElem?, Array.getElem?_eq_none (by omega)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,8 @@ private theorem hasseDerivative_zero_xOrder_toPoly_of_map_C {F : Type*}
(b : Nat) :
CBivariate.toPoly (CBivariate.hasseDerivative 0 b Q) =
(Polynomial.hasseDeriv b P).map (Polynomial.C : F →+* Polynomial F) := by
apply Polynomial.ext
intro j
apply Polynomial.ext
intro i
ext j : 2
ext i : 2
rw [CBivariate.coeff_toPoly, CBivariate.hasseDerivative_coeff]
rw [Polynomial.coeff_map, Polynomial.hasseDeriv_coeff]
rw [cbivariate_coeff_of_toPoly_map_C hQ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ theorem hasseDerivativeEval_ofYConstant_mul_eq_eval_mul_of_lower {F : Type*}
CPolynomial.eval x A * CBivariate.hasseDerivativeEval order b x y P := by
intro n
induction n using Nat.strong_induction_on with
| h n ih =>
| ind n ih =>
intro A hsize P order hLower
by_cases hzeroSize : A.val.size = 0
· rw [cpoly_eq_zero_of_val_size_eq_zero A hzeroSize, ofYConstant_zero]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private theorem lee_coeff_coeffwise_hasseDeriv_sum
rw [Polynomial.sum_def]
by_cases hj : j ∈ P.support
· rw [Finset.sum_eq_single j]
· rw [Polynomial.coeff_monomial, ite_eq_left rfl]
· rw [Polynomial.coeff_monomial_apply, ite_eq_left rfl]
· intro k _hk hkj
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]
· intro hjnot
contradiction
· rw [Finset.sum_eq_zero]
Expand All @@ -85,7 +85,7 @@ private theorem lee_coeff_coeffwise_hasseDeriv_sum
have hkj : k ≠ j := by
intro h
exact hj (h ▸ hk)
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]

private theorem lee_toPoly_hasseDerivative_eq_coeffwise_hasseDeriv_hasseDeriv
(Q : CBivariate F) (a b : Nat) :
Expand Down
6 changes: 3 additions & 3 deletions CompPoly/Bivariate/GuruswamiSudan/PolynomialCorrectness.lean
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,9 @@ private theorem coeff_coeffwise_hasseDeriv_sum {F : Type*} [Field F]
rw [Polynomial.sum_def]
by_cases hj : j ∈ P.support
· rw [Finset.sum_eq_single j]
· rw [Polynomial.coeff_monomial, ite_eq_left rfl]
· rw [Polynomial.coeff_monomial_apply, ite_eq_left rfl]
· intro k _hk hkj
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]
· intro hjnot
contradiction
· rw [Finset.sum_eq_zero]
Expand All @@ -912,7 +912,7 @@ private theorem coeff_coeffwise_hasseDeriv_sum {F : Type*} [Field F]
have hkj : k ≠ j := by
intro h
exact hj (h ▸ hk)
rw [Polynomial.coeff_monomial, ite_eq_right hkj]
rw [Polynomial.coeff_monomial_apply, ite_eq_right hkj]

/-- The executable bivariate Hasse derivative matches the Mathlib-side
coefficientwise inner Hasse derivative of the outer Hasse derivative. -/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ theorem alekhnovichRootCandidatesWithFuel_complete {F : Type*}
(hroot : CBivariate.composeY Q p = 0) :
p ∈ (alekhnovichRootCandidatesWithFuel fieldRoots fuel Q k).toList := by
induction fuel using Nat.strong_induction_on generalizing Q k p with
| h fuel ih =>
| ind fuel ih =>
cases fuel with
| zero =>
omega
Expand Down
25 changes: 13 additions & 12 deletions CompPoly/Bivariate/ToPoly.lean
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ lemma ofPoly_monomial {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring
CPolynomial.monomial n ⟨c.toImpl, CPolynomial.Raw.isCanonical_toImpl c⟩ := by
unfold CBivariate.ofPoly
simp +decide
rw [ Finset.sum_eq_single n ] <;> simp +decide [ Polynomial.coeff_monomial ]
rw [ Finset.sum_eq_single n ] <;>
simp +decide [ Polynomial.coeff_monomial, Finsupp.single_apply ]
aesop

/--
Expand Down Expand Up @@ -175,7 +176,7 @@ lemma ofPoly_add {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring R]
· aesop
· aesop
· aesop
· contrapose! hx
· contrapose hx
aesop
exact h_ofPoly_add_p p q

Expand All @@ -188,8 +189,8 @@ theorem ofPoly_coeff {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring
Finset.sum (Polynomial.support p) (fun j ↦
CPolynomial.coeff
(CPolynomial.monomial j
⟨Polynomial.toImpl (Polynomial.coeff p j),
CPolynomial.Raw.isCanonical_toImpl (Polynomial.coeff p j)⟩) n) := by
⟨Polynomial.toImpl (p.coeff j),
CPolynomial.Raw.isCanonical_toImpl (p.coeff j)⟩) n) := by
unfold CBivariate.ofPoly
induction' p.support using Finset.induction with j s hj ih
· exact CPolynomial.eq_iff_coeff.mpr (congrFun rfl)
Expand Down Expand Up @@ -217,9 +218,9 @@ theorem toPoly_coeff {R : Type*} [BEq R] [LawfulBEq R] [Semiring R]
theorem toPoly_eq_map {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring R]
(p : CBivariate R) :
toPoly p = (CPolynomial.toPoly p).map (CPolynomial.ringEquiv (R := R)) := by
convert Polynomial.ext _
convert AddMonoidAlgebra.ext (Finsupp.ext _)
unfold CBivariate.toPoly
simp +decide [ Polynomial.coeff_monomial ]
simp +decide [ Polynomial.coeff_monomial, Finsupp.single_apply ]
intro n
split_ifs <;> simp_all +decide [ CPolynomial.toPoly ]
· erw [ CPolynomial.Raw.coeff_toPoly ]
Expand Down Expand Up @@ -439,7 +440,7 @@ theorem support_toPoly_outer {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [S
ext x
simp +decide [ CPolynomial.mem_support_iff, CBivariate.supportY ]
rw [ CBivariate.toPoly ]
simp +decide [ Polynomial.coeff_monomial ]
simp +decide [ Polynomial.coeff_monomial, Finsupp.single_apply ]
rw [ CPolynomial.mem_support_iff ]
aesop

Expand All @@ -452,7 +453,7 @@ theorem natDegreeY_toPoly {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semi
by_cases hp : p = 0
· simp +decide [ hp ]
· refine' le_antisymm _ _
· exact Finset.le_sup (f := id) (Polynomial.natDegree_mem_support_of_nonzero hp)
· exact Finset.le_sup (f := id) (Polynomial.natDegree_mem_support_of_ne_zero hp)
· exact Finset.sup_le fun i hi ↦ Polynomial.le_natDegree_of_mem_supp _ hi
rw [ h_deg, support_toPoly_outer, CBivariate.natDegreeY,
CPolynomial.natDegree_eq_support_sup ]
Expand Down Expand Up @@ -554,7 +555,7 @@ theorem evalX_toPoly_coeff {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Sem
have h₂ :
eval a (f.toPoly.coeff j) =
∑ i ∈ f.support, if i = j then CPolynomial.eval a (f.val.coeff i) else 0 := by
simp +decide [CBivariate.toPoly, Polynomial.coeff_monomial]
simp +decide [CBivariate.toPoly, Polynomial.coeff_monomial, Finsupp.single_apply]
split_ifs <;> simp +decide [*, CPolynomial.eval_toPoly]
rw [show ((evalX (R := R) a f).toPoly).coeff j =
∑ i ∈ CPolynomial.support f,
Expand All @@ -570,7 +571,7 @@ theorem evalX_toPoly_coeff {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Sem
exact congrArg (fun p : Polynomial R => p.coeff j)
(CPolynomial.monomial_toPoly (R := R) i (CPolynomial.eval a (f.val.coeff i)))
_ = if i = j then CPolynomial.eval a (f.val.coeff i) else 0 := by
simp [Polynomial.coeff_monomial]
simp [Polynomial.coeff_monomial, Finsupp.single_apply]

/--
`evalX` is compatible with full bivariate evaluation when `a` and `y` commute.
Expand All @@ -588,7 +589,7 @@ theorem evalX_toPoly_eval_commute {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial
· aesop
· intro j hj
simp_all +decide
contrapose! hj
contrapose hj
simp_all +decide [evalX_toPoly_coeff]
convert h_lhs using 1
· exact CPolynomial.eval_toPoly y (evalX (R := R) a f)
Expand Down Expand Up @@ -675,7 +676,7 @@ theorem evalX_toPoly_eval_commute_converse
Polynomial.monomial 1 a := by
ext j
rw [evalX_toPoly_coeff, monomialXY_toPoly]
simp [Polynomial.coeff_monomial]
simp [Polynomial.coeff_monomial, Finsupp.single_apply]
split_ifs with h
· subst h
simp [Polynomial.eval_monomial]
Expand Down
2 changes: 1 addition & 1 deletion CompPoly/Data/Classes/CanonicalNat.lean
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ theorem ofNat?_eq_some_iff {n : ℕ} {x : F} : ofNat? n = some x ↔ n < bound F
theorem ofNat?_eq_none_iff {n : ℕ} : ofNat? (F := F) n = none ↔ bound F ≤ n := by
unfold ofNat?
split <;> simp only [reduceCtorEq, false_iff, not_le, *, true_iff, not_lt] at *
all_goals assumption
assumption

/-- The canonical natural as an equivalence with `Fin (bound F)`. -/
def equivFin : F ≃ Fin (bound F) where
Expand Down
7 changes: 4 additions & 3 deletions CompPoly/Data/Polynomial/MonomialBasis.lean
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ noncomputable def monomialBasisOfDegreeLT {n : ℕ} : Basis (Fin n) L (L⦃< n
exact Subtype.ext_iff.mp hl

have h_coeff_eq_li :
coeff (Finsupp.linearCombination L monomials_in_submodule l).val i = l i := by
(Finsupp.linearCombination L monomials_in_submodule l).val.coeff i = l i := by
-- `span_le` changes the goal to showing every vector in the generating set
set v := monomials_in_submodule
simp only [v, monomials_in_submodule, monomial_one_right_eq_X_pow]
rw [Finsupp.linearCombination_apply]
simp only [SetLike.mk_smul_mk]
conv =>
lhs
simp only [Finsupp.sum, AddSubmonoidClass.coe_finsetSum, finsetSum_coeff, coeff_smul,
coeff_X_pow, smul_eq_mul, mul_ite, mul_one, mul_zero, monomials_in_submodule, v]
simp only [Finsupp.sum, AddSubmonoidClass.coe_finsetSum, finsetSum_coeff,
AddMonoidAlgebra.coeff_smul_apply, coeff_X_pow, smul_eq_mul, mul_ite, mul_one, mul_zero,
monomials_in_submodule, v]
-- ⊢ (∑ x ∈ l.support, if ↑i = ↑x then l x else 0) = l i
simp_rw [Fin.val_eq_val, eq_comm]
-- ⊢ l i = ∑ x ∈ l.support, if i = x then l x else 0
Expand Down
4 changes: 2 additions & 2 deletions CompPoly/Fields/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ private lemma comp_x_square_coeff_pos_deg {f : Polynomial F} {n : ℕ} (h : 0 <
simp only [Nat.even_iff]
split_ifs <;> simp_all
omega
· rintro _ _ _ (_ | _ | n) <;> try simp [←mul_assoc]
· rintro _ _ _ (_ | _ | n) <;> simp [←mul_assoc]
have : (n + 1 + 1) / 2 = n / 2 + 1 := by omega
split <;> aesop (add safe (by omega)) (add simp [Nat.even_iff])
· rintro _ _ _ _ (_ | _ | n) <;> try simp_all
· rintro _ _ _ _ (_ | _ | n) <;> simp_all
have : (n + 1 + 1) / 2 = n / 2 + 1 := by omega
simp_all only [coeff_C_succ, add_zero]

Expand Down
7 changes: 3 additions & 4 deletions CompPoly/Fields/Binary/AdditiveNTT/Intermediate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ abbrev IntermediateCoeffVecSpace (i : Fin r) := Fin (2^(ℓ - i)) → L
def intermediateToCoeffsVec (i : Fin r) : -- (h_i : i ≤ ℓ)
L⦃<2^(ℓ - i)⦄[X] →ₗ[L] IntermediateCoeffVecSpace (L := L) (ℓ := ℓ) i where
toFun := fun p => fun k => p.val.coeff k.val
map_add' := fun p q => by ext k; simp [coeff_add]
map_smul' := fun c p => by ext k; simp [coeff_smul, smul_eq_mul]
map_add' := fun p q => by ext k; simp
map_smul' := fun c p => by ext k; simp [smul_eq_mul]

/-- The Change-of-Basis Matrix from the Intermediate Novel Basis to the Monomial Basis.
A_jk = coeff of X^k in intermediate basis vector X_j. -/
Expand Down Expand Up @@ -986,8 +986,7 @@ lemma intermediateEvaluationPoly_from_inovel_coeffs_eq_self
intermediateEvaluationPoly 𝔽q β h_ℓ_add_R_rate (i := i) (h_i := h_i)
(coeffs := getINovelCoeffs 𝔽q β h_ℓ_add_R_rate i h_i P) = P := by
-- 1. Apply extensionality (two polys are equal if all coeffs are equal)
apply Polynomial.ext
intro k
ext k : 2
let N := 2 ^ (ℓ - i.val)
set novel_coeffs := getINovelCoeffs 𝔽q β h_ℓ_add_R_rate i h_i P
-- 2. Case Analysis on k
Expand Down
8 changes: 4 additions & 4 deletions CompPoly/Fields/Binary/AdditiveNTT/NovelPolynomialBasis.lean
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ lemma U_i_is_union_of_cosets (i : Fin r) (hi : 0 < i) :
unfold U
have h_ico : Set.Ico 0 i = Set.Ico 0 (i - 1) ∪ {i - 1} := by
ext k;
simp only [Set.mem_Ico, Fin.zero_le, true_and, Set.union_singleton, Set.Ico_insert_right,
simp only [Set.mem_Ico, Fin.zero_le, true_and, Set.union_singleton, Set.insert_right_Ico,
Set.mem_Icc]
-- ⊢ k < i ↔ k ≤ i - 1
exact Fin.lt_iff_le_pred (a := k) (b := i) (h_b := by omega)
Expand Down Expand Up @@ -220,7 +220,7 @@ theorem root_U_lift_down
· -- PART 1: Existence -- ⊢ ∃ x, a - x • β i ∈ U 𝔽q β i
have h_ico : Set.Ico 0 (i+1) = Set.Ico 0 i ∪ {i} := by
ext k; simp only [Set.mem_Ico, Fin.zero_le, true_and, Set.union_singleton,
Set.Ico_insert_right, Set.mem_Icc]
Set.insert_right_Ico, Set.mem_Icc]
-- ⊢ k < i + 1 ↔ k ≤ i
exact Fin.le_iff_lt_succ (a := k) (b := i) (h_b := h_i_add_1).symm
rw [U, h_ico, Set.image_union, Set.image_singleton, Submodule.span_union] at h_a_mem_U_i_plus_1
Expand Down Expand Up @@ -1404,11 +1404,11 @@ noncomputable instance finiteDimensionalCoeffVecSpace (ℓ : ℕ) :
/-- The linear map from polynomials (in the subtype) to their coefficient vectors. -/
def toCoeffsVec (ℓ : Nat) : L⦃<2^ℓ⦄[X] →ₗ[L] CoeffVecSpace L ℓ where
toFun := fun p => fun i => p.val.coeff i.val
map_add' := fun p q => by ext i; simp [coeff_add]
map_add' := fun p q => by ext i; simp
map_smul' := fun c p => by
ext i
simp only [Pi.smul_apply, RingHom.id_apply, smul_eq_mul]
rw [Submodule.coe_smul, Polynomial.coeff_smul, smul_eq_mul]
rw [Submodule.coe_smul, AddMonoidAlgebra.coeff_smul_apply, smul_eq_mul]

/-- The rows of a square lower-triangular matrix with
non-zero diagonal entries are linearly independent. -/
Expand Down
2 changes: 1 addition & 1 deletion CompPoly/Fields/Binary/BF128Ghash/Impl.lean
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ lemma mul_inv_cancel (a : ConcreteBF128Ghash) (h : a ≠ 0) : a * a⁻¹ = 1 :=
rw [pow_one]
rw [h_pow_pred_eq, toQuot_pow_card]
have h_quot_ne_zero : toQuot a ≠ 0 := by
contrapose! h
contrapose h
rw [← toQuot_zero] at h
exact toQuot_injective h
exact _root_.mul_inv_cancel₀ h_quot_ne_zero
Expand Down
2 changes: 2 additions & 0 deletions CompPoly/Fields/Binary/BF64/Ext3.lean
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ theorem aeval_ext3Gen : aeval ext3Gen ext3Params.poly = 0 := Ext.aeval_gen_poly
@[simp] theorem nat_card_ext3 : Nat.card Ext3 = 2 ^ 192 := by
rw [Ext.nat_card_ext, ext3Params_q, ext3Params_d, ← pow_mul]

-- Stated for any enumeration, since `Ext3` has no global `Fintype` instance.
set_option linter.concreteInstances false in
/-- Any enumeration of `Ext3` has `2 ^ 192` elements. -/
@[simp] theorem card_ext3 [Fintype Ext3] : Fintype.card Ext3 = 2 ^ 192 := by
rw [← Nat.card_eq_fintype_card, nat_card_ext3]
Expand Down
2 changes: 2 additions & 0 deletions CompPoly/Fields/Binary/BF64/Impl.lean
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ instance : Finite BF64 := Finite.of_equiv (Fin (2 ^ 64)) equivFin.symm
theorem nat_card_bf64 : Nat.card BF64 = 2 ^ 64 := by
rw [Nat.card_congr equivFin, Nat.card_fin]

-- Stated for any enumeration, since `BF64` has no global `Fintype` instance.
set_option linter.concreteInstances false in
/-- Any enumeration of `BF64` has `2 ^ 64` elements. -/
theorem card_bf64 [Fintype BF64] : Fintype.card BF64 = 2 ^ 64 := by
rw [← Nat.card_eq_fintype_card, nat_card_bf64]
Expand Down
4 changes: 2 additions & 2 deletions CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ theorem towerAlgebraMap_succ_last (r : ℕ) : ∀ l : ℕ, (h_le : l ≤ r) →
(towerAlgebraMap (l:=l+1) (r:=r+1) (by omega)).comp (towerAlgebraMap
(l:=l) (r:=l+1) (by omega)) := by
induction r using Nat.strong_induction_on with
| h r ih_r => -- prove for width = r + 1
| ind r ih_r => -- prove for width = r + 1
intro l h_le
if h_l_eq_r : l = r then
subst h_l_eq_r
Expand Down Expand Up @@ -148,7 +148,7 @@ theorem towerAlgebraMap_assoc : ∀ r mid l : ℕ, (h_l_le_mid : l ≤ mid) →
-- We induct on `r`, keeping `l` and `mid` as variables in the induction hypothesis.
intro r
induction r using Nat.strong_induction_on with
| h r ih_r => -- right width = r, left width = l
| ind r ih_r => -- right width = r, left width = l
intro mid l h_l_le_mid h_mid_le_r
-- A = |l| --- (1) --- |mid| --- (2) --- |r-1| --- (3) --- |r|
-- Proof : A = 3 ∘ (12) (succ decomposition) = 3 ∘ (2 ∘ 1) (induction hypothesis)
Expand Down
4 changes: 2 additions & 2 deletions CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ theorem concreteTowerAlgebraMap_succ_last (r : ℕ) : ∀ l : ℕ, (h_le : l ≤
(concreteTowerAlgebraMap (l:=l + 1) (r:=r + 1) (by omega)).comp (concreteTowerAlgebraMap
(l:=l) (r:=l + 1) (by omega)) := by
induction r using Nat.strong_induction_on with
| h r ih_r => -- prove for width = r + 1
| ind r ih_r => -- prove for width = r + 1
intro l h_le
if h_l_eq_r : l = r then
subst h_l_eq_r
Expand Down Expand Up @@ -188,7 +188,7 @@ theorem concreteTowerAlgebraMap_assoc :
-- We induct on `r`, keeping `l` and `mid` as variables in the induction hypothesis.
intro r
induction r using Nat.strong_induction_on with
| h r ih_r => -- right width = r, left width = l
| ind r ih_r => -- right width = r, left width = l
intro mid l h_l_le_mid h_mid_le_r
-- A = |l| --- (1) --- |mid| --- (2) --- |r - 1| --- (3) --- |r|
-- Proof : A = 3 ∘ (12) (succ decomposition) = 3 ∘ (2 ∘ 1) (induction hypothesis)
Expand Down
Loading
Loading