import Mathlib import OAI.Computability.VertexCover.Machines.ListFilter import OAI.Computability.VertexCover.Machines.GraphDescriptor import OAI.Computability.VertexCover.Machines.NumberedGraph namespace OAI section section section section section section section section section section section section section section section section section section section section section section section section section section section section section section section section namespace VertexCover.Machine.GraphMachine open LabelCover noncomputable section variable {a b d : ℕ} def weightCount (a b d : ℕ) : ℕ := Fintype.card (Weight a b d) theorem weightCount_pos : 0 count I d) := ((((FixedLC.MPoly hb).comp (Poly.natPow (Fintype.card (PositionPair d)))).pair (Poly.const FixedLC.code natBits (weightCount a b d))).comp Poly.natMul).congr (fun _ => rfl) def decodePoly : Poly natBits (vertexCode (a := a) (b := b) (d := d)) decode := by let q := ((Poly.identity natBits).pair (Poly.const natBits natBits (weightCount a b d))).comp Poly.natDiv let r := (Poly.finMod (weightCount a b d) weightCount_pos).comp (Poly.finite finCode weightCode (finCode_injective _) (Fintype.equivFin (Weight a b d)).symm) exact (q.pair r).congr (fun _ => rfl) def numberFrame (p : FixedLC a b × (ℕ × ℕ)) : Frame a b d := (p.1,(decode p.2.1,decode p.2.2)) def numberFramePoly : Poly (prodBits (FixedLC.code (a := a) (b := b)) (prodBits natBits natBits)) (frameCode (a := a) (b := b) (d := d)) numberFrame := by let I := Poly.fst (FixedLC.code (a := a) (b := b)) (prodBits natBits natBits) let p := Poly.snd (FixedLC.code (a := a) (b := b)) (prodBits natBits natBits) exact I.pair (((p.comp (Poly.fst natBits natBits)).comp decodePoly).pair ((p.comp (Poly.snd natBits natBits)).comp decodePoly)) def test (t : ℝ) (p : FixedLC a b × (ℕ × ℕ)) : Bool := decide (p.2.1 p.1 && p.2)) def testPoly (ha : 0 rfl) theorem test_correct (I : FixedLC a b) (t : ℝ) (u v : Fin (count I d)) : test (d := d) t (I,(u.val,v.val))=true ↔ u (ne_of_lt hl) (congrArg Fin.val ((fullEquiv I d).injective h)),hn⟩ · rintro ⟨hl,_,hn⟩; exact ⟨hl,hn⟩ end end VertexCover.Machine.GraphMachine end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end OAI