@@ -43,46 +43,30 @@ private def reconcile (goal : MVarId) : MetaM (Option MVarId) := goal.withContex
4343 return goal'
4444
4545open Lean Elab Tactic in
46- private def reconcile_tac : TacticM Unit := liftMetaTactic1 reconcile
46+ /--
47+ Reconciles `Monoid.toMulAction Fˣ = Units.mulAction'` across the goal.
48+ -/
49+ scoped elab "reconcile" : tactic => liftMetaTactic1 reconcile
4750
4851/--
4952`reconcile`-aware `aesop` that deals with coset membership.
5053
51- - Optionally takes either side of `mem_leftCoset_iff` as a hint .
54+ Can be trivially extended to recognise more than just `mem_leftCoset_iff` .
5255-/
53- scoped syntax (name := reconcileStx) withPosition( "aesop_reconcile" (colGt ident)?) : tactic
56+ scoped syntax (name := reconcileStx) "aesop_reconcile" : tactic
5457
55- open Lean Elab Tactic in
58+ set_option hygiene false in
59+ open Lean Elab Tactic PrettyPrinter Delaborator in
5660@ [tactic reconcileStx, inherit_doc reconcileStx]
57- private def elabReconcileStx : Tactic := fun stx => do
61+ private def elabReconcileStx : Tactic := fun stx => withMainContext do
5862 match stx with
59- | `(tactic|aesop_reconcile $[$h]?) =>
60- let tac : TacticM _ :=
61- match h with
62- | .none => `(tactic|(try apply (mem_leftCoset_iff _).1
63- aesop (add safe tactic reconcile_tac)))
64- | .some h => `(tactic| (try have := (mem_leftCoset_iff _).2 $h
65- try apply (mem_leftCoset_iff _).1
66- aesop (add safe tactic reconcile_tac)))
67- evalTactic (←tac)
63+ | `(tactic|aesop_reconcile) =>
64+ evalTactic (←
65+ `(tactic|(have := fun X₁ X₂ X₃ ↦ @mem_leftCoset_iff Fˣ _ X₁ X₂ X₃
66+ reconcile
67+ aesop)))
6868 | _ => throwError "Unsupported syntax."
6969
70- /--
71- Reconciles `Monoid.toMulAction Fˣ = Units.mulAction'` across the goal.
72- -/
73- scoped elab "reconcile" : tactic => reconcile_tac
74-
75- -- open Lean Elab Tactic in
76- -- scoped elab "reconcile" h:(ident)? : tactic => do
77- -- let tac : TacticM _ :=
78- -- match h with
79- -- | .none => `(tactic|(try apply (mem_leftCoset_iff _).1
80- -- aesop (add safe tactic (reconcile_tac))))
81- -- | .some h => `(tactic| (try have := (mem_leftCoset_iff _).2 $h
82- -- try apply (mem_leftCoset_iff _).1
83- -- aesop (add safe tactic (reconcile_tac))))
84- -- evalTactic (←tac)
85-
8670namespace Domain
8771
8872/-- Constructs the subgroups of `Fˣ` which we will use to construct
@@ -194,8 +178,10 @@ def domainEmb {i : ℕ} : evalDomain D i ↪ F :=
194178
195179/- Proof the first subgroup is `D`, the cyclic group generated by `DIsCyclicC.gen : Fˣ` -/
196180omit [Finite F] in
197- lemma D_def : D = evalDomain D 0 := by
181+ @[simp]
182+ lemma D_def : evalDomain D 0 = D := by
198183 unfold evalDomain
184+ symm
199185 ext x
200186 rw [Subgroup.mem_zpowers_iff]
201187 simp only [pow_zero, pow_one]
@@ -360,8 +346,6 @@ namespace CosetDomain
360346
361347open Pointwise
362348
363-
364-
365349/- Element of `Fˣ` we will use to define our coset -/
366350variable (x : Fˣ)
367351
@@ -373,21 +357,12 @@ def evalDomain (i : ℕ) : Set Fˣ :=
373357abbrev evalDomainSigma (s : Fin (n + 1 ) → ℕ+) (i : ℕ) :=
374358 evalDomain D x (∑ j' ∈ finRangeTo i, s j')
375359
376- -- set_option pp.all true in
377360/- Enumeration of the elements of the `i`th coset. -/
378361def domain (n : ℕ) (i : ℕ) : Fin (2 ^ (n - i)) → evalDomain D x i :=
379362 fun j =>
380363 ⟨
381364 x ^ 2 ^ i * (DIsCyclicC.gen ^ (2 ^ i)) ^ j.1 ,
382- by
383- simp
384- rw [←Domain.evalDomain]
385- have h :
386- (x ^ 2 ^ i)⁻¹ * (x ^ 2 ^ i * (DIsCyclicC.gen.1 ^ 2 ^ i) ^ j.1 ) ∈
387- Domain.evalDomain D i := by
388- rw [←mul_assoc]
389- simp
390- aesop_reconcile h
365+ by aesop_reconcile
391366 ⟩
392367
393368lemma domain_injective {i : ℕ} : i ≤ n → Function.Injective (domain D x n i) := by
@@ -422,9 +397,7 @@ noncomputable def domainToFin {i : Fin (n + 1)} : evalDomain D x i → Fin (2 ^
422397 g.1 .1 = x.1 ^ (2 ^ i.1 ) * ((DIsCyclicC.gen.1 ^ (2 ^ i.1 )) ^ ind.1 ) := by
423398 have h := g.2
424399 unfold evalDomain at h
425- have h' : (x ^ 2 ^ i.1 )⁻¹ * ↑g ∈ ↑(Domain.evalDomain D ↑i) := by
426- apply (@mem_leftCoset_iff Fˣ _ (Domain.evalDomain D ↑i) g.1 (x ^ (2 ^ i.1 ))).mp
427- aesop_reconcile
400+ have h' : (x ^ 2 ^ i.1 )⁻¹ * ↑g ∈ ↑(Domain.evalDomain D ↑i) := by aesop_reconcile
428401 unfold Domain.evalDomain at h'
429402 rw [Subgroup.mem_zpowers_iff] at h'
430403 rcases h' with ⟨ind, h'⟩
@@ -480,7 +453,11 @@ def injectF {F : Type} [NonBinaryField F] {D : Subgroup Fˣ} [DIsCyclicC : IsCyc
480453/- Helper lemmas for constructing operations on/lifting between domains. -/
481454
482455omit [Finite F] in
483- lemma D_def : evalDomain D x 0 = x • D := by simp [Domain.D_def D]
456+ @[simp]
457+ lemma D_def : evalDomain D x 0 = x • D := by
458+ unfold evalDomain
459+ rw [Domain.D_def]
460+ simp
484461
485462lemma pow_2_pow_i_mem_Di_of_mem_D {F : Type } [NonBinaryField F] [Finite F] {D : Subgroup Fˣ}
486463 [DIsCyclicC : IsCyclicWithGen ↥D] {x : Fˣ} :
@@ -489,10 +466,10 @@ lemma pow_2_pow_i_mem_Di_of_mem_D {F : Type} [NonBinaryField F] [Finite F] {D :
489466 unfold evalDomain
490467 intros a i h
491468 have h : x⁻¹ * a ∈ Domain.evalDomain D 0 := by aesop_reconcile
492- rw [←Domain.D_def] at h
493469 have : (x⁻¹ * a) ^ 2 ^ i = (x ^ (2 ^ i))⁻¹ * (a ^ (2 ^ i)) := by field_simp
494- have h := this ▸ Domain.pow_2_pow_i_mem_Di_of_mem_D D (i := i) h
495- aesop_reconcile h
470+ simp only [Domain.D_def] at h
471+ have := Domain.pow_2_pow_i_mem_Di_of_mem_D D (i := i) h
472+ aesop_reconcile
496473
497474omit [Finite F] in
498475lemma sqr_mem_D_succ_i_of_mem_D_i : ∀ {a : Fˣ} {i : ℕ},
@@ -510,8 +487,8 @@ lemma sqr_mem_D_succ_i_of_mem_D_i : ∀ {a : Fˣ} {i : ℕ},
510487 congr 1
511488 grind
512489 rw [this]
513- have h := this ▸ Domain.sqr_mem_D_succ_i_of_mem_D_i D h
514- aesop_reconcile h
490+ have h := Domain.sqr_mem_D_succ_i_of_mem_D_i D h
491+ aesop_reconcile
515492
516493omit [Finite F] in
517494lemma pow_lift : ∀ {a : Fˣ} {i : ℕ} (s : ℕ),
@@ -533,17 +510,17 @@ lemma neg_mem_dom_of_mem_dom : ∀ {a : Fˣ} (i : Fin n),
533510 unfold evalDomain
534511 rintro a ⟨i, i_prop⟩ h
535512 have mem : (x ^ 2 ^ i)⁻¹ * a ∈ Domain.evalDomain D i := by
536- aesop_reconcile h
513+ aesop_reconcile
537514 have : (x ^ 2 ^ i)⁻¹ * -a ∈ ↑(Domain.evalDomain D i) := by
538515 have : (x ^ 2 ^ i)⁻¹ * -a = ((x ^ 2 ^ i)⁻¹ * a) * (- 1 ) := by field_simp
539516 rw [this]
540517 exact
541518 (
542519 Subgroup.mul_mem_cancel_right
543- (Domain.evalDomain D i)
520+ _
544521 (Domain.minus_one_in_doms D i_prop)
545522 ).mpr mem
546- aesop_reconcile this
523+ aesop_reconcile
547524
548525omit [Finite F] in
549526lemma mul_root_of_unity {x : Fˣ} :
@@ -563,11 +540,11 @@ lemma mul_root_of_unity {x : Fˣ} :
563540 apply Subgroup.mem_zpowers_iff.mpr
564541 exists (ka + (2 ^ (j - i)) * kb)
565542 rw [
566- ←@mul_assoc Fˣ _ _ a b, ←a_in, ←b_in, zpow_add,
567- Eq.symm (pow_mul_pow_sub 2 i_le_j), pow_mul, zpow_mul
543+ ←@mul_assoc _ _ _ a b, ←a_in, ←b_in, zpow_add,
544+ (pow_mul_pow_sub 2 i_le_j).symm , pow_mul, zpow_mul
568545 ]
569546 norm_cast
570- aesop_reconcile this
547+ aesop_reconcile
571548
572549omit [Finite F] in
573550lemma dom_n_eq_triv : evalDomain D x n = {x ^ (2 ^ n)} := by
0 commit comments