Download data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.68 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean
-
curl -L -o ArithmeticLineIntegration.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean
4.68 kB
| 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 | |