Documentation

GaudisCrypt.Logic.PHoareWhileRevTest

Golden tests of phoare_while I V k ε, and of conseq, rnd on a lower bound #

The goals EC's while I V k ε leaves on a loop that flips a coin until it shows heads (see Logic/ECAutoTest.lean for the format; scripts/update_golden.py refreshes the expected text).

The body of proc run of module Flip, as a procedure of its own: it calls no module parameter, so it has no holes.

A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see Flip.run.procedure.apply_simp) rather than run. Use Flip.run for this procedure as a module.

Equations
Instances For

    The module declared by module Flip: the record of its procedures Flip.run.

    The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Flip.apply_simp to apply it with.

    Equations
    Instances For
      @[simp]

      @[simp]: Flip.run = Module.proc Flip.run.procedure — true by definition, proc run using no module parameter and so having no holes to fill.

      proc run of module Flip as a module: Module.proc Flip.run.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Flip.run.apply_simp says exactly that.

      Equations
      Instances For
        theorem GaudisCrypt.PHoareWhileRevTest.Flip.run.procedure.apply_simp (holeArgs✝ : HoleSigs.empty.Instantiation) :
        procedure.instantiate holeArgs✝ = proc () : Bool { var b : Bool; b <- false; while (!§b) { b <$ EC.dbool; } return §b }

        Instantiating the holes of Flip.run.procedure with a tuple holeArgs of procedures: the body of proc run as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

        Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [Flip.run.procedure.apply_simp]).