Download data/lean/OAI/Combinatorics/MatchingCount/Sampling/MarkBridge.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.95 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Sampling/MarkBridge.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Sampling/MarkBridge.lean
-
curl -L -o MarkBridge.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Sampling/MarkBridge.lean
4.95 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Probability.Marking | |
| import OAI.Combinatorics.MatchingCount.Algorithm.RelabelWeights | |
| import OAI.Combinatorics.MatchingCount.Sampling.RelabelMarking | |
| namespace OAI | |
| namespace MatchingFPRAS.RationalSource | |
| open Finset Transport Variation Enlargement | |
| variable {V : Type*} [Fintype V] [LinearOrder V] [Nontrivial V] | |
| attribute [local instance] NumberedHierarchy.labelOrder sym2Order bagEdgeOrder bagEdgeFintype | |
| attribute [local instance] UnitRefresh.Computable.allowedDec prodOrder sumOrder | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| DecidableEq (SourceLabel (fun x y=>(w x y:β)) K) := Classical.decEq _ | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| Fintype (BagEdge (sourceBags (fun x y=>(w x y:β)) K)) := Fintype.ofFinite _ | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| DecidableEq (BagPM (bags w K)) := Classical.decEq _ | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| Fintype (BagPM (bags w K)) := Fintype.ofFinite _ | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| Fintype (Marked w K) := Fintype.ofFinite _ | |
| noncomputable local instance (w : V β V β β) (K : β) : | |
| Fintype (SourceMarked (fun x y=>(w x y:β)) K) := Fintype.ofFinite _ | |
| lemma sourceEdgeEquiv_central (w : V β V β β) (K : β) (q : LogicalEdge V) : | |
| sourceEdgeEquiv w K (Enlargement.centralEdge (fun x y=>(w x y:β)) K q)=centralEdge w K q := | |
| sourceEdgeEquiv_real w K _ | |
| lemma probePortion_cast (w : V β V β β) (K D : β) | |
| (e : BagEdge (sourceBags (fun x y=>(w x y:β)) K)) : | |
| (probePortion w K D (sourceEdgeEquiv w K e):β)=Enlargement.probePortion (fun x y=>(w x y:β)) K D e := by | |
| classical | |
| have he : (β q,centralEdge w K q=sourceEdgeEquiv w K e) β | |
| β q,Enlargement.centralEdge (fun x y=>(w x y:β)) K q=e := by | |
| constructor | |
| Β· rintro β¨q,hqβ© | |
| exact β¨q,(sourceEdgeEquiv w K).injective ((sourceEdgeEquiv_central w K q).trans hq)β© | |
| Β· rintro β¨q,rflβ© | |
| exact β¨q,(sourceEdgeEquiv_central w K q).symmβ© | |
| simp only [probePortion,Enlargement.probePortion,he] | |
| split_ifs <;> push_cast <;> rfl | |
| lemma portions_cast (w : V β V β β) (K D : β) | |
| (e : BagEdge (sourceBags (fun x y=>(w x y:β)) K)) (i : Fin 3) : | |
| (portions w K D (sourceEdgeEquiv w K e) i:β)=sourcePortions (fun x y=>(w x y:β)) K D e i := by | |
| fin_cases i | |
| Β· exact realPortion_cast w K e | |
| Β· change ((bagHeight w K (sourceEdgeEquiv w K e).color/D-probePortion w K D (sourceEdgeEquiv w K e):β):β)=_ | |
| rw [Rat.cast_sub,Rat.cast_div,Rat.cast_natCast,probePortion_cast,sourceEdgeEquiv_color,bagHeight_cast] | |
| rfl | |
| Β· exact probePortion_cast w K D e | |
| noncomputable def sourceMarkedEquiv (w : V β V β β) (K : β) : | |
| SourceMarked (fun x y=>(w x y:β)) K β Marked w K := | |
| markedEquiv (inc:=BagEdge.Incident (bags:=sourceBags (fun x y=>(w x y:β)) K)) | |
| (j:=BagEdge.Incident (bags:=bags w K)) (sourceEdgeEquiv w K) (fun _ _=>Iff.rfl) | |
| lemma portions_collapse (w : V β V β β) (K D : β) : | |
| Marking.collapse (fun e i=>(portions w K D e i:β))=fun e=>(bagWeight w K D e:β) := by | |
| funext e | |
| change (β i : Fin 3,(portions w K D e i:β))=(bagWeight w K D e:β) | |
| exact_mod_cast portions_sum w K D e | |
| lemma markedLaw_eq (w : V β V β β) (hw : β x y,0<w x y) (K D : β) (hD : 0<D) | |
| (a : Marked w K) : | |
| markedLaw w K D a=Marking.law BagEdge.Incident (fun e i=>(portions w K D e i:β)) a := by | |
| have hc : β e,Marking.collapse (fun e i=>(portions w K D e i:β)) eβ 0 := by | |
| intro e | |
| rw [portions_collapse] | |
| dsimp only | |
| exact_mod_cast (bagWeight_pos w hw K D hD e).ne' | |
| have h:=Marking.law_from_reveal BagEdge.Incident (fun e i=>(portions w K D e i:β)) hc a | |
| rw [portions_collapse] at h | |
| convert h using 1 | |
| simp only [markedLaw,Variation.sigmaLift,product,gibbs,matchingWeight,partition,Marking.conditional, | |
| portions_collapse,Rat.cast_div,partitionWeight] | |
| congr 3 | |
| ext | |
| simp | |
| lemma markedLaw_equiv (w : V β V β β) (hw : β x y,0<w x y) (K D : β) (hD : 0<D) | |
| (a : SourceMarked (fun x y=>(w x y:β)) K) : | |
| markedLaw w K D (sourceMarkedEquiv w K a)=sourceLaw (fun x y=>(w x y:β)) K D a := by | |
| rw [markedLaw_eq w hw K D hD] | |
| change Marking.law BagEdge.Incident (fun e i=>(portions w K D e i:β)) | |
| (markedEquiv (inc:=BagEdge.Incident (bags:=sourceBags (fun x y=>(w x y:β)) K)) | |
| (j:=BagEdge.Incident (bags:=bags w K)) (sourceEdgeEquiv w K) (fun _ _=>Iff.rfl) a)=_ | |
| rw [law_markedEquiv (inc:=BagEdge.Incident (bags:=sourceBags (fun x y=>(w x y:β)) K)) | |
| (j:=BagEdge.Incident (bags:=bags w K)) (sourceEdgeEquiv w K) (fun _ _=>Iff.rfl)] | |
| have hp : ((fun e i=>(portions w K D e i:β)) β sourceEdgeEquiv w K)= | |
| sourcePortions (fun x y=>(w x y:β)) K D := by | |
| funext e i | |
| exact portions_cast w K D e i | |
| rw [hp] | |
| rfl | |
| end MatchingFPRAS.RationalSource | |
| end OAI | |