Download data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactPrintCost.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.46 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactPrintCost.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactPrintCost.lean
-
curl -L -o ExactPrintCost.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactPrintCost.lean
2.46 kB
| import OAI.Combinatorics.ContingencyTables.Sampling.ExactPrefixFeasibility | |
| import OAI.Combinatorics.ContingencyTables.Sampling.GreedyPublicProgram | |
| namespace OAI | |
| /-! # Uniform printing cost for every feasible exact-sampling output -/ | |
| namespace ContingencyTables.ExactPrintCost | |
| open MatchingFPRAS MatchingFPRAS.TreeTyped MatchingFPRAS.PhysicalStream | |
| open DensePrograms SmallGraphProfiles Polynomial | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| lemma weight_ofFn {A : Type} [Codec A] {n B : β} (f : Fin n β A) | |
| (h : β i,weight (f i) β€ B) : weight (List.ofFn f) β€ n*(B+1)+1 := by | |
| have hb := weight_map_bound (f := f) (as := List.finRange n) (fun i _ => h i) | |
| simpa only [βList.ofFn_eq_map,List.length_finRange] using hb | |
| def matrixSize {m n : β} (r : Fin m β β) : β := | |
| m*(n*(4*weight (β i,r i)+2)+2)+1 | |
| lemma matrix_weight {m n : β} (r : Fin m β β) (c : Fin n β β) (X : Table r c) : | |
| weight (matrixCode X.val) β€ matrixSize (n := n) r := by | |
| have row (i : Fin m) : weight (List.ofFn (X.val i)) β€ n*(4*weight (β i,r i)+2)+1 := by | |
| apply weight_ofFn | |
| intro j | |
| exact weight_nat_small (entry_le_total X.property i j) | |
| exact weight_ofFn (fun i => List.ofFn (X.val i)) row | |
| /-- One fixed polynomial bounds both printing time and printed word length | |
| uniformly over the feasible set. -/ | |
| theorem polynomial_print_bound : β p : Polynomial β, | |
| β (m n : β) (r : Fin m β β) (c : Fin n β β) (X : Table r c), | |
| GreedyFeasibleTable.printMatrixRealizer.cost (matrixCode X.val)+ | |
| weight (GreedyFeasibleTable.printMatrix (matrixCode X.val)) β€ p.eval (matrixSize (n := n) r) := by | |
| obtain β¨p,hpβ© := GreedyFeasibleTable.polynomial_printMatrix | |
| exact β¨p,fun _ _ r c X => (hp _).trans | |
| (polynomial_eval_monotone p (matrix_weight r c X))β© | |
| lemma prefix_print_bound {m n : β} (r : Fin m β β) (c : Fin n β β) | |
| (htotal : (β i,r i)=β j,c j) (B : β) | |
| (hB : β X : Table r c,GreedyFeasibleTable.printMatrixRealizer.cost (matrixCode X.val) β€ B) | |
| (N : β) : | |
| (ExactCoreProgram.prefixExperiment (List.ofFn r,List.ofFn c) N).All | |
| (fun o => o.elim 0 GreedyFeasibleTable.printMatrixRealizer.cost β€ B) := by | |
| exact (exactPrefix_feasible r c htotal N).mono (by | |
| intro o ho | |
| cases o with | |
| | none => exact Nat.zero_le _ | |
| | some X => | |
| obtain β¨T,rflβ© := ho | |
| exact hB T) | |
| end | |
| end ContingencyTables.ExactPrintCost | |
| end OAI | |