Documentation

DescriptiveComplexity.Problems.Wide.DrawRunElem

The element loop's run #

The run theorem of DescriptiveComplexity.Draw.elemRule, in the kit-discharge idiom: one hypothesis – the program's rules at an injection of rule names are the loop's – and the geometry of the working cell, and the machine carries itself from the loop's entry checkpoint to its exit phase, the control folded over every tuple of the enumeration.

The shape of the statement follows the loop's shape. The enumeration is abstract – a finite linear order ι, in practice the lexicographic order on control-held tuples – and the control's evolution is a family per index: fsOf a j is the pointer before the j-th read of round a, tied together by four equations (the entry initializes round a₀, each read stores its bit, each advance dispatch opens the next round, the last round is recognized by the exhaustion guard). Every read trip is one DescriptiveComplexity.Draw.ReadKit discharge; the store, dispatch and walk-back steps are single DescriptiveComplexity.Draw.Prog.step_move / step_moveBack steps; the loop closes by DescriptiveComplexity.Draw.reachesIn_of_ordLoop_card.

The run is proved with its cost (elem_reachesIn): given a width c for one read trip, a round costs 2 + (c + 2) · nr – the dispatch, the walk back, and per read the trip, the store and the walk back – and the whole loop that once per element of the enumeration, plus the round that opens it and the step that leaves. elem_run is the same run with the budget forgotten, at the width every trip has anyway: twice the number of addresses. A space-bounded caller reads that one; a clocked program compares the count with its clock.

Every track the loop touches – the read tracks and a reference track t₀ the tape is presented along – is backed: its digits are carried by the background at its own slot, which is what DescriptiveComplexity.Draw.Data.back provides and what lets consecutive trips walking different tracks share one tape term (DescriptiveComplexity.Draw.trackTape_of_back).

What indexes the file is a parameter (DescriptiveComplexity.IxFile): a track is a set of registers and the cells the reads stop at are registers, so nothing here asks the file to have one register per element of the universe.

theorem DescriptiveComplexity.Draw.trackTape_of_back {A R P Q W K : Type} {dd : } [Fintype Q] [Fintype W] [DecidableEq W] [FirstOrder.Language.wide.Structure (Univ A R P K dd)] {PR : Prog A R P Q W K dd} {I : Type} {ile : IIProp} (RF : IxFile (Univ A R P K dd) I ile) {t : W} {rest : (Univ A R P K ddProp)WA} {m : IProp} (hm : ∀ (r : Univ A R P K ddProp), rest r t = bitVal PR.zero PR.one (bitAtOf RF.cell m r)) :
PR.trackTapeAt RF.cell t rest m = fun (r : Univ A R P K ddProp) => PR.syElt (rest r)

A backed track presents the naked background: a walked track whose digits the background already carries at its own slot adds nothing to the tape. This is what lets one leg's conclusion be the next leg's hypothesis when the two walk different tracks.

Dependency graph
theorem DescriptiveComplexity.Draw.passTracks_of_back {A R P Q W K : Type} {dd : } [Fintype Q] [Fintype W] [DecidableEq W] [FirstOrder.Language.wide.Structure (Univ A R P K dd)] {PR : Prog A R P Q W K dd} {I : Type} {ile : IIProp} (RF : IxFile (Univ A R P K dd) I ile) {t : W} {rest : (Univ A R P K ddProp)WA} {m : IProp} (hm : ∀ (r : Univ A R P K ddProp), rest r t = bitVal PR.zero PR.one (bitAtOf RF.cell m r)) (r : Univ A R P K ddProp) :
PR.passTracksAt RF.cell t rest m r = rest r

A backed track's pass presentation is the background itself.

Dependency graph
def DescriptiveComplexity.Draw.elemPhaseAt {P : Type} {nr : } (emb : ElemPh nrP) (k : ) :
P

