Documentation

CslibFrontier.Computability.PCP.Encoded.Preprocess.Programs

Rotation and constraint programs for preprocessing #

The edge-list construction and random-walk algorithms use the same numbered half-edges. These programs expose the complete rotation, including the return label, without rebuilding the preprocessed edge list for each call. Cloud search, numerical family rotation, constraint lookup and every copied runtime graph are charged by the joint certificates.

Main definitions #

Main results #

References #

Decode a numbered half-edge into its edge index and endpoint bit.

@[simp]

Numbering retains both the edge identity and its endpoint.

Rotate on one of the four kinds of preprocessed darts, retaining its return label.

def Cslib.PCP.Encoded.Graph.preprocessRelation {C α D : Type} [DecidableEq α] (eval : C → α → α → Bool) (fallback : C) (g : Graph C) (p : (ℕ × Bool) × ConstraintGraph.PreprocessLabel D) (a b : α) :

Original edges retain their orientation, cloud edges check equality, and new edges accept.

theorem Cslib.PCP.Encoded.Graph.preprocessRotation_eq {C α D : Type} (g : Graph C) (eval : C → α → α → Bool) (fallback : C) (family : (n : ℕ) → RotationMap (Fin n) D) (rotate : ℕ × ℕ × D → ℕ × D) (hrotate : ∀ (n : ℕ) (v : Fin n) (d : D), rotate (n, ↑v, d) = (↑((family n).rot (v, d)).1, ((family n).rot (v, d)).2)) (v : Fin g.edges.length × Bool) (d : ConstraintGraph.PreprocessLabel D) :
preprocessRotation fallback rotate g ((↑v.1, v.2), d) = have next := (g.regularPreprocess eval fallback family).graph.rot (v, d); ((↑next.1.1, next.1.2), next.2)

Exact agreement on the existing half-edges needs no claim about malformed vertex names.

theorem Cslib.PCP.Encoded.Graph.preprocessRelation_eq_true {C α D : Type} [DecidableEq α] (g : Graph C) (eval : C → α → α → Bool) (fallback : C) (family : (n : ℕ) → RotationMap (Fin n) D) (v : Fin g.edges.length × Bool) (d : ConstraintGraph.PreprocessLabel D) (a b : α) :
preprocessRelation eval fallback g ((↑v.1, v.2), d) a b = true ↔ (g.regularPreprocess eval fallback family).rel (v, d) a b

The executable constraint is the existing mathematical preprocessing constraint.

theorem Cslib.PCP.Encoded.Graph.isPolyTime_preprocessRelation {C α D : Type} {enc : C ↪ List Bool} {dartEncoding : ConstraintGraph.PreprocessLabel D ↪ List Bool} [Finite D] [DecidableEq α] {Input : Type} {input : Input ↪ List Bool} {alphabet : α ↪ List Bool} {graph : Input → Graph C} {dart : Input → (ℕ × Bool) × ConstraintGraph.PreprocessLabel D} {left right : Input → α} {eval : C → α → α → Bool} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (encoding enc)) (hdart : Turing.MultiTapeTM.ComputableInPolyTime dart input (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBool) dartEncoding)) (heval : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : C × α × α) => eval p.1 p.2.1 p.2.2) (Turing.MultiTapeTM.encPair enc (Turing.MultiTapeTM.encPair alphabet alphabet)) Turing.MultiTapeTM.encBool) (hleft : Turing.MultiTapeTM.ComputableInPolyTime left input alphabet) (hright : Turing.MultiTapeTM.ComputableInPolyTime right input alphabet) (fallback : C) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : Input) => preprocessRelation eval fallback (graph x) (dart x) (left x) (right x)) input Turing.MultiTapeTM.encBool

Computed constraints and labels use the same evaluator under any fixed label encoding.