File size: 2,868 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 | import OAI.Combinatorics.LowSpaceSubsetSum.Word.WordMain
namespace OAI
/-! # Worst-case Subset Sum in one-fifth-exponential space
The threshold is chosen once from its proved existence theorem. No solution,
deficiency statistic, or bit-length exponent is an input. The finite random-word
experiment has one-sided correctness, success probability at least two thirds,
and bounds on its operation and writable-storage counts on every outcome.
-/
noncomputable section
namespace LowSpaceSubsetSum
def algorithm {n : β} (I : Instance n) (words : WordFinalDecision.Words I) :
(Bool Γ β) Γ β := WordFinalDecision.run decisionThreshold I words
/-- One-sided randomized correctness and all-outcome resource-count bounds. -/
theorem worst_case_subset_sum :
(β (n : β) (I : Instance n) (words : WordFinalDecision.Words I),
(algorithm I words).1.1 = true β Solvable I) β§
(β (n : β) (I : Instance n), Solvable I β
(2/3 : β) β€ (FiniteLaw.uniform : FiniteLaw (WordFinalDecision.Words I)).probability
(fun words => (algorithm I words).1.1 = true)) β§
(β c : β, 0 < c β βαΆ n : β in Filter.atTop,
β I : Instance n, inputBits I β€ n^c β β words : WordFinalDecision.Words I,
((algorithm I words).1.2 : β) β€
(4*(3 : β)^624)*(n : β)^(624*c)*(2 : β)^((1/2 : β)*n) β§
((algorithm I words).2 : β) β€
2*(inputScale I : β)^15*(2 : β)^((199/1000 : β)*n)) :=
β¨fun _ I words => WordFinalDecision.sound decisionThreshold I words,
fun _ I => WordFinalDecision.probability decisionThreshold I,
WordMain.main_resources decisionThresholdβ©
/-- The writable-storage count has every fixed exponential rate above .199. -/
theorem exponential_space (rho : β) (hrho : (199/1000 : β) < rho) (c : β) (hc : 0 < c) :
βαΆ n : β in Filter.atTop, β I : Instance n, inputBits I β€ n^c β
β words : WordFinalDecision.Words I,
((algorithm I words).1.2 : β) β€
(4*(3 : β)^624)*(n : β)^(624*c)*(2 : β)^((1/2 : β)*n) β§
((algorithm I words).2 : β) β€ (2*(3 : β)^15)*(2 : β)^(rho*n) :=
WordMain.space_corollary decisionThreshold rho hrho c hc
/-- In particular, ordinary one-fifth-exponential writable space. -/
theorem one_fifth_space (c : β) (hc : 0 < c) :
βαΆ n : β in Filter.atTop, β I : Instance n, inputBits I β€ n^c β
β words : WordFinalDecision.Words I,
((algorithm I words).1.2 : β) β€
(4*(3 : β)^624)*(n : β)^(624*c)*(2 : β)^((1/2 : β)*n) β§
((algorithm I words).2 : β) β€ (2*(3 : β)^15)*(2 : β)^((1/5 : β)*n) :=
exponential_space (1/5) (by norm_num) c hc
theorem algorithm_word_width {n : β} (I : Instance n) :
wordWidth I = 4*(n+inputBits I+2) := rfl
end LowSpaceSubsetSum
end
end OAI
|