Big-step event semantics of call-free programs #
A big-step presentation of the reference event semantics (StepStmtStarE over
EvalCmdE, no calls), with one factory:
BRun F ss σ evs o— the statement list runs from storeσto outcomeo(normal end orexit l, with the store), emittingevs;BReach F ss σ evs— a run of the list fromσemitsevsand stops right after a command emitting events (a prefix of an execution, such as the prefix ending at a failing assertion), soevsends with the events of that command.
Blocks, ite branches and loop iterations project the store on exit (projectStore), as
the small-step semantics does. A loop enters its body when its guard admits it
(guardEnters) and stops when its guard admits stopping (guardExits); a nondeterministic
guard admits both.
Key definitions: PStmts, guardEnters, guardExits, BRun, BReach, evalInterp,
FailsAt, Claim, Fails.
A statement of a program over commands and calls.
Equations
Instances For
A list of statements of a program over commands and calls.
Equations
Instances For
Commands under the event semantics; calls have no step.
Equations
- Imperative.BigStep.EvalE x✝³ x✝² (Imperative.CmdExt.cmd c) x✝¹ x✝ = Imperative.EvalCmdE P x✝³ x✝² c x✝¹ x✝
- Imperative.BigStep.EvalE x✝³ x✝² (Imperative.CmdExt.call procName args md) x✝¹ x✝ = False
Instances For
How a statement list ends.
- normal {P : PureExpr} (σ : SemanticStore P) : Outcome P
- exit {P : PureExpr} (l : String) (σ : SemanticStore P) : Outcome P
Instances For
The outcome with its store projected on a parent store (leaving a scope).
Equations
Instances For
The store an outcome ends with.
Equations
Instances For
The outcome of a block labelled l whose body ended with o.
Equations
- One or more equations did not get rendered due to their size.
- Imperative.BigStep.Outcome.block l σp (Imperative.BigStep.Outcome.normal σ) = Imperative.BigStep.Outcome.normal (Imperative.projectStore σp σ)
Instances For
The loop guard g lets the loop enter its body from the store σ: a deterministic guard
evaluates to true; a nondeterministic guard always does.
Equations
Instances For
The loop guard g lets the loop stop at the store σ: a deterministic guard evaluates to
false; a nondeterministic guard always does.
Equations
Instances For
Big-step run of a statement list.
- nil {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : SemanticStore P} : BRun F [] σ [] (Outcome.normal σ)
- cons_normal {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {s : PStmt P} {σ : SemanticStore P} {evs1 : List (Event P)} {σ1 : SemanticStore P} {rest : PStmts P} {evs2 : List (Event P)} {o : Outcome P} : BRunS F s σ evs1 (Outcome.normal σ1) → BRun F rest σ1 evs2 o → BRun F (s :: rest) σ (evs1 ++ evs2) o
- cons_exit {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {s : PStmt P} {σ : SemanticStore P} {evs : List (Event P)} {l : String} {σ1 : SemanticStore P} {rest : List (PStmt P)} : BRunS F s σ evs (Outcome.exit l σ1) → BRun F (s :: rest) σ evs (Outcome.exit l σ1)
Instances For
Big-step run of one statement.
- cmd {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : SemanticStore P} {c : CmdExt P} {σ' : SemanticStore P} {evs : List (Event P)} : EvalE F σ c σ' evs → BRunS F (Stmt.cmd c) σ evs (Outcome.normal σ')
- ite_true {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : P.Ident → Option P.Val} {c : P.Expr} {tss : PStmts P} {evs : List (Event P)} {o : Outcome P} {ess : List (Stmt P (CmdExt P))} {md : MetaData P} : P.eval F σ c = some (HasBool.ttVal F) → BRun F tss σ evs o → BRunS F (Stmt.ite (ExprOrNondet.det c) tss ess md) σ evs (Outcome.proj σ o)
- ite_false {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : P.Ident → Option P.Val} {c : P.Expr} {ess : PStmts P} {evs : List (Event P)} {o : Outcome P} {tss : List (Stmt P (CmdExt P))} {md : MetaData P} : P.eval F σ c = some (HasBool.ffVal F) → BRun F ess σ evs o → BRunS F (Stmt.ite (ExprOrNondet.det c) tss ess md) σ evs (Outcome.proj σ o)
- ite_nondet_true {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {tss : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {o : Outcome P} {ess : List (Stmt P (CmdExt P))} {md : MetaData P} : BRun F tss σ evs o → BRunS F (Stmt.ite ExprOrNondet.nondet tss ess md) σ evs (Outcome.proj σ o)
- ite_nondet_false {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {ess : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {o : Outcome P} {tss : List (Stmt P (CmdExt P))} {md : MetaData P} : BRun F ess σ evs o → BRunS F (Stmt.ite ExprOrNondet.nondet tss ess md) σ evs (Outcome.proj σ o)
- block {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {ss : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {o : Outcome P} {l : String} {md : MetaData P} : BRun F ss σ evs o → BRunS F (Stmt.block l ss md) σ evs (Outcome.block l σ o)
- exit {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {l : String} {md : MetaData P} {σ : SemanticStore P} : BRunS F (Stmt.exit l md) σ [] (Outcome.exit l σ)
- typeDecl {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {tc : TypeConstructor} {md : MetaData P} {σ : SemanticStore P} : BRunS F (Stmt.typeDecl tc md) σ [] (Outcome.normal σ)
- loop_exit
{P : PureExpr}
[HasBool P]
[HasFvar P]
{F : P.Factory}
{σ : SemanticStore P}
{g : ExprOrNondet P}
{m : Option P.Expr}
{inv : List (String × P.Expr)}
{body : List (Stmt P (CmdExt P))}
{md : MetaData P}
: guardExits F σ g → BRunS F (Stmt.loop g m inv body md) σ [] (Outcome.normal σ)
The guard lets the loop stop: it ends normally, unchanged.
- loop_iter
{P : PureExpr}
[HasBool P]
[HasFvar P]
{F : P.Factory}
{σ : SemanticStore P}
{g : ExprOrNondet P}
{body : PStmts P}
{evs1 : List (Event P)}
{σ1 : SemanticStore P}
{m : Option P.Expr}
{inv : List (String × P.Expr)}
{md : MetaData P}
{evs2 : List (Event P)}
{o : Outcome P}
: guardEnters F σ g →
BRun F body σ evs1 (Outcome.normal σ1) →
BRunS F (Stmt.loop g m inv body md) (projectStore σ σ1) evs2 o →
BRunS F (Stmt.loop g m inv body md) σ (evs1 ++ evs2) o
The guard lets the loop enter its body, which ends normally; the loop runs again from the store of the iteration projected on its entry store.
- loop_break
{P : PureExpr}
[HasBool P]
[HasFvar P]
{F : P.Factory}
{σ : SemanticStore P}
{g : ExprOrNondet P}
{body : PStmts P}
{evs : List (Event P)}
{l : String}
{σ1 : SemanticStore P}
{m : Option P.Expr}
{inv : List (String × P.Expr)}
{md : MetaData P}
: guardEnters F σ g →
BRun F body σ evs (Outcome.exit l σ1) → BRunS F (Stmt.loop g m inv body md) σ evs (Outcome.exit l (projectStore σ σ1))
The guard lets the loop enter its body, which exits: so does the loop.
Instances For
A run of a statement list emits evs and stops right after a command emitting events.
- here {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {s : PStmt P} {σ : SemanticStore P} {evs : List (Event P)} {rest : List (PStmt P)} : BReachS F s σ evs → BReach F (s :: rest) σ evs
- later {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {s : PStmt P} {σ : SemanticStore P} {evs1 : List (Event P)} {σ1 : SemanticStore P} {rest : PStmts P} {evs2 : List (Event P)} : BRunS F s σ evs1 (Outcome.normal σ1) → BReach F rest σ1 evs2 → BReach F (s :: rest) σ (evs1 ++ evs2)
Instances For
A run of one statement emits evs and stops right after a command emitting events.
- cmd {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : SemanticStore P} {c : CmdExt P} {σ' : SemanticStore P} {evs : List (Event P)} : EvalE F σ c σ' evs → evs ≠ [] → BReachS F (Stmt.cmd c) σ evs
- ite_true {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : P.Ident → Option P.Val} {c : P.Expr} {tss : PStmts P} {evs : List (Event P)} {ess : List (Stmt P (CmdExt P))} {md : MetaData P} : P.eval F σ c = some (HasBool.ttVal F) → BReach F tss σ evs → BReachS F (Stmt.ite (ExprOrNondet.det c) tss ess md) σ evs
- ite_false {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {σ : P.Ident → Option P.Val} {c : P.Expr} {ess : PStmts P} {evs : List (Event P)} {tss : List (Stmt P (CmdExt P))} {md : MetaData P} : P.eval F σ c = some (HasBool.ffVal F) → BReach F ess σ evs → BReachS F (Stmt.ite (ExprOrNondet.det c) tss ess md) σ evs
- ite_nondet_true {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {tss : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {ess : List (Stmt P (CmdExt P))} {md : MetaData P} : BReach F tss σ evs → BReachS F (Stmt.ite ExprOrNondet.nondet tss ess md) σ evs
- ite_nondet_false {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {ess : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {tss : List (Stmt P (CmdExt P))} {md : MetaData P} : BReach F ess σ evs → BReachS F (Stmt.ite ExprOrNondet.nondet tss ess md) σ evs
- block {P : PureExpr} [HasBool P] [HasFvar P] {F : P.Factory} {ss : PStmts P} {σ : SemanticStore P} {evs : List (Event P)} {l : String} {md : MetaData P} : BReach F ss σ evs → BReachS F (Stmt.block l ss md) σ evs
- loop_here
{P : PureExpr}
[HasBool P]
[HasFvar P]
{F : P.Factory}
{σ : SemanticStore P}
{g : ExprOrNondet P}
{body : PStmts P}
{evs : List (Event P)}
{m : Option P.Expr}
{inv : List (String × P.Expr)}
{md : MetaData P}
: guardEnters F σ g → BReach F body σ evs → BReachS F (Stmt.loop g m inv body md) σ evs
The guard lets the loop enter its body, which stops.
- loop_later
{P : PureExpr}
[HasBool P]
[HasFvar P]
{F : P.Factory}
{σ : SemanticStore P}
{g : ExprOrNondet P}
{body : PStmts P}
{evs1 : List (Event P)}
{σ1 : SemanticStore P}
{m : Option P.Expr}
{inv : List (String × P.Expr)}
{md : MetaData P}
{evs2 : List (Event P)}
: guardEnters F σ g →
BRun F body σ evs1 (Outcome.normal σ1) →
BReachS F (Stmt.loop g m inv body md) (projectStore σ σ1) evs2 →
BReachS F (Stmt.loop g m inv body md) σ (evs1 ++ evs2)
The guard lets the loop enter its body, which ends normally; the next iterations stop.
Instances For
The interpretation of a condition as its evaluation to true under the event's factory
and store, in a single world.
Equations
- Imperative.BigStep.evalInterp = { World := Unit, holds := fun (x : Unit) (c : Imperative.EventArg P) => P.eval c.factory c.store c.expr = some (Imperative.HasBool.ttVal c.factory) }
Instances For
The event is a failing occurrence of the target t with the condition e: an assertion
with the label and metadata of t and the condition e, evaluating to false, or a cover
with the label and metadata of t and the condition e, evaluating to true.
Equations
- One or more equations did not get rendered due to their size.
- Imperative.BigStep.FailsAt t e (Imperative.Event.assume a) = False
Instances For
The events tr claim a failure of the target t with the condition e: they end with a
failing occurrence of t with the condition e, every assumption before it evaluating to
true. A list fails t with the condition e exactly when a reach of it emits events that
claim that failure (fails_iff_claim).
Equations
- One or more equations did not get rendered due to their size.
Instances For
A statement list fails target t with the condition e from store σ: a run reaches a
failing occurrence of t with the condition e, every assumption before it evaluating to
true (Trace.AssumptionsHold under evalInterp).
Equations
- One or more equations did not get rendered due to their size.