statement
stringlengths
1
15.9k
proof
stringlengths
0
44.6k
type
stringclasses
18 values
symbolic_name
stringlengths
1
61
library
stringclasses
21 values
filename
stringclasses
502 values
imports
listlengths
0
38
deps
listlengths
0
64
docstring
stringlengths
0
500
source_url
stringclasses
1 value
commit
stringclasses
1 value
eval_fmla (s:state) (f:fmla)
= match f with | Fterm e -> eval_expr s e <> 0 | Fand f1 f2 -> eval_fmla s f1 /\ eval_fmla s f2 | Fnot f -> not (eval_fmla s f) | Fimplies f1 f2 -> eval_fmla s f1 -> eval_fmla s f2 end
predicate
eval_fmla
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "eval_expr", "f1", "f2", "fmla", "state" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
subst_expr (e:expr) (x:ident) (t:expr) : expr
= match e with | Econst _ -> e | Evar y -> if x=y then t else e | Ebin e1 op e2 -> Ebin (subst_expr e1 x t) op (subst_expr e2 x t) end
function
subst_expr
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "expr", "ident", "op" ]
substitution
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_subst_expr: forall s:state, e [@induction]:expr, x:ident, t:expr. eval_expr s (subst_expr e x t) = eval_expr (IdMap.set s x (eval_expr s t)) e
lemma
eval_subst_expr
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "eval_expr", "expr", "ident", "induction", "set", "state", "subst_expr" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
subst (f:fmla) (x:ident) (t:expr) : fmla
= match f with | Fterm e -> Fterm (subst_expr e x t) | Fand f1 f2 -> Fand (subst f1 x t) (subst f2 x t) | Fnot f -> Fnot (subst f x t) | Fimplies f1 f2 -> Fimplies (subst f1 x t) (subst f2 x t) end
function
subst
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "expr", "f1", "f2", "fmla", "ident", "subst_expr" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_subst: forall s:state, f:fmla, x:ident, t:expr. eval_fmla s (subst f x t) <-> eval_fmla (IdMap.set s x (eval_expr s t)) f
lemma
eval_subst
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "eval_expr", "eval_fmla", "expr", "fmla", "ident", "set", "state", "subst" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
valid_fmla (p:fmla)
= forall s:state. eval_fmla s p
predicate
valid_fmla
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "eval_fmla", "fmla", "state" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
valid_triple (p:fmla) (i:stmt) (q:fmla)
= forall s:state. eval_fmla s p -> forall s':state, n:int. many_steps s i s' Sskip n -> eval_fmla s' q
predicate
valid_triple
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "eval_fmla", "fmla", "int", "many_steps", "state", "stmt" ]
Hoare triples
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assign_rule: forall q:fmla, x:ident, e:expr. valid_triple (subst q x e) (Sassign x e) q
lemma
assign_rule
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "expr", "fmla", "ident", "subst", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
seq_rule: forall p q r:fmla, i1 i2:stmt. valid_triple p i1 r /\ valid_triple r i2 q -> valid_triple p (Sseq i1 i2) q
lemma
seq_rule
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "fmla", "i1", "i2", "stmt", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
if_rule: forall e:expr, p q:fmla, i1 i2:stmt. valid_triple (Fand p (Fterm e)) i1 q /\ valid_triple (Fand p (Fnot (Fterm e))) i2 q -> valid_triple p (Sif e i1 i2) q
lemma
if_rule
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "expr", "fmla", "i1", "i2", "stmt", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
while_rule: forall e:expr, inv:fmla, i:stmt. valid_triple (Fand (Fterm e) inv) i inv -> valid_triple inv (Swhile e i) (Fand (Fnot (Fterm e)) inv)
lemma
while_rule
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "expr", "fmla", "inv", "stmt", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
consequence_rule: forall p p' q q':fmla, i:stmt. valid_fmla (Fimplies p' p) -> valid_triple p i q -> valid_fmla (Fimplies q q') -> valid_triple p' i q'
lemma
consequence_rule
examples/WP_revisited
examples/WP_revisited/imp_n.why
[ "int.Int", "map.Const", "map.Map" ]
[ "fmla", "p'", "stmt", "valid_fmla", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
datatype
= Tint | Tbool
type
datatype
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[]
terms and formulas
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ident
= int
type
ident
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "int" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
term
= | Tconst int | Tvar ident | Tderef ident | Tbin term operator term
type
term
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "ident", "int", "operator" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
fmla
= | Fterm term | Fand fmla fmla | Fnot fmla | Fimplies fmla fmla | Flet ident term fmla | Fforall ident datatype fmla
type
fmla
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "datatype", "ident", "term" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
value
= | Vint int | Vbool bool
type
value
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "int" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
env
= IdMap.map ident value
type
env
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "ident", "map", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_bin (x:value) (op:operator) (y:value) : value
= match x,y with | Vint x,Vint y -> match op with | Oplus -> Vint (x+y) | Ominus -> Vint (x-y) | Omult -> Vint (x*y) | Ole -> Vbool (if x <= y then True else False) end | _,_ -> Vbool False end
function
eval_bin
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "op", "operator", "value" ]
semantics of formulas
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
get_env (i:ident) (e:env) : value
= IdMap.get e i
function
get_env
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "get", "ident", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_term (sigma:env) (pi:env) (t:term) : value
= match t with | Tconst n -> Vint n | Tvar id -> get_env id pi | Tderef id -> get_env id sigma | Tbin t1 op t2 -> eval_bin (eval_term sigma pi t1) op (eval_term sigma pi t2) end
function
eval_term
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_bin", "get_env", "id", "op", "pi", "t1", "t2", "term", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_fmla (sigma:env) (pi:env) (f:fmla)
= match f with | Fterm t -> eval_term sigma pi t = Vbool True | Fand f1 f2 -> eval_fmla sigma pi f1 /\ eval_fmla sigma pi f2 | Fnot f -> not (eval_fmla sigma pi f) | Fimplies f1 f2 -> eval_fmla sigma pi f1 -> eval_fmla sigma pi f2 | Flet x t f -> eval_fmla sigma (IdMap.set pi x (eval_term sigma pi t))...
predicate
eval_fmla
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_term", "f1", "f2", "fmla", "int", "pi", "set" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
subst_term (e:term) (r:ident) (v:ident) : term
= match e with | Tconst _ -> e | Tvar _ -> e | Tderef x -> if r=x then Tvar v else e | Tbin e1 op e2 -> Tbin (subst_term e1 r v) op (subst_term e2 r v) end
let function
subst_term
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "ident", "op", "term" ]
substitution of a reference `r` by a logic variable `v` warning: proper behavior only guaranted if `v` is fresh
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
fresh_in_term (id:ident) (t:term)
= match t with | Tconst _ -> true | Tvar v -> id <> v | Tderef _ -> true | Tbin t1 _ t2 -> fresh_in_term id t1 /\ fresh_in_term id t2 end
predicate
fresh_in_term
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "id", "ident", "t1", "t2", "term" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_subst_term: forall sigma pi:env, e:term, x:ident, v:ident. fresh_in_term v e -> eval_term sigma pi (subst_term e x v) = eval_term (IdMap.set sigma x (IdMap.get pi v)) pi e
lemma
eval_subst_term
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_term", "fresh_in_term", "get", "ident", "pi", "set", "subst_term", "term" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_term_change_free : forall t:term, sigma pi:env, id:ident, v:value. fresh_in_term id t -> eval_term sigma (IdMap.set pi id v) t = eval_term sigma pi t
lemma
eval_term_change_free
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_term", "fresh_in_term", "id", "ident", "pi", "set", "term", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
subst (f:fmla) (x:ident) (v:ident) : fmla
= match f with | Fterm e -> Fterm (subst_term e x v) | Fand f1 f2 -> Fand (subst f1 x v) (subst f2 x v) | Fnot f -> Fnot (subst f x v) | Fimplies f1 f2 -> Fimplies (subst f1 x v) (subst f2 x v) | Flet y t f -> Flet y (subst_term t x v) (subst f x v) | Fforall y ty f -> Fforall y ty (subst f x v) end
let function
subst
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "f1", "f2", "fmla", "ident", "subst_term" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_subst: forall f:fmla, sigma pi:env, x:ident, v:ident. fresh_in_fmla v f -> (eval_fmla sigma pi (subst f x v) <-> eval_fmla (IdMap.set sigma x (IdMap.get pi v)) pi f)
lemma
eval_subst
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "fresh_in_fmla", "get", "ident", "pi", "set", "subst" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_swap: forall f:fmla, sigma pi:env, id1 id2:ident, v1 v2:value. id1 <> id2 -> (eval_fmla sigma (IdMap.set (IdMap.set pi id1 v1) id2 v2) f <-> eval_fmla sigma (IdMap.set (IdMap.set pi id2 v2) id1 v1) f)
lemma
eval_swap
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "ident", "pi", "set", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
eval_change_free : forall f:fmla, sigma pi:env, id:ident, v:value. fresh_in_fmla id f -> (eval_fmla sigma (IdMap.set pi id v) f <-> eval_fmla sigma pi f)
lemma
eval_change_free
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "fresh_in_fmla", "id", "ident", "pi", "set", "value" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
stmt
= | Sskip | Sassign ident term | Sseq stmt stmt | Sif term stmt stmt | Sassert fmla | Swhile term fmla stmt
type
stmt
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fmla", "ident", "term" ]
statements
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
check_skip: forall s:stmt. s=Sskip \/s<>Sskip
lemma
check_skip
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
one_step env env stmt env env stmt
= | one_step_assign: forall sigma pi:env, x:ident, e:term. one_step sigma pi (Sassign x e) (IdMap.set sigma x (eval_term sigma pi e)) pi Sskip | one_step_seq: forall sigma pi sigma' pi':env, i1 i1' i2:stmt. one_step sigma pi i1 sigma' pi' i1' -> ...
inductive
one_step
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "eval_term", "fmla", "i1", "i2", "ident", "inv", "pi", "set", "stmt", "term" ]
small-steps semantics for statements
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
many_steps env env stmt env env stmt int
= | many_steps_refl: forall sigma pi:env, i:stmt. many_steps sigma pi i sigma pi i 0 | many_steps_trans: forall sigma1 pi1 sigma2 pi2 sigma3 pi3:env, i1 i2 i3:stmt, n:int. one_step sigma1 pi1 i1 sigma2 pi2 i2 -> many_steps sigma2 pi2 i2 sigma3 pi3 i3 n -> many_steps sigma1 pi1 i1 si...
inductive
many_steps
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "i1", "i2", "int", "one_step", "pi", "stmt" ]
many steps of execution
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
steps_non_neg: forall sigma1 pi1 sigma2 pi2:env, i1 i2:stmt, n:int. many_steps sigma1 pi1 i1 sigma2 pi2 i2 n -> n >= 0
lemma
steps_non_neg
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "i1", "i2", "int", "many_steps", "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
many_steps_seq: forall sigma1 pi1 sigma3 pi3:env, i1 i2:stmt, n:int. many_steps sigma1 pi1 (Sseq i1 i2) sigma3 pi3 Sskip n -> exists sigma2 pi2:env, n1 n2:int. many_steps sigma1 pi1 i1 sigma2 pi2 Sskip n1 /\ many_steps sigma2 pi2 i2 sigma3 pi3 Sskip n2 /\ n = 1 + n1 + n2
lemma
many_steps_seq
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "i1", "i2", "int", "many_steps", "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
valid_fmla (p:fmla)
= forall sigma pi:env. eval_fmla sigma pi p
predicate
valid_fmla
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "pi" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
valid_triple (p:fmla) (i:stmt) (q:fmla)
= forall sigma pi:env. eval_fmla sigma pi p -> forall sigma' pi':env, n:int. many_steps sigma pi i sigma' pi' Sskip n -> eval_fmla sigma' pi' q
predicate
valid_triple
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "int", "many_steps", "pi", "stmt" ]
partial correctness
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
my_pi : env
= Const.const (Vint 42)
function
my_pi
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "const", "env" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
Test13 : eval_term my_sigma my_pi (Tconst 13) = Vint 13
goal
Test13
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "eval_term", "my_pi", "my_sigma" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
Test42 : eval_term my_sigma my_pi (Tvar 0) = Vint 42
goal
Test42
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "eval_term", "my_pi", "my_sigma" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
Test0 : eval_term my_sigma my_pi (Tderef 0) = Vint 0
goal
Test0
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "eval_term", "my_pi", "my_sigma" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
Test55 : eval_term my_sigma my_pi (Tbin (Tvar 0) Oplus (Tconst 13)) = Vint 55
goal
Test55
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "eval_term", "my_pi", "my_sigma" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
Ass42 : let x = 0 in forall sigma' pi':env. one_step my_sigma my_pi (Sassign x (Tconst 42)) sigma' pi' Sskip -> IdMap.get sigma' x = Vint 42
goal
Ass42
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "get", "my_pi", "my_sigma", "one_step" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
If42 : let x = 0 in forall sigma1 pi1 sigma2 pi2:env, i:stmt. one_step my_sigma my_pi (Sif (Tbin (Tderef x) Ole (Tconst 10)) (Sassign x (Tconst 13)) (Sassign x (Tconst 42))) sigma1 pi1 i -> one_step sigma1 pi1 i sigma2 pi2 Sskip -> IdMap.get sigma2 x...
goal
If42
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "get", "my_pi", "my_sigma", "one_step", "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assign_rule: forall q:fmla, x id:ident, e:term. fresh_in_fmla id q -> valid_triple (Flet id e (subst q x id)) (Sassign x e) q
lemma
assign_rule
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fmla", "fresh_in_fmla", "id", "ident", "subst", "term", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
if_rule: forall e:term, p q:fmla, i1 i2:stmt. valid_triple (Fand p (Fterm e)) i1 q /\ valid_triple (Fand p (Fnot (Fterm e))) i2 q -> valid_triple p (Sif e i1 i2) q
lemma
if_rule
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fmla", "i1", "i2", "stmt", "term", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
while_rule_ext: forall e:term, inv inv':fmla, i:stmt. valid_fmla (Fimplies inv' inv) -> valid_triple (Fand (Fterm e) inv') i inv' -> valid_triple inv' (Swhile e inv i) (Fand (Fnot (Fterm e)) inv')
lemma
while_rule_ext
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fmla", "inv", "stmt", "term", "valid_fmla", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assigns (sigma:env) (a:Set.fset ident) (sigma':env)
= forall i:ident. not (Set.mem i a) -> IdMap.get sigma i = IdMap.get sigma' i
predicate
assigns
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "fset", "get", "ident", "mem" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assigns_refl: forall sigma:env, a:Set.fset ident. assigns sigma a sigma
lemma
assigns_refl
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "assigns", "env", "fset", "ident" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assigns_trans: forall sigma1 sigma2 sigma3:env, a:Set.fset ident. assigns sigma1 a sigma2 /\ assigns sigma2 a sigma3 -> assigns sigma1 a sigma3
lemma
assigns_trans
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "assigns", "env", "fset", "ident" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assigns_union_left: forall sigma sigma':env, s1 s2:Set.fset ident. assigns sigma s1 sigma' -> assigns sigma (Set.union s1 s2) sigma'
lemma
assigns_union_left
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "assigns", "env", "fset", "ident", "union" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assigns_union_right: forall sigma sigma':env, s1 s2:Set.fset ident. assigns sigma s2 sigma' -> assigns sigma (Set.union s1 s2) sigma'
lemma
assigns_union_right
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "assigns", "env", "fset", "ident", "union" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
stmt_writes (i:stmt) (w:Set.fset ident)
= match i with | Sskip | Sassert _ -> true | Sassign id _ -> Set.mem id w | Sseq s1 s2 | Sif _ s1 s2 -> stmt_writes s1 w /\ stmt_writes s2 w | Swhile _ _ s -> stmt_writes s w end
predicate
stmt_writes
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fset", "id", "ident", "mem", "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
compute_writes (s:stmt) : S.set ensures { forall sigma pi sigma' pi':env, n:int. many_steps sigma pi s sigma' pi' Sskip n -> assigns sigma result sigma' } variant { s }
= match s with | Sskip -> S.empty () | Sassign i _ -> S.singleton i | Sseq s1 s2 -> S.union (compute_writes s1) (compute_writes s2) | Sif _ s1 s2 -> S.union (compute_writes s1) (compute_writes s2) | Swhile _ _ s -> compute_writes s | Sassert _ -> S.empty () end
let
compute_writes
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "assigns", "empty", "env", "int", "many_steps", "pi", "set", "singleton", "stmt", "union" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
fresh_from_fmla (q:fmla) : ident ensures { fresh_in_fmla result q }
val
fresh_from_fmla
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "fmla", "fresh_in_fmla", "ident" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
abstract_effects (i:stmt) (f:fmla) : fmla ensures { forall sigma pi:env. eval_fmla sigma pi result -> eval_fmla sigma pi f /\ (*** forall sigma':env, w:Set.set ident. stmt_writes i w /\ assigns sigma w sigma' -> eval_fmla sigma' pi result *) forall sigma' pi':env, n:int. ...
val
abstract_effects
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "env", "eval_fmla", "fmla", "int", "many_steps", "pi", "stmt" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
wp (i:stmt) (q:fmla) ensures { valid_triple result i q } variant { i }
= match i with | Sskip -> q | Sseq i1 i2 -> wp i1 (wp i2 q) | Sassign x e -> let id = fresh_from_fmla q in Flet id e (subst q x id) | Sif e i1 i2 -> Fand (Fimplies (Fterm e) (wp i1 q)) (Fimplies (Fnot (Fterm e)) (wp i2 q)) | Sassert f -> Fimplies f q (* liberal wp...
let
wp
examples/WP_revisited
examples/WP_revisited/wp2.mlw
[ "HoareLogic", "Imp", "bool.Bool", "int.Int", "map.Const", "map.Map", "set.Fset", "set.SetApp" ]
[ "abstract_effects", "fmla", "fresh_from_fmla", "i1", "i2", "id", "inv", "stmt", "subst", "valid_triple" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784