Download data/lean/OAI/Algorithms/SubexponentialSAT/Subexp/AssignmentFrontendNumericBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/Subexp/AssignmentFrontendNumericBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/Subexp/AssignmentFrontendNumericBounds.lean
-
curl -L -o AssignmentFrontendNumericBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/Subexp/AssignmentFrontendNumericBounds.lean
12.1 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.SubexpVertexPairComplexity | |
| import OAI.Algorithms.SubexponentialSAT.Subexp.SequentialStep | |
| import OAI.Algorithms.SubexponentialSAT.ScoreBuilderSizeBounds | |
| namespace OAI.Algorithms | |
| /-! Arithmetic envelopes used by the complete assignment frontend. The size | |
| parameter includes every growing numerical parameter and the actual input | |
| scope-byte count. No generated-tape size or body runtime is supplied. -/ | |
| namespace SubexponentialSAT.Subexp.AssignmentFrontendBounds | |
| open BitProgram StructuredCalls MulticolorTypes | |
| def sourceSize (r Q Ξ D : β) (scopes : List (List β)) : β := | |
| D + scopes.length + blockSize r Q Ξ + Q + r + Ξ + | |
| (SubexpPlanAlphabetBase.scopeBytes scopes).length + 1 | |
| def scoreCoefficient : β := 10000 * 31 ^ 6 * 1025 ^ 12 | |
| def inputCoefficient : β := 2000101 | |
| def coefficient : β := | |
| 2000000 + 20000 * inputCoefficient ^ 4 + 40 * inputCoefficient ^ 2 + | |
| 2 * (scoreCoefficient + 40003) + 6 | |
| theorem le_power {S k : β} (hS : 1 β€ S) (hk : 1 β€ k) : S β€ S ^ k := by | |
| simpa only [pow_one] using Nat.pow_le_pow_right hS hk | |
| theorem sourceSize_pos (r Q Ξ D : β) (scopes : List (List β)) : | |
| 1 β€ sourceSize r Q Ξ D scopes := by | |
| unfold sourceSize | |
| omega | |
| theorem seedCount_le (r Q Ξ D : β) (scopes : List (List β)) : | |
| scopes.length + (Ξ + 1) * D β€ 2 * sourceSize r Q Ξ D scopes ^ 2 := by | |
| let S := sourceSize r Q Ξ D scopes | |
| have hS := sourceSize_pos r Q Ξ D scopes | |
| have hE : scopes.length β€ S := by dsimp [S, sourceSize]; omega | |
| have hD : D β€ S := by dsimp [S, sourceSize]; omega | |
| have hd : Ξ + 1 β€ S := by dsimp [S, sourceSize]; omega | |
| have hprod : (Ξ + 1) * D β€ S ^ 2 := by | |
| simpa only [pow_two] using Nat.mul_le_mul hd hD | |
| have hS2 : S β€ S ^ 2 := le_power hS (by decide) | |
| change scopes.length + (Ξ + 1) * D β€ 2 * S ^ 2 | |
| omega | |
| theorem pair_polynomial_le (r Q Ξ D : β) (scopes : List (List β)) : | |
| 60 * (SubexpVertexPairProgram.polynomialBound D Ξ scopes + | |
| (SubexpPlanAlphabetBase.scopeBytes scopes).length + 4) β€ | |
| 2000000 * sourceSize r Q Ξ D scopes ^ 5 := by | |
| let S := sourceSize r Q Ξ D scopes | |
| have hS : 1 β€ S := sourceSize_pos r Q Ξ D scopes | |
| have hD : D β€ S := by dsimp [S, sourceSize]; omega | |
| have hE : scopes.length β€ S := by dsimp [S, sourceSize]; omega | |
| have hd : Ξ + 1 β€ S := by dsimp [S, sourceSize]; omega | |
| have hd' : Ξ β€ S := by omega | |
| have hB : (SubexpPlanAlphabetBase.scopeBytes scopes).length β€ S := by | |
| dsimp [S, sourceSize]; omega | |
| have hS2 : S β€ S ^ 2 := le_power hS (by decide) | |
| have hS3 : S β€ S ^ 3 := le_power hS (by decide) | |
| have hS4 : S β€ S ^ 4 := le_power hS (by decide) | |
| have hS5 : S β€ S ^ 5 := le_power hS (by decide) | |
| have h23 : S ^ 2 β€ S ^ 3 := Nat.pow_le_pow_right hS (by decide) | |
| have h24 : S ^ 2 β€ S ^ 4 := Nat.pow_le_pow_right hS (by decide) | |
| have h25 : S ^ 2 β€ S ^ 5 := Nat.pow_le_pow_right hS (by decide) | |
| have h45 : S ^ 4 β€ S ^ 5 := Nat.pow_le_pow_right hS (by decide) | |
| have h13 : 1 β€ S ^ 3 := hS.trans hS3 | |
| have h14 : 1 β€ S ^ 4 := hS.trans hS4 | |
| have h15 : 1 β€ S ^ 5 := hS.trans hS5 | |
| have hM : scopes.length + (Ξ + 1) * D β€ 2 * S ^ 2 := seedCount_le r Q Ξ D scopes | |
| have hp : SubexpPlanAlphabetBase.planWordBound D Ξ scopes β€ 7 * S ^ 3 := by | |
| calc | |
| _ β€ 1 + (2 * (2 * S ^ 2) + 2) * S := by | |
| unfold SubexpPlanAlphabetBase.planWordBound | |
| gcongr | |
| _ β€ 7 * S ^ 3 := by ring_nf; omega | |
| have hi : SubexpIncidencePlanProgram.inputSize D Ξ D scopes β€ 2 * S := by | |
| change (SubexpPlanAlphabetBase.scopeBytes scopes).length + D + Ξ + D + 1 β€ 2 * S | |
| dsimp [S, sourceSize] | |
| omega | |
| have hcopy : (SubexpPlanAlphabetBase.scopeBytes scopes).length + D + Ξ + D β€ 2 * S := by | |
| change (SubexpPlanAlphabetBase.scopeBytes scopes).length + D + Ξ + D + 1 β€ 2 * S at hi | |
| omega | |
| have hprod : D * Ξ β€ S ^ 2 := by | |
| simpa only [pow_two] using Nat.mul_le_mul hD hd' | |
| have hclear : 2 * scopes.length + 2 * D + D * Ξ + 3 * Ξ + 3 * D + 1 β€ 12 * S ^ 2 := by | |
| omega | |
| have hu : SubexpPlanAlphabetBase.uniformCallbackBound D Ξ scopes β€ 10000 * S ^ 3 := by | |
| calc | |
| _ β€ 1000 * (2 * S) ^ 3 + 7 * (2 * S) + 34 * (7 * S ^ 3) + | |
| 2 * (12 * S ^ 2) + 106 := by | |
| unfold SubexpPlanAlphabetBase.uniformCallbackBound | |
| gcongr | |
| _ β€ 10000 * S ^ 3 := by ring_nf; omega | |
| have ha : SubexpPlanAlphabetBase.polynomialBound D Ξ scopes β€ 10100 * S ^ 4 := by | |
| calc | |
| _ β€ 6 * S ^ 2 + 17 * S + 15 + S * (6 * S + 10000 * S ^ 3 + 7) := by | |
| unfold SubexpPlanAlphabetBase.polynomialBound | |
| gcongr | |
| _ β€ 10100 * S ^ 4 := by ring_nf; omega | |
| have hv : SubexpVertexPairProgram.polynomialBound D Ξ scopes β€ 20000 * S ^ 5 := by | |
| calc | |
| _ β€ 10100 * S ^ 4 + (S * (2 * (7 * S ^ 3) + 1)) * (61 * S + 45) + | |
| 48 * S ^ 2 + 73 * S + 78 := by | |
| unfold SubexpVertexPairProgram.polynomialBound | |
| gcongr | |
| _ β€ 20000 * S ^ 5 := by ring_nf; omega | |
| calc | |
| _ β€ 60 * (20000 * S ^ 5 + S + 4) := by | |
| gcongr | |
| _ β€ 2000000 * S ^ 5 := by omega | |
| theorem selection_numeric_le (S q weight total width : β) (hS : 1 β€ S) | |
| (hq : q β€ S) (hweight : weight β€ S ^ 4) (ht : total β€ 2 * S ^ 2) | |
| (hw : width β€ S ^ 2) : | |
| SequentialProgram.selectionBudget q weight total width β€ 40000 * S ^ 10 := by | |
| have h1 : S β€ S ^ 10 := le_power hS (by decide) | |
| have h2 : S ^ 2 β€ S ^ 10 := Nat.pow_le_pow_right hS (by decide) | |
| have h3 : S ^ 3 β€ S ^ 10 := Nat.pow_le_pow_right hS (by decide) | |
| have h4 : S ^ 4 β€ S ^ 10 := Nat.pow_le_pow_right hS (by decide) | |
| have h5 : S ^ 5 β€ S ^ 10 := Nat.pow_le_pow_right hS (by decide) | |
| have h6 : S ^ 6 β€ S ^ 10 := Nat.pow_le_pow_right hS (by decide) | |
| calc | |
| _ β€ SequentialProgram.selectionBudget S (S ^ 4) (2 * S ^ 2) (S ^ 2) := by | |
| unfold SequentialProgram.selectionBudget SequentialProgram.minimumBudget | |
| SequentialProgram.updateBudget SequentialProgram.recordBudget | |
| gcongr | |
| _ β€ 40000 * S ^ 10 := by | |
| unfold SequentialProgram.selectionBudget SequentialProgram.minimumBudget | |
| SequentialProgram.updateBudget SequentialProgram.recordBudget | |
| ring_nf | |
| omega | |
| theorem selection_budget_le (r Q Ξ D : β) (scopes : List (List β)) (hr : 0 < r) : | |
| SequentialProgram.selectionBudget (r ^ Q) (D ^ 2 * (blockSize r Q Ξ) ^ 2) | |
| (scopes.length + (Ξ + 1) * D) (Q * r) β€ 40000 * sourceSize r Q Ξ D scopes ^ 10 := by | |
| let S := sourceSize r Q Ξ D scopes | |
| have hS : 1 β€ S := sourceSize_pos r Q Ξ D scopes | |
| have hD : D β€ S := by dsimp [S, sourceSize]; omega | |
| have hN : blockSize r Q Ξ β€ S := by dsimp [S, sourceSize]; omega | |
| have hQ : Q β€ S := by dsimp [S, sourceSize]; omega | |
| have hrS : r β€ S := by dsimp [S, sourceSize]; omega | |
| apply selection_numeric_le S _ _ _ _ hS | |
| Β· exact (ScoreBuilderSizeBounds.wordChoices_le r Q Ξ (blockSize r Q Ξ) (by omega) rfl).trans hN | |
| Β· calc | |
| _ β€ S ^ 2 * S ^ 2 := Nat.mul_le_mul (Nat.pow_le_pow_left hD 2) (Nat.pow_le_pow_left hN 2) | |
| _ = _ := by ring | |
| Β· exact seedCount_le r Q Ξ D scopes | |
| Β· simpa only [pow_two] using Nat.mul_le_mul hQ hrS | |
| theorem input_expression_le (r Q Ξ D : β) (scopes : List (List β)) | |
| (pairBits : β) (hr : 0 < r) | |
| (hp : pairBits β€ 2000000 * sourceSize r Q Ξ D scopes ^ 5) : | |
| let M := scopes.length + (Ξ + 1) * D | |
| 1 + r + Q + Ξ + D + scopes.length + (Ξ + 1) + 2 * (Ξ + 1) + Q * r + | |
| M + r ^ Q + (1 + (2 * r + 2) * r) + (1 + (2 * (Q * r) + 2) * r ^ Q) + Q * r + | |
| r ^ Q * (Q * r) + (1 + (2 * M + 2) * M) + pairBits β€ | |
| 2000100 * sourceSize r Q Ξ D scopes ^ 5 := by | |
| let S := sourceSize r Q Ξ D scopes | |
| let M := scopes.length + (Ξ + 1) * D | |
| change pairBits β€ 2000000 * S ^ 5 at hp | |
| have hS : 1 β€ S := sourceSize_pos r Q Ξ D scopes | |
| have hD : D β€ S := by dsimp [S, sourceSize]; omega | |
| have hE : scopes.length β€ S := by dsimp [S, sourceSize]; omega | |
| have hQ : Q β€ S := by dsimp [S, sourceSize]; omega | |
| have hrS : r β€ S := by dsimp [S, sourceSize]; omega | |
| have hdS : Ξ + 1 β€ S := by dsimp [S, sourceSize]; omega | |
| have hq : r ^ Q β€ S := (ScoreBuilderSizeBounds.wordChoices_le r Q Ξ | |
| (blockSize r Q Ξ) (by omega) rfl).trans (by dsimp [S, sourceSize]; omega) | |
| have hM : M β€ 2 * S ^ 2 := seedCount_le r Q Ξ D scopes | |
| have hw : Q * r β€ S ^ 2 := by simpa only [pow_two] using Nat.mul_le_mul hQ hrS | |
| have hS2 : S β€ S ^ 2 := le_power hS (by decide) | |
| have hS3 : S β€ S ^ 3 := le_power hS (by decide) | |
| have hS4 : S β€ S ^ 4 := le_power hS (by decide) | |
| have hS5 : S β€ S ^ 5 := le_power hS (by decide) | |
| have h25 : S ^ 2 β€ S ^ 5 := Nat.pow_le_pow_right hS (by decide) | |
| have h35 : S ^ 3 β€ S ^ 5 := Nat.pow_le_pow_right hS (by decide) | |
| have h45 : S ^ 4 β€ S ^ 5 := Nat.pow_le_pow_right hS (by decide) | |
| have hc : 1 + (2 * r + 2) * r β€ 5 * S ^ 2 := by | |
| calc | |
| _ β€ 1 + (2 * S + 2) * S := by gcongr | |
| _ β€ 5 * S ^ 2 := by ring_nf; omega | |
| have hwords : 1 + (2 * (Q * r) + 2) * r ^ Q β€ 5 * S ^ 3 := by | |
| calc | |
| _ β€ 1 + (2 * S ^ 2 + 2) * S := by gcongr | |
| _ β€ 5 * S ^ 3 := by ring_nf; omega | |
| have hflat : r ^ Q * (Q * r) β€ S ^ 3 := by | |
| calc | |
| _ β€ S * S ^ 2 := Nat.mul_le_mul hq hw | |
| _ = S ^ 3 := by ring | |
| have hseeds : 1 + (2 * M + 2) * M β€ 13 * S ^ 4 := by | |
| calc | |
| _ β€ 1 + (2 * (2 * S ^ 2) + 2) * (2 * S ^ 2) := by gcongr | |
| _ β€ 13 * S ^ 4 := by | |
| have h24 : S ^ 2 β€ S ^ 4 := Nat.pow_le_pow_right hS (by decide) | |
| ring_nf | |
| omega | |
| change 1 + r + Q + Ξ + D + scopes.length + (Ξ + 1) + 2 * (Ξ + 1) + Q * r + | |
| M + r ^ Q + (1 + (2 * r + 2) * r) + (1 + (2 * (Q * r) + 2) * r ^ Q) + Q * r + | |
| r ^ Q * (Q * r) + (1 + (2 * M + 2) * M) + pairBits β€ 2000100 * S ^ 5 | |
| omega | |
| theorem score_expression_le (r Q Ξ D : β) (scopes : List (List β)) (hr : 0 < r) : | |
| 10000 * 31 ^ 6 * | |
| (16 * ((scopes.length + (Ξ + 1) * D) + D + r ^ Q + Q * r + Ξ + 1) ^ 2 + 1) ^ 12 * | |
| (r ^ Q) ^ (2 * (Ξ + 1)) β€ | |
| scoreCoefficient * sourceSize r Q Ξ D scopes ^ 50 := by | |
| have h := ScoreBuilderSizeBounds.runtime_expression_le D scopes.length | |
| (blockSize r Q Ξ) Q r Ξ (by omega) rfl | |
| exact h.trans (Nat.mul_le_mul_left _ (Nat.pow_le_pow_left | |
| (by unfold ScoreBuilderSizeBounds.sourceSize sourceSize; omega) 50)) | |
| theorem total_expression_le (S pair input init score select count : β) (hS : 1 β€ S) | |
| (hp : pair β€ 2000000 * S ^ 5) | |
| (hi : input β€ (20000 * inputCoefficient ^ 4) * S ^ 20) | |
| (hn : init β€ (40 * inputCoefficient ^ 2) * S ^ 10) | |
| (hs : score β€ scoreCoefficient * S ^ 50) | |
| (hsel : select β€ 40000 * S ^ 10) | |
| (hm : count β€ 2 * S ^ 2) : | |
| pair + (input + 1) + (init + (count * (score + select + 3) + 3) + 1) + 1 β€ | |
| coefficient * S ^ 60 := by | |
| have h1 : 1 β€ S ^ 60 := Nat.one_le_pow _ _ hS | |
| have h5 : S ^ 5 β€ S ^ 60 := Nat.pow_le_pow_right hS (by decide) | |
| have h10 : S ^ 10 β€ S ^ 60 := Nat.pow_le_pow_right hS (by decide) | |
| have h20 : S ^ 20 β€ S ^ 60 := Nat.pow_le_pow_right hS (by decide) | |
| have h50 : S ^ 10 β€ S ^ 50 := Nat.pow_le_pow_right hS (by decide) | |
| have h150 : 1 β€ S ^ 50 := Nat.one_le_pow _ _ hS | |
| have h52 : S ^ 52 β€ S ^ 60 := Nat.pow_le_pow_right hS (by decide) | |
| have hbody : score + select + 3 β€ (scoreCoefficient + 40003) * S ^ 50 := by | |
| have ht := hsel.trans (Nat.mul_le_mul_left 40000 h50) | |
| rw [Nat.add_mul] | |
| omega | |
| have hloop : count * (score + select + 3) β€ | |
| (2 * (scoreCoefficient + 40003)) * S ^ 60 := by | |
| calc | |
| _ β€ (2 * S ^ 2) * ((scoreCoefficient + 40003) * S ^ 50) := Nat.mul_le_mul hm hbody | |
| _ = (2 * (scoreCoefficient + 40003)) * S ^ 52 := by ring | |
| _ β€ _ := Nat.mul_le_mul_left _ h52 | |
| have hp' := hp.trans (Nat.mul_le_mul_left 2000000 h5) | |
| have hi' := hi.trans (Nat.mul_le_mul_left (20000 * inputCoefficient ^ 4) h20) | |
| have hn' := hn.trans (Nat.mul_le_mul_left (40 * inputCoefficient ^ 2) h10) | |
| unfold coefficient | |
| simp only [Nat.add_mul] | |
| omega | |
| end SubexponentialSAT.Subexp.AssignmentFrontendBounds | |
| end OAI.Algorithms | |