Documentation

DescriptiveComplexity.Problems.Wide.DrawVar

One variable's machinery: gates, the VAL loop, the stage write #

The spine of the per-variable evaluation (DescriptiveComplexity.Problems.Wide.DrawEval dispatches into it, once per variable position): the gates decide whether the working address's outer blocks encode points – their machinery is abstract here, their verdict a control flag – the junk path writes False into the stage track directly, and the valid path runs the VAL loop: clear the VAL register, evaluate the matrix at the empty valuation, then rounds of exhaustion test, increment and matrix until VAL is exhausted, the accumulator folds riding in the dispatching rules' dstSt (separation never reads dstSt, so the folds are parameters here – initSt at the empty valuation, storeCarry at each increment's block-indexed landing, postFold after each matrix pass – and their content is fixed with the runs, not with the shapes).

Everything is generic over the program's phase type: the spine's phases embed by a parameter, the gates' and the matrix's machineries come with their own rules, and the exit – writing the variable's next-stage bit at the marker off the verdict accumulator – targets a parameter phase. One copy of this file's shapes per variable position is instantiated at assembly.

The shapes #

The phases of one variable's machinery: the four checkpoints, the kit copies, and the two abstract blocks. B is the carry-block index of the VAL increment.

  • vchk0 {B PG PX : Type} : VarPh B PG PX

    The entry checkpoint: walk to the marker, begin the gates.

  • gatesP {B PG PX : Type} : PGVarPh B PG PX

    A phase of the gates' machinery.

  • vchk1 {B PG PX : Type} : VarPh B PG PX

    After the gates: dispatch on their verdict flag.

  • clearValP {B PG PX : Type} : TrackPhVarPh B PG PX

    Clearing the VAL register.

  • matrixP {B PG PX : Type} : PXVarPh B PG PX

    A phase of the matrix's machinery.

  • mchk1 {B PG PX : Type} : VarPh B PG PX

    After a matrix pass: fold and begin the exhaustion test.

  • valTestP {B PG PX : Type} : TestPhVarPh B PG PX

    The exhaustion test on VAL.

  • valIncrP {B PG PX : Type} : IncrPh BVarPh B PG PX

    The increment of VAL, landing per carry block.

  • vchk2 {B PG PX : Type} : VarPh B PG PX

    Converged: write the stage bit and leave.

Instances For
    Dependency graph

    The sites of one variable's machinery.

    • vchk0 {SG SX : Type} : VarSite SG SX

      The entry checkpoint.

    • gates {SG SX : Type} : SGVarSite SG SX

      A gates site.

    • vchk1 {SG SX : Type} : VarSite SG SX

      The verdict checkpoint.

    • clearVal {SG SX : Type} : VarSite SG SX

      The VAL clear.

    • matrix {SG SX : Type} : SXVarSite SG SX

      A matrix site.

    • mchk1 {SG SX : Type} : VarSite SG SX

      The post-matrix checkpoint.

    • valTest {SG SX : Type} : VarSite SG SX

      The exhaustion test.

    • valIncr {SG SX : Type} : VarSite SG SX

      The VAL increment.

    • vchk2 {SG SX : Type} : VarSite SG SX

      The exit checkpoint.

    Instances For
      Dependency graph
      Dependency graph
      Dependency graph
      @[reducible, inline]

      The carry-block index of the VAL increment.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.Draw.Data.varRule {L : FirstOrder.Language} (dt : Data L) {A Q P PG PX SG SX : Type} (zero one : A) {ShG : SGType} {ShX : SXType} (emb : VarPh dt.CarryB PG PXP) (ruleG : (s : SG) → ShG sRule A Q dt.SlotIx P) (ruleX : (s : SX) → ShX sRule A Q dt.SlotIx P) (pgEntry pxEntry exitPh : P) (newSlot : dt.SlotIx) (gateFlag : Q) (accBit : (QA)Prop) (enterSt initSt postFold : (QA)(dt.SlotIxA)QA) (storeCarry : dt.CarryB(QA)(dt.SlotIxA)QA) (i : VarSite SG SX) :
        VarSh SG SX ShG ShX dt.CarryB iRule A Q dt.SlotIx P

        The rules of one variable's machinery. Parameters: the phase embedding, the two abstract machineries with their entry phases, the exit phase, the variable's stage slot, the gates' verdict flag, the verdict accumulator, and the three fold updates.

        Equations
        Instances For
          Dependency graph
          theorem DescriptiveComplexity.Draw.Data.varRule_dstIn {L : FirstOrder.Language} (dt : Data L) {A Q P PG PX SG SX : Type} (zero one : A) {ShG : SGType} {ShX : SXType} {emb : VarPh dt.CarryB PG PXP} {ruleG : (s : SG) → ShG sRule A Q dt.SlotIx P} {ruleX : (s : SX) → ShX sRule A Q dt.SlotIx P} (pgEntry pxEntry exitPh : P) (newSlot : dt.SlotIx) (gateFlag : Q) (accBit : (QA)Prop) (enterSt initSt postFold : (QA)(dt.SlotIxA)QA) (storeCarry : dt.CarryB(QA)(dt.SlotIxA)QA) {S : PProp} (hemb : ∀ (p : VarPh dt.CarryB PG PX), S (emb p)) (hexit : S exitPh) (hG : ∀ (s : SG) (ρ : ShG s), S (ruleG s ρ).dstPh) (hX : ∀ (s : SX) (ρ : ShX s), S (ruleX s ρ).dstPh) (hpg : S pgEntry) (hpx : S pxEntry) (i : VarSite SG SX) (ρ : VarSh SG SX ShG ShX dt.CarryB i) :
          S (dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ).dstPh

          A property of a variable machinery's phases and its exit holds of every phase it can move to, given it holds of the gates' and the matrix's.

          Dependency graph
          theorem DescriptiveComplexity.Draw.Data.varHosrc {L : FirstOrder.Language} (dt : Data L) {A Q P PG PX SG SX : Type} (zero one : A) {ShG : SGType} {ShX : SXType} {emb : VarPh dt.CarryB PG PXP} {ruleG : (s : SG) → ShG sRule A Q dt.SlotIx P} {ruleX : (s : SX) → ShX sRule A Q dt.SlotIx P} (pgEntry pxEntry exitPh : P) (newSlot : dt.SlotIx) (gateFlag : Q) (accBit : (QA)Prop) (enterSt initSt postFold : (QA)(dt.SlotIxA)QA) (storeCarry : dt.CarryB(QA)(dt.SlotIxA)QA) {ownG : PGSG} {ownX : PXSX} (hosrcG : ∀ (s : SG) (ρ : ShG s), ∃ (p : PG), (ruleG s ρ).srcPh = emb (VarPh.gatesP p) ownG p = s) (hosrcX : ∀ (s : SX) (ρ : ShX s), ∃ (p : PX), (ruleX s ρ).srcPh = emb (VarPh.matrixP p) ownX p = s) (i : VarSite SG SX) (ρ : VarSh SG SX ShG ShX dt.CarryB i) :
          ∃ (p : VarPh dt.CarryB PG PX), (dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ).srcPh = emb p varOwn ownG ownX p = i

          Every rule of one variable's machinery fires from a phase its site owns; the two abstract machineries' obligations are parameters.

          Dependency graph
          theorem DescriptiveComplexity.Draw.Data.varSep {L : FirstOrder.Language} (dt : Data L) {A Q P PG PX SG SX : Type} (zero one : A) {ShG : SGType} {ShX : SXType} (hzo : zero one) {emb : VarPh dt.CarryB PG PXP} (hemb : Function.Injective emb) {ruleG : (s : SG) → ShG sRule A Q dt.SlotIx P} {ruleX : (s : SX) → ShX sRule A Q dt.SlotIx P} {pgEntry pxEntry exitPh : P} {newSlot : dt.SlotIx} {gateFlag : Q} {accBit : (QA)Prop} {enterSt initSt postFold : (QA)(dt.SlotIxA)QA} {storeCarry : dt.CarryB(QA)(dt.SlotIxA)QA} (hsepG : ∀ (s : SG) (ρ ρ' : ShG s) (f : QA) (g : dt.SlotIxA), (ruleG s ρ).guard f g(ruleG s ρ').guard f g(ruleG s ρ).srcPh = (ruleG s ρ').srcPhρ = ρ') (hsepX : ∀ (s : SX) (ρ ρ' : ShX s) (f : QA) (g : dt.SlotIxA), (ruleX s ρ).guard f g(ruleX s ρ').guard f g(ruleX s ρ).srcPh = (ruleX s ρ').srcPhρ = ρ') (i : VarSite SG SX) (ρ ρ' : VarSh SG SX ShG ShX dt.CarryB i) (f : QA) (g : dt.SlotIxA) :
          (dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ).guard f g(dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ').guard f g(dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ).srcPh = (dt.varRule zero one emb ruleG ruleX pgEntry pxEntry exitPh newSlot gateFlag accBit enterSt initSt postFold storeCarry i ρ').srcPhρ = ρ'

          One variable's machinery separates in-shape: the checkpoints by their guards, the kits by their sep and exit_disjoint, the exit pairs by the phases the embedding keeps apart; the two abstract machineries by their parameters.

          Dependency graph