openAI-math-dataset / lean /OAI /Combinatorics /ContingencyTables /Transport /BoundedProfileSemantics.lean
Download lean/OAI/Combinatorics/ContingencyTables/Transport/BoundedProfileSemantics.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 4.08 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/ContingencyTables/Transport/BoundedProfileSemantics.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Combinatorics/ContingencyTables/Transport/BoundedProfileSemantics.lean
-
curl -L -o BoundedProfileSemantics.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/ContingencyTables/Transport/BoundedProfileSemantics.lean
4.08 kB
| import OAI.Combinatorics.ContingencyTables.Transport.BoundedProfileWalk | |
| import OAI.Combinatorics.ContingencyTables.Transport.ListedBooleanStep | |
| namespace OAI | |
| /-! # The bounded binary loop preserves the physical profile walk -/ | |
| namespace ContingencyTables.SmallGraphProfiles | |
| open ProfilePrograms PhysicalCompletionFibres FirstPaperPhysicalMarginal CompletionCounts | |
| open SmallContextCoordinates FirstSuccess FairBits | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| variable {m n q : ℕ} (r : Fin m → ℕ) (c : Fin n → ℕ) | |
| variable (e : Fin q ≃ Cells (paperSmall r c)) | |
| local notation "d" => dimensionAllowance (I := Fin m) (J := Fin n) | |
| lemma stateCode_bounded (x : PaperStates r c) (a : Cells (paperSmall r c)) (side : Bool) : | |
| physicalProfile (paperSmall r c) (stateCapacity r c) r c (d^12) x (a,side)≤d^20 := by | |
| have he := (physicalProfile_feasible r c x).bounded (a,side) | |
| exact he.trans_eq (stateCapacity_small r c _ _ a.property) | |
| lemma capViews_stateCode (x y : PaperStates r c) : | |
| capViews (stateCodeData r c e x,stateCode r c e y)=stateCode r c e y := by | |
| have hb (side : Bool) : | |
| capView ((q,d^20),viewList (paperSmall r c) e | |
| (physicalProfile (paperSmall r c) (stateCapacity r c) r c (d^12) y) side)= | |
| viewList (paperSmall r c) e | |
| (physicalProfile (paperSmall r c) (stateCapacity r c) r c (d^12) y) side := by | |
| apply capView_eq | |
| · simp only [viewList,List.length_ofFn] | |
| · intro a ha | |
| obtain ⟨i,rfl⟩ := List.mem_ofFn.mp ha | |
| exact stateCode_bounded r c y (e i) side | |
| simpa only [capViews,stateCodeData,codeCheckData,cellCatalog,List.length_ofFn,stateCode,profileCode] | |
| using Prod.ext (hb false) (hb true) | |
| variable (hr : 0 < (largeIndices ((dimensionAllowance (I := Fin m) (J := Fin n))^20,List.ofFn r)).length) | |
| variable (hc : 0 < (largeIndices ((dimensionAllowance (I := Fin m) (J := Fin n))^20,List.ofFn c)).length) | |
| variable (b h : ℕ) (hb : Nat.clog 2 (stateBound r c+2) ≤ b) | |
| local notation "s" => smallProposalBits (I := Fin m) (J := Fin n) | |
| local notation "f" => 25*(d+b+h+1)^62 | |
| def encodedConfiguration (initial current : PaperStates r c) : ProfileConfiguration := | |
| (((stateCodeData r c e initial,d^12),(d,h)),stateCode r c e current) | |
| theorem advanceProfile_encoded (htotal : (∑ i,r i)=∑ j,c j) | |
| (initial x : PaperStates r c) (bits : Fin (s+f) → Bool) : | |
| advanceProfile ((List.ofFn (splitWordEquiv s f bits).1,List.ofFn (splitWordEquiv s f bits).2), | |
| encodedConfiguration r c e h initial x)= | |
| encodedConfiguration r c e h initial (listedBitStep r c e hr hc b h hb x bits) := by | |
| apply Prod.ext | |
| · rfl | |
| · change capViews (stateCodeData r c e initial, | |
| profileStep (encodedStepInput r c e b h x | |
| (splitWordEquiv s f bits).1 (splitWordEquiv s f bits).2))=_ | |
| rw [profileStep_listedBitStep r c e hr hc b h hb htotal] | |
| exact capViews_stateCode r c e initial _ | |
| theorem profileWalk_ofFn (htotal : (∑ i,r i)=∑ j,c j) | |
| (initial x : PaperStates r c) (steps : ℕ) (bits : Fin steps → Fin (s+f) → Bool) : | |
| profileWalk (encodedConfiguration r c e h initial x, | |
| List.ofFn (fun i => (List.ofFn (splitWordEquiv s f (bits i)).1, | |
| List.ofFn (splitWordEquiv s f (bits i)).2)))= | |
| encodedConfiguration r c e h initial | |
| (wordWalk (listedBitStep r c e hr hc b h hb) x steps bits) := by | |
| induction steps with | |
| | zero => rfl | |
| | succ steps ih => | |
| unfold profileWalk at ih ⊢ | |
| rw [List.ofFn_succ',List.concat_eq_append,List.foldl_append] | |
| change advanceProfile ((List.ofFn (splitWordEquiv s f (bits (Fin.last steps))).1, | |
| List.ofFn (splitWordEquiv s f (bits (Fin.last steps))).2), | |
| (List.ofFn (fun i => (List.ofFn (splitWordEquiv s f ((Fin.init bits) i)).1, | |
| List.ofFn (splitWordEquiv s f ((Fin.init bits) i)).2))).foldl | |
| (fun state word => advanceProfile (word,state)) | |
| (encodedConfiguration r c e h initial x))=_ | |
| rw [ih (Fin.init bits)] | |
| exact advanceProfile_encoded r c e hr hc b h hb htotal initial _ _ | |
| end | |
| end ContingencyTables.SmallGraphProfiles | |
| end OAI | |