Download data/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.04 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean
-
curl -L -o MaskedAssignment.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean
7.04 kB
| import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedSelection | |
| namespace OAI | |
| /-! Joint tensor extraction, compatibility and entropy estimates. -/ | |
| noncomputable section | |
| namespace MatrixMultiplication.JointMaskedSelection.OrbitData | |
| open JointCoarseHashing | |
| attribute [local instance] Classical.propDecidable | |
| variable {P E O V : Type*} [Fintype P] [Fintype E] | |
| def actualTargets (d : OrbitData P E O V) : Finset (Triple P) := | |
| Finset.univ.image d.coarse | |
| theorem coarse_mem_actualTargets (d : OrbitData P E O V) (e : E) : | |
| d.coarse e β d.actualTargets := | |
| Finset.mem_image.mpr β¨e, Finset.mem_univ e, rflβ© | |
| def xFlag (k : β) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (I : Word P) : Prop := | |
| JointHashing.xHash s (castWord k I) β U | |
| def yFlag (k : β) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (J : Word P) : Prop := | |
| JointHashing.yHash s (castWord k J) β U | |
| def zFlag (d : OrbitData P E O V) (k : β) (U : Finset (ZMod (37 ^ k))) | |
| (s : Sample P k) (K : Word P) : Prop := | |
| JointHashing.zHash (twoUnit k) s (fun p => (d.support p : ZMod (37 ^ k))) (castWord k K) β U | |
| omit [Fintype E] in | |
| theorem actual_survival_iff (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) | |
| (s : Sample P k) (f : Triple P) (hf : f β d.ambient) : | |
| JointCoarseAssignment.survives (xFlag k U s) (yFlag k U s) (d.zFlag k U s) f β | |
| Survives k U f s := | |
| full_survival_iff k U hAP d.support f (d.support_ambient f hf) s | |
| def actualEligible (d : OrbitData P E O V) (k : β) (U : Finset (ZMod (37 ^ k))) | |
| (s : Sample P k) : Finset (Triple P) := | |
| JointCoarseAssignment.eligible d.ambient d.actualTargets | |
| (xFlag k U s) (yFlag k U s) (d.zFlag k U s) | |
| theorem good_mem_actualEligible (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) (s : Sample P k) (hg : d.Good k U N e s) : | |
| d.coarse e β d.actualEligible k U s := by | |
| apply JointAssignmentLoss.eligible_of_no_ambientXCollision d.ambient d.actualTargets | |
| (xFlag k U s) (yFlag k U s) (d.zFlag k U s) (d.coarse e) | |
| (d.target_mem e) (d.coarse_mem_actualTargets e) | |
| ((d.actual_survival_iff k U hAP s _ (d.target_mem e)).2 hg.1) | |
| rintro β¨f, hf, hne, hs, hxβ© | |
| exact d.good_eligibility k U N e s hg | |
| β¨f, (d.mem_eligibilityCompetitors e f).2 β¨hf, hne, hxβ©, | |
| (d.actual_survival_iff k U hAP s f hf).1 hsβ© | |
| def actualAssignment (d : OrbitData P E O V) (k : β) (U : Finset (ZMod (37 ^ k))) | |
| (compatible useful : Triple P β V β Prop) (keep : V β Prop) | |
| (s : Sample P k) (v : V) : Option (Triple P) := | |
| JointExtraction.retainAssignment | |
| (JointCoarseAssignment.assignUseful (d.actualEligible k U s) compatible useful) keep v | |
| theorem model_retained_assigned (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) | |
| (v : V) (hv : v β JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s) | |
| (hc : compatible (d.coarse e) v) (hu : useful (d.coarse e) v) (hk : keep v) | |
| (hcover : β f β d.actualTargets, f β d.coarse e β compatible f v β | |
| f β d.competitors e o v) : | |
| d.actualAssignment k U compatible useful keep s v = some (d.coarse e) := by | |
| obtain β¨hpass, hnotbadβ© := Finset.mem_filter.1 hv | |
| have hassign := JointAssignmentLoss.assignUseful_of_no_targetCollision | |
| d.ambient d.actualTargets (xFlag k U s) (yFlag k U s) (d.zFlag k U s) | |
| compatible useful (d.coarse e) v (d.good_mem_actualEligible k U hAP N e s hg) hc hu | |
| (by | |
| rintro β¨f, hf, hne, hsurv, hcompβ© | |
| have hfc := hcover f hf hne hcomp | |
| have hfa := d.competitor_mem e o ho v hpass f hfc | |
| exact hnotbad β¨f, hfc, (d.actual_survival_iff k U hAP s f hfa).1 hsurvβ©) | |
| simpa only [actualAssignment, actualEligible, JointExtraction.retainAssignment, ite_eq_left hk] using hassign | |
| theorem actual_failure_subset_model_missing (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.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v β | |
| some (d.coarse e)) β | |
| d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := by | |
| intro v hv | |
| obtain β¨hvfull, hvfailβ© := Finset.mem_filter.1 hv | |
| apply Finset.mem_sdiff.2 | |
| refine β¨hvfull, ?_β© | |
| intro hvmodel | |
| have hpass := (Finset.mem_filter.1 hvmodel).1 | |
| exact hvfail (d.model_retained_assigned k U hAP N e o ho s hg compatible useful keep v | |
| hvmodel (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) | |
| theorem good_actual_missingFraction_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) | |
| (Cβ 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) | |
| (hdet : β o β d.orbits e, | |
| JointLossCounts.deterministicLossFraction (d.full e o) (d.passing e o) β€ Cβ / N) : | |
| (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v β | |
| some (d.coarse e))).card : β) / ((d.full e o).card : β) β€ (Cβ + 1) / N := by | |
| have hcard := Finset.card_le_card | |
| (d.actual_failure_subset_model_missing k U hAP N e o ho s hg compatible useful keep hc hu hk hcover) | |
| have hR : (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v β | |
| some (d.coarse e))).card : β) β€ | |
| ((d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s).card : β) := by | |
| exact_mod_cast hcard | |
| exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans | |
| (d.good_missingFraction_le k U Cβ N e s hg hdet o ho) | |
| end MatrixMultiplication.JointMaskedSelection.OrbitData | |
| end | |
| end OAI | |