Buckets:
| import Mathlib | |
| import OAI.Combinatorics.SharpRamsey.Marking.ClassSelection | |
| namespace OAI | |
| section | |
| namespace SharpLogRamsey.Marking | |
| open Finset | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] | |
| [FiniteDimensional K V] [Fintype (Projectivization K V)] | |
| [Fintype (Projectivization K (Module.Dual K V))] | |
| [Fintype (Projectivization K (Module.Dual K (Module.Dual K V)))] [Finite K] | |
| def expensiveBudget (K V : Type*) [Field K] [AddCommGroup V] [Module K V] | |
| [FiniteDimensional K V] [Fintype (Projectivization K V)] : â := | |
| 32*(Module.finrank K V+1)^2*(Nat.card K:â)* | |
| Real.log (Fintype.card (Points (K:=K) (V:=V))+1:â) | |
| omit [Fintype (Projectivization K (Module.Dual K (Module.Dual K V)))] in | |
| lemma two_expensive_bound {N : â} (F : Fin NâProjectivePair (K:=K) (V:=V)) : | |
| ((bothExpensive (twoMask (Nat.card K) F)).card:â)†| |
| expensiveBudget K V+expensiveBudget K (Module.Dual K V) := by | |
| have hq : (0:â)<Nat.card K := by exact_mod_cast Nat.card_pos (α:=K) | |
| have hâ := scan_expensive_bound (Nat.card K:â) hq (fun _=>â„) ((List.ofFn F).map toScan) | |
| have hâ := scan_expensive_bound (Nat.card K:â) hq (fun _=>â„) | |
| ((List.ofFn (reversedPairs F)).map toScan) | |
| have h := bothExpensive_card (Nat.card K) F | |
| have h' : ((bothExpensive (twoMask (Nat.card K) F)).card:â)†| |
| (expensiveMask (tupleMask (Nat.card K) F)).card+ | |
| (expensiveMask (tupleMask (Nat.card K) (reversedPairs F))).card := by exact_mod_cast h | |
| rw [expensiveMask_card,expensiveMask_card] at h' | |
| exact h'.trans (add_le_add hâ hâ) | |
| variable {Ω Î Îș : Type*} [Fintype Ω] [Fintype Î] [Fintype Îș] [Nonempty Îș] | |
| omit [Fintype Îș] [Nonempty Îș] in | |
| lemma twoScan_subset_pointwise {N n : â} (hdim : Module.finrank K V=n+3) | |
| (p : Selection.Law Ω) (C : ΩâÎ) (F : ΩâFin NâProjectivePair (K:=K) (V:=V)) | |
| (hcons : â x,p.mass xâ 0âScanConsistent ((List.ofFn (F x)).map toScan)) | |
| (hinc : â x,p.mass xâ 0ââ i,Incidence.Incident (F x i).1 (F x i).2) | |
| (z : TwoMessage (K:=K) (V:=V) Î N) | |
| (hz : (p.map (sourceMessage C F)).mass zâ 0) | |
| (S : Finset (Fin N)) (hS : Disjoint S (bothExpensive z.2.2)) : | |
| 0â€S.card*jointJ K (n+2)-Selection.entropy | |
| (((p.cond (sourceMessage C F) z).map F).restrict S) := by | |
| let Ξ := sourceMessage C F | |
| let Μ := (p.cond Ξ z).map F | |
| have hcoord (i : S) : Selection.entropy ((Μ.restrict S).marginal i) †jointJ K (n+2) := by | |
| rw [Selection.Law.marginal_restrict] | |
| have hs : Selection.entropy (Μ.marginal (i:Fin N)) †| |
| Real.log (cheapBoth z i).card := by | |
| change Selection.entropy (((p.cond Ξ z).map F).map (fun f=>f i)) †_ | |
| rw [Selection.Law.map_map] | |
| apply Selection.entropy_mapped_support | |
| intro x hx | |
| obtain âšhx,heâ© := p.cond_support Ξ z hz x hx | |
| have hi : (i:Fin N)âbothExpensive (twoMask (Nat.card K) (F x)) := by | |
| have he' : twoMask (Nat.card K) (F x)=z.2.2 := congrArg (fun z=>z.2.2) he | |
| rw [he'] | |
| exact disjoint_left.mp hS i.property | |
| have hh := cheapBoth_mem C F x (hcons x hx) (hinc x hx) i hi | |
| simpa only [Function.comp_apply,âhe,Ξ,sourceMessage] using hh | |
| exact hs.trans (cheapBoth_log_card hdim z i) | |
| have hh := (Selection.entropy_subadditive_pi (Μ.restrict S)).trans | |
| (sum_le_sum (fun i _=>hcoord i)) | |
| have he : (â _ : S,jointJ K (n+2))=S.card*jointJ K (n+2) := by simp | |
| rw [he] at hh | |
| exact sub_nonneg.mpr hh | |
| omit [Fintype Îș] [Nonempty Îș] in | |
| def conditionedDeficit {N : â} (p : Selection.Law Ω) (C : ΩâÎ) | |
| (F : ΩâFin NâProjectivePair (K:=K) (V:=V)) | |
| (E : Finset (TwoMessage (K:=K) (V:=V) Î N)) | |
| (hE : 0<(p.map (sourceMessage C F)).event E) | |
| (S : TwoMessage (K:=K) (V:=V) Î NâFinset (Fin N)) (J : â) : â := | |
| Selection.selectedDeficit (p.onContextEvent (sourceMessage C F) E hE) | |
| (sourceMessage C F) F S J | |
| omit [Fintype (Projectivization K (Module.Dual K (Module.Dual K V)))] in | |
| theorem actual_common_class_slots {N : â} | |
| (p : Selection.Law Ω) (C : ΩâÎ) (F : ΩâFin NâProjectivePair (K:=K) (V:=V)) | |
| (colour : TwoMessage (K:=K) (V:=V) Î NâFin NâÎș) (m : â) | |
| (hm : (Fintype.card Îș*m:â)+expensiveBudget K V+ | |
| expensiveBudget K (Module.Dual K V)â€(N:â)) : | |
| â (c : Îș) (E : Finset (TwoMessage (K:=K) (V:=V) Î N)) | |
| (_hE : 0<(p.map (sourceMessage C F)).event E) | |
| (S : TwoMessage (K:=K) (V:=V) Î NâFinset (Fin N)), | |
| 1/(Fintype.card Îș:â)â€(p.map (sourceMessage C F)).event E â§ | |
| (â z,Disjoint (S z) (bothExpensive z.2.2)) â§ | |
| (â zâE,(S z).card=m â§ â iâS z,colour z i=c) := by | |
| let Ξ:=sourceMessage C F | |
| let U:=fun z : TwoMessage (K:=K) (V:=V) Î N=>(bothExpensive z.2.2)á¶ | |
| have hcount x (_hx : p.mass xâ 0) : Fintype.card Îș*mâ€(U (Ξ x)).card := by | |
| have hb := two_expensive_bound (F x) | |
| have hc : ((U (Ξ x)).card:â)=(N:â)-(bothExpensive (twoMask (Nat.card K) (F x))).card := by | |
| simp only [U,Ξ,sourceMessage,Selection.markingMessage,card_compl, | |
| Fintype.card_fin] | |
| rw [Nat.cast_sub (by simpa only [Fintype.card_fin] using | |
| (card_le_univ (bothExpensive (twoMask (Nat.card K) (F x)))))] | |
| have hh : (Fintype.card Îș*m:â)â€((U (Ξ x)).card:â) := by rw [hc]; linarith | |
| exact_mod_cast hh | |
| obtain âšc,E,S,hprob,hslotsâ© := Selection.common_class_extraction p Ξ U colour m hcount | |
| have hp : 0<(p.map Ξ).event E := lt_of_lt_of_le (one_div_pos.mpr (by | |
| exact_mod_cast (Fintype.card_pos (α:=Îș)))) hprob | |
| let S' := fun z=>if zâE then S z else â | |
| have hS z : Disjoint (S' z) (bothExpensive z.2.2) := by | |
| by_cases hz : zâE | |
| · simp only [S',ite_eq_left hz] | |
| apply disjoint_left.mpr | |
| intro i hi hie | |
| exact (mem_compl.mp ((hslots z hz).2.1 hi)) hie | |
| · simp [S',hz] | |
| refine âšc,E,hp,S',hprob,hS,?_â© | |
| intro z hz | |
| simpa only [S',ite_eq_left hz] using âš(hslots z hz).1,(hslots z hz).2.2â© | |
| omit [Fintype Îș] [Nonempty Îș] in | |
| theorem twoScan_conditioned_deficit {N n : â} (hdim : Module.finrank K V=n+3) | |
| (p : Selection.Law Ω) (C : ΩâÎ) (F : ΩâFin NâProjectivePair (K:=K) (V:=V)) | |
| (D : ÎâFin NâFinset (ProjectivePair (K:=K) (V:=V))) (Jprev : â) | |
| (hcons : â x,p.mass xâ 0âScanConsistent ((List.ofFn (F x)).map toScan)) | |
| (hinc : â x,p.mass xâ 0ââ i,Incidence.Incident (F x i).1 (F x i).2) | |
| (hD : â x,p.mass xâ 0ââ i,F x iâD (C x) i) | |
| (hprev : â c i,Real.log (D c i).cardâ€Jprev) | |
| (E : Finset (TwoMessage (K:=K) (V:=V) Î N)) | |
| (hp : 0<(p.map (sourceMessage C F)).event E) | |
| (S : TwoMessage (K:=K) (V:=V) Î NâFinset (Fin N)) | |
| (hS : â z,Disjoint (S z) (bothExpensive z.2.2)) : | |
| conditionedDeficit p C F E hp S (jointJ K (n+2)) †| |
| excessCost p C F Jprev (jointJ K (n+2))/(p.map (sourceMessage C F)).event E := by | |
| unfold conditionedDeficit | |
| apply Selection.selectedDeficit_onContextEvent_le | |
| · intro z hz | |
| convert twoScan_subset_pointwise hdim p C F hcons hinc z hz (S z) (hS z) using 1; congr! | |
| · exact (twoScan_subset_deficit hdim p C F D Jprev hcons hinc hD hprev S hS).2 | |
| theorem actual_common_class {N n : â} (hdim : Module.finrank K V=n+3) | |
| (p : Selection.Law Ω) (C : ΩâÎ) (F : ΩâFin NâProjectivePair (K:=K) (V:=V)) | |
| (D : ÎâFin NâFinset (ProjectivePair (K:=K) (V:=V))) (Jprev : â) | |
| (hcons : â x,p.mass xâ 0âScanConsistent ((List.ofFn (F x)).map toScan)) | |
| (hinc : â x,p.mass xâ 0ââ i,Incidence.Incident (F x i).1 (F x i).2) | |
| (hD : â x,p.mass xâ 0ââ i,F x iâD (C x) i) | |
| (hprev : â c i,Real.log (D c i).cardâ€Jprev) | |
| (colour : TwoMessage (K:=K) (V:=V) Î NâFin NâÎș) (m : â) | |
| (hm : (Fintype.card Îș*m:â)+expensiveBudget K V+ | |
| expensiveBudget K (Module.Dual K V)â€(N:â)) : | |
| â (c : Îș) (E : Finset (TwoMessage (K:=K) (V:=V) Î N)) | |
| (hE : 0<(p.map (sourceMessage C F)).event E) | |
| (S : TwoMessage (K:=K) (V:=V) Î NâFinset (Fin N)), | |
| 1/(Fintype.card Îș:â)â€(p.map (sourceMessage C F)).event E â§ | |
| (â z,Disjoint (S z) (bothExpensive z.2.2)) â§ | |
| (â zâE,(S z).card=m â§ â iâS z,colour z i=c) â§ | |
| conditionedDeficit p C F E hE S (jointJ K (n+2)) †| |
| excessCost p C F Jprev (jointJ K (n+2))/(p.map (sourceMessage C F)).event E := by | |
| obtain âšc,E,hp,S,hprob,hS,hslotsâ© := actual_common_class_slots p C F colour m hm | |
| exact âšc,E,hp,S,hprob,hS,hslots, | |
| twoScan_conditioned_deficit hdim p C F D Jprev hcons hinc hD hprev E hp S hSâ© | |
| end | |
| end SharpLogRamsey.Marking | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 8.61 kB
- Xet hash:
- 634a77a5a801794a554344f043596bfccc0bc9c46c2aae3fc536f291cba7aef4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.