Download data/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.99 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean
-
curl -L -o JointMaskedGoodSelection.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean
6.99 kB
| import Mathlib | |
| import OAI.LinearAlgebra.MatrixFields.Construction.JointMaskedAssignment | |
| import OAI.LinearAlgebra.MatrixFields.Entropy.JointMaskedRates | |
| namespace OAI | |
| namespace MatrixAllFields | |
| open scoped BigOperators Topology Polynomial | |
| section | |
| noncomputable section | |
| namespace MatrixMultiplication.JointMaskedGoodSelection | |
| open Filter JointCoarseHashing JointExtractionRates JointMaskedSelection | |
| open JointOrdinarySelection (hashLevel hashSet) | |
| open JointMaskedRates | |
| open scoped Topology | |
| attribute [local instance] Classical.propDecidable | |
| theorem eventually_exists_good_selection | |
| {P E O V : β β Type*} [β N, Fintype (P N)] [β N, Fintype (E N)] | |
| (d : β N, OrbitData (P N) (E N) (O N) (V N)) | |
| (hinj : β N, Function.Injective (d N).coarse) | |
| (degree : β β β) (B p : β) | |
| (heligibility : β N e, ((d N).eligibilityCompetitors e).card β€ degree N) | |
| (hdegree : β N e, β o β (d N).orbits e, β v β (d N).passing e o, | |
| ((d N).competitors e o v).card β€ degree N) | |
| (horbits : β N e, ((d N).orbits e).card β€ B * (N + 1) ^ p) | |
| {A D H : β} (hH : 0 β€ H) (hgap : D < H) | |
| (hdegreeRate : β Ξ· : β, 0 < Ξ· β | |
| βαΆ N in atTop, Real.log (degree N : β) / (N : β) β€ D + Ξ·) | |
| (hpos : βαΆ N in atTop, 0 < Fintype.card (E N)) | |
| (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : β) / (N : β)) atTop (π A)) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) : | |
| βαΆ N in atTop, β (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), | |
| G.card = βReal.exp ((N : β) * (A - H - Ξ΅))ββ β§ | |
| (β e β G, (d N).Good (hashLevel H N) (hashSet H N) (N : β) e s) β§ | |
| (β e β G, β f β G, e β f β ((d N).coarse e).1 β ((d N).coarse f).1) := by | |
| classical | |
| have huniform := eventually_errorBound_le_half degree B p hH hgap hdegreeRate | |
| have hsmall : βαΆ N in atTop, β e, | |
| (((d N).eligibilityCompetitors e).card : β) / (hashModulus H N : β) + | |
| (((d N).orbits e).card : β) * (N : β) * | |
| ((degree N : β) / (hashModulus H N : β)) β€ 1 / 2 := by | |
| filter_upwards [huniform] with N hN e | |
| exact (count_error_le_envelope (d N) e (degree N) B p N (hashModulus H N) | |
| (heligibility N e) (horbits N e)).trans hN | |
| have hpositive : βαΆ N : β in atTop, (0 : β) < N := by | |
| filter_upwards [eventually_gt_atTop (0 : β)] with N hN | |
| exact_mod_cast hN | |
| let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => | |
| (d N).Good (hashLevel H N) (hashSet H N) (N : β) e s | |
| have hinc : βαΆ N in atTop, β e, | |
| (((JointAPFree.modularSet (hashModulus H N)).card : β) / | |
| (hashModulus H N : β) ^ 2 / 2) * | |
| (Fintype.card (Sample (P N) (hashLevel H N)) : β) β€ | |
| (goodIncidence (good N) e : β) := by | |
| filter_upwards [hsmall, hpositive] with N hN hNpos e | |
| rw [show goodIncidence (good N) e = | |
| ((d N).goodEvent (hashLevel H N) (hashSet H N) (N : β) e).card from | |
| (d N).goodIncidence_eq _ _ _ _] | |
| exact (d N).goodEvent_card_lower (hashLevel H N) (hashSet H N) (N : β) hNpos e | |
| (degree N) (hdegree N e) (hN e) | |
| have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hΞ΅ | |
| have hselection := eventually_exists_good_subfamily good | |
| (fun N => βReal.exp ((N : β) * (A - H - Ξ΅))ββ) hyield | |
| filter_upwards [hselection] with N hN | |
| obtain β¨s, G, hcard, hgoodβ© := hN | |
| refine β¨s, G, hcard, hgood, ?_β© | |
| intro e he f hf hne | |
| exact (d N).good_no_shared_x (hashLevel H N) (hashSet H N) (N : β) f e s | |
| (hgood f hf) (hgood e he) (fun h => hne ((hinj N) h)) | |
| end MatrixMultiplication.JointMaskedGoodSelection | |
| namespace MatrixMultiplication.JointMaskedSelection.OrbitData | |
| open JointCoarseHashing | |
| attribute [local instance] Classical.propDecidable | |
| variable {P E O V : Type*} [Fintype P] [Fintype E] | |
| omit [Fintype E] in | |
| theorem good_randomLossFraction_le (d : OrbitData P E O V) (k : β) | |
| (U : Finset (ZMod (37 ^ k))) (N : β) (e : E) (s : Sample P k) | |
| (hg : d.Good k U N e s) (o : O) (ho : o β d.orbits e) : | |
| JointLossCounts.randomLossFraction (d.full e o) (d.passing e o) | |
| (d.variableBad k U e o) s β€ 1 / N := by | |
| exact le_of_not_gt (fun h => hg.2 (Or.inr β¨o, ho, hβ©)) | |
| theorem passing_actual_failure_subset_bad (d : OrbitData P E O V) (k : β) | |
| (U : Finset (ZMod (37 ^ k))) | |
| (hAP : β x β U, β y β U, β z β U, x + y = 2 * z β x = z β§ y = z) | |
| (N : β) (e : E) (o : O) (ho : o β d.orbits e) (s : Sample P k) | |
| (hg : d.Good k U N e s) | |
| (compatible useful : Triple P β V β Prop) (keep : V β Prop) | |
| (hc : β v β d.passing e o, compatible (d.coarse e) v) | |
| (hu : β v β d.passing e o, useful (d.coarse e) v) | |
| (hk : β v β d.passing e o, keep v) | |
| (hcover : β v β d.passing e o, β f β d.actualTargets, | |
| f β d.coarse e β compatible f v β f β d.competitors e o v) : | |
| (d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v β | |
| some (d.coarse e)) β (d.passing e o).filter (fun v => d.variableBad k U e o v s) := by | |
| intro v hv | |
| obtain β¨hpass, hfailβ© := Finset.mem_filter.mp hv | |
| refine Finset.mem_filter.mpr β¨hpass, ?_β© | |
| by_contra hnotbad | |
| have hret : v β JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := | |
| Finset.mem_filter.mpr β¨hpass, hnotbadβ© | |
| exact hfail (d.model_retained_assigned k U hAP N e o ho s hg | |
| compatible useful keep v hret (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) | |
| theorem good_passing_actual_failure_fraction_le (d : OrbitData P E O V) (k : β) | |
| (U : Finset (ZMod (37 ^ k))) | |
| (hAP : β x β U, β y β U, β z β U, x + y = 2 * z β x = z β§ y = z) | |
| (N : β) (e : E) (o : O) (ho : o β d.orbits e) (s : Sample P k) | |
| (hg : d.Good k U N e s) | |
| (compatible useful : Triple P β V β Prop) (keep : V β Prop) | |
| (hc : β v β d.passing e o, compatible (d.coarse e) v) | |
| (hu : β v β d.passing e o, useful (d.coarse e) v) | |
| (hk : β v β d.passing e o, keep v) | |
| (hcover : β v β d.passing e o, β f β d.actualTargets, | |
| f β d.coarse e β compatible f v β f β d.competitors e o v) : | |
| (((d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v β | |
| some (d.coarse e))).card : β) / ((d.full e o).card : β) β€ 1 / N := by | |
| have hcard := Finset.card_le_card | |
| (d.passing_actual_failure_subset_bad k U hAP N e o ho s hg | |
| compatible useful keep hc hu hk hcover) | |
| have hR : (((d.passing e o).filter (fun v => | |
| d.actualAssignment k U compatible useful keep s v β some (d.coarse e))).card : β) β€ | |
| (((d.passing e o).filter (fun v => d.variableBad k U e o v s)).card : β) := by | |
| exact_mod_cast hcard | |
| exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans | |
| (d.good_randomLossFraction_le k U N e s hg o ho) | |
| end MatrixMultiplication.JointMaskedSelection.OrbitData | |
| end | |
| end | |
| end MatrixAllFields | |
| end OAI | |