Theorem W, option (A), stage A1: the peak of the core language #
The machine records the largest value it computes (State.peak, raised by bump with
Expr.maxv at every evaluated expression). sim (Sim.lean) says nothing about it. This file
computes the same quantity on Level F, without running the machine (docs/WORD.md §4, approach
(i′)):
Exp.pk κ s L eisExpr.maxvof the compiled expression: the largest value amonge, its subexpressions, and the index arithmetic the compiler adds (i·stride + jfor a list entry,c·(H+1) + jfor a path entry, the parameter index ofprm).Exp.maxv_compileproves the two equal whenevereevaluates.pkF κ c s Lis the largestpkof every expression the run ofevalF κ c s Levaluates (loop bounds, call arguments and the expressions inside the compiled forms ofpush,lgrow,prepInit, …).PeakSim.leanproves that whenevalFreturnsokorfail, the compiled run ends withpeak = Max.max m.peak (pkF κ c s L).
Nothing here is used by Theorems A and B.
Expressions #
The value of an expression, 0 if it does not evaluate.
Equations
- OrderMaintenance.Impl.Exp.val κ s L e = (OrderMaintenance.Impl.Exp.ev κ s L e).getD 0
Instances For
The peak of the compiled row width H + 1 (it reads parameter 15 and adds 1).
Equations
Instances For
The peak of an expression: Expr.maxv of its compiled form (Exp.maxv_compile).
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.lit n) = n
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.var x_1) = L x_1
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.rd f i) = max (OrderMaintenance.Impl.Exp.pk κ s L i) (OrderMaintenance.Impl.Exp.val κ s L (OrderMaintenance.Impl.Exp.rd f i))
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.size t) = OrderMaintenance.Impl.Tbl.size s t
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.prm k) = max k.idx (OrderMaintenance.Impl.PF.get s.P k)
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.un op a) = max (OrderMaintenance.Impl.Exp.pk κ s L a) (OrderMaintenance.Impl.Exp.val κ s L (OrderMaintenance.Impl.Exp.un op a))
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.llen k i) = max (OrderMaintenance.Impl.Exp.pk κ s L i) (OrderMaintenance.Impl.Exp.val κ s L (OrderMaintenance.Impl.Exp.llen k i))
- OrderMaintenance.Impl.Exp.pk κ s L (OrderMaintenance.Impl.Exp.opt o) = OrderMaintenance.Impl.OF.get s o
Instances For
The peak of an argument list (maxvList of the compiled list).
Equations
- OrderMaintenance.Impl.pkList κ s L es = List.foldr max 0 (List.map (OrderMaintenance.Impl.Exp.pk κ s L) es)
Instances For
The peak bounds the value.
pk is the machine's maxv of the compiled expression, whenever the expression
evaluates.
Statements #
The peak of the compiled index i·stride + j of list k (as in .lrd and .lwr).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The peak of the compiled path index x·(H+1) + j, where px is the peak and x the value of
the row expression (as in .prd, .pwr and .prepPath).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The peak of iterations k, …, k+n-1 of a loop whose body runs as f with peak g
(mirrors runForF).
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.pkFor f g x x✝² 0 x✝¹ x✝ = 0
Instances For
The peak of a run of the core language: the largest pk of every expression that the
compiled code evaluates, following evalF's run (sim_peak, PeakSim.lean).
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.pkF κ OrderMaintenance.Impl.Stm.skip x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ (x_3 ::= e) x✝¹ x✝ = OrderMaintenance.Impl.Exp.pk κ x✝¹ x✝ e
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.wr f i e) x✝¹ x✝ = max (OrderMaintenance.Impl.Exp.pk κ x✝¹ x✝ i) (OrderMaintenance.Impl.Exp.pk κ x✝¹ x✝ e)
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.push t x_3) x✝¹ x✝ = OrderMaintenance.Impl.Tbl.size x✝¹ t + 1
- OrderMaintenance.Impl.pkF κ OrderMaintenance.Impl.Stm.fail x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ OrderMaintenance.Impl.Stm.bug x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.lwr k snd i j e) x✝¹ x✝ = max (OrderMaintenance.Impl.lidxPk κ x✝¹ x✝ k i j) (OrderMaintenance.Impl.Exp.pk κ x✝¹ x✝ e)
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.lclear k i) x✝¹ x✝ = OrderMaintenance.Impl.Exp.pk κ x✝¹ x✝ i
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.rowReset c) x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.prepInit c b) x✝¹ x✝ = max (OrderMaintenance.Impl.pkList κ x✝¹ x✝ [c, b]) 1
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.prepSet h b t) x✝¹ x✝ = OrderMaintenance.Impl.pkList κ x✝¹ x✝ [h, b, t]
- OrderMaintenance.Impl.pkF κ OrderMaintenance.Impl.Stm.prepCommit x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.jobSet x_3 y z t a b c d) x✝¹ x✝ = max (OrderMaintenance.Impl.pkList κ x✝¹ x✝ [x_3, y, z, t, a, b, c, d]) 1
- OrderMaintenance.Impl.pkF κ OrderMaintenance.Impl.Stm.jobClear x✝¹ x✝ = 0
- OrderMaintenance.Impl.pkF κ (OrderMaintenance.Impl.Stm.pcSet t a b c d) x✝¹ x✝ = OrderMaintenance.Impl.pkList κ x✝¹ x✝ [t, a, b, c, d]
Instances For
The loop rule: an invariant I k before iteration k under which the body's peak is at
most W and which a normal end of the body passes on.