Documentation

LeanPool.OrderMaintenance.Impl.PeakMW

Theorem W, option (A), stage A3: tools for the machine-only code #

Nothing here is used by Theorems A and B.

Peak-only rules #

@[reducible, inline]

The postcondition of a peak-only proof.

Equations
Instances For
    theorem OrderMaintenance.Impl.wpB_and {B : ℕ} {c : Machine.Stmt} {Q : Machine.State → ℕ → Prop} {s : Machine.State} (h : Machine.wp c Q s) (hp : Machine.wpB B c TT s) :
    Machine.wpB B c Q s
    theorem OrderMaintenance.Impl.wpB_T {B : ℕ} {c : Machine.Stmt} {Q : Machine.State → ℕ → Prop} {s : Machine.State} (h : Machine.wpB B c Q s) :
    theorem OrderMaintenance.Impl.wpB_seq_of {B : ℕ} {c d : Machine.Stmt} {Qc : Machine.State → ℕ → Prop} {s : Machine.State} (hc : Machine.wp c Qc s) (hpc : Machine.wpB B c TT s) (hd : ∀ (s' : Machine.State) (n : ℕ), Qc s' n → Machine.wpB B d TT s') :
    Machine.wpB B (c;; d) TT s

    A sequence whose first part's state facts come from a wp theorem.

    theorem OrderMaintenance.Impl.wpB_seq_T {B : ℕ} {c d : Machine.Stmt} {Qc : Machine.State → ℕ → Prop} {s : Machine.State} (hc : Machine.wpB B c Qc s) (hd : ∀ (s' : Machine.State) (n : ℕ), Qc s' n → Machine.wpB B d TT s') :
    Machine.wpB B (c;; d) TT s

    A sequence, both parts by budget proofs.

    theorem OrderMaintenance.Impl.wpB_assign_seq {B : ℕ} {x : Machine.Reg} {e : Machine.Expr} {d : Machine.Stmt} {s : Machine.State} (v : ℕ) (he : Machine.Expr.eval s e = some v) (hB : Machine.Expr.maxv s e ≤ B) (h : ∀ (s' : Machine.State), s'.loc = Machine.State.upd s.loc x v → s'.mem = s.mem → s'.cap = s.cap → Machine.wpB B d TT s') :
    Machine.wpB B (x ::= e;; d) TT s
    theorem OrderMaintenance.Impl.wpB_store_seq {B : ℕ} {a : Machine.Arr} {i e : Machine.Expr} {d : Machine.Stmt} {s : Machine.State} (j v : ℕ) (hi : Machine.Expr.eval s i = some j) (he : Machine.Expr.eval s e = some v) (hj : j < s.cap a) (hBi : Machine.Expr.maxv s i ≤ B) (hBe : Machine.Expr.maxv s e ≤ B) (h : ∀ (s' : Machine.State), s'.loc = s.loc → s'.mem = (s.write a j v).mem → s'.cap = s.cap → Machine.wpB B d TT s') :
    theorem OrderMaintenance.Impl.wpB_ite_T {B : ℕ} {c : Machine.Expr} {t f : Machine.Stmt} {s : Machine.State} (v : ℕ) (hc : Machine.Expr.eval s c = some v) (hB : Machine.Expr.maxv s c ≤ B) (h : ∀ (s' : Machine.State), s'.loc = s.loc → s'.mem = s.mem → s'.cap = s.cap → Machine.wpB B (if v ≠ 0 then t else f) TT s') :
    theorem OrderMaintenance.Impl.wpB_seq_ofQ {B : ℕ} {c d : Machine.Stmt} {Qc Q : Machine.State → ℕ → Prop} {s : Machine.State} (hc : Machine.wp c Qc s) (hpc : Machine.wpB B c TT s) (hd : ∀ (s' : Machine.State) (n : ℕ), Qc s' n → Machine.wpB B d (fun (s'' : Machine.State) (m : ℕ) => Q s'' (n + m)) s') :
    Machine.wpB B (c;; d) Q s

    A sequence with a postcondition, the first part's state facts from a wp theorem.

    theorem OrderMaintenance.Impl.wpB_ite_Q {B : ℕ} {c : Machine.Expr} {t f : Machine.Stmt} {Q : Machine.State → ℕ → Prop} {s : Machine.State} (v : ℕ) (hc : Machine.Expr.eval s c = some v) (hB : Machine.Expr.maxv s c ≤ B) (h : ∀ (s' : Machine.State), s'.loc = s.loc → s'.mem = s.mem → s'.cap = s.cap → Machine.wpB B (if v ≠ 0 then t else f) (fun (s'' : Machine.State) (n : ℕ) => Q s'' (1 + c.cost + n)) s') :

    A conditional with a postcondition, forgetting the bumped state.

    theorem OrderMaintenance.Impl.wpB_and2 {B : ℕ} {c : Machine.Stmt} {Q R : Machine.State → ℕ → Prop} {s : Machine.State} (h : Machine.wp c Q s) (hp : Machine.wpB B c R s) :
    Machine.wpB B c (fun (s' : Machine.State) (n : ℕ) => Q s' n ∧ R s' n) s

    Two facts about the same run.

    A value is at most the peak of its expression.

    Truncated subtraction introduces no peak above its operands and the Boolean value one.

    Addition bounds every intermediate value by the sum of the operand peak bounds.

    Equality comparison adds only a Boolean value to the operand peak bounds.

    theorem OrderMaintenance.Impl.dpk_le_of {B : ℕ} {c : Machine.Stmt} {m : Machine.State} (h : Machine.wpB B c TT { mem := m.mem, cap := m.cap, loc := m.loc, peak := 0 }) :

    From a budget proof at the reset state to dpk.

    The budget #

    @[reducible, inline]

    The budget of one operation: 2^(2K+4) + 2^KH.

    Equations
    Instances For
      theorem OrderMaintenance.Impl.one_le_BW (K KH : ℕ) :
      1 ≤ BW K KH

      Every word budget contains a positive power of two.

      theorem OrderMaintenance.Impl.pk_BW {K KH x : ℕ} (h : x < 2 ^ wPk K KH) :
      x ≤ BW K KH
      theorem OrderMaintenance.Impl.pow_BW (K : ℕ) :
      16 * 2 ^ K ≤ 2 ^ (2 * K + 4)
      theorem OrderMaintenance.Impl.lt_K_BW {K KH x : ℕ} (h : x < 2 ^ K) :
      x ≤ BW K KH

      Close a word-budget inequality using positivity and the square-width power bound.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        The capacities of the proof parameters #

        theorem OrderMaintenance.Impl.CapsW.mono {K K' : ℕ} {κ : Caps} (h : CapsW K κ) (hK : K ≤ K') :
        CapsW K' κ
        theorem OrderMaintenance.Impl.size_lt_64 {N : ℕ} (h : N < 64) :
        N.size ≤ 6
        theorem OrderMaintenance.Impl.memOf_small {N : ℕ} (h : N < 64) :

        The cells of a core of the proof parameters, for N < 64 (L = 8).

        The cells of a core of the proof parameters are below 2^(wK P).

        The capacities of the proof parameters are below 2^(wK P), the index arithmetic of the compiled code included.

        A core ready for a call #

        A core ready for a call at word size K, handle width KH.

        Instances For
          theorem OrderMaintenance.Impl.CoreK.caps {K KH : ℕ} {c : Model.Core} (h : CoreK K KH c) :
          CapsW K (capsOf c.P)
          theorem OrderMaintenance.Impl.CoreK.room {K KH : ℕ} {c : Model.Core} (h : CoreK K KH c) :
          PRoom K c.P
          theorem OrderMaintenance.Impl.CoreK.k8 {K KH : ℕ} {c : Model.Core} (h : CoreK K KH c) :
          512 ≤ K