Documentation

CslibFrontier.Computability.PolyTime.CSP.CrossInsertion

Native disjoint insertion of an ordered CROSS #

One composition step doubles every old variable name and places a fixed actual CROSS gadget at odd names. Its four free ports, in their original directed order, follow the old boundary. The emitted certificate is the executed ordered-boundary append program. Repeated and sparse old names, nullary rows and closed components are retained.

The template and its ordered witness are static constants. The original-language existence result obtains them internally from the common-complement and bad-relation premises; the target alphabet need not be finite. Runtime covers every raw state and uses no acceptance invariant. Assignment extension agrees on all even old names and all four odd free ports; odd auxiliary names are existential witnesses.

This is an original composition step. Adjacent wire swaps, the iteration bound and the common-complement native hardness reduction remain objectives of #3091.

Main definitions #

Main results #

Raw data carried by a boundary composition program; no validity proof is input data.

  • body : Logic.PL.CSP Rel ℕ

    Actual original-language constraints with binary natural-number names.

  • ports : List ℕ

    Ordered boundary positions; repeated names remain in raw inputs.

  • Binary successor entries on body darts followed by structural probe darts.

theorem Cslib.Complexity.CSP.CrossInsertion.encState_rotation_budget {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State Rel} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState encRel) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).rotation) encIn✝ Graph.encRotationCertificate S✝

Encode the binary-named body first, then the binary port word, then the binary successor certificate. The first two fields are framed, with no extra grouping or tag.

theorem Cslib.Complexity.CSP.CrossInsertion.encState_mk_inO {Rel : Type} (encRel : Rel ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Logic.PL.CSP Rel ℕ} {T0 S0 : γ → ℕ} {x1 : γ → List ℕ} {T1 S1 : γ → ℕ} {x2 : γ → Graph.RotationCertificate} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (encCSP encRel Turing.MultiTapeTM.encNat) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat) T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Graph.encRotationCertificate T2 S2) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { body := x0 x, ports := x1 x, rotation := x2 x }) encIn (encState encRel) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
@[simp]
theorem Cslib.Complexity.CSP.CrossInsertion.encState_apply {Rel : Type} (encRel : Rel ↪ List Bool) (a : State Rel) :
(encState encRel) a = (encStateFields encRel) (a.body, a.ports, a.rotation)
theorem Cslib.Complexity.CSP.CrossInsertion.encState_mk_deg {Rel : Type} (encRel : Rel ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : Logic.PL.CSP Rel ℕ × List ℕ × Graph.RotationCertificate) => { body := p.1, ports := p.2.1, rotation := p.2.2 }) (encStateFields encRel) (encState encRel) 1 1
theorem Cslib.Complexity.CSP.CrossInsertion.encState_ports_polyTime {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State Rel} :
theorem Cslib.Complexity.CSP.CrossInsertion.encState_body_budget {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State Rel} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState encRel) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).body) encIn✝ (encCSP encRel Turing.MultiTapeTM.encNat) S✝
theorem Cslib.Complexity.CSP.CrossInsertion.encState_rotation_polyTime {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State Rel} :
theorem Cslib.Complexity.CSP.CrossInsertion.encState_mk_budget {Rel : Type} (encRel : Rel ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Logic.PL.CSP Rel ℕ} {x1 : γ → List ℕ} {x2 : γ → Graph.RotationCertificate} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn (encCSP encRel Turing.MultiTapeTM.encNat) budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat) budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Graph.encRotationCertificate budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { body := x0 x, ports := x1 x, rotation := x2 x }) encIn (encState encRel) budget
@[reducible, inline]

The tuple of the fields of encState.

theorem Cslib.Complexity.CSP.CrossInsertion.encState_ports_budget {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State Rel} :
theorem Cslib.Complexity.CSP.CrossInsertion.encState_body_polyTime {Rel : Type} (encRel : Rel ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State Rel} :

The source invariant for composition: distinct boundary names and the two full ordered-boundary checks. This predicate is not used in the runtime certificate.

