Download data/lean/OAI/Algorithms/SubexponentialSAT/DyadicCallbackWordBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.15 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/DyadicCallbackWordBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/DyadicCallbackWordBounds.lean
-
curl -L -o DyadicCallbackWordBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/DyadicCallbackWordBounds.lean
7.15 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.DyadicCallbackInputs | |
| import OAI.Algorithms.SubexponentialSAT.SparsificationThresholdTable | |
| import OAI.Algorithms.SubexponentialSAT.ExecQuantitativeSparsify | |
| import OAI.Algorithms.SubexponentialSAT.ExecClauseRelationScanEncoding | |
| namespace OAI.Algorithms | |
| /-! Length bounds for the actual dyadic selector output and threshold bank. -/ | |
| namespace SubexponentialSAT.DyadicCallbackWordBounds | |
| open CandidatePrepareProgram ExecSunflowerCallbackBounds | |
| open DyadicMaskedSearchBounds DyadicCallbackInputs | |
| open SubexpPackingParameters | |
| theorem encodedLiterals_codeFormula {n : β} (F : List (List (SAT.Literal (Fin n)))) : | |
| encodedLiterals F = ExecClauseRelationScan.codeFormula | |
| (F.map (List.map Encoding.literalCode)) := by | |
| simp only [encodedLiterals, ExecClauseRelationScan.codeFormula, | |
| ExecClauseRelationScan.codeClause, List.map_map, Function.comp_def] | |
| /-- The word-valued callback formula is exactly the existing serialized | |
| executable node formula, including every list frame. -/ | |
| theorem formulaCode_encodedLiterals {n : β} (F : List (List (SAT.Literal (Fin n)))) : | |
| formulaCode (encodedLiterals F) = ExecQuantitativeSparsify.encodeRawFormula F := by | |
| change ExecClauseRelationScan.encodeFormula (encodedLiterals F) = _ | |
| rw [encodedLiterals_codeFormula, ExecClauseRelationScan.encodeFormula_codes] | |
| rfl | |
| def thresholdCoefficient (k T : β) : β := | |
| SparsificationThresholdTable.widthCoeff (SparsificationThresholdTable.expressions k) * (T + 4) | |
| theorem selector_output_length_le (T n : β) : | |
| (SparsificationBudgetProgram.outputWord T (s n)).length + 1 β€ (T + 4) * (n + 1) := by | |
| have h := SparsificationBudgetProgram.outputWord_length_le T (s n).bits | |
| rw [SparsificationBudgetProgram.value_bits] at h | |
| have hb := SparsificationBudgetProgram.bits_length_le (s n) | |
| have hs := s_le_n n | |
| nlinarith | |
| theorem threshold_coefficient_le (k : β) (i : Fin (k - 1)) : | |
| ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) β€ | |
| SparsificationThresholdTable.widthCoeff (SparsificationThresholdTable.expressions k) := by | |
| exact Finset.single_le_sum (fun j _ => Nat.zero_le | |
| (ArithmeticExpressionProgram.widthCoeff (SparsificationThresholdTable.expressions k j))) | |
| (Finset.mem_univ i) | |
| /-- This applies to the exact padded words returned by the arithmetic table; | |
| it does not replace those words by a canonical representation. -/ | |
| theorem threshold_word_length_le (k T n m r : β) (i : Fin (k - 1)) | |
| (word : List Bool) | |
| (hword : word.length β€ ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) * | |
| ((SparsificationBudgetProgram.outputWord T (s n)).length + 1)) : | |
| word.length β€ thresholdCoefficient k T * localSize n m r k := by | |
| have hlocal : n + 1 β€ localSize n m r k := by unfold localSize; omega | |
| calc | |
| word.length β€ ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) * | |
| ((SparsificationBudgetProgram.outputWord T (s n)).length + 1) := hword | |
| _ β€ SparsificationThresholdTable.widthCoeff (SparsificationThresholdTable.expressions k) * | |
| ((T + 4) * (n + 1)) := Nat.mul_le_mul (threshold_coefficient_le k i) | |
| (selector_output_length_le T n) | |
| _ β€ thresholdCoefficient k T * localSize n m r k := by | |
| simpa only [thresholdCoefficient, Nat.mul_assoc] using | |
| Nat.mul_le_mul_left (thresholdCoefficient k T) hlocal | |
| theorem aggregate_executed_threshold_le (F : Formula) (n m r k T : β) | |
| (i : Fin (k - 1)) (limit threshold : List Bool) | |
| (hcount : F.length β€ m) (hwidth : β C β F, C.length β€ k) | |
| (hliteral : β C β F, β bits β C, bits.length β€ 2 * n + 1) | |
| (hlimit : limit.length β€ m + 1) | |
| (hthreshold : threshold.length β€ ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) * | |
| ((SparsificationBudgetProgram.outputWord T (s n)).length + 1)) : | |
| aggregate F k r (DyadicWidth.width m) limit (i.val + 2).bits threshold β€ | |
| (thresholdCoefficient k T + 24) * localSize n m r k ^ 3 := by | |
| have hi : i.val + 2 β€ k := by have := i.isLt; omega | |
| exact aggregate_threshold_le F n m r k (DyadicWidth.width m) (thresholdCoefficient k T) | |
| limit (i.val + 2).bits threshold hcount hwidth hliteral (DyadicWidth.width_le_succ m) | |
| hlimit ((SparsificationBudgetProgram.bits_length_le _).trans (by omega)) | |
| (threshold_word_length_le k T n m r i threshold hthreshold) | |
| def callbackCoefficient (k T : β) : β := 3000000 * (thresholdCoefficient k T + 24) ^ 8 | |
| theorem callback_envelope_le (F : Formula) (n m r k T : β) | |
| (i : Fin (k - 1)) (limit threshold : List Bool) | |
| (hcount : F.length β€ m) (hwidth : β C β F, C.length β€ k) | |
| (hliteral : β C β F, β bits β C, bits.length β€ 2 * n + 1) | |
| (hlimit : limit.length β€ m + 1) | |
| (hthreshold : threshold.length β€ ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) * | |
| ((SparsificationBudgetProgram.outputWord T (s n)).length + 1)) : | |
| 3000000 * (aggregate F k r (DyadicWidth.width m) limit (i.val + 2).bits threshold) ^ 8 β€ | |
| callbackCoefficient k T * localSize n m r k ^ 24 := by | |
| calc | |
| _ β€ 3000000 * ((thresholdCoefficient k T + 24) * localSize n m r k ^ 3) ^ 8 := | |
| Nat.mul_le_mul_left _ (Nat.pow_le_pow_left | |
| (aggregate_executed_threshold_le F n m r k T i limit threshold | |
| hcount hwidth hliteral hlimit hthreshold) 8) | |
| _ = _ := by simp only [callbackCoefficient, mul_pow, β pow_mul]; ring | |
| open Filter | |
| /-- The actual callback's proved aggregate envelope fits the dyadic masked | |
| loop uniformly over every searched width and every bounded-width node. -/ | |
| theorem eventually_callback_envelope_subexponential (k T : β) : | |
| βαΆ n : β in atTop, β (i : Fin (k - 1)) (F : Formula) (m : β) | |
| (limit threshold : List Bool), | |
| m β€ (2 * n + 1) ^ k β F.length β€ m β | |
| (β C β F, C.length β€ k) β | |
| (β C β F, β bits β C, bits.length β€ 2 * n + 1) β | |
| limit.length β€ m + 1 β | |
| threshold.length β€ ArithmeticExpressionProgram.widthCoeff | |
| (SparsificationThresholdProgram.thresholdExpr (i.val + 2)) * | |
| ((SparsificationBudgetProgram.outputWord T (s n)).length + 1) β | |
| (sourceBudget k m (arity T n (i.val + 2)) | |
| (3000000 * (aggregate F k (arity T n (i.val + 2)) (DyadicWidth.width m) | |
| limit (i.val + 2).bits threshold) ^ 8) : β) β€ | |
| (2 : β) ^ SubexpComputation.scale n := by | |
| filter_upwards [eventually_sourceBudget_subexponential k T (callbackCoefficient k T) 24] with n hn | |
| intro i F m limit threshold hm hcount hwidth hliteral hlimit hthreshold | |
| have hi : i.val + 2 β€ k := by have := i.isLt; omega | |
| exact hn (i.val + 2) hi m _ hm | |
| (callback_envelope_le F n m (arity T n (i.val + 2)) k T i limit threshold | |
| hcount hwidth hliteral hlimit hthreshold) | |
| end SubexponentialSAT.DyadicCallbackWordBounds | |
| end OAI.Algorithms | |