theorempattern_card (w : ℝ) (H : ℕ) : Fintype.card (FullPattern w H) =
(divisorModulus w H).totient*divisorModulus w H*(coprimeModulus w H).totient*coprimeModulus w H:=by
proof · 2
lines
simp only [FullPattern,Fintype.card_prod,ZMod.card_units_eq_totient,ZMod.card]
ring
theoremweight_sum (w : ℝ) (H : ℕ) : (∑_v : FullPattern w H,weight w H)=1:=by
proof · 8
lines
havehT0 : (divisorModulus w H : ℝ) ≠0:=by exact_mod_cast (divisorModulus_pos w H).ne'
havehT1 : (coprimeModulus w H : ℝ) ≠0:=by exact_mod_cast (coprimeModulus_pos w H).ne'
havehP0 : ((divisorModulus w H).totient : ℝ) ≠0:=by
exact_mod_cast (Nat.totient_pos.mpr (divisorModulus_pos w H)).ne'
havehP1 : ((coprimeModulus w H).totient : ℝ) ≠0:=by
exact_mod_cast (Nat.totient_pos.mpr (coprimeModulus_pos w H)).ne'
simp only [Finset.sum_const,Finset.card_univ,pattern_card,nsmul_eq_mul,Nat.cast_mul,weight]
field_simp
theoremcount_eq_indicator_sum (w : ℝ) (H qA J : ℕ) (beta delta : ∀t : ℕ,ZMod t)
(v : FullPattern w H) : (survivorCount w H qA Jbeta delta v : ℝ)=
∑ j ∈Finset.range J,indicator w H qA beta delta j v :=by
proof · 1
line
simp only [survivorCount,Finset.card_filter,Nat.cast_sum,Nat.cast_ite,Nat.cast_one,Nat.cast_zero,indicator]
theoremjoint_condition_split (w : ℝ) (HqA : ℕ) (beta delta : ∀t : ℕ,ZMod t)
(S : Finsetℕ) (p0 : (ZMod (divisorModulus w H))ˣ) (k0 : ZMod (divisorModulus w H))
(p1 : (ZMod (coprimeModulus w H))ˣ) (m1 : ZMod (coprimeModulus w H)) :
jointCondition w H qA beta delta S (p0,k0,p1,m1) ↔
divisorCondition w H beta S p0 k0 ∧ coprimeCondition w H qA delta S p1 m1 :=by
proof · 5
lines
constructor
· intro h
exact ⟨fun t ht j hj => (h j hj).1 t ht,fun t ht j hj => (h j hj).2 t ht⟩
· rintro ⟨h0,h1⟩ j hj
exact ⟨fun t ht => h0 t ht j hj,fun t ht => h1 t ht j hj⟩
theoremdivisor_condition_card (w : ℝ) (H : ℕ) (beta : ∀t : ℕ,ZMod t) (S : Finsetℕ)
(p0 : (ZMod (divisorModulus w H))ˣ) :
(Finset.univ.filter (divisorCondition w H beta S p0)).card =
∏ t ∈ divisorPrimes w H,(t-(positionResidues S t).card) :=by
proof · 19
lines
let u (t : ℕ) : (ZMod t)ˣ :=ifht : t ∈ divisorPrimes w Hthen projectedUnit (divisorModulus w H) t (Finset.dvd_prod_of_mem _ ht) p0 else1have hu (t : ℕ) (ht : t ∈ divisorPrimes w H) : (u t : ZMod t)=(p0.val.val : ZMod t) :=by
dsimp only [u]
rw [dite_eq_left ht]
exact projectedUnit_coe (divisorModulus w H) t (Finset.dvd_prod_of_mem _ ht) p0
have hP (t : ℕ) (ht : t ∈ divisorPrimes w H) : t.Prime:=
(LargePrimeDeletion.mem_cutoffPrimes.mp (Finset.mem_filter.mp ht).1).1let : NeZero (∏ t ∈ divisorPrimes w H,t) := ⟨(divisorModulus_pos w H).ne'⟩
have hh := prime_unit_avoidance_card (divisorPrimes w H) S hP u beta
havehe : Finset.univ.filter (divisorCondition w H beta S p0) =
Finset.univ.filter (funk0 : ZMod (divisorModulus w H) =>∀ t ∈ divisorPrimes w H,∀ j ∈S,(k0.val : ZMod t)+(u t : ZMod t)*(j : ZMod t) ≠ beta t) :=by
apply Finset.filter_congr
intro k0 _
unfold divisorCondition
exact forall_congr' (fun t => forall_congr' (fun ht =>by rw [hu t ht]))
rw [he]
exact hh
theoremmultiply_unit_iff (t : ℕ) (u : (ZMod t)ˣ) (x c : ZMod t) :
(u : ZMod t)*x=c ↔ x=(↑(u⁻¹) : ZMod t)*c :=by
proof · 6
lines
constructor
· intro h
have hh := congrArg (funy : ZMod t => (↑(u⁻¹) : ZMod t)*y) h
simpa only [← mul_assoc,Units.inv_mul,one_mul] using hh
· intro h
rw [h,← mul_assoc,Units.mul_inv,one_mul]
theoremcoprime_condition_card (w : ℝ) (HqA : ℕ) (delta : ∀t : ℕ,ZMod t) (S : Finsetℕ)
(p1 : (ZMod (coprimeModulus w H))ˣ) (hqA : ∀ t ∈ coprimePrimes w H,qA.Coprime t) :
(Finset.univ.filter (coprimeCondition w H qA delta S p1)).card =
∏ t ∈ coprimePrimes w H,(t-(positionResidues S t).card) :=by
proof · 38
lines
let u (t : ℕ) : (ZMod t)ˣ :=ifht : t ∈ coprimePrimes w HthenZMod.unitOfCoprime H
(((LargePrimeDeletion.mem_cutoffPrimes.mp (Finset.mem_filter.mp ht).1).1.coprime_iff_not_dvd.mpr
(Finset.mem_filter.mp ht).2).symm) else1let coeff (t : ℕ) (ht : t ∈ coprimePrimes w H) : (ZMod t)ˣ :=
projectedUnit (coprimeModulus w H) t (Finset.dvd_prod_of_mem _ ht) p1*ZMod.unitOfCoprime qA (hqA t ht)
let c (t : ℕ) : ZMod t :=ifht : t ∈ coprimePrimes w Hthen (↑((coeff t ht)⁻¹) : ZMod t)*delta t else0have hu (t : ℕ) (ht : t ∈ coprimePrimes w H) : (u t : ZMod t)=(H : ZMod t) :=by
simp only [u,dite_eq_left ht,ZMod.coe_unitOfCoprime]
have hc (t : ℕ) (ht : t ∈ coprimePrimes w H) :
(coeff t ht : ZMod t)=(p1.val.val : ZMod t)*(qA : ZMod t) :=by
simp only [coeff,Units.val_mul,ZMod.coe_unitOfCoprime]
exact congrArg (funv : ZMod t => v*(qA : ZMod t))
(projectedUnit_coe (coprimeModulus w H) t (Finset.dvd_prod_of_mem _ ht) p1)
have hP (t : ℕ) (ht : t ∈ coprimePrimes w H) : t.Prime:=
(LargePrimeDeletion.mem_cutoffPrimes.mp (Finset.mem_filter.mp ht).1).1let : NeZero (∏ t ∈ coprimePrimes w H,t) := ⟨(coprimeModulus_pos w H).ne'⟩
have hh := prime_unit_avoidance_card (coprimePrimes w H) S hP u c
havehe : Finset.univ.filter (coprimeCondition w H qA delta S p1) =
Finset.univ.filter (funm1 : ZMod (coprimeModulus w H) =>∀ t ∈ coprimePrimes w H,∀ j ∈S,(m1.val : ZMod t)+(u t : ZMod t)*(j : ZMod t) ≠ c t) :=by
apply Finset.filter_congr
intro m1 _
unfold coprimeCondition
apply forall_congr'
intro t
apply forall_congr'
intro ht
rw [hu t ht]
apply forall_congr'
intro j
apply forall_congr'
intro _hj
simp only [c,dite_eq_left ht]
rw [← hc t ht]
exact not_congr (multiply_unit_iff t (coeff t ht) _ _)
rw [he]
exact hh