Documentation

Strata.DL.Imperative.StmtSemanticsDeterminism

Syntactic determinism of the reference small-step semantics #

This module is self-contained metatheory of StepStmtE — the reference small-step semantics over Config P (Cmd P). It involves no interpreter, no monad, and no fuel.

There are exactly four syntactic sources of nondeterminism in the reference semantics, all of them a .nondet in the program text:

StmtDeterministic rules out all four, recursively, and Config.deterministic lifts it to a whole configuration. StepDetE is the sub-relation of StepStmtE made of the deterministic rules. Lemmas about these definitions are in StmtSemanticsDeterminismProps.lean: the semantics preserves Config.deterministic (StepStmtE.preserves_deterministic), and every step out of a deterministic configuration is a StepDetE step (StepStmtE.toStepDetE).

Downstream this is the bridge that lets a monad-generic completeness result be instantiated at monads whose choose refuses nondeterminism: on a deterministic program the choice-resolution obligation is vacuous, because a StepDetE derivation never consults a choice.

The syntactic determinism predicate #

A right-hand side / guard is deterministic when it is .det, not .nondet.

Equations
Instances For

    A base command is deterministic when it has no .nondet init/set right-hand side. assert, assume and cover are store-neutral event emitters and are always deterministic.

    Equations
    Instances For

      StmtDeterministic lifted to a configuration: every statement still to be executed — in the active position, in the pending tail of every enclosing .seq, and inside every enclosing .block — is deterministic. Terminal and exiting configurations have no statements left, hence are deterministic.

      Equations
      Instances For

        StepDetE, the deterministic-rules-only semantics #

        StepDetE has exactly the rules of StepStmtE that resolve no choice.

        inductive Imperative.StepDetE (P : PureExpr) [HasBool P] {EventT : Type u_2} (EvalCmd : EvalCmdParamE P (Cmd P) EventT) :
        Config P (Cmd P) → List EventT → Config P (Cmd P) → Prop

        The sub-relation of StepStmtE consisting of the rules that resolve no nondeterministic choice.

        Instances For
          @[reducible, inline]
          abbrev Imperative.StepDetStarE (P : PureExpr) [HasBool P] {EventT : Type u_2} (EvalCmd : EvalCmdParamE P (Cmd P) EventT) :
          Config P (Cmd P) → List EventT → Config P (Cmd P) → Prop

          Traced reflexive-transitive closure of StepDetE.

          Equations
          Instances For