Download data/lean/OAI/Combinatorics/IndependentSets/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.75 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/IndependentSets/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Model.lean
2.75 kB
| import Mathlib | |
| namespace OAI | |
| namespace LargeIndependentSets | |
| structure Literal where | |
| name : β | |
| positive : Bool | |
| deriving DecidableEq | |
| structure Formula where | |
| clauses : List (List Literal) | |
| width : β C β clauses, C.length β€ 3 | |
| def Formula.Satisfiable (Ο : Formula) : Prop := | |
| β assignment : β β Bool, β C β Ο.clauses, | |
| β l β C, assignment l.name = l.positive | |
| /-- Binary framing: `true,b` for a payload bit and `false` as terminator. -/ | |
| def frame : List Bool β List Bool | |
| | [] => [false] | |
| | b :: bs => true :: b :: frame bs | |
| def nameBits (n : β) : List Bool := frame n.bits | |
| def literalBits (l : Literal) : List Bool := l.positive :: nameBits l.name | |
| def clauseBits (C : List Literal) : List Bool := | |
| nameBits C.length ++ C.flatMap literalBits | |
| def formulaBits (Ο : Formula) : List Bool := | |
| nameBits Ο.clauses.length ++ Ο.clauses.flatMap clauseBits | |
| /-- A nonempty, finite, simple, undirected, unweighted graph. -/ | |
| structure Graph where | |
| vertices : β | |
| nonempty : 0 < vertices | |
| adj : Fin vertices β Fin vertices β Bool | |
| symm : β u v, adj u v = adj v u | |
| loopless : β u, adj u u = false | |
| def Graph.Independent (G : Graph) (S : Finset (Fin G.vertices)) : Prop := | |
| β u β S, β v β S, u β v β G.adj u v = false | |
| instance (G : Graph) (S : Finset (Fin G.vertices)) : Decidable (G.Independent S) := | |
| inferInstanceAs (Decidable (β u β S, β v β S, u β v β G.adj u v = false)) | |
| def Graph.independenceNumber (G : Graph) : β := | |
| ((Finset.univ : Finset (Fin G.vertices)).powerset.filter G.Independent).sup Finset.card | |
| def Graph.ThreeColorable (G : Graph) : Prop := | |
| β color : Fin G.vertices β Fin 3, | |
| β u v, G.adj u v = true β color u β color v | |
| /-- Full explicit adjacency matrix, row-major, with binary vertex count. -/ | |
| def graphBits (G : Graph) : List Bool := | |
| nameBits G.vertices ++ (List.finRange G.vertices).flatMap | |
| (fun u => (List.finRange G.vertices).map (G.adj u)) | |
| open scoped Classical | |
| noncomputable section | |
| /-- Polynomial-time graph reduction with a real independence-ratio threshold. -/ | |
| structure RealGraphReduction (Ξ΄ : β) where | |
| reduce : List Bool β Graph | |
| computation : Turing.TM2ComputableInPolyTime (id : List Bool β List Bool) graphBits reduce | |
| finiteAlphabets : β k : computation.tm.K, Finite (computation.tm.Ξ k) | |
| outputBound : Polynomial β | |
| outputSize : β b, (graphBits (reduce b)).length β€ outputBound.eval b.length | |
| completeness : β Ο : Formula, Ο.Satisfiable β (reduce (formulaBits Ο)).ThreeColorable | |
| soundness : β Ο : Formula, Β¬Ο.Satisfiable β | |
| ((reduce (formulaBits Ο)).independenceNumber : β) < | |
| Ξ΄ * (reduce (formulaBits Ο)).vertices | |
| end | |
| end LargeIndependentSets | |
| end OAI | |