Download data/lean/OAI/Combinatorics/MatchingCount/Algorithm/OnlineLaw.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.72 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Algorithm/OnlineLaw.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Algorithm/OnlineLaw.lean
-
curl -L -o OnlineLaw.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Algorithm/OnlineLaw.lean
5.72 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Algorithm.TreeGeneratedUpdate | |
| import OAI.Combinatorics.MatchingCount.Probability.OnlineSampleLaw | |
| namespace OAI | |
| namespace MatchingFPRAS.OnlineStage | |
| open PhysicalStream TreeTyped ExecutableSource NumericLadder TreeFraction ExecutableScaling | |
| open UnitRefresh Transport Enlargement TreeTyped.Numbered ExecutableAdaptive Variation | |
| attribute [local instance] NumberedHierarchy.labelOrder | |
| attribute [local instance] Transport.sym2Order Transport.bagEdgeOrder Transport.bagEdgeFintype | |
| attribute [local instance] UnitRefresh.Computable.allowedDec Transport.prodOrder Transport.sumOrder | |
| variable {n : β} [Nontrivial (Fin n)] | |
| variable (w : Fin nβFin nββ) (K D m : β) | |
| abbrev vertexCount := Fintype.card (SourceVertex (Fin n) K) | |
| abbrev labelCount := Fintype.card (RationalSource.Label w K) | |
| abbrev edgeCount := Fintype.card (BagEdge (RationalSource.bags w K)) | |
| abbrev tierCount := Transport.endpoint (vertexCount (n:=n) K) D K Fintype.card_pos | |
| abbrev copies := ladderQ (vertexCount (n:=n) K) D | |
| abbrev scansCount := discreteLadderSteps (vertexCount (n:=n) K) D K (tierCount (n:=n) K D) m | |
| abbrev choiceWidth (Ξ· : β) := bitPrecision (scansCount (n:=n) K D m * | |
| scanErrorNumerator (SourceVertex (Fin n) K) (RationalSource.Label w K) (RationalSource.bags w K) | |
| (tierCount (n:=n) K D) (copies (n:=n) K D)) Ξ· | |
| abbrev markWidth (Ξ· : β) := bitPrecision (6*edgeCount w K) Ξ· | |
| abbrev Raw (Ξ· : β) := OnlineSample.Random (vertexCount (n:=n) K) (choiceWidth w K D m Ξ·) | |
| (scansCount (n:=n) K D m) (edgeCount w K) (markWidth w K Ξ·) | |
| def rawEquiv (Ξ· : β) : | |
| ((Fin (scansCount (n:=n) K D m*scanBitCount (vertexCount (n:=n) K) (choiceWidth w K D m Ξ·))βBool) Γ | |
| (BagEdge (RationalSource.bags w K)βFin (markWidth w K Ξ·)βBool)) β Raw w K D m Ξ· := | |
| Equiv.prodCongr (runBitsEquiv (SourceVertex (Fin n) K) (choiceWidth w K D m Ξ·) (scansCount (n:=n) K D m)) | |
| (Equiv.arrowCongr (orderedEnum (BagEdge (RationalSource.bags w K))).symm (Equiv.refl _)) | |
| lemma raw_scan (Ξ· : β) (bs : Raw w K D m Ξ·) : | |
| runBitsEquiv (SourceVertex (Fin n) K) (choiceWidth w K D m Ξ·) (scansCount (n:=n) K D m) | |
| ((rawEquiv w K D m Ξ·).symm bs).1=bs.1 := | |
| congrArg Prod.fst ((rawEquiv w K D m Ξ·).apply_symm_apply bs) | |
| lemma raw_marks (Ξ· : β) (bs : Raw w K D m Ξ·) (e : BagEdge (RationalSource.bags w K)) : | |
| ((rawEquiv w K D m Ξ·).symm bs).2 e=bs.2 ((orderedEnum _).symm e) := rfl | |
| noncomputable def rawDraw (hw : β a b,0<w a b) (hD : 0<D) | |
| (hu : β a b,aβ bβBottleneckAlgorithm.edge w a bβ€(4:β)^K) | |
| (hq : 0<copies (n:=n) K D) (he : Even n) (Ξ· : β) : Raw w K D m Ξ·βRationalSource.Marked w K := | |
| RationalSource.markedSampler w hw K D m hD Fintype.card_pos hu hq | |
| (RationalSource.startMatching w K he) Ξ· β (rawEquiv w K D m Ξ·).symm | |
| noncomputable def core (hw : β a b,0<w a b) (hD : 0<D) | |
| (hu : β a b,aβ bβBottleneckAlgorithm.edge w a bβ€(4:β)^K) (he : Even n) | |
| (T q : β) (hq : 0<q) {k r km : β} | |
| (bits : Fin rβScanBits (SourceVertex (Fin n) K) k) | |
| (mb : BagEdge (RationalSource.bags w K)βFin kmβBool) : RationalSource.Marked w K := | |
| TableMarking.reveal (BagEdge.Incident (bags:=RationalSource.bags w K)) | |
| (ladderRun (RationalSource.bags_adjacent w K hu) (RationalSource.tree_acyclic w K) | |
| (fun l : RationalSource.Label w K=>l.1.val) (RationalSource.parent w K) | |
| (RationalSource.bags_ranked w K hu) (RationalSource.bags_nonempty w K) | |
| (RationalSource.parent_rank w K) hq (RationalSource.bagWeight w K D) | |
| (RationalSource.startMatching w K he) k r (fun _=>RationalSource.startMatching w K he) bits | |
| (topSlot T q hq)) | |
| (fun e=>(RationalSource.markingTable w hw K D hD e).draw km (mb e)) | |
| lemma generated_eq_core (hw : β a b,0<w a b) (hD : 0<D) | |
| (hu : β a b,aβ bβBottleneckAlgorithm.edge w a bβ€(4:β)^K) (he : Even n) | |
| (ft fq : List Bool) (hq : 0<fq.length) {k r km : β} | |
| (bits : Fin rβScanBits (SourceVertex (Fin n) K) k) | |
| (mb : BagEdge (RationalSource.bags w K)βFin kmβBool) : | |
| generatedSourceSample he w hw K D hD hu ft fq hq bits mb= | |
| core w K D hw hD hu he ft.length fq.length hq bits mb := rfl | |
| lemma generated_eq_raw (hw : β a b,0<w a b) (hD : 0<D) | |
| (hu : β a b,aβ bβBottleneckAlgorithm.edge w a bβ€(4:β)^K) | |
| (hq : 0<copies (n:=n) K D) (he : Even n) (Ξ· : β) (bs : Raw w K D m Ξ·) : | |
| generatedSourceSample he w hw K D hD hu | |
| (List.replicate (tierCount (n:=n) K D) false) (List.replicate (copies (n:=n) K D) false) | |
| (by simpa only [List.length_replicate] using hq) bs.1 | |
| (fun e=>bs.2 ((orderedEnum (BagEdge (RationalSource.bags w K))).symm e)) = | |
| rawDraw w K D m hw hD hu hq he Ξ· bs := by | |
| rw [generated_eq_core] | |
| simp only [List.length_replicate] | |
| unfold core rawDraw RationalSource.markedSampler TableMarking.draw RationalSource.topSampler | |
| RationalSource.sampler finiteLadder ladderBitRun | |
| simp only [Function.comp_apply,raw_scan,raw_marks] | |
| noncomputable local instance : Fintype (BagPM (RationalSource.bags w K)) := Fintype.ofFinite _ | |
| noncomputable local instance : Fintype (RationalSource.Marked w K) := Fintype.ofFinite _ | |
| lemma rawDraw_law (hw : β a b,0<w a b) (hD : 0<D) | |
| (hu : β a b,aβ bβBottleneckAlgorithm.edge w a bβ€(4:β)^K) | |
| (hq : 0<copies (n:=n) K D) (he : Even n) (Ξ· : β) : | |
| imageLaw (rawDraw w K D m hw hD hu hq he Ξ·)= | |
| RationalSource.markedSamplerLaw w hw K D m hD Fintype.card_pos hu hq | |
| (RationalSource.startMatching w K he) Ξ· := by | |
| unfold rawDraw RationalSource.markedSamplerLaw | |
| apply Eq.trans (imageLaw_comp_equiv (rawEquiv w K D m Ξ·).symm _) | |
| exact imageLaw_instances _ _ _ | |
| end MatchingFPRAS.OnlineStage | |
| end OAI | |