introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.87 kB
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