File size: 2,461 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 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
|