Download data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLogSpace/CodeAssemblyBudgets.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.66 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLogSpace/CodeAssemblyBudgets.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLogSpace/CodeAssemblyBudgets.lean
-
curl -L -o CodeAssemblyBudgets.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLogSpace/CodeAssemblyBudgets.lean
9.66 kB
| import OAI.Algorithms.SubexponentialSAT.SqrtLogSpace.NativeCodeAssembly | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLogSpace.CodeSearchNativeBudgets | |
| namespace OAI.Algorithms.SubexponentialSAT.SqrtLogSpace.CodeAssemblyBudgets | |
| open SqrtLog NativeCodeAssembly CodeSearchNativeBudgets | |
| /-- The serializer is polynomial in the physical metadata boundary, including | |
| its unary vertex word and both complete retained code matrices. -/ | |
| theorem afterBoundary_le (A m B : β) (dword mword width : List Bool) | |
| (hA : 1 β€ A) (hr : SparseCode.dimension m B β€ A) | |
| (hD : SparseCode.degree m B β€ A) (ht : SparseCode.localRows m B β€ A) | |
| (hdword : dword.length β€ A) (hmword : mword.length β€ A) | |
| (hwidth : width.length β€ A) (hvertices : 2 ^ SparseCode.dimension m B β€ A) | |
| (hg : SparseCode.degree m B * SparseCode.dimension m B β€ A) | |
| (hl : SparseCode.localRows m B * SparseCode.degree m B β€ A) : | |
| afterBoundary A m B dword mword width β€ 10000000000000000 * A ^ 5 := by | |
| have hb := (searchBoundary_le A m B hg hl).2 | |
| have h := serializerTime_polynomial (r := SparseCode.dimension m B) | |
| (D := SparseCode.degree m B) (t := SparseCode.localRows m B) | |
| (W := NativeCode.searchBoundary A m B) (S := 15 * A) dword mword width | |
| (by omega) (by omega) (by omega) (by omega) (by omega) | |
| (by omega) (by omega) (by omega) (by omega) | |
| change afterBoundary A m B dword mword width β€ _ at h | |
| nlinarith only [h] | |
| /-- Actual unary metadata discharges every code-dimension premise. -/ | |
| theorem metadata_afterSpace_le {m B A : β} (a : LeafOuterProgram.Data) | |
| (hmeta : LeafOuterProgram.Metadata m B a) | |
| (ha : β i, (a.stacks i).length β€ A) : | |
| afterSpace A m B (a.stacks 800).length (a.stacks 801) | |
| (a.stacks 782) (a.stacks 768) β€ 20000000000000000 * A ^ 5 := by | |
| have hA := metadata_bound_pos a hmeta ha | |
| have hD := metadata_value_bound a hmeta ha 0 | |
| have ht := metadata_value_bound a hmeta ha 1 | |
| have hl := metadata_value_bound a hmeta ha 2 | |
| have hd := metadata_value_bound a hmeta ha 3 | |
| have hr := metadata_value_bound a hmeta ha 4 | |
| have hg := metadata_value_bound a hmeta ha 5 | |
| have hv := metadata_value_bound a hmeta ha 6 | |
| change SparseCode.degree m B β€ A at hD | |
| change SparseCode.localRows m B β€ A at ht | |
| change SparseCode.localRows m B * SparseCode.degree m B β€ A at hl | |
| change SparseCode.degree m B / (100 * B * SparseCode.logSize m) + 1 β€ A at hd | |
| change SparseCode.dimension m B β€ A at hr | |
| change SparseCode.dimension m B * SparseCode.degree m B β€ A at hg | |
| rw [Nat.mul_comm] at hg | |
| change 2 ^ SparseCode.dimension m B β€ A at hv | |
| have hs := searchesSpace_le A m B (a.stacks 800).length (a.stacks 801).length | |
| hA hD ht hd hr (ha 800) (ha 801) hg hl | |
| have hb := afterBoundary_le A m B (a.stacks 801) (a.stacks 782) (a.stacks 768) | |
| hA hr hD ht (ha 801) (ha 782) (ha 768) hv hg hl | |
| have hp : A ^ 2 β€ A ^ 5 := Nat.pow_le_pow_right hA (by decide) | |
| unfold afterSpace | |
| exact max_le (hs.trans (Nat.mul_le_mul_left _ hp)) (by omega) | |
| open SqrtLog.CodeSetupCost in | |
| /-- Both full searches and serialization fit one fixed fifth power of the | |
| original explicit code envelope and the physical metadata size. -/ | |
| theorem afterTime_le_envelope (A m B qlen H W : β) (dword mword width : List Bool) | |
| (hA : 1 β€ A) (hrA : SparseCode.dimension m B β€ A) | |
| (hDA : SparseCode.degree m B β€ A) (htA : SparseCode.localRows m B β€ A) | |
| (hdword : dword.length β€ A) (hmword : mword.length β€ A) | |
| (hwidth : width.length β€ A) (hvertices : 2 ^ SparseCode.dimension m B β€ A) | |
| (hg : SparseCode.degree m B * SparseCode.dimension m B β€ A) | |
| (hl : SparseCode.localRows m B * SparseCode.degree m B β€ A) | |
| (ht : SparseCode.localRows m B β€ H) (hD : SparseCode.degree m B β€ H) | |
| (hd : SparseCode.degree m B / (100 * B * SparseCode.logSize m) + 1 β€ H) | |
| (hr : SparseCode.dimension m B β€ H) (hq : qlen β€ W) (hDl : dword.length β€ W) : | |
| afterTime A m B qlen dword mword width β€ | |
| 20000000000000000 * (A + envelope 3000000000000 H W + 1) ^ 5 := by | |
| have hs := searchesTime_le_envelope A m B qlen dword.length H W ht hD hd hr hq hDl hg hl | |
| have hb := afterBoundary_le A m B dword mword width hA hrA hDA htA | |
| hdword hmword hwidth hvertices hg hl | |
| let X := A + envelope 3000000000000 H W + 1 | |
| have hX : 1 β€ X := by dsimp [X]; omega | |
| have hAX : A β€ X := by dsimp [X]; omega | |
| have hp : X ^ 3 β€ X ^ 5 := Nat.pow_le_pow_right hX (by decide) | |
| have hpA := Nat.pow_le_pow_left hAX 5 | |
| change _ β€ 20000000000000000 * X ^ 5 | |
| unfold afterTime | |
| unfold afterBoundary at hb | |
| change NativeCode.searchesTime A m B qlen dword.length β€ 5000000000 * X ^ 3 at hs | |
| nlinarith only [hs, hb, hp, hpA] | |
| open SqrtLog.Statement | |
| open Filter | |
| open scoped Topology | |
| /-- A fixed fifth power preserves the unchanged exponent scale. -/ | |
| theorem fifth_cost_runtimeBound (cost A E n C : β) | |
| (hc : cost β€ C * (A + E + 1) ^ 5) | |
| (he : (E : β) β€ (2 : β) ^ runtimeScale n) : | |
| (cost : β) β€ runtimeBound (32 * (C : β)) 5 5 A n := by | |
| let R : β := (2 : β) ^ runtimeScale n | |
| have hr1 : 1 β€ R := Real.one_le_rpow (by norm_num) (runtimeScale_nonneg n) | |
| have hsum : (A : β) + E + 1 β€ 2 * ((A : β) + 1) * R := by | |
| have hA : 0 β€ (A : β) := Nat.cast_nonneg A | |
| change (E : β) β€ R at he | |
| nlinarith | |
| have hc' : (cost : β) β€ (C : β) * ((A : β) + E + 1) ^ 5 := by exact_mod_cast hc | |
| calc | |
| _ β€ (C : β) * ((A : β) + E + 1) ^ 5 := hc' | |
| _ β€ (C : β) * (2 * ((A : β) + 1) * R) ^ 5 := | |
| mul_le_mul_of_nonneg_left (pow_le_pow_leftβ | |
| (add_nonneg (add_nonneg (Nat.cast_nonneg A) (Nat.cast_nonneg E)) zero_le_one) hsum 5) | |
| (Nat.cast_nonneg C) | |
| _ = runtimeBound (32 * (C : β)) 5 5 A n := by | |
| unfold runtimeBound R | |
| rw [mul_pow, mul_pow, β Real.rpow_mul_natCast (by norm_num)] | |
| norm_num | |
| rw [mul_comm (runtimeScale n) 5] | |
| ring | |
| open SqrtLog.Asymptotic SqrtLog.CodeSetupCost in | |
| /-- One fixed cutoff covers every actual produced code metadata boundary. | |
| Only its measured physical cap remains as the polynomial factor. -/ | |
| theorem eventually_produced_afterTime (q wordDegree : β) : | |
| βαΆ n : β in atTop, β (A m B : β) (a : LeafOuterProgram.Data), | |
| 0 < m β 0 < B β m β€ n * B β B β€ L n ^ q β | |
| LeafOuterProgram.Metadata m B a β (β i, (a.stacks i).length β€ A) β | |
| (a.stacks 800).length β€ (n + 1) ^ wordDegree β | |
| (a.stacks 801).length β€ (n + 1) ^ wordDegree β | |
| (afterTime A m B (a.stacks 800).length (a.stacks 801) | |
| (a.stacks 782) (a.stacks 768) : β) β€ | |
| runtimeBound 640000000000000000 5 5 A n := by | |
| filter_upwards [eventually_envelope 3000000000000 | |
| (320000 * (q + 2) ^ 3 + q + 4) (2 * q + 3) wordDegree] | |
| with n hn A m B a hm hB hmn hBn hmeta ha hq hDl | |
| obtain β¨ht, hD, hd, hrβ© := produced_dimensions_le n m B q hm hB hmn hBn | |
| have hA := metadata_bound_pos a hmeta ha | |
| have hDA := metadata_value_bound a hmeta ha 0 | |
| have htA := metadata_value_bound a hmeta ha 1 | |
| have hl := metadata_value_bound a hmeta ha 2 | |
| have hrA := metadata_value_bound a hmeta ha 4 | |
| have hg := metadata_value_bound a hmeta ha 5 | |
| have hv := metadata_value_bound a hmeta ha 6 | |
| change SparseCode.degree m B β€ A at hDA | |
| change SparseCode.localRows m B β€ A at htA | |
| change SparseCode.localRows m B * SparseCode.degree m B β€ A at hl | |
| change SparseCode.dimension m B β€ A at hrA | |
| change SparseCode.dimension m B * SparseCode.degree m B β€ A at hg | |
| rw [Nat.mul_comm] at hg | |
| change 2 ^ SparseCode.dimension m B β€ A at hv | |
| let H := (320000 * (q + 2) ^ 3 + q + 4) * L n ^ (2 * q + 3) | |
| let W := max (a.stacks 800).length (a.stacks 801).length | |
| have hc := afterTime_le_envelope A m B (a.stacks 800).length H W | |
| (a.stacks 801) (a.stacks 782) (a.stacks 768) hA hrA hDA htA | |
| (ha 801) (ha 782) (ha 768) hv hg hl ht hD hd hr | |
| (le_max_left _ _) (le_max_right _ _) | |
| have h := fifth_cost_runtimeBound _ A (envelope 3000000000000 H W) n | |
| 20000000000000000 hc (hn H W le_rfl (max_le hq hDl)) | |
| norm_num only [Nat.cast_ofNat] at h | |
| exact h | |
| /-- Metadata preparation and the complete code command have a single | |
| ordinary-polynomial source-space bound. The constants precede every input, | |
| and the numerical occurrence value is never substituted for its word length. -/ | |
| theorem complete_space_polynomial : | |
| β C degree : β, β m B W ml Bl : β, | |
| 0 < m β 0 < B β ml β€ W β Bl β€ W β | |
| let A := W + NativeLeafSetup.parameterTime m B W ml Bl | |
| β a : LeafOuterProgram.Data, LeafOuterProgram.Metadata m B a β | |
| (β i, (a.stacks i).length β€ A) β | |
| max (A + 1) (afterSpace A m B (a.stacks 800).length | |
| (a.stacks 801) (a.stacks 782) (a.stacks 768)) β€ | |
| C * (m + W + 16) ^ degree := by | |
| obtain β¨C, degree, hparameterβ© := NativeLeafSetup.parameterTime_polynomial | |
| refine β¨20000000000000000 * C ^ 5, degree * 5, ?_β© | |
| intro m B W ml Bl hm hB hml hBl A a hmeta ha | |
| have hp := hparameter m B W ml Bl hm hB hml hBl | |
| change A + 1 β€ C * (m + W + 16) ^ degree at hp | |
| have hA : A β€ C * (m + W + 16) ^ degree := by omega | |
| have hs := metadata_afterSpace_le a hmeta ha | |
| have hpow := Nat.pow_le_pow_left hA 5 | |
| have hleft : A + 1 β€ 20000000000000000 * (C * (m + W + 16) ^ degree) ^ 5 := | |
| hp.trans ((Nat.le_self_pow (by decide) _).trans | |
| (Nat.le_mul_of_pos_left _ (by decide))) | |
| have hright := hs.trans (Nat.mul_le_mul_left 20000000000000000 hpow) | |
| have h := max_le hleft hright | |
| simpa only [mul_pow, β pow_mul, Nat.mul_assoc] using h | |
| end OAI.Algorithms.SubexponentialSAT.SqrtLogSpace.CodeAssemblyBudgets | |