This commit is contained in:
Dan Frumin 2019-06-12 17:52:53 +02:00
parent aa65e1af67
commit 0c55194a2f
4 changed files with 43 additions and 40 deletions

View File

@ -1,5 +1,6 @@
Require Import Coq.Program.Equality.
From stdpp Require Import base tactics.
Require Import ImpSimpl.
Require Import base tactics. (* For typeclasses; obtained from <http://robbertkrebbers.nl/research/ch2o/> *)
(** * Basic definition *)

View File

@ -1,10 +1,6 @@
(** This file is a slight modification of ImpSimpl.v from Adam
Chilipala's FRAP: <http://adam.chlipala.net/frap/> *)
Require Import String.
(** We use Robbert's prelude from <http://robbertkrebbers.nl/research/ch2o/> *)
Require Import stringmap natmap.
From stdpp Require Import stringmap natmap.
(** Here's some appropriate syntax for expressions (side-effect-free) of a simple imperative language with a mutable memory. *)
Inductive exp :=
@ -91,9 +87,9 @@ Definition set (dst src : exp) : cmd :=
| _ => Assign "Bad LHS" 0
end.
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 "{{ 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.
Infix "+" := plus : reset_scope.

View File

@ -1,12 +1,12 @@
CH2O=/Users/dan/projects/ch2o-new/
ImpSimpl.vo: ImpSimpl.v
coqc -R $(CH2O) ch2o ImpSimpl.v
coqc ImpSimpl.v
Hoare.vo: Hoare.v ImpSimpl.vo
coqc -R $(CH2O) ch2o Hoare.v
coqc Hoare.v
all: Hoare.vo
doc: ImpSimpl.vo Hoare.vo
coqdoc -R $(CH2O) ch2o ImpSimpl.v Hoare.v
coqdoc ImpSimpl.v Hoare.v

6
README Normal file
View File

@ -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>.