cleanup
This commit is contained in:
parent
aa65e1af67
commit
0c55194a2f
3
Hoare.v
3
Hoare.v
|
@ -1,5 +1,6 @@
|
||||||
|
Require Import Coq.Program.Equality.
|
||||||
|
From stdpp Require Import base tactics.
|
||||||
Require Import ImpSimpl.
|
Require Import ImpSimpl.
|
||||||
Require Import base tactics. (* For typeclasses; obtained from <http://robbertkrebbers.nl/research/ch2o/> *)
|
|
||||||
|
|
||||||
(** * Basic definition *)
|
(** * Basic definition *)
|
||||||
|
|
||||||
|
|
10
ImpSimpl.v
10
ImpSimpl.v
|
@ -1,10 +1,6 @@
|
||||||
(** This file is a slight modification of ImpSimpl.v from Adam
|
(** This file is a slight modification of ImpSimpl.v from Adam
|
||||||
Chilipala's FRAP: <http://adam.chlipala.net/frap/> *)
|
Chilipala's FRAP: <http://adam.chlipala.net/frap/> *)
|
||||||
|
From stdpp Require Import stringmap natmap.
|
||||||
Require Import String.
|
|
||||||
|
|
||||||
(** We use Robbert's prelude from <http://robbertkrebbers.nl/research/ch2o/> *)
|
|
||||||
Require Import stringmap natmap.
|
|
||||||
|
|
||||||
(** Here's some appropriate syntax for expressions (side-effect-free) of a simple imperative language with a mutable memory. *)
|
(** Here's some appropriate syntax for expressions (side-effect-free) of a simple imperative language with a mutable memory. *)
|
||||||
Inductive exp :=
|
Inductive exp :=
|
||||||
|
@ -91,9 +87,9 @@ Definition set (dst src : exp) : cmd :=
|
||||||
| _ => Assign "Bad LHS" 0
|
| _ => Assign "Bad LHS" 0
|
||||||
end.
|
end.
|
||||||
Infix "<-" := set (no associativity, at level 70) : cmd_scope.
|
Infix "<-" := set (no associativity, at level 70) : cmd_scope.
|
||||||
Infix ";;" := Seq (right associativity, at level 75) : cmd_scope.
|
Infix ";;;" := Seq (right associativity, at level 70) : cmd_scope.
|
||||||
Notation "'when' b 'then' then_ 'else' else_ 'done'" := (If_ b then_ else_) (at level 75, b at level 0).
|
Notation "'when' b 'then' then_ 'else' else_ 'done'" := (If_ b then_ else_) (at level 75, b at level 0).
|
||||||
Notation "{{ I }} 'while' b 'loop' body 'done'" := (While_ b body) (at level 75).
|
Notation "'while' b 'loop' body 'done'" := (While_ b body) (at level 75).
|
||||||
Delimit Scope cmd_scope with cmd.
|
Delimit Scope cmd_scope with cmd.
|
||||||
|
|
||||||
Infix "+" := plus : reset_scope.
|
Infix "+" := plus : reset_scope.
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -1,12 +1,12 @@
|
||||||
CH2O=/Users/dan/projects/ch2o-new/
|
CH2O=/Users/dan/projects/ch2o-new/
|
||||||
|
|
||||||
ImpSimpl.vo: ImpSimpl.v
|
ImpSimpl.vo: ImpSimpl.v
|
||||||
coqc -R $(CH2O) ch2o ImpSimpl.v
|
coqc ImpSimpl.v
|
||||||
|
|
||||||
Hoare.vo: Hoare.v ImpSimpl.vo
|
Hoare.vo: Hoare.v ImpSimpl.vo
|
||||||
coqc -R $(CH2O) ch2o Hoare.v
|
coqc Hoare.v
|
||||||
|
|
||||||
all: Hoare.vo
|
all: Hoare.vo
|
||||||
|
|
||||||
doc: ImpSimpl.vo Hoare.vo
|
doc: ImpSimpl.vo Hoare.vo
|
||||||
coqdoc -R $(CH2O) ch2o ImpSimpl.v Hoare.v
|
coqdoc ImpSimpl.v Hoare.v
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
A simple formulation of Hoare logic for a WHILE-language, with a proof of /relative completeness/:
|
||||||
|
|
||||||
|
If a triple { P } s { Q } is valid in the model, then it is derivable
|
||||||
|
using the rules in Hoare.v (see the inductive type `hoare_triple`).
|
||||||
|
|
||||||
|
Requires std++: <https://gitlab.mpi-sws.org/iris/stdpp>.
|
Loading…
Reference in New Issue