Instances For
    def Cslib.Complexity.CSP.CrossInsertion.insert {Rel : Type} {ar : Rel → ℕ} {sem : Rel → List Bool → Bool} (g : Logic.PL.CSP.PPGadget ar sem BitString.cross) (w : OrderedBoundary.GadgetWitness g) (I : State Rel) :
    State Rel

    Insert a fixed CROSS at odd names after doubling all old names. The actual old body, port lengths and static template occurrence count fund the raw append table computation.

    @[simp]

    Insertion adds exactly the actual template rows. No row is removed, including nullaries.

    @[simp]

    Every old occurrence remains, followed by every actual template occurrence.

    @[simp]

    Four original directed free ports are appended, without deduplicating old positions.

    @[simp]

    The raw emitted table has the actual combined dart count, even on malformed inputs.

    The actual gadget supplies every new arity obligation; old malformed rows stay malformed.

    Insertion preserves distinctness exactly, without silently repairing repeated ports.

    theorem Cslib.Complexity.CSP.CrossInsertion.accepted_insert {Rel : Type} {ar : Rel → ℕ} {sem : Rel → List Bool → Bool} (g : Logic.PL.CSP.PPGadget ar sem BitString.cross) (w : OrderedBoundary.GadgetWitness g) (I : State Rel) (hI : I.Accepted) :

    Both complete checks for the emitted table follow from the actual relabeled static gadget and Witness.appendComputed. Empty old boundaries and closed components survive.

    theorem Cslib.Complexity.CSP.CrossInsertion.eval_insert_iff {Rel : Type} {ar : Rel → ℕ} {sem : Rel → List Bool → Bool} (g : Logic.PL.CSP.PPGadget ar sem BitString.cross) (w : OrderedBoundary.GadgetWitness g) (I : State Rel) (σ : ℕ → Bool) (a : Fin 4 → Bool) :
    Logic.PL.CSP.eval sem σ I.body = true ∧ a ∈ BitString.cross ↔ ∃ (τ : ℕ → Bool), Logic.PL.CSP.eval sem τ (insert g w I).body = true ∧ (∀ (x : ℕ), τ (2 * x) = σ x) ∧ ∀ (i : Fin 4), τ (2 * ↑i + 1) = a i

    Exact composition semantics. The extension agrees with the assignment on ALL even old names and with the four given odd free ports. Odd auxiliary labels are internal witnesses; there is no source acceptance, well-formedness or prefix hypothesis.

    Doubling a positive old name adds exactly one binary digit. Zero stays the empty word. This is a single-step identity; accumulated bounds for a later iteration are separate.

    One fixed insertion is native polynomial time on EVERY raw state, with binary names, ports and table entries. Only list lengths fund loops; no source invariant is used.

    theorem Cslib.Complexity.CSP.CrossInsertion.exists_originalInsertion {Rel : Type} {ar : Rel → ℕ} {sem : Rel → List Bool → Bool} (encRel : Rel ↪ List Bool) (h : ¬Logic.PL.CSP.HasSchaeferPolymorphism ar sem) (hnot : Logic.PL.CSP.HasPolymorphism ar sem fun (a : Fin 1 → Bool) => !a 0) (r : Rel) (hne : (Logic.PL.CSP.booleanRelation ar sem r).Nonempty) (hbad : ¬BitString.IsEvenDeltaMatroid (BitString.cyclicDifferenceRelation (Logic.PL.CSP.booleanRelation ar sem r))) :
    ∃ (g : Logic.PL.CSP.PPGadget ar sem BitString.cross) (w : OrderedBoundary.GadgetWitness g), Turing.MultiTapeTM.ComputableInPolyTime (insert g w) (encState encRel) (encState encRel) ∧ (∀ (I : State Rel), I.Accepted → (insert g w I).Accepted) ∧ ∀ (I : State Rel) (σ : ℕ → Bool) (a : Fin 4 → Bool), Logic.PL.CSP.eval sem σ I.body = true ∧ a ∈ BitString.cross ↔ ∃ (τ : ℕ → Bool), Logic.PL.CSP.eval sem τ (insert g w I).body = true ∧ (∀ (x : ℕ), τ (2 * x) = σ x) ∧ ∀ (i : Fin 4), τ (2 * ↑i + 1) = a i

    The common-complement/bad-original-relation premises internally yield a static actual CROSS insertion with its all-raw native runtime, full checker preservation and exact assignment extension. This is one disjoint composition step, not an adjacent swap or a hardness theorem.