File size: 4,751 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | import OAI.Algorithms.SubexponentialSAT.LeanCompat
import OAI.Algorithms.SubexponentialSAT.SqrtLog.BucketProgramProducedRankMatrix
import OAI.Algorithms.SubexponentialSAT.SqrtLog.LeafHeadSetupProgramLoop
import OAI.Algorithms.SubexponentialSAT.SqrtLog.CostAssemblyInventory
namespace OAI.Algorithms
/-! Rank-sensitive cardinality of the actual attained Cartesian inventory.
The hypotheses constrain entry values, not the cardinalities of head tables. -/
noncomputable section
namespace SubexponentialSAT.SqrtLog.BucketProgram.ProducedRank
open LeafHeadSetupProgram
open scoped BigOperators
def headRank (C : β β β β β€) (D n : β)
(rows : List (List Bool)) (low : List Bool) (z : β) : β :=
LayoutRank.rowRank (selectedMatrix C D (selectedHeads n rows low z))
def commonBase (n H : β) : β := 2*n*H+1
theorem commonBase_pos (n H : β) : 1 β€ commonBase n H := by unfold commonBase; omega
theorem producedHead_length_le_rank {base : Data} {n N D : β}
{rows : List (List Bool)} {low : List Bool}
{Rel : β β β β LayoutMatrixProgram.Pair β Prop} {B z : β}
{table : BucketTupleProgram.HeadTable}
(hp : ProducedHead base n N D rows low Rel B z table)
(C : β β β β β€) (H : β)
(hrel : β j v p,j < Dβv < nβRel j v pβ
SubexponentialSAT.BinaryArithmetic.toNat p.2 β€ SubexponentialSAT.BinaryArithmetic.toNat (base.stacks 141) β§
(SubexponentialSAT.BinaryArithmetic.toNat p.1 : β€)-(SubexponentialSAT.BinaryArithmetic.toNat p.2 : β€)=C j v)
(hbound : β j v p,j < Dβv < nβRel j v pβ|C j v| β€ (H:β€)) :
table.buckets.length β€ (commonBase n H)^headRank C D n rows low z := by
obtain β¨mr,ys,hr,hy,rflβ© := hp
have hj := HeadIdentifierProgram.chosenIds_bound (HeadIdentifierProgram.predicate rows low z) n
have ht := actualBuckets_length_le_rank (base.stacks 141) n H C hr hy
(fun j v p hj' hv hp=>hrel j v p hj' (hj v hv) hp)
(fun j v p hj' hv hp=>hbound j v p hj' (hj v hv) hp)
apply ht.trans
apply Nat.pow_le_pow_left
have hc := HeadIdentifierProgram.count_le (HeadIdentifierProgram.predicate rows low z) n
change 2*(selectedHeads n rows low z).length*H+1 β€ 2*n*H+1
have hc' : (selectedHeads n rows low z).length β€ n := hc
gcongr
private theorem sum_succ (f : β β β) (z k : β) :
(β i : Fin (k+1),f (z+i.val))=f z+β i : Fin k,f ((z+1)+i.val) := by
rw [Fin.sum_univ_succ]
simp [Nat.add_left_comm,Nat.add_comm]
/-- The product in `enumerate_length` is bounded using the rank of every
literal selected matrix, in the producer's consecutive head order. -/
theorem producedHeads_product_le_rankSum {base : Data} {n N D : β}
{rows : List (List Bool)} {low : List Bool}
{Rel : β β β β LayoutMatrixProgram.Pair β Prop} {B z : β}
{tables : List BucketTupleProgram.HeadTable}
(hp : ProducedHeads base n N D rows low Rel B z tables)
(C : β β β β β€) (H : β)
(hrel : β j v p,j < Dβv < nβRel j v pβ
SubexponentialSAT.BinaryArithmetic.toNat p.2 β€ SubexponentialSAT.BinaryArithmetic.toNat (base.stacks 141) β§
(SubexponentialSAT.BinaryArithmetic.toNat p.1 : β€)-(SubexponentialSAT.BinaryArithmetic.toNat p.2 : β€)=C j v)
(hbound : β j v p,j < Dβv < nβRel j v pβ|C j v| β€ (H:β€)) :
(tables.map fun table=>table.buckets.length).prod β€
(commonBase n H)^(β i : Fin tables.length,headRank C D n rows low (z+i.val)) := by
induction hp with
| nil => simp
| @cons z table tables hh ht ih =>
have hh' := producedHead_length_le_rank hh C H hrel hbound
simp only [List.map_cons,List.prod_cons,List.length_cons,sum_succ,pow_add]
exact Nat.mul_le_mul hh' ih
theorem producedHeads_enumerate_le_rankSum {base : Data} {n N D : β}
{rows : List (List Bool)} {low : List Bool}
{Rel : β β β β LayoutMatrixProgram.Pair β Prop} {B z : β}
{tables : List BucketTupleProgram.HeadTable}
(hp : ProducedHeads base n N D rows low Rel B z tables)
(C : β β β β β€) (H : β)
(hrel : β j v p,j < Dβv < nβRel j v pβ
SubexponentialSAT.BinaryArithmetic.toNat p.2 β€ SubexponentialSAT.BinaryArithmetic.toNat (base.stacks 141) β§
(SubexponentialSAT.BinaryArithmetic.toNat p.1 : β€)-(SubexponentialSAT.BinaryArithmetic.toNat p.2 : β€)=C j v)
(hbound : β j v p,j < Dβv < nβRel j v pβ|C j v| β€ (H:β€)) :
(BucketTupleProgram.enumerate tables).length β€
(commonBase n H)^(β i : Fin tables.length,headRank C D n rows low (z+i.val)) := by
rw [BucketTupleProgram.enumerate_length]
exact producedHeads_product_le_rankSum hp C H hrel hbound
end SubexponentialSAT.SqrtLog.BucketProgram.ProducedRank
end
end OAI.Algorithms
|