Documentation

Complexity.Computability.Circuit.Boolean.SemiCircuit.Simplification

Restricting parameters and deleting constraints #

The simplifications of a fair semi-circuit, each preserving well-formedness:

A consistent assignment of a restriction is consistent for the original semi-circuit once the restricted parameter takes the value of its literal (SemiCircuit.consistent_restrict), and consistent assignments of the deletions lift to the original semi-circuit (SemiCircuit.DeleteGateOK.liftsTo, SemiCircuit.DeleteEqnOK.liftsTo, SemiCircuit.DropEqnOK.liftsTo, SemiCircuit.liftsTo_dropTrivialEqn).

Main definitions #

Main results #

References #

Restricting a parameter #

Restrict the parameter x to the literal ℓ: reroute x to ℓ and remove it from the parameters.

Instances For
    theorem Cslib.Circuits.Boolean.SemiCircuit.mem_live_restrict {C : SemiCircuit} {x : ℕ} {ℓ : Lit} {i : ℕ} (hi : i ∈ C.live) (hix : i ≠ x) :
    i ∈ (C.restrict x ℓ).live
    theorem Cslib.Circuits.Boolean.SemiCircuit.WellFormed.restrict {C : SemiCircuit} (hC : C.WellFormed) {x : ℕ} {ℓ : Lit} (hx : x ∈ C.params) (hℓ : ∀ (y : ℕ), ℓ.Reads y → y ∈ C.params ∧ y ≠ x) :

    Restricting a parameter to a literal reading at most another parameter preserves well-formedness.

    theorem Cslib.Circuits.Boolean.SemiCircuit.consistent_restrict {C : SemiCircuit} (hC : C.WellFormed) {x : ℕ} {ℓ : Lit} (hx : x ∈ C.params) (hℓ : ℓ.arg ≠ Arg.node x) {val : ℕ → Bool} (h : (C.restrict x ℓ).Consistent val) :
    C.Consistent (Function.update val x (ℓ.eval val))

    A consistent assignment of a restriction, with the restricted parameter given the value of its literal, is consistent for the original semi-circuit.

    theorem Cslib.Circuits.Boolean.SemiCircuit.out_restrict {C : SemiCircuit} {x : ℕ} {ℓ : Lit} (hℓ : ℓ.arg ≠ Arg.node x) (val : ℕ → Bool) :
    (C.restrict x ℓ).out.eval val = C.out.eval (Function.update val x (ℓ.eval val))

    Deleting a gate #

    Delete the gate J, rerouting its uses to the literal ℓ.

    Instances For

      The hypotheses of a gate deletion: J is a gate, ℓ reads at most an input of J, and either J computes ℓ on the solutions of the affine system or nothing reads J.

      Instances For
        theorem Cslib.Circuits.Boolean.SemiCircuit.eqnsHold_deleteGate {C : SemiCircuit} (hC : C.WellFormed) {J : ℕ} {ℓ : Lit} (hJ : J ∈ C.gates) (val : ℕ → Bool) :
        (C.deleteGate J ℓ).EqnsHold val ↔ C.EqnsHold val
        theorem Cslib.Circuits.Boolean.SemiCircuit.mem_live_deleteGate {C : SemiCircuit} {J : ℕ} {ℓ : Lit} {i : ℕ} (hi : i ∈ C.live) (hiJ : i ≠ J) :
        i ∈ (C.deleteGate J ℓ).live

        Deleting a gate preserves well-formedness.

        A consistent assignment of a gate deletion lifts, by giving the deleted gate its value.

        Deleting an equation #

        Delete the equation e, which reads v = ℓ, and the auxiliary variable v, rerouting v to ℓ.

        Instances For

          The hypotheses of deleting an equation: e is an equation stating v = ℓ for an auxiliary variable v and a literal ℓ reading at most another term of e.

          Instances For
            theorem Cslib.Circuits.Boolean.SemiCircuit.mem_live_deleteEqn {C : SemiCircuit} {e v : ℕ} {ℓ : Lit} {i : ℕ} (hi : i ∈ C.live) (hiv : i ≠ v) :
            i ∈ (C.deleteEqn e v ℓ).live
            theorem Cslib.Circuits.Boolean.SemiCircuit.DeleteEqnOK.eqnsHold {C : SemiCircuit} {e v : ℕ} {ℓ : Lit} (h : C.DeleteEqnOK e v ℓ) {val : ℕ → Bool} (hval : (C.deleteEqn e v ℓ).EqnsHold val) :
            C.EqnsHold (Function.update val v (ℓ.eval val))

            A solution of the affine system after deleting v = ℓ extends to a solution of the original system by giving v the value of ℓ.

            theorem Cslib.Circuits.Boolean.SemiCircuit.WellFormed.deleteEqn {C : SemiCircuit} (hC : C.WellFormed) {e v : ℕ} {ℓ : Lit} (h : C.DeleteEqnOK e v ℓ) :
            (C.deleteEqn e v ℓ).WellFormed

            Deleting an equation v = ℓ with its auxiliary variable preserves well-formedness.

            theorem Cslib.Circuits.Boolean.SemiCircuit.DeleteEqnOK.liftsTo {C : SemiCircuit} (hC : C.WellFormed) {e v : ℕ} {ℓ : Lit} (h : C.DeleteEqnOK e v ℓ) :
            (C.deleteEqn e v ℓ).LiftsTo C

            A consistent assignment after deleting v = ℓ lifts, by giving v the value of ℓ.

            Dropping an equation #

            Delete the equation e together with an auxiliary variable v occurring nowhere else.

            Instances For

              The hypotheses of dropping an equation: the auxiliary variable v occurs in the equation e and nowhere else.

              Instances For

                The value of the dropped auxiliary variable solving its equation.

                Instances For
                  theorem Cslib.Circuits.Boolean.SemiCircuit.DropEqnOK.eqnsHold {C : SemiCircuit} {e v : ℕ} (h : C.DropEqnOK e v) {val : ℕ → Bool} (hval : (C.dropEqn e v).EqnsHold val) :
                  C.EqnsHold (C.dropEqnValue e v val)

                  Dropping an equation with an auxiliary variable occurring only there preserves well-formedness.

                  A consistent assignment after dropping an equation lifts, by solving the equation for the dropped auxiliary variable.

                  Delete an equation without terms.

                  Instances For
                    theorem Cslib.Circuits.Boolean.SemiCircuit.eqnsHold_dropTrivialEqn {C : SemiCircuit} (hC : C.WellFormed) {e : ℕ} (he : e ∈ C.eqns) (hterms : (C.eqn e).terms = ∅) (val : ℕ → Bool) :

                    An equation without terms of a well-formed semi-circuit always holds, so dropping it keeps the solutions of the affine system.