The phase before the k-th read of a round – the fold checkpoint once the reads are exhausted. DescriptiveComplexity.Draw.elemFirstRd is this at 0, DescriptiveComplexity.Draw.elemNextRd j at j + 1.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    Dependency graph
    theorem DescriptiveComplexity.Draw.not_reg_of_lt_bot {A R P K : Type} {dd : } [FirstOrder.Language.wide.Structure (Univ A R P K dd)] [Finite A] [Finite R] [Finite P] [Finite K] {I : Type} {ile : IIProp} (RF : IxFile (Univ A R P K dd) I ile) (hlin : IsLinOrd WMLe) (hix : IsLinOrd ile) {gbot : I} (hbot : ∀ (y : I), ile gbot y) {v : Univ A R P K ddProp} (hv : WMSetLt WMLe v (RF.cell gbot)) (u : I) :
    v RF.cell u

    The working cell is nobody's register.

    Dependency graph
    theorem DescriptiveComplexity.Draw.elem_reachesIn {A R P Q W K : Type} {dd : } [Fintype Q] [Fintype W] [DecidableEq W] [LinearOrder A] [LinearOrder R] [LinearOrder P] [LinearOrder K] [FirstOrder.Language.wide.Structure (Univ A R P K dd)] [Finite A] [Finite R] [Finite P] [Finite K] {PR : Prog A R P Q W K dd} {nr : } {I : Type} {ile : IIProp} (RF : IxFile (Univ A R P K dd) I ile) {wk rg : W} {emb : ElemPh nrP} {rdTrack : Fin nrW} {MatchOf : Fin nr(QA)(WA)Prop} {setFlag : Fin nrBool(QA)(WA)QA} {initEl advEl exitSt : (QA)(WA)QA} {IsMaxEl : (QA)Prop} {exitPh : P} {rEmb : (i : ElemSite nr) → ElemSh nr iR} (hrules : ∀ (i : ElemSite nr) (ρ : ElemSh nr i), PR.rules (rEmb i ρ) = elemRule PR.one wk rg emb rdTrack MatchOf setFlag initEl advEl exitSt IsMaxEl exitPh i ρ) (hR : PR.table.Reads) (hlin : IsLinOrd WMLe) (hix : IsLinOrd ile) {gbot : I} (hbot : ∀ (y : I), ile gbot y) {v v' : Univ A R P K ddProp} (hv : WMSetLt WMLe v (RF.cell gbot)) (hvi : WMIncr WMLe v v') {rest : (Univ A R P K ddProp)WA} (hwkS : ∀ (r : Univ A R P K ddProp), rest r wk = bitVal PR.zero PR.one (r = v)) (hrg : ∀ (r : Univ A R P K ddProp), rest r rg = bitVal PR.zero PR.one (∃ (u : I), r = RF.cell u)) {m : Fin nrIProp} (hm : ∀ (j : Fin nr) (r : Univ A R P K ddProp), rest r (rdTrack j) = bitVal PR.zero PR.one (bitAtOf RF.cell (m j) r)) (hnewk : ∀ (j : Fin nr), wk rdTrack j) (hnerg : ∀ (j : Fin nr), rg rdTrack j) {t₀ : W} {m₀ : IProp} (hm₀ : ∀ (r : Univ A R P K ddProp), rest r t₀ = bitVal PR.zero PR.one (bitAtOf RF.cell m₀ r)) (hwkt₀ : wk t₀) (hrgt₀ : rg t₀) {ι : Type} [LinearOrder ι] [Finite ι] {a₀ aT : ι} (hbotI : ∀ (a : ι), a₀ a) (htopI : ∀ (a : ι), a aT) (F : ιQA) (fsOf : ιFin (nr + 1)QA) (hlastF : ∀ (a : ι), fsOf a (Fin.last nr) = F a) (x : ιFin nrI) (hname : ∀ (a : ι) (j : Fin nr), MatchOf j (fsOf a j.castSucc) (PR.passTracksAt RF.cell (rdTrack j) rest (m j) (RF.cell (x a j)))) (huniq : ∀ (a : ι) (j : Fin nr) (r : Univ A R P K ddProp), MatchOf j (fsOf a j.castSucc) (PR.passTracksAt RF.cell (rdTrack j) rest (m j) r)r = RF.cell (x a j)) (hfsT : ∀ (a : ι) (j : Fin nr), m j (x a j)fsOf a j.succ = setFlag j true (fsOf a j.castSucc) (rest v)) (hfsF : ∀ (a : ι) (j : Fin nr), ¬m j (x a j)fsOf a j.succ = setFlag j false (fsOf a j.castSucc) (rest v)) (hadv : ∀ (a a' : ι), a < a'(∀ (b : ι), ¬(a < b b < a'))advEl (F a) (rest v) = fsOf a' 0) (hmaxT : IsMaxEl (F aT)) (hmaxF : a < aT, ¬IsMaxEl (F a)) (c : ) (hcost : ∀ (a : ι) (j : Fin nr), 2 * (wideRank (RF.cell (x a j)) - wideRank v) + 2 c) {f₀ : QA} (hinit : initEl f₀ (rest v) = fsOf a₀ 0) :
    (wideData (Univ A R P K dd)).ReachesIn ((2 + (c + 2) * nr) * (Nat.card ι + 1) + 1) { state := Sum.inr (PR.stElt (emb ElemPh.e0) f₀), head := Sum.inl v, tape := wideTape (PR.trackTapeAt RF.cell t₀ rest m₀) (PR.syElt PR.blank) } { state := Sum.inr (PR.stElt exitPh (exitSt (F aT) (rest v))), head := Sum.inl v', tape := wideTape (PR.trackTapeAt RF.cell t₀ rest m₀) (PR.syElt PR.blank) }

    The element loop's run, on a clock: from the entry checkpoint at the marker to the exit phase one cell to its right, the control folded over the whole enumeration – entered with initEl, each round's reads stored by setFlag, each advance by advEl, the verdict handed to exitSt at the top index – and the cost is one round's width once per element of the enumeration, plus the round that opens it and the step that leaves.

    Dependency graph
    theorem DescriptiveComplexity.Draw.elem_run {A R P Q W K : Type} {dd : } [Fintype Q] [Fintype W] [DecidableEq W] [LinearOrder A] [LinearOrder R] [LinearOrder P] [LinearOrder K] [FirstOrder.Language.wide.Structure (Univ A R P K dd)] [Finite A] [Finite R] [Finite P] [Finite K] {PR : Prog A R P Q W K dd} {nr : } {I : Type} {ile : IIProp} (RF : IxFile (Univ A R P K dd) I ile) {wk rg : W} {emb : ElemPh nrP} {rdTrack : Fin nrW} {MatchOf : Fin nr(QA)(WA)Prop} {setFlag : Fin nrBool(QA)(WA)QA} {initEl advEl exitSt : (QA)(WA)QA} {IsMaxEl : (QA)Prop} {exitPh : P} {rEmb : (i : ElemSite nr) → ElemSh nr iR} (hrules : ∀ (i : ElemSite nr) (ρ : ElemSh nr i), PR.rules (rEmb i ρ) = elemRule PR.one wk rg emb rdTrack MatchOf setFlag initEl advEl exitSt IsMaxEl exitPh i ρ) (hR : PR.table.Reads) (hlin : IsLinOrd WMLe) (hix : IsLinOrd ile) {gbot : I} (hbot : ∀ (y : I), ile gbot y) {v v' : Univ A R P K ddProp} (hv : WMSetLt WMLe v (RF.cell gbot)) (hvi : WMIncr WMLe v v') {rest : (Univ A R P K ddProp)WA} (hwkS : ∀ (r : Univ A R P K ddProp), rest r wk = bitVal PR.zero PR.one (r = v)) (hrg : ∀ (r : Univ A R P K ddProp), rest r rg = bitVal PR.zero PR.one (∃ (u : I), r = RF.cell u)) {m : Fin nrIProp} (hm : ∀ (j : Fin nr) (r : Univ A R P K ddProp), rest r (rdTrack j) = bitVal PR.zero PR.one (bitAtOf RF.cell (m j) r)) (hnewk : ∀ (j : Fin nr), wk rdTrack j) (hnerg : ∀ (j : Fin nr), rg rdTrack j) {t₀ : W} {m₀ : IProp} (hm₀ : ∀ (r : Univ A R P K ddProp), rest r t₀ = bitVal PR.zero PR.one (bitAtOf RF.cell m₀ r)) (hwkt₀ : wk t₀) (hrgt₀ : rg t₀) {ι : Type} [LinearOrder ι] [Finite ι] {a₀ aT : ι} (hbotI : ∀ (a : ι), a₀ a) (htopI : ∀ (a : ι), a aT) (F : ιQA) (fsOf : ιFin (nr + 1)QA) (hlastF : ∀ (a : ι), fsOf a (Fin.last nr) = F a) (x : ιFin nrI) (hname : ∀ (a : ι) (j : Fin nr), MatchOf j (fsOf a j.castSucc) (PR.passTracksAt RF.cell (rdTrack j) rest (m j) (RF.cell (x a j)))) (huniq : ∀ (a : ι) (j : Fin nr) (r : Univ A R P K ddProp), MatchOf j (fsOf a j.castSucc) (PR.passTracksAt RF.cell (rdTrack j) rest (m j) r)r = RF.cell (x a j)) (hfsT : ∀ (a : ι) (j : Fin nr), m j (x a j)fsOf a j.succ = setFlag j true (fsOf a j.castSucc) (rest v)) (hfsF : ∀ (a : ι) (j : Fin nr), ¬m j (x a j)fsOf a j.succ = setFlag j false (fsOf a j.castSucc) (rest v)) (hadv : ∀ (a a' : ι), a < a'(∀ (b : ι), ¬(a < b b < a'))advEl (F a) (rest v) = fsOf a' 0) (hmaxT : IsMaxEl (F aT)) (hmaxF : a < aT, ¬IsMaxEl (F a)) {f₀ : QA} (hinit : initEl f₀ (rest v) = fsOf a₀ 0) :
    Relation.ReflTransGen (wideData (Univ A R P K dd)).Step { state := Sum.inr (PR.stElt (emb ElemPh.e0) f₀), head := Sum.inl v, tape := wideTape (PR.trackTapeAt RF.cell t₀ rest m₀) (PR.syElt PR.blank) } { state := Sum.inr (PR.stElt exitPh (exitSt (F aT) (rest v))), head := Sum.inl v', tape := wideTape (PR.trackTapeAt RF.cell t₀ rest m₀) (PR.syElt PR.blank) }

    The element loop's run, the budget forgotten: what a space-bounded caller reads. The width of a trip is then the largest of the finitely many the loop takes.

    Dependency graph