Download data/lean/OAI/Computability/VertexCover/Basic.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Basic.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/VertexCover/Basic.lean
-
curl -L -o Basic.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Basic.lean
2.58 kB
| import Mathlib | |
| import OAI.Computability.VertexCover.Encoding.BinaryEncoding | |
| namespace OAI | |
| section | |
| namespace VertexCover | |
| def ThreeSAT (input : List Bool) : Prop := | |
| β formula, UniqueGames.BinaryEncoding.decodeFormula input = some formula β§ | |
| formula.Satisfiable | |
| structure ExplicitGraph where | |
| n : β | |
| edges : List (Fin n Γ Fin n) | |
| increasing : β e β edges, e.1 < e.2 | |
| nodup : edges.Nodup | |
| namespace ExplicitGraph | |
| def Cover (G : ExplicitGraph) (S : Finset (Fin G.n)) : Prop := | |
| β e β G.edges, e.1 β S β¨ e.2 β S | |
| instance (G : ExplicitGraph) (S : Finset (Fin G.n)) : Decidable (G.Cover S) := | |
| inferInstanceAs (Decidable (β e β G.edges, e.1 β S β¨ e.2 β S)) | |
| noncomputable def coverNumber (G : ExplicitGraph) : β := | |
| Nat.find (show β k : β, β S : Finset (Fin G.n), G.Cover S β§ S.card = k from | |
| β¨G.n, Finset.univ, by simp [Cover], by simpβ©) | |
| def bits (G : ExplicitGraph) : List Bool := | |
| let names := [G.n] ++ List.range G.n ++ [G.edges.length] ++ | |
| G.edges.flatMap (fun e => [e.1.val, e.2.val]) | |
| names.flatMap UniqueGames.BinaryEncoding.nameBits | |
| end ExplicitGraph | |
| def FiniteAlphabet (M : Turing.FinTM2) : Prop := β k, Finite (M.Ξ k) | |
| structure GapReduction (m : β) where | |
| construct : List Bool β ExplicitGraph | |
| computation : Turing.TM2ComputableInPolyTime (id : List Bool β List Bool) | |
| ExplicitGraph.bits construct | |
| finiteAlphabet : FiniteAlphabet computation.tm | |
| completeness : β input, ThreeSAT input β | |
| ((construct input).coverNumber : β) < | |
| (1 / 2 + 1 / (m : β)) * (construct input).n | |
| soundness : β input, Β¬ ThreeSAT input β | |
| (1 - 1 / (m : β)) * (construct input).n < | |
| ((construct input).coverNumber : β) | |
| def natListBits (L : List β) : List Bool := | |
| (L.length :: L).flatMap UniqueGames.BinaryEncoding.nameBits | |
| structure Approximation (Ξ± : β) where | |
| run : ExplicitGraph β List β | |
| computation : Turing.TM2ComputableInPolyTime ExplicitGraph.bits natListBits run | |
| finiteAlphabet : FiniteAlphabet computation.tm | |
| nodup : β G, (run G).Nodup | |
| vertices : β G, β v β run G, v < G.n | |
| covers : β G, β e β G.edges, e.1.val β run G β¨ e.2.val β run G | |
| quality : β G, ((run G).length : β) β€ Ξ± * (G.coverNumber : β) | |
| structure ThreeSATDecision where | |
| run : List Bool β Bool | |
| computation : Turing.TM2ComputableInPolyTime (id : List Bool β List Bool) | |
| (fun b : Bool => [b]) run | |
| finiteAlphabet : FiniteAlphabet computation.tm | |
| correct : β input, run input = true β ThreeSAT input | |
| end VertexCover | |
| end | |
| end OAI | |