Download data/lean/OAI/Combinatorics/MatchingCount/Arithmetic/TreeStateNormalize.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.42 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Arithmetic/TreeStateNormalize.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Arithmetic/TreeStateNormalize.lean
-
curl -L -o TreeStateNormalize.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Arithmetic/TreeStateNormalize.lean
2.42 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Machines.TreeReach | |
| import OAI.Combinatorics.MatchingCount.Machines.TreeStateTable | |
| namespace OAI | |
| namespace MatchingFPRAS.ExecutableLadder | |
| open TreeTyped Polynomial | |
| variable {I E : Type} [Codec I] [Codec E] [DecidableEq I] [Inhabited I] [LinearOrder E] | |
| abbrev StateEnvelope (I E : Type) := List IΓFinset E | |
| def normalizeState (x : StateEnvelope I EΓStateTable I (Finset E)) : StateTable I (Finset E) := | |
| x.1.1.map (fun i=>(i,lookup β (x.2,i)β©x.1.2)) | |
| def normalizeStateRealizer (Eq : Realizer (fun x : IΓI=>decide (x.1=x.2))) | |
| (EqE : Realizer (fun x : EΓE=>decide (x.1=x.2))) : Realizer (normalizeState (I:=I) (E:=E)) := | |
| (composition (pair identity first.fst) (mapWith (pair second | |
| (composition (pair (composition (pair first.snd second) (lookupRealizer β Eq)) first.fst.snd) | |
| (finsetInter EqE))))).congr (fun _=>rfl) | |
| lemma polynomial_normalizeState {Eq : Realizer (fun x : IΓI=>decide (x.1=x.2))} | |
| {EqE : Realizer (fun x : EΓE=>decide (x.1=x.2))} | |
| (hEq : PolynomialTime Eq) (hE : PolynomialTime EqE) : PolynomialTime (normalizeStateRealizer Eq EqE) := by | |
| unfold normalizeStateRealizer Realizer.fst Realizer.snd | |
| apply polynomial_congr | |
| have := polynomial_lookup (β : Finset E) hEq | |
| tree_cost | |
| omit [Inhabited I] in | |
| lemma normalizeState_weight (keys : List I) (univ : Finset E) (s : StateTable I (Finset E)) : | |
| weight (normalizeState ((keys,univ),s))β€(weight keys+1)*(weight univ+3) := by | |
| induction keys with | |
| | nil=>simp only [normalizeState,List.map_nil,weight_nil]; omega | |
| | cons i keys ih=> | |
| have hu : weight (lookup β (s,i)β©univ)β€weight univ := weight_finset_subset Finset.inter_subset_right | |
| change weight ((i,lookup β (s,i)β©univ)::normalizeState ((keys,univ),s))β€_ | |
| rw [weight_cons,weight_prod,weight_cons] | |
| nlinarith | |
| omit [Codec I] [Codec E] [Inhabited I] in | |
| lemma normalizeState_rep {Ξ© : Type} (keys : List I) (univ : Finset E) (e : Ξ©βFinset E) | |
| (he : β a,e aβuniv) (s : IβΞ©) : | |
| normalizeState ((keys,univ),stateRep keys (e β s))=stateRep keys (e β s) := by | |
| unfold normalizeState stateRep | |
| apply List.map_congr_left | |
| intro i hi | |
| change (i,lookup β (stateRep keys (e β s),i)β©univ)=(i,e (s i)) | |
| rw [lookup_stateRep β keys (e β s) i hi] | |
| simp only [Function.comp_apply,Finset.inter_eq_left.mpr (he (s i))] | |
| end MatchingFPRAS.ExecutableLadder | |
| end OAI | |