Download lean/OAI/Computability/MaxCut/Games/GraphIterationBounds.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 3.61 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/MaxCut/Games/GraphIterationBounds.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/MaxCut/Games/GraphIterationBounds.lean
-
curl -L -o GraphIterationBounds.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/MaxCut/Games/GraphIterationBounds.lean
3.61 kB
| import Mathlib | |
| import OAI.Computability.MaxCut.PCP.TableIteration | |
| import OAI.Computability.MaxCut.Machines.GraphCounterFinish | |
| namespace OAI | |
| /-! One polynomial bounds every actual intermediate encoding in the concrete | |
| logarithmic graph iteration. The linear recurrence is on graph size. -/ | |
| namespace MaxCutGames.Foundations.Complexity.GraphIterationBounds | |
| open PCP RoundTables | |
| def inputBits (input : Input) : List Bool := GraphTables.tableBits input.val | |
| def countedBits (input : Input) : List Bool := GraphCounterPrefix.output input.val | |
| def words (H : BaseTable) (input : Input) (i : Nat) : List Bool := | |
| GraphTables.tableBits (TableIteration.runTables H i input.val) | |
| def count (input : Input) : Nat := GraphCounterPrefix.count input.val | |
| noncomputable def lengthPolynomial : Polynomial Nat := | |
| (GraphTableComplexity.encodingPolynomial 64).comp (PCPIterationMachine.sizePolynomial sizeFactor) | |
| theorem inputBits_le_countedBits (input : Input) : (inputBits input).length ≤ (countedBits input).length := by | |
| simp only [inputBits, countedBits, GraphCounterPrefix.output, List.length_append] | |
| omega | |
| theorem size_le_inputBits (input : Input) : size input ≤ (inputBits input).length := by | |
| have h := GraphTableComplexity.size_add_two_le_bits input.val | |
| unfold size inputBits | |
| omega | |
| theorem count_le (input : Input) : count input ≤ (countedBits input).length + 1 := | |
| (PCPIterationMachine.rounds_le (size input)).trans | |
| (Nat.add_le_add_right ((size_le_inputBits input).trans (inputBits_le_countedBits input)) 1) | |
| theorem intermediate_size (H : BaseTable) (input : Input) (i : Nat) (hi : i ≤ count input) : | |
| size (TableIteration.run H i input) ≤ PCPIterationMachine.sizeEnvelope sizeFactor (size input) := by | |
| apply PCPIterationMachine.semanticSize_bound | |
| (fun j => size (TableIteration.run H j input)) sizeFactor (size input) | |
| sizeFactor_positive (Nat.le_succ _) _ i hi | |
| intro j _ | |
| exact step_size H (TableIteration.run H j input) | |
| theorem intermediate_bits (H : BaseTable) (input : Input) (i : Nat) (hi : i ≤ count input) : | |
| (words H input i).length ≤ lengthPolynomial.eval (countedBits input).length := by | |
| have hsize := intermediate_size H input i hi | |
| have hinput := (size_le_inputBits input).trans (inputBits_le_countedBits input) | |
| have heval := MachineComposition.natPolynomial_eval_mono | |
| (PCPIterationMachine.sizePolynomial sizeFactor) hinput | |
| rw [PCPIterationMachine.sizePolynomial_eval, PCPIterationMachine.sizePolynomial_eval] at heval | |
| have hs := hsize.trans heval | |
| have htable : (TableIteration.runTables H i input.val).vertices + | |
| (TableIteration.runTables H i input.val).darts ≤ | |
| PCPIterationMachine.sizeEnvelope sizeFactor (countedBits input).length := by | |
| rw [← TableIteration.run_val] | |
| exact hs | |
| rw [lengthPolynomial, Polynomial.eval_comp, PCPIterationMachine.sizePolynomial_eval] | |
| exact GraphTableComplexity.bits_le_of_size_le _ htable | |
| noncomputable def runtimePolynomial (bodyTime : Polynomial Nat) : Polynomial Nat := | |
| (Polynomial.X + 1) * (bodyTime.comp lengthPolynomial + 2 * lengthPolynomial + 4) + | |
| 2 * lengthPolynomial + 4 | |
| theorem runtimePolynomial_eval (bodyTime : Polynomial Nat) (N : Nat) : | |
| (runtimePolynomial bodyTime).eval N = | |
| (N + 1) * (bodyTime.eval (lengthPolynomial.eval N) + 2 * lengthPolynomial.eval N + 4) + | |
| 2 * lengthPolynomial.eval N + 4 := by | |
| simp only [runtimePolynomial, Polynomial.eval_add, Polynomial.eval_mul, Polynomial.eval_X, | |
| Polynomial.eval_one, Polynomial.eval_ofNat, Polynomial.eval_comp] | |
| end MaxCutGames.Foundations.Complexity.GraphIterationBounds | |
| end OAI | |