File size: 4,675 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | import Mathlib.Data.Nat.Totient
import OAI.NumberTheory.Ostmann.Characters.PolynomialLineFlags
namespace OAI
/-! # Actual line integrals as bounded functions of the cleared polynomial tests -/
namespace Ostmann
open scoped BigOperators Classical
noncomputable def internalLineScalar (external : Bool) (p : β) : β :=
((if external then p else p - 1 : β) : β)β»ΒΉ
theorem internalLineScalar_nonneg (external : Bool) (p : β) :
0 β€ internalLineScalar external p := by
unfold internalLineScalar
positivity
theorem internalLineScalar_le_one (external : Bool) (p : β) :
internalLineScalar external p β€ 1 := by
let n : β := if external then p else p - 1
change (n : β)β»ΒΉ β€ 1
rcases Nat.eq_zero_or_pos n with h | h
Β· simp [h]
Β· exact inv_le_one_of_one_leβ (by exact_mod_cast h)
noncomputable def internalLineFlagWeight {J : Type*} (external : Bool) (p : β)
(flags : Bool β J β Bool) : β :=
if lineFeasibleFlags external flags then internalLineScalar external p else 0
theorem internalLineFlagWeight_nonneg {J : Type*} (external : Bool) (p : β)
(flags : Bool β J β Bool) : 0 β€ internalLineFlagWeight external p flags := by
unfold internalLineFlagWeight
split_ifs
Β· exact internalLineScalar_nonneg external p
Β· rfl
theorem internalLineFlagWeight_le_one {J : Type*} (external : Bool) (p : β)
(flags : Bool β J β Bool) : internalLineFlagWeight external p flags β€ 1 := by
unfold internalLineFlagWeight
split_ifs
Β· exact internalLineScalar_le_one external p
Β· norm_num
/-- The normalized count before the giant variables are integrated out. -/
noncomputable def internalLineProbability {J : Type*} {p : β} [Fact p.Prime]
(external : Bool) (a b : J β ZMod p) : β :=
if external then
(Fintype.card {z : ZMod p Γ (ZMod p)Λ£ // β j, a j * z.1 + b j * z.2 = 0} : β) /
Fintype.card (ZMod p Γ (ZMod p)Λ£)
else
(Fintype.card {z : (ZMod p)Λ£ Γ (ZMod p)Λ£ // β j, a j * z.1 + b j * z.2 = 0} : β) /
Fintype.card ((ZMod p)Λ£ Γ (ZMod p)Λ£)
theorem internalLineProbability_nonneg {J : Type*} {p : β} [Fact p.Prime]
(external : Bool) (a b : J β ZMod p) : 0 β€ internalLineProbability external a b := by
unfold internalLineProbability
split_ifs <;> positivity
theorem external_lineSystem_integral_eq_flags {Ο J : Type*} {p : β} [Fact p.Prime]
(L : J β PolynomialGiantLine Ο) (i : J) (Ο : MvPolynomial Ο β€ β+* ZMod p)
(hd : β j, Ο (L j).denominator β 0)
(hrow : ((L i).normalized Ο).1 β 0 β¨ ((L i).normalized Ο).2 β 0) :
(Fintype.card {z : ZMod p Γ (ZMod p)Λ£ //
β j, ((L j).normalized Ο).1 * z.1 + ((L j).normalized Ο).2 * z.2 = 0} : β) /
Fintype.card (ZMod p Γ (ZMod p)Λ£) =
internalLineFlagWeight true p
(fun s => arithmeticTestFlag (Ο (lineTestPolynomials L i s) = 0)) := by
rw [external_lineSystem_probability _ _ i hrow]
unfold internalLineFlagWeight
rw [external_polynomialLine_flags_iff L i Ο hd]
rfl
theorem unit_lineSystem_integral_eq_flags {Ο J : Type*} {p : β} [Fact p.Prime]
(L : J β PolynomialGiantLine Ο) (i : J) (Ο : MvPolynomial Ο β€ β+* ZMod p)
(hd : β j, Ο (L j).denominator β 0)
(hrow : ((L i).normalized Ο).1 β 0 β¨ ((L i).normalized Ο).2 β 0) :
(Fintype.card {z : (ZMod p)Λ£ Γ (ZMod p)Λ£ //
β j, ((L j).normalized Ο).1 * z.1 + ((L j).normalized Ο).2 * z.2 = 0} : β) /
Fintype.card ((ZMod p)Λ£ Γ (ZMod p)Λ£) =
internalLineFlagWeight false p
(fun s => arithmeticTestFlag (Ο (lineTestPolynomials L i s) = 0)) := by
rw [unit_lineSystem_probability _ _ i hrow]
unfold internalLineFlagWeight
rw [unit_polynomialLine_flags_iff L i Ο hd]
have hc : Fintype.card (ZMod p)Λ£ = p - 1 := by
rw [ZMod.card_units_eq_totient, Nat.totient_prime (Fact.out : p.Prime)]
simp only [internalLineScalar, Bool.false_eq_true, ite_false, hc]
theorem internalLineProbability_eq_flags {Ο J : Type*} {p : β} [Fact p.Prime]
(external : Bool) (L : J β PolynomialGiantLine Ο) (i : J)
(Ο : MvPolynomial Ο β€ β+* ZMod p) (hd : β j, Ο (L j).denominator β 0)
(hrow : ((L i).normalized Ο).1 β 0 β¨ ((L i).normalized Ο).2 β 0) :
internalLineProbability external (fun j => ((L j).normalized Ο).1)
(fun j => ((L j).normalized Ο).2) =
internalLineFlagWeight external p
(fun s => arithmeticTestFlag (Ο (lineTestPolynomials L i s) = 0)) := by
cases external
Β· exact unit_lineSystem_integral_eq_flags L i Ο hd hrow
Β· exact external_lineSystem_integral_eq_flags L i Ο hd hrow
end Ostmann
end OAI
|