Skip to content

Commit 38f4981

Browse files
quangvdaokatyhr
authored andcommitted
feat: rename oracle => answer in OracleInterface (Verified-zkEVM#134)
* rename `oracle` => `answer` in OracleInterface * fix * fix lint * delete tree, no longer needed * update import * remove binary tree stuff
1 parent ffd2081 commit 38f4981

29 files changed

Lines changed: 121 additions & 478 deletions

File tree

ArkLib.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ import ArkLib.Data.Polynomial.RationalFunctions
9797
import ArkLib.Data.Probability.Instances
9898
import ArkLib.Data.Probability.Notation
9999
import ArkLib.Data.RingTheory.TowerOfAlgebra
100-
import ArkLib.Data.Tree.Binary
101-
import ArkLib.Data.Tree.General
102100
import ArkLib.Data.UniPoly.Basic
103101
import ArkLib.Data.UniPoly.BasicOld
104102
import ArkLib.Data.UniPoly.PolynomialReflection

ArkLib/CommitmentScheme/Basic.lean

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import ArkLib.OracleReduction.Security.Basic
2525
security definitions for commitment schemes have to be stated differently than those for IOPs.
2626
-/
2727

28+
-- Note: remove this once we properly define the security definitions for commitment schemes
29+
set_option linter.unusedVariables false
30+
2831
namespace Commitment
2932

3033
open OracleSpec OracleComp SubSpec
@@ -70,7 +73,7 @@ def correctness (scheme : Scheme oSpec Data Randomness Commitment pSpec)
7073
∀ query : O.Query,
7174
[ fun x => x.2.1 | do
7275
let cm ← liftComp (scheme.commit data randomness) _
73-
let ⟨result, _⟩ ← scheme.opening.run ⟨cm, query, O.oracle data query⟩ ⟨data, randomness⟩
76+
let ⟨result, _⟩ ← scheme.opening.run ⟨cm, query, O.answer data query⟩ ⟨data, randomness⟩
7477
return result] ≥ 1 - correctnessError
7578

7679
/-- A commitment scheme satisfies **perfect correctness** if it satisfies correctness with no error.
@@ -98,7 +101,7 @@ def BindingAdversary (oSpec : OracleSpec ι) (Data Commitment AuxState : Type)
98101
Informally, evaluation binding says that it's computationally infeasible to open a commitment to
99102
two different responses for the same query. -/
100103
def binding (scheme : Scheme oSpec Data Randomness Commitment pSpec)
101-
(bindingError : ℝ≥0): Prop :=
104+
(bindingError : ℝ≥0) : Prop :=
102105
∀ AuxState : Type,
103106
∀ adversary : BindingAdversary oSpec Data Commitment AuxState,
104107
∀ prover : Prover oSpec (Commitment × O.Query × O.Response) AuxState Bool Unit pSpec,
@@ -129,7 +132,7 @@ def ExtractabilityAdversary (oSpec : OracleSpec ι) (Data Commitment AuxState :
129132
opening procedure that takes in `st`, the probability that:
130133
131134
1. The verifier accepts in the opening procedure given `cm, q, r`
132-
2. The extracted data `d` is inconsistent with the claimed response (i.e., `O.oracle d q ≠ r`)
135+
2. The extracted data `d` is inconsistent with the claimed response (i.e., `O.answer d q ≠ r`)
133136
134137
is at most `extractabilityError`.
135138
@@ -143,7 +146,7 @@ def extractability (scheme : Scheme oSpec Data Randomness Commitment pSpec)
143146
∀ adversary : ExtractabilityAdversary oSpec Data Commitment AuxState,
144147
∀ prover : Prover oSpec (Commitment × O.Query × O.Response) AuxState Bool Unit pSpec,
145148
False
146-
-- [ fun ⟨b, d, q, r⟩ => b ∧ O.oracle d q = r | do
149+
-- [ fun ⟨b, d, q, r⟩ => b ∧ O.answer d q = r | do
147150
-- let result ← liftM (simulate loggingOracle ∅ adversary)
148151
-- let ⟨⟨cm, query, response, st⟩, queryLog⟩ := result
149152
-- let proof : Proof pSpec oSpec (Commitment × O.Query × O.Response) AuxState :=

ArkLib/CommitmentScheme/MerkleTree.lean

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Quang Dao
55
-/
66

7-
import ArkLib.Data.Tree.Binary
87
import Mathlib.Data.Vector.Snoc
98
import VCVio.OracleComp.QueryTracking.CachingOracle
109

@@ -313,49 +312,3 @@ section Test
313312
end Test
314313

315314
end MerkleTree
316-
317-
-- Alternative definition of Merkle tree using inductive type
318-
319-
variable {α : Type}
320-
321-
/-- Helper function to get the proof for a value at a given path. -/
322-
def getProofHelper [DecidableEq α] : List Bool → BinaryTree α → List α
323-
| _, BinaryTree.nil => []
324-
| _, BinaryTree.leaf _ => []
325-
| [], BinaryTree.node _ _ _ => []
326-
| false :: rest, BinaryTree.node _ l r =>
327-
match BinaryTree.getRoot r with
328-
| none => getProofHelper rest l
329-
| some v => v :: getProofHelper rest l
330-
| true :: rest, BinaryTree.node _ l r =>
331-
match BinaryTree.getRoot l with
332-
| none => getProofHelper rest r
333-
| some v => v :: getProofHelper rest r
334-
335-
/-- Generate a Merkle proof for a leaf with value 'a'.
336-
The proof consists of the sibling hashes needed to recompute the root. -/
337-
def generateProof [DecidableEq α] (a : α) (tree : BinaryTree α) : Option (List α) :=
338-
match BinaryTree.findPath a tree with
339-
| none => none
340-
| some path => some (getProofHelper path tree)
341-
342-
/-- Verify a Merkle proof that a value 'a' is in the tree with root 'root'.
343-
The 'proof' contains sibling hashes, and 'path' is the position (left/right) at each level. -/
344-
def verifyProof [DecidableEq α] (hashFn : α → α → α) (a : α) (root : α)
345-
(proof : List α) (path : List Bool) : Bool :=
346-
let rec verify (current : α) (p : List α) (dirs : List Bool) : Bool :=
347-
match p, dirs with
348-
| [], [] => current = root
349-
| sibling :: restProof, dir :: restPath =>
350-
let nextHash := if dir then hashFn sibling current else hashFn current sibling
351-
verify nextHash restProof restPath
352-
| _, _ => false -- Proof and path lengths don't match
353-
verify a proof path
354-
355-
-- /-- Build a Merkle tree from a list of leaves using a hash function. -/
356-
-- def buildMerkleTree [DecidableEq α] [Inhabited α]
357-
-- (hashFn : α → α → α) (leaves : List α) : BinaryTree α :=
358-
-- -- Find the smallest power of 2 that fits all leaves
359-
-- -- We can estimate 2^n >= leaves.length by using n = ceiling(log2(leaves.length))
360-
-- let n := Nat.ceil (Nat.log 2 (leaves.length + 1)) -- Ceiling of log base 2
361-
-- LeafTree.toMerkleTree hashFn (LeafTree.fromList n leaves)

ArkLib/CommitmentScheme/SimpleRO.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def verify [BEq γ] (cm : γ) (v : α) (r : β) : OracleComp (ROspec α β γ) U
5353
local instance : OracleInterface α where
5454
Query := Unit
5555
Response := α
56-
oracle := fun x _ => x
56+
answer := fun x _ => x
5757

5858
def commitmentScheme : Commitment.Scheme (oSpec α β γ) α β γ !p[] where
5959
commit := fun v r => commit v

ArkLib/Data/FieldTheory/BinaryField/Tower/Impl.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,7 @@ theorem concreteTowerAlgebraMap_assoc :
21622162
**Formalization of Cross - Level Algebra** : For any `k ≤ τ`, `ConcreteBTField τ` is an
21632163
algebra over `ConcreteBTField k`.
21642164
-/
2165-
instance instAssocTowerOfAlgebraConcreteBTF: AssocTowerOfAlgebra (ConcreteBTField) where
2165+
instance instAssocTowerOfAlgebraConcreteBTF : AssocTowerOfAlgebra (ConcreteBTField) where
21662166
towerAlgebraMap := concreteTowerAlgebraMap
21672167
smul := fun i j h => by
21682168
exact (concreteTowerAlgebraMap i j h).toAlgebra.toSMul -- derive same smul from algebra
@@ -2585,7 +2585,7 @@ theorem PowerBasis.cast_basis_succ_of_eq_rec_apply
25852585
-- The proof of the theorem itself remains simple.
25862586
subst h_r
25872587
simp only [ConcreteBTFieldAlgebra_id,
2588-
Algebra.id.map_eq_id, PowerBasis.coe_basis, Fin.coe_cast, RingHom.id_apply]
2588+
Algebra.algebraMap_self, PowerBasis.coe_basis, Fin.coe_cast, RingHom.id_apply]
25892589
rw [Basis_cast_index_apply (h_eq:=by
25902590
exact powerBasisSucc_dim r1) (h_le:=by omega)]
25912591
simp only [PowerBasis.coe_basis, Fin.coe_cast]
@@ -2771,12 +2771,12 @@ noncomputable def towerEquiv_zero : RingEquiv (R:=GF(2)) (S:=ConcreteBTField 0)
27712771
· simp only [y_zero, or_true, ↓reduceIte]
27722772
· simp only [y_one, one_ne_zero, or_false, ↓reduceIte]
27732773
}
2774-
noncomputable def towerRingEquiv0: BTField 0 ≃+* ConcreteBTField 0 := by
2774+
noncomputable def towerRingEquiv0 : BTField 0 ≃+* ConcreteBTField 0 := by
27752775
apply RingEquiv.trans (R:=BTField 0) (S:=GF(2)) (S':=ConcreteBTField 0)
27762776
· exact RingEquiv.refl (BTField 0)
27772777
· exact towerEquiv_zero
27782778

2779-
noncomputable def towerRingEquivFromConcrete0: ConcreteBTField 0 ≃+* BTField 0 := by
2779+
noncomputable def towerRingEquivFromConcrete0 : ConcreteBTField 0 ≃+* BTField 0 := by
27802780
exact towerRingEquiv0.symm
27812781

27822782
noncomputable def towerRingHomForwardMap (k : ℕ) : ConcreteBTField k → BTField k := by
@@ -2818,10 +2818,10 @@ lemma towerRingHomForwardMap0_eq :
28182818
simp only [RingEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe, ↓reduceDIte]
28192819

28202820
structure TowerEquivResult (k : ℕ) where
2821-
ringEquiv: ConcreteBTField k ≃+* BTField k
2822-
ringEquivForwardMapEq: ringEquiv = towerRingHomForwardMap k
2823-
mapGenerator: (towerRingHomForwardMap k) (Z k) = BinaryTower.Z k
2824-
mapSplit: (h_pos: k > 0) → ∀ x : ConcreteBTField k, ringEquiv.toFun (x) =
2821+
ringEquiv : ConcreteBTField k ≃+* BTField k
2822+
ringEquivForwardMapEq : ringEquiv = towerRingHomForwardMap k
2823+
mapGenerator : (towerRingHomForwardMap k) (Z k) = BinaryTower.Z k
2824+
mapSplit : (h_pos: k > 0) → ∀ x : ConcreteBTField k, ringEquiv.toFun x =
28252825
BinaryTower.join_via_add_smul (k:=k) (h_pos:=h_pos) (hi_btf := by
28262826
have hi_btf := (split (k:=k) (h:=h_pos) x).fst
28272827
exact towerRingHomForwardMap (k:=k-1) hi_btf
@@ -2876,7 +2876,7 @@ noncomputable def towerEquiv (n : ℕ) : TowerEquivResult n := by
28762876
mapSplit := fun h_pos x => by sorry
28772877
}
28782878

2879-
noncomputable instance instAssocTowerOfAlgebraEquiv: AssocTowerOfAlgebraEquiv
2879+
noncomputable instance instAssocTowerOfAlgebraEquiv : AssocTowerOfAlgebraEquiv
28802880
(ConcreteBTField) (BTField) where
28812881
toRingEquiv := fun i => (towerEquiv i).ringEquiv
28822882
commutesLeft' := fun i j h r => by

ArkLib/Data/FieldTheory/NonBinaryField/Basic.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ private lemma coeffs_of_comp_minus_x_pos_degree {f : Polynomial F} {n : ℕ} (h
4141
· rintro _ _ _ (_ | _) <;> aesop (add simp [Nat.even_add_one, Nat.even_iff])
4242
· rintro _ _ _ _ (_ | _) <;> aesop
4343

44-
theorem coeffs_of_comp_minus_x {f : Polynomial F} {n : ℕ} :
44+
theorem coeffs_of_comp_minus_x {f : Polynomial F} {n : ℕ} :
4545
(f.comp (-X)).coeff n = if Even n then f.coeff n else -f.coeff n := by
4646
by_cases hpos : 0 < f.degree
4747
· rw [coeffs_of_comp_minus_x_pos_degree hpos]
4848
· have : f.natDegree = 0 := by aesop (add simp natDegree_pos_iff_degree_pos.symm)
4949
cases n <;> aesop (add simp natDegree_eq_zero)
5050

51-
private lemma comp_x_square_coeff_pos_deg {f : Polynomial F} {n : ℕ} (h : 0 < f.degree):
51+
private lemma comp_x_square_coeff_pos_deg {f : Polynomial F} {n : ℕ} (h : 0 < f.degree) :
5252
(f.comp (X * X)).coeff n = if Even n then f.coeff (n / 2) else 0 := by
5353
revert n
5454
apply degree_pos_induction_on (h0 := h) (P := fun f => _)
55-
· rintro _ _ (_ | n) <;>
55+
· rintro _ _ (_ | n) <;>
5656
aesop (add simp [coeff_X, Even]) (add safe [(by existsi 1), (by omega)])
5757
· rintro _ _ _ (_ | _ | n) <;> try simp [←mul_assoc]
5858
have : (n + 1 + 1) / 2 = n / 2 + 1 := by omega
5959
split <;> aesop (add safe (by omega)) (add simp [Nat.even_iff])
6060
· rintro _ _ _ _ (_ | _ | n) <;> try simp_all
6161
have : (n + 1 + 1) / 2 = n / 2 + 1 := by omega
6262
simp_all only [coeff_C_succ, add_zero]
63-
63+
6464
theorem comp_x_square_coeff {f : Polynomial F} {n : ℕ} :
6565
(f.comp (X * X)).coeff n = if Even n then f.coeff (n / 2) else 0 := by
6666
by_cases hpos : 0 < f.degree
@@ -74,7 +74,7 @@ theorem comp_x_square_coeff {f : Polynomial F} {n : ℕ} :
7474
lemma eq_poly_deg_one {a b c d : F} {x₁ x₂ : F}
7575
(h1 : a + b * x₁ = c + d * x₁)
7676
(h2 : a + b * x₂ = c + d * x₂)
77-
(h1_2 : x₁ ≠ x₂):
77+
(h1_2 : x₁ ≠ x₂) :
7878
Polynomial.C a + Polynomial.C b * Polynomial.X
7979
= Polynomial.C c + Polynomial.C d * Polynomial.X := by
8080
by_cases h_b_d : b = d

ArkLib/Data/MlPoly/Basic.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ instance inhabited [Inhabited R] : Inhabited (MlPoly R n) := by simp [MlPoly]; i
6060
/-- Conform a list of coefficients to a `MlPoly` with a given number of variables.
6161
May either pad with zeros or truncate. -/
6262
@[inline]
63-
def ofArray [Zero R] (coeffs : Array R) (n : ℕ): MlPoly R n :=
63+
def ofArray [Zero R] (coeffs : Array R) (n : ℕ) : MlPoly R n :=
6464
.ofFn (fun i => if h : i.1 < coeffs.size then coeffs[i] else 0)
6565
-- ⟨((coeffs.take (2 ^ n)).rightpad (2 ^ n) 0 : Array R), by simp⟩
6666
-- Not sure which is better performance wise?
@@ -190,7 +190,7 @@ instance inhabited [Inhabited R] : Inhabited (MlPolyEval R n) := by
190190
/-- Conform a list of coefficients to a `MlPolyEval` with a given number of variables.
191191
May either pad with zeros or truncate. -/
192192
@[inline]
193-
def ofArray [Zero R] (coeffs : Array R) (n : ℕ): MlPolyEval R n :=
193+
def ofArray [Zero R] (coeffs : Array R) (n : ℕ) : MlPolyEval R n :=
194194
.ofFn (fun i => if h : i.1 < coeffs.size then coeffs[i] else 0)
195195
-- ⟨((coeffs.take (2 ^ n)).rightpad (2 ^ n) 0 : Array R), by simp⟩
196196
-- Not sure which is better performance wise?
@@ -409,7 +409,7 @@ lemma forwardRange_getElem (n : ℕ) (r : Fin n) (l : Fin (r.val + 1)) (k : Fin
409409
simp only [List.get_eq_getElem]
410410
simp only [List.getElem_ofFn]
411411

412-
lemma forwardRange_succ_right_ne_empty (n : ℕ) (r : Fin (n-1)) (l : Fin (r.val + 1)) :
412+
lemma forwardRange_succ_right_ne_empty (n : ℕ) (r : Fin (n - 1)) (l : Fin (r.val + 1)) :
413413
forwardRange n ⟨r + 1, by omega⟩ ⟨l, by simp only; omega⟩ ≠ [] := by
414414
rw [forwardRange]
415415
simp only [List.ofFn_succ, Fin.coe_ofNat_eq_mod, Nat.zero_mod, add_zero, Fin.val_succ, ne_eq,
@@ -421,7 +421,7 @@ lemma forwardRange_pred_le_ne_empty (n : ℕ) (r : Fin n) (l : Fin (r.val + 1))
421421
simp only [List.ofFn_succ, Fin.coe_ofNat_eq_mod, Nat.zero_mod, add_zero, Fin.val_succ, ne_eq,
422422
reduceCtorEq, not_false_eq_true]
423423

424-
lemma forwardRange_dropLast (n : ℕ) (r : Fin (n-1)) (l : Fin (r.val + 1)) :
424+
lemma forwardRange_dropLast (n : ℕ) (r : Fin (n - 1)) (l : Fin (r.val + 1)) :
425425
(forwardRange n ⟨r + 1, by omega⟩ ⟨l, by simp only; omega⟩).dropLast
426426
= forwardRange n ⟨r, by omega⟩ ⟨l, by simp only [Fin.is_lt]⟩ := by
427427
apply List.ext_getElem
@@ -494,7 +494,7 @@ def lagrangeToMono_segment (n : ℕ) (r : Fin n) (l : Fin (r.val + 1)) :
494494
let range := forwardRange n r l
495495
(range.foldr (fun h acc => lagrangeToMonoLevel h acc))
496496

497-
lemma monoToLagrange_eq_monoToLagrange_segment (n: ℕ) [NeZero n] (v: Vector R (2 ^ n)) :
497+
lemma monoToLagrange_eq_monoToLagrange_segment (n : ℕ) [NeZero n] (v : Vector R (2 ^ n)) :
498498
have h_n_ne_zero: n ≠ 0 := by exact NeZero.ne n
499499
monoToLagrange n v = monoToLagrange_segment n (r:=⟨n - 1, by omega⟩) (l:=⟨0, by omega⟩) v := by
500500
have h_n_ne_zero: n ≠ 0 := by exact NeZero.ne n
@@ -503,7 +503,7 @@ lemma monoToLagrange_eq_monoToLagrange_segment (n: ℕ) [NeZero n] (v: Vector R
503503
congr
504504
exact Eq.symm (forwardRange_0_eq_finRange n)
505505

506-
lemma lagrangeToMono_eq_lagrangeToMono_segment (n: ℕ) [NeZero n] (v: Vector R (2 ^ n)) :
506+
lemma lagrangeToMono_eq_lagrangeToMono_segment (n : ℕ) [NeZero n] (v : Vector R (2 ^ n)) :
507507
have h_n_ne_zero: n ≠ 0 := by exact NeZero.ne n
508508
lagrangeToMono n v = lagrangeToMono_segment n (r:=⟨n - 1, by omega⟩) (l:=⟨0, by omega⟩) v := by
509509
have h_n_ne_zero: n ≠ 0 := by exact NeZero.ne n
@@ -512,7 +512,7 @@ lemma lagrangeToMono_eq_lagrangeToMono_segment (n: ℕ) [NeZero n] (v: Vector R
512512
congr
513513
exact Eq.symm (forwardRange_0_eq_finRange n)
514514

515-
lemma testBit_of_sub_two_pow_of_bit_1 {n i: ℕ} (h_testBit_eq_1: (n).testBit i = true) :
515+
lemma testBit_of_sub_two_pow_of_bit_1 {n i : ℕ} (h_testBit_eq_1 : (n).testBit i = true) :
516516
(n - 2^i).testBit i = false := by
517517
have h := Nat.testBit_false_eq_getBit_eq_0 (n:=n - 2^i) (k:=i)
518518
rw [h]

ArkLib/Data/MlPoly/Equiv.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ noncomputable def monomialOfNat (i : ℕ) : (Fin n) →₀ ℕ :=
4040
simp only [ne_eq, Finset.mem_univ, implies_true]) -- the support set is exactly Finset.univ
4141

4242
theorem eq_monomialOfNat_iff_eq_bitRepr (m : Fin n →₀ ℕ)
43-
(h_binary : ∀ j: Fin n, m j ≤ 1) (i: Fin (2^n)) :
43+
(h_binary : ∀ j : Fin n, m j ≤ 1) (i: Fin (2^n)) :
4444
monomialOfNat i = m ↔ i = Nat.binaryFinMapToNat m h_binary := by
4545
constructor
4646
· intro h_mono_eq
@@ -115,7 +115,7 @@ theorem toMvPolynomial_is_multilinear (p : MlPoly R n) :
115115
exact Fintype.sum_eq_zero (fun a ↦ 0) (congrFun rfl)
116116
exact hs h_sum_zero
117117

118-
theorem coeff_of_toMvPolynomial_eq_coeff_of_MlPoly (p : MlPoly R n) (m : Fin n →₀ ℕ):
118+
theorem coeff_of_toMvPolynomial_eq_coeff_of_MlPoly (p : MlPoly R n) (m : Fin n →₀ ℕ) :
119119
coeff m (toMvPolynomial p) =
120120
if h_binary: (∀ j: Fin n, m j ≤ 1) then
121121
let i_of_m: ℕ := Nat.binaryFinMapToNat (m:=m) (h_binary:=h_binary)

ArkLib/Data/Polynomial/EvenAndOdd.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import ArkLib.Data.FieldTheory.NonBinaryField.Basic
1616

1717
namespace Polynomial
1818

19-
variable {F : Type} [NonBinaryField F]
19+
variable {F : Type*} [NonBinaryField F]
2020

2121
/-- The even part of a polynomial `f = a_0 + a_1 X + a_2 X² + ...`, which is the polynomial
2222
@@ -101,7 +101,7 @@ noncomputable def oddPart_x (f : Polynomial F) : Polynomial F := deevenize (oddP
101101
-- Merged the `Lemmas` files into here
102102
section Lemmas
103103

104-
variable {F: Type} [NonBinaryField F]
104+
variable {F : Type*} [NonBinaryField F]
105105

106106
private noncomputable def evenPart' (f : Polynomial F) : Polynomial F :=
107107
match f with
@@ -111,7 +111,7 @@ private noncomputable def evenPart' (f : Polynomial F) : Polynomial F :=
111111
}⟩⟩
112112

113113
@[simp]
114-
private lemma evenPart'_coeffs {f : Polynomial F} {n : ℕ}:
114+
private lemma evenPart'_coeffs {f : Polynomial F} {n : ℕ} :
115115
(evenPart' f).coeff n = if Even n then f.coeff n else 0 := by
116116
rcases f with ⟨⟨supp, g, h⟩⟩
117117
simp [evenPart']
@@ -124,7 +124,7 @@ private noncomputable def x_times_oddPart' (f : Polynomial F) : Polynomial F :=
124124
}⟩⟩
125125

126126
@[simp]
127-
private lemma x_times_oddPart'_coeff {f : Polynomial F} {n : ℕ}:
127+
private lemma x_times_oddPart'_coeff {f : Polynomial F} {n : ℕ} :
128128
(x_times_oddPart' f).coeff n = if Odd n then f.coeff n else 0 := by
129129
rcases f with ⟨⟨supp, g, h⟩⟩
130130
simp [x_times_oddPart']
@@ -234,7 +234,7 @@ lemma evenize_eq_comp_x_squared {f : Polynomial F} :
234234
intro n
235235
simp [comp_x_square_coeff]
236236

237-
lemma deevenize_comp_x_squared {f : Polynomial F} (hEven : EvenPoly f):
237+
lemma deevenize_comp_x_squared {f : Polynomial F} (hEven : EvenPoly f) :
238238
(deevenize f).comp (Polynomial.X * Polynomial.X) = f := by
239239
apply Polynomial.ext
240240
intro n
@@ -257,7 +257,7 @@ lemma evenize_is_even {f : Polynomial F} :
257257
rw [←Nat.not_odd_iff_even] at hEven
258258
tauto
259259

260-
lemma eq_evenize_deevenize {f : Polynomial F} (hEven : EvenPoly f):
260+
lemma eq_evenize_deevenize {f : Polynomial F} (hEven : EvenPoly f) :
261261
evenize (deevenize f) = f := by
262262
apply Polynomial.ext
263263
intro n
@@ -280,7 +280,7 @@ lemma deevenize_evenize {f : Polynomial F} :
280280
apply Polynomial.ext
281281
simp
282282

283-
lemma evenize_eval {f : Polynomial F} {s : F}:
283+
lemma evenize_eval {f : Polynomial F} {s : F} :
284284
(evenize f).eval s = f.eval (s * s) := by
285285
rw [evenize_eq_comp_x_squared]
286286
simp [Polynomial.eval_comp, Polynomial.eval_mul]

0 commit comments

Comments
 (0)