File size: 6,551 Bytes
2f887db | 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | import OAI.Computability.PerfectCompleteness.Construction.OriginalChildScalarAssemblyLemmas
import OAI.Computability.PerfectCompleteness.Foundations.CommonAccuracy
import OAI.Computability.PerfectCompleteness.Foundations.WholeCutCallsLemmas
namespace OAI
namespace PerfectCompleteness.FixedCallBudget
open RecursiveSpaces DescendantSpaces
open scoped BigOperators
noncomputable section
def pairCount (rows repeats : Nat → Nat) (root cutoff : Nat) : Nat :=
rows cutoff + OriginalCutCalls.count rows repeats root cutoff
def budget (depth : Nat) (rows repeats : Nat → Nat) : Nat :=
1 + ∑ root : Fin (depth + 1), ∑ cutoff : Fin (depth + 1),
pairCount rows repeats root.val cutoff.val
theorem budget_pos (depth : Nat) (rows repeats : Nat → Nat) :
0 < budget depth rows repeats := by
unfold budget
omega
theorem pairCount_le {depth root cutoff : Nat} (rows repeats : Nat → Nat)
(hroot : root ≤ depth) (hcutoff : cutoff ≤ depth) :
pairCount rows repeats root cutoff ≤ budget depth rows repeats := by
let a : Fin (depth + 1) := ⟨root, Nat.lt_succ_of_le hroot⟩
let b : Fin (depth + 1) := ⟨cutoff, Nat.lt_succ_of_le hcutoff⟩
have hinner : pairCount rows repeats root cutoff ≤
∑ j : Fin (depth + 1), pairCount rows repeats a.val j.val :=
Finset.single_le_sum (fun j _ => Nat.zero_le
(pairCount rows repeats a.val j.val)) (Finset.mem_univ b)
have houter : (∑ j : Fin (depth + 1), pairCount rows repeats a.val j.val) ≤
∑ i : Fin (depth + 1), ∑ j : Fin (depth + 1),
pairCount rows repeats i.val j.val :=
Finset.single_le_sum (fun i _ => Nat.zero_le
(∑ j : Fin (depth + 1), pairCount rows repeats i.val j.val))
(Finset.mem_univ a)
unfold budget
omega
theorem original_calls_le {depth root cutoff : Nat} {branch : Nat → Nat}
(rows repeats : Nat → Nat) (p : Path branch root cutoff)
(hroot : root ≤ depth) :
Fintype.card (OriginalCutCalls.Index rows repeats p) ≤ budget depth rows repeats := by
rw [OriginalCutCalls.card_eq_count]
have h := pairCount_le rows repeats hroot (p.height_le.trans hroot)
unfold pairCount at h
omega
theorem modified_calls_le {depth root cutoff : Nat} {branch : Nat → Nat}
(rows repeats : Nat → Nat) (p : Path branch root cutoff)
(hroot : root ≤ depth) :
Fintype.card (WholeCutCalls.Index rows repeats p) ≤ budget depth rows repeats := by
rw [WholeCutCalls.card_eq_formula]
have h := pairCount_le rows repeats hroot (p.height_le.trans hroot)
unfold pairCount OriginalCutCalls.count at h
omega
theorem copied_calls_le {calls copies depth : Nat} (rows repeats : Nat → Nat)
(hcalls : calls ≤ budget depth rows repeats) :
Fintype.card (Fin copies × Fin calls) ≤ copies * budget depth rows repeats := by
simpa only [Fintype.card_prod, Fintype.card_fin] using
Nat.mul_le_mul_left copies hcalls
theorem child_bound_mono {calls calls' : Nat} (hcalls : calls ≤ calls')
(branch : Nat → Nat) (height sourceLength : Nat) (rows : Nat → Nat) :
ChildBlockCardinality.bound branch height sourceLength calls rows ≤
ChildBlockCardinality.bound branch height sourceLength calls' rows := by
apply Nat.mul_le_mul_right
apply pow_le_pow_right₀ _ hcalls
unfold TreeCardinality.functionBound
exact one_le_pow₀ (by decide : (1 : Nat) ≤ 2)
theorem copied_calls_with_extra_le {calls copies extra depth : Nat}
(rows repeats : Nat → Nat) (hcalls : calls ≤ budget depth rows repeats) :
Fintype.card ((Fin copies × Fin calls) ⊕ Fin extra) ≤
copies * budget depth rows repeats + extra := by
simpa only [Fintype.card_sum, Fintype.card_prod, Fintype.card_fin] using
Nat.add_le_add_right (Nat.mul_le_mul_left copies hcalls) extra
end
end PerfectCompleteness.FixedCallBudget
namespace PerfectCompleteness.FixedParameters
open FixedRows AscendingBranching
noncomputable section
def calls {δ : ℚ} (plan : Plan δ) : Nat :=
2 * FixedCallBudget.budget plan.depth (rows plan) (repeats plan) + 1
structure Parameters (δ : ℚ) (positive : 0 < δ) where
plan : Plan δ
accuracy : ℝ
accuracy_pos : 0 < accuracy
accuracy_small : ∀ j ≤ plan.depth, accuracy < CommonAccuracy.tolerance plan j
alphabetCost : Nat
alphabetCost_pos : 0 < alphabetCost
alphabetCost_bound : SourceOddLists.alphabetLog (cutoff plan positive)
(sourceLength plan positive) ≤ alphabetCost
cubeSize : Nat → Nat
cube_errors : ∀ n,
CubeErrors
(ChildBlockCardinality.bound (fun k => cubeSize k ^ 3) n
(sourceLength plan positive) (calls plan) (rows plan) : ℝ)
(FixedBranching.cleanRate alphabetCost
(ChildBlockCardinality.bound (fun k => cubeSize k ^ 3) n
(sourceLength plan positive) (calls plan) (rows plan) : ℝ))
accuracy (cubeSize n)
theorem exists_parameters {δ : ℚ} (hδ : 0 < δ) (hδ' : δ < 1) :
Nonempty (Parameters δ hδ) := by
obtain ⟨plan⟩ := exists_plan hδ hδ'
obtain ⟨accuracy, haccuracy, hsmall⟩ := CommonAccuracy.exists_accuracy plan hδ
obtain ⟨cost, hcost, hcostBound, size, hsize⟩ :=
FixedSourceBranching.exists_source_branching plan hδ
(fun _ => calls plan) haccuracy
refine ⟨{
plan := plan
accuracy := accuracy
accuracy_pos := haccuracy
accuracy_small := ?_
alphabetCost := cost
alphabetCost_pos := hcost
alphabetCost_bound := hcostBound
cubeSize := size
cube_errors := hsize }⟩
intro j hj
simpa only [CommonAccuracy.tolerance, lt_min_iff] using hsmall j hj
variable {δ : ℚ} {hδ : 0 < δ} (p : Parameters δ hδ)
def branch (n : Nat) : Nat := p.cubeSize n ^ 3
def projectionProbability (n : Nat) : ℚ := 1 / (p.cubeSize n : ℚ) ^ 2
theorem branch_pos (n : Nat) : 0 < branch p n := by
have h := (p.cube_errors n).1
unfold branch
positivity
theorem projectionProbability_bounds (n : Nat) :
0 < projectionProbability p n ∧ projectionProbability p n < 1 :=
FixedBranching.rational_probability (p.cube_errors n).1
theorem source_rate (input : List Bool) (unsat : ¬BinaryLanguage.language input)
(k : Nat) :
((SourceOddLists.game (cutoff p.plan hδ)
(PCPSource.clauseFamily (BinaryLanguage.totalRename input))
(sourceLength p.plan hδ)).repetition k).value ≤
(RepetitionRate.halfRate p.alphabetCost : ℝ) ^ k :=
FixedSourceBranching.source_rate p.plan hδ p.alphabetCost
p.alphabetCost_pos p.alphabetCost_bound input unsat k
end
end PerfectCompleteness.FixedParameters
end OAI
|