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
opp_involutive: forall m. opp (opp m) = m
lemma
opp_involutive
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
opposite_add: forall m1 m2. m1 === m2 -> opp (add m1 m2) = add (opp m1) (opp m2)
lemma
opposite_add
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "add", "opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ft1 (a b c: mat int) (i j: int) : int -> int -> int
= fun k -> smulf (mul_atom a b i k) (get c k j)
function
ft1
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "get", "int", "mat", "mul_atom", "smulf" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ft2 (a b c: mat int) (i j: int) : int -> int -> int
= fun k -> smulf (mul_atom b c k j) (get a i k)
function
ft2
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "get", "int", "mat", "mul_atom", "smulf" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_assoc_get (a b c: mat int) (i j: int) requires { cols a = rows b } requires { cols b = rows c } requires { 0 <= i < (rows a) /\ 0 <= j < (cols c) } ensures { get (mul (mul a b) c) i j = get (mul a (mul b c)) i j }
= let ft1 = ft1 a b c i j in let ft2 = ft2 a b c i j in fubini ft1 ft2 0 (cols b) 0 (cols a); sum_ext (mul_atom (mul a b) c i j) (sumf ft1 0 (cols a)) 0 (cols b); assert { get (mul (mul a b) c) i j = sum (sumf ft1 0 (cols a)) 0 (cols b) }; sum_ext (mul_atom a (mul b c) i j) (sumf ft2 0 (cols b)) 0 (...
let lemma
mul_assoc_get
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "cols", "ft1", "ft2", "fubini", "get", "int", "mat", "mul", "mul_atom", "rows", "sum", "sum_ext", "sumf" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_assoc: forall a b c. cols a = rows b -> cols b = rows c -> let ab = mul a b in let bc = mul b c in let a_bc = mul a bc in let ab_c = mul ab c in a_bc = ab_c by a_bc == ab_c
lemma
mul_assoc
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "ab", "bc", "cols", "mul", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_distr_right_get (a b c: mat int) (i j: int) requires { 0 <= i < rows a /\ 0 <= j < cols c } requires { cols b = rows c} requires { a === b } ensures { get (mul (add a b) c) i j = get (add (mul a c) (mul b c)) i j }
= let mac = mul_atom a c i j in let mbc = mul_atom b c i j in assert { get (add (mul a c) (mul b c)) i j = get (mul a c) i j + get (mul b c) i j = sum (addf mac mbc) 0 (cols b) }; sum_ext (addf mac mbc) (mul_atom (add a b) c i j) 0 (cols b)
let lemma
mul_distr_right_get
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "add", "addf", "cols", "get", "int", "mat", "mul", "mul_atom", "rows", "sum", "sum_ext" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_distr_right: forall a b c. a === b -> cols b = rows c -> mul (add a b) c = add (mul a c) (mul b c) by mul (add a b) c == add (mul a c) (mul b c)
lemma
mul_distr_right
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "add", "cols", "mul", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_distr_left_get (a b c: mat int) (i j : int) requires { 0 <= i < rows a /\ 0 <= j < cols c } requires { cols a = rows b } requires { b === c } ensures { get (mul a (add b c)) i j = get (add (mul a b) (mul a c)) i j }
= let mab = mul_atom a b i j in let mac = mul_atom a c i j in assert { get (add (mul a b) (mul a c)) i j = get (mul a b) i j + get (mul a c) i j = sum (addf mab mac) 0 (cols a) }; sum_ext (addf mab mac) (mul_atom a (add b c) i j) 0 (cols a)
let lemma
mul_distr_left_get
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "add", "addf", "cols", "get", "int", "mat", "mul", "mul_atom", "rows", "sum", "sum_ext" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_distr_left: forall a b c. b === c -> cols a = rows b -> mul a (add b c) = add (mul a b) (mul a c) by mul a (add b c) == add (mul a b) (mul a c)
lemma
mul_distr_left
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "add", "cols", "mul", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_zero_right: forall a c. 0 <= c -> mul a (zero a.cols c) = zero a.rows c
lemma
mul_zero_right
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "cols", "mul", "rows", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_zero_left: forall a r. 0 <= r -> mul (zero r a.rows) a = zero r a.cols
lemma
mul_zero_left
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "cols", "mul", "rows", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_opp: forall a b. a.cols = b.rows -> let oa = opp a in let ob = opp b in let ab = mul a b in let oab = opp ab in mul oa b = oab = mul a ob by add (mul oa b) (add ab oab) = oab = add (mul a ob) (add ab oab)
lemma
mul_opp
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "ab", "add", "cols", "mul", "opp", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ofs2 (a: mat int) (ai aj: int) : int -> int -> int
= fun i j -> get a (ai + i) (aj + j)
function
ofs2
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "get", "int", "mat" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
block (a: mat int) (r dr c dc: int) : mat int
= create dr dc (ofs2 a r c)
function
block
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "create", "int", "mat", "ofs2" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
c_blocks (a a1 a2: mat int)
= 0 <= a1.cols <= a.cols /\ a1 = block a 0 a.rows 0 a1.cols /\ a2 = block a 0 a.rows a1.cols (a.cols - a1.cols)
predicate
c_blocks
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "a1", "a2", "block", "cols", "int", "mat", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
r_blocks (a a1 a2: mat int)
= 0 <= a1.rows <= a.rows /\ a1 = block a 0 a1.rows 0 a.cols /\ a2 = block a a1.rows (a.rows - a1.rows) 0 a.cols
predicate
r_blocks
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "a1", "a2", "block", "cols", "int", "mat", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
block_mul_ij (a a1 a2 b b1 b2: mat int) (k: int) : unit requires { a.cols = b.rows /\ a1.cols = b1.rows} requires { 0 <= k <= a.cols } requires { c_blocks a a1 a2 /\ r_blocks b b1 b2 } ensures { forall i j. 0 <= i < a.rows -> 0 <= j < b.cols -> 0 <= k <= a1.cols -> s...
= if 0 < k then begin let k = k - 1 in assert { forall i j. 0 <= i < a.rows -> 0 <= j < b.cols -> mul_atom a b i j k = if k < a1.cols then mul_atom a1 b1 i j k else mul_atom a2 b2 i j (k - a1.cols) }; block_mul_ij a a1 a2 b b1 b2 k end
let
block_mul_ij
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "a1", "a2", "b1", "b2", "c_blocks", "cols", "int", "mat", "mul_atom", "r_blocks", "rows", "sum", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_split (a a1 a2 b b1 b2: mat int) : unit requires { a.cols = b.rows /\ a1.cols = b1.rows} requires { c_blocks a a1 a2 /\ r_blocks b b1 b2 } ensures {add (mul a1 b1) (mul a2 b2) = mul a b }
= block_mul_ij a a1 a2 b b1 b2 a.cols; assert { add (mul a1 b1) (mul a2 b2) == mul a b }
let lemma
mul_split
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "a1", "a2", "add", "b1", "b2", "block_mul_ij", "c_blocks", "cols", "int", "mat", "mul", "r_blocks", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_block_cell (a b: mat int) (r dr c dc i j: int) : unit requires { a.cols = b.rows } requires { 0 <= r /\ r + dr <= a.rows } requires { 0 <= c /\ c + dc <= b.cols } requires { 0 <= i < dr /\ 0 <= j < dc } ensures { ofs2 (mul a b) r c i j = get (mul (block a r dr 0 a.cols) (block b ...
= let a' = block a r dr 0 a.cols in let b' = block b 0 b.rows c dc in sum_ext (mul_atom a b (i + r) (j + c)) (mul_atom a' b' i j) 0 a.cols
let lemma
mul_block_cell
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "block", "cols", "get", "int", "mat", "mul", "mul_atom", "ofs2", "rows", "sum_ext", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_block: forall a b: mat int, r dr c dc: int. a.cols = b.rows -> 0 <= r <= r + dr <= a.rows -> 0 <= c <= c + dc <= b.cols -> let a' = block a r dr 0 a.cols in let b' = block b 0 b.rows c dc in let m' = block (mul a b) r dr c dc in m' = mul a' b' by m' == mul a' b'
lemma
mul_block
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices.mlw
[ "Matrix", "MatrixArithmetic", "MatrixGen", "int.Int", "int.Sum", "sum_extended.Sum_extended" ]
[ "block", "cols", "int", "mat", "mul", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mono
= { m_prod : list int; m_pos : bool; }
type
mono
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
l_mdl (f:int -> mat int) (l:list int) : mat int
= match l with | Nil -> zero (-1) (-1) | Cons x Nil -> f x | Cons x q -> mul (f x) (l_mdl f q) end
function
l_mdl
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list", "mat", "mul", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
l_vld (f:int -> mat int) (r c:int) (l:list int)
= match l with | Nil -> false | Cons x Nil -> rows (f x) = r && cols (f x) = c | Cons x q -> rows (f x) = r && l_vld f (cols (f x)) c q end
predicate
l_vld
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "int", "list", "mat", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
l_mdl_ok (f:int -> mat int) (r c:int) (l:list int) : unit requires { l_vld f r c l } ensures { let rs = l_mdl f l in rows rs = r /\ cols rs = c } variant { l }
= match l with | Nil -> absurd | Cons _ Nil -> () | Cons x q -> l_mdl_ok f (cols (f x)) c q end
let lemma
l_mdl_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "int", "l_mdl", "l_vld", "list", "mat", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_mdl (f:int -> mat int) (m:mono) : mat int
= let m0 = l_mdl f m.m_prod in if m.m_pos then m0 else opp m0
function
m_mdl
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "l_mdl", "mat", "mono", "opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_mdl_ok (f:int -> mat int) (r c:int) (m:mono) : unit requires { l_vld f r c m.m_prod } ensures { let rs = m_mdl f m in rows rs = r /\ cols rs = c }
= l_mdl_ok f r c m.m_prod
let lemma
m_mdl_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "int", "l_mdl_ok", "l_vld", "m_mdl", "mat", "mono", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_mdl (f:int -> mat int) (r c:int) (l:list mono) : mat int
= match l with | Nil -> zero r c | Cons x q -> add (lm_mdl f r c q) (m_mdl f x) end
function
lm_mdl
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "add", "int", "list", "m_mdl", "mat", "mono", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_mdl_simp (f:int -> mat int) (r c:int) (l:list mono) : mat int
= match l with | Nil -> zero r c | Cons x Nil -> m_mdl f x | Cons x q -> add (lm_mdl_simp f r c q) (m_mdl f x) end
function
lm_mdl_simp
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "add", "int", "list", "m_mdl", "mat", "mono", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_vld (f:int -> mat int) (r c:int) (l:list mono)
= match l with | Nil -> true | Cons x q -> l_vld f r c x.m_prod && lm_vld f r c q end
predicate
lm_vld
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "l_vld", "list", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_mdl_ok (f:int -> mat int) (r c:int) (l:list mono) : unit requires { lm_vld f r c l /\ r >= 0 /\ c >= 0 } ensures { let rs = lm_mdl f r c l in rows rs = r /\ cols rs = c } variant { l }
= match l with | Nil -> () | Cons _ q -> lm_mdl_ok f r c q end
let lemma
lm_mdl_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "int", "list", "lm_mdl", "lm_vld", "mat", "mono", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_mdl_same (f:int -> mat int) (r c:int) (l:list mono) : unit requires { lm_vld f r c l } ensures { lm_mdl_simp f r c l = lm_mdl f r c l } variant { l }
= match l with | Nil -> () | Cons _ Nil -> () | Cons _ q -> lm_mdl_same f r c q end
let
lm_mdl_same
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list", "lm_mdl", "lm_mdl_simp", "lm_vld", "mat", "mono", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
l_compare (l1 l2:list int) : int
= match l1, l2 with | Nil, Nil -> 0 | Nil, _ -> (-1) | _, Nil -> 1 | Cons x q, Cons y r -> if x < y then (-1) else if x > y then 1 else l_compare q r end
function
l_compare
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
l_compare_zero (l1 l2:list int) : unit requires { l_compare l1 l2 = 0 } ensures { l1 = l2 } variant { l1 }
= match l1, l2 with | Nil, Nil -> () | Cons _ q, Cons _ r -> l_compare_zero q r | _ -> absurd end
let
l_compare_zero
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "l_compare", "list", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_lower (m1 m2:mono)
= let cmp = l_compare m1.m_prod m2.m_prod in cmp < 0 || (cmp = 0 && (m1.m_pos -> m2.m_pos))
predicate
m_lower
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cmp", "l_compare", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_collapse (l:list mono) (m:mono) : list mono
= match l with | Nil -> Cons m Nil | Cons x q -> if not x.m_pos && m.m_pos && l_compare m.m_prod x.m_prod = 0 then q else Cons m l end
function
m_collapse
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "l_compare", "list", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_collapse_ok (f:int -> mat int) (r c:int) (l:list mono) (m:mono) : list mono requires { lm_vld f r c l /\ l_vld f r c m.m_prod } requires { r >= 0 /\ c >= 0 } ensures { result = m_collapse l m /\ lm_vld f r c result } ensures { lm_mdl f r c result = add (lm_mdl f r c...
= let res = m_collapse l m in match l with | Nil -> () | Cons x q -> if not x.m_pos && m.m_pos && l_compare m.m_prod x.m_prod = 0 then begin l_compare_zero m.m_prod x.m_prod; assert { lm_mdl f r c q = add (m_mdl f m) (add (lm_mdl f r c q) (m_mdl f x)) } ...
let
m_collapse_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "add", "int", "l_compare", "l_compare_zero", "l_vld", "list", "lm_mdl", "lm_vld", "m_collapse", "m_mdl", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_collapse (acc l:list mono) : list mono
= match l with | Nil -> acc | Cons x q -> lm_collapse (m_collapse acc x) q end
function
lm_collapse
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "list", "m_collapse", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_collapse_ok (f:int -> mat int) (r c:int) (acc l:list mono) : list mono requires { lm_vld f r c acc /\ lm_vld f r c l } requires { r >= 0 /\ c >= 0 } ensures { result = lm_collapse acc l /\ lm_vld f r c result } ensures { lm_mdl f r c result = add (lm_mdl f r c...
= match l with | Nil -> acc | Cons x q -> lm_collapse_ok f r c (m_collapse_ok f r c acc x) q end
let
lm_collapse_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "add", "int", "list", "lm_collapse", "lm_mdl", "lm_vld", "m_collapse_ok", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
cat_rev (acc l:list 'a) : list 'a
= match l with | Nil -> acc | Cons x q -> cat_rev (Cons x acc) q end
function
cat_rev
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "list" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
cat_rev_ok (f:int -> mat int) (r c:int) (acc l:list mono) : list mono requires { lm_vld f r c acc /\ lm_vld f r c l } requires { r >= 0 /\ c >= 0 } ensures { result = cat_rev acc l /\ lm_vld f r c result } ensures { lm_mdl f r c result = add (lm_mdl f r c acc) (lm_mdl f r c l) } vari...
= match l with | Nil -> acc | Cons x q -> cat_rev_ok f r c (Cons x acc) q end
let
cat_rev_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "add", "cat_rev", "int", "list", "lm_mdl", "lm_vld", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_dump (x:mono) (acc l:list mono) : (list mono,list mono)
= match l with | Nil -> (acc, Nil) | Cons y q -> if m_lower x y then (acc, l) else lm_dump x (m_collapse acc y) q end
function
lm_dump
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "list", "m_collapse", "m_lower", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_dump_ok (f:int -> mat int) (r c:int) (x:mono) (acc l:list mono) : (list mono,list mono) requires { r >= 0 /\ c >= 0 } requires { lm_vld f r c acc /\ lm_vld f r c l } ensures { result = lm_dump x acc l } ensures { let (acc2,l2) = result in lm_vld f r c acc2 /\ lm_vld f r c l2 /\ ...
= match l with | Nil -> (acc, Nil) | Cons y q -> if m_lower x y then (acc, l) else lm_dump_ok f r c x (m_collapse_ok f r c acc y) q end
let
lm_dump_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "add", "int", "list", "lm_dump", "lm_mdl", "lm_vld", "m_collapse_ok", "m_lower", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_merge (acc l1 l2:list mono) : list mono
= match l1 with | Nil -> cat_rev Nil (lm_collapse acc l2) | Cons x q -> let (acc,l2) = lm_dump x acc l2 in lm_merge (m_collapse acc x) q l2 end
function
lm_merge
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "cat_rev", "list", "lm_collapse", "lm_dump", "m_collapse", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_merge_ok (f:int -> mat int) (r c:int) (acc l1 l2:list mono) : list mono requires { r >= 0 /\ c >= 0 /\ lm_vld f r c acc } requires { lm_vld f r c l1 /\ lm_vld f r c l2 } ensures { result = lm_merge acc l1 l2 /\ lm_vld f r c result } ensures { lm_mdl f r c result = add (lm_mdl f ...
= match l1 with | Nil -> cat_rev_ok f r c Nil (lm_collapse_ok f r c acc l2) | Cons x q -> let (acc,l2) = lm_dump_ok f r c x acc l2 in lm_merge_ok f r c (m_collapse_ok f r c acc x) q l2 end
let
lm_merge_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "acc", "add", "cat_rev_ok", "int", "list", "lm_collapse_ok", "lm_dump_ok", "lm_mdl", "lm_merge", "lm_vld", "m_collapse_ok", "mat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
cat (l1 l2:list 'a) : list 'a
= match l1 with | Nil -> l2 | Cons x q -> Cons x (cat q l2) end
function
cat
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "list" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
cat_ok (f:int -> mat int) (r k c:int) (l1 l2:list int) : list int requires { r >= 0 /\ k >= 0 /\ c >= 0 } requires { l_vld f r k l1 /\ l_vld f k c l2 } ensures { result = cat l1 l2 /\ l_vld f r c result } ensures { l_mdl f result = mul (l_mdl f l1) (l_mdl f l2) } v...
= match l1, l2 with | Nil, _ | _, Nil -> absurd | Cons x Nil, _ -> Cons x l2 | Cons x q, _ -> Cons x (cat_ok f (cols (f x)) k c q l2) end
let
cat_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cat", "cols", "int", "l_mdl", "l_vld", "list", "mat", "mul" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_mul (m1 m2:mono) : mono
= { m_pos = (m1.m_pos <-> m2.m_pos); m_prod = cat m1.m_prod m2.m_prod }
function
m_mul
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cat", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_mul_ok (f:int -> mat int) (r k c:int) (m1 m2:mono) : mono requires { r >= 0 /\ k >= 0 /\ c >= 0 } requires { l_vld f r k m1.m_prod /\ l_vld f k c m2.m_prod } ensures { result = m_mul m1 m2 /\ l_vld f r c result.m_prod } ensures { m_mdl f result = mul (m_mdl f m1) (m_mdl f m2) }
= { m_pos = (if m1.m_pos then m2.m_pos else not m2.m_pos); m_prod = cat_ok f r k c m1.m_prod m2.m_prod }
let
m_mul_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cat_ok", "int", "l_vld", "m_mdl", "m_mul", "mat", "mono", "mul" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_distribute (m:mono) (l:list mono) : list mono
= match l with | Nil -> Nil | Cons x q -> Cons (m_mul m x) (m_distribute m q) end
function
m_distribute
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "list", "m_mul", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
m_distribute_ok (f:int -> mat int) (r k c:int) (m:mono) (l:list mono) : list mono requires { r >= 0 /\ k >= 0 /\ c >= 0 } requires { l_vld f r k m.m_prod /\ lm_vld f k c l } ensures { result = m_distribute m l /\ lm_vld f r c result } ensures { lm_mdl f r c resu...
= match l with | Nil -> Nil | Cons x q -> Cons (m_mul_ok f r k c m x) (m_distribute_ok f r k c m q) end
let
m_distribute_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "l_vld", "list", "lm_mdl", "lm_vld", "m_distribute", "m_mdl", "m_mul_ok", "mat", "mono", "mul" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_distribute (l1 l2:list mono) : list mono
= match l1 with | Nil -> Nil | Cons x q -> lm_merge Nil (m_distribute x l2) (lm_distribute q l2) end
function
lm_distribute
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "list", "lm_merge", "m_distribute", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_distribute_ok (f:int -> mat int) (r k c:int) (l1 l2:list mono) : list mono requires { r >= 0 /\ k >= 0 /\ c >= 0 } requires { lm_vld f r k l1 /\ lm_vld f k c l2 } ensures { result = lm_distribute l1 l2 /\ lm_vld f r c result } ensures { lm_mdl f r c result =...
= match l1 with | Nil -> Nil | Cons x q -> lm_merge_ok f r c Nil (m_distribute_ok f r k c x l2) (lm_distribute_ok f r k c q l2) end
let
lm_distribute_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list", "lm_distribute", "lm_mdl", "lm_merge_ok", "lm_vld", "m_distribute_ok", "mat", "mono", "mul" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_opp (l:list mono) : list mono
= match l with | Nil -> Nil | Cons x q -> lm_merge Nil (Cons { x with m_pos = not x.m_pos } Nil) (lm_opp q) end
function
lm_opp
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "list", "lm_merge", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
lm_opp_ok (f:int -> mat int) (r c:int) (l:list mono) : list mono requires { r >= 0 /\ c >= 0 /\ lm_vld f r c l } ensures { result = lm_opp l /\ lm_vld f r c result } ensures { lm_mdl f r c result = opp (lm_mdl f r c l) } variant { l }
= match l with | Nil -> Nil | Cons x q -> let m2 = { x with m_pos = not x.m_pos } in lm_merge_ok f r c Nil (Cons m2 Nil) (lm_opp_ok f r c q); end
let
lm_opp_ok
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list", "lm_mdl", "lm_merge_ok", "lm_opp", "lm_vld", "mat", "mono", "opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
empty : int -> mat int
= zero 0
constant
empty
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "mat", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
env
= { mutable ev_f : int -> mat int; mutable ev_c : int; }
type
env
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "mat" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
expr
= { e_body : list LOCAL.mono; e_rows : int; e_cols : int; }
type
expr
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "list", "mono" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
e_vld (env:env) (e:expr)
= e.e_rows >= 0 /\ e.e_cols >= 0 /\ LOCAL.lm_vld env.ev_f e.e_rows e.e_cols e.e_body
predicate
e_vld
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "env", "expr", "lm_vld" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
e_mdl (env:env) (e:expr) : mat int
= LOCAL.lm_mdl_simp env.ev_f e.e_rows e.e_cols e.e_body
function
e_mdl
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "env", "expr", "int", "lm_mdl_simp", "mat" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
extends (f:int -> mat int) (c:int) (v:mat int) : int -> mat int
= fun n -> if n <> c then f n else v
function
extends
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "int", "mat" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
extends_rw : forall f c v n. extends f c v n = if n <> c then f n else v
lemma
extends_rw
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "extends" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_env () : env ensures { result.ev_c --> 0 }
= { ev_f = LOCAL.empty; ev_c = 0 }
let
symb_env
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "empty", "env" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_mat (m:mat int) (n:int) : expr
= { e_rows = m.rows; e_cols = m.cols; e_body = Cons { LOCAL.m_pos = true; LOCAL.m_prod = Cons n Nil } Nil }
function
symb_mat
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "expr", "int", "mat", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_reg (ghost env:env) (m:mat int) : expr writes { env } ensures { env.ev_c --> old env.ev_c + 1 } ensures { env.ev_f --> extends (old env.ev_f) (old env.ev_c) m } ensures { result --> symb_mat m (old env.ev_c) } ensures { e_vld env result }
= let id = env.ev_c in env.ev_f <- extends env.ev_f id m; env.ev_c <- id + 1; symb_mat m id
let
symb_reg
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "e_vld", "env", "expr", "extends", "id", "int", "mat", "symb_mat" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_opp (e:expr) : expr
= { e_rows = e.e_rows; e_cols = e.e_cols; e_body = LOCAL.lm_opp e.e_body }
function
symb_opp
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "expr", "lm_opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_opp (env:env) (e:expr) : expr requires { e_vld env e } ensures { e_vld env result } ensures { result --> symb_opp e } ensures { e_mdl env result = opp (e_mdl env e) }
= let (r,c) = (e.e_rows,e.e_cols) in LOCAL.lm_mdl_same env.ev_f r c e.e_body; let res = { e_rows = r; e_cols = c; e_body = LOCAL.lm_opp_ok env.ev_f r c e.e_body } in LOCAL.lm_mdl_same env.ev_f r c res.e_body; res
let
symb_opp
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "e_mdl", "e_vld", "env", "expr", "lm_mdl_same", "lm_opp_ok", "opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_add (e1 e2:expr) : expr
= { e_rows = e1.e_rows; e_cols = e1.e_cols; e_body = LOCAL.lm_merge Nil e1.e_body e2.e_body }
function
symb_add
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "expr", "lm_merge" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_add (env:env) (e1 e2:expr) : expr requires { e_vld env e1 /\ e_vld env e2 } requires { e1.e_rows = e2.e_rows /\ e1.e_cols = e2.e_cols } ensures { e_vld env result } ensures { result --> symb_add e1 e2 } ensures { e_mdl env result = add (e_mdl env e1) (e_mdl env e2) }
= let (r,c) = (e1.e_rows, e1.e_cols) in LOCAL.lm_mdl_same env.ev_f r c e1.e_body; LOCAL.lm_mdl_same env.ev_f r c e2.e_body; let res = { e_rows = r; e_cols = c; e_body = LOCAL.lm_merge_ok env.ev_f r c Nil e1.e_body e2.e_body } in LOCAL.lm_mdl_same env.ev_f r c res.e_body; res
let
symb_add
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "add", "e_mdl", "e_vld", "env", "expr", "lm_mdl_same", "lm_merge_ok" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_sub (e1 e2:expr) : expr
= symb_add e1 (symb_opp e2)
function
symb_sub
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "expr", "symb_add", "symb_opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_sub (env:env) (e1 e2:expr) : expr requires { e_vld env e1 /\ e_vld env e2 } requires { e1.e_rows = e2.e_rows /\ e1.e_cols = e2.e_cols } ensures { e_vld env result } ensures { result --> symb_sub e1 e2 } ensures { e_mdl env result = sub (e_mdl env e1) (e_mdl env e2) }
= symb_add env e1 (symb_opp env e2)
let
symb_sub
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "e_mdl", "e_vld", "env", "expr", "sub", "symb_add", "symb_opp" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_mul (e1 e2:expr) : expr
= { e_rows = e1.e_rows; e_cols = e2.e_cols; e_body = LOCAL.lm_distribute e1.e_body e2.e_body }
function
symb_mul
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "expr", "lm_distribute" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
symb_mul (env:env) (e1 e2:expr) : expr requires { e_vld env e1 /\ e_vld env e2 } requires { e1.e_cols = e2.e_rows } ensures { e_vld env result } ensures { result --> symb_mul e1 e2 } ensures { e_mdl env result = mul (e_mdl env e1) (e_mdl env e2) }
= let (r,k,c) = (e1.e_rows,e1.e_cols,e2.e_cols) in LOCAL.lm_mdl_same env.ev_f r k e1.e_body; LOCAL.lm_mdl_same env.ev_f k c e2.e_body; let res = { e_rows = r; e_cols = c; e_body = LOCAL.lm_distribute_ok env.ev_f r k c e1.e_body e2.e_body } in LOCAL.lm_mdl_same env.ev_f r c res.e_body; res
let
symb_mul
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "e_mdl", "e_vld", "env", "expr", "lm_distribute_ok", "lm_mdl_same", "mul" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
harness (a11 a12 a22 b11 b21 b22:mat int) : unit requires { a11 === a12 === a22 === b11 === b21 === b22 } requires { a11.rows = a11.cols }
= let env = symb_env () in let e_a11 = symb_reg env a11 in let e_a12 = symb_reg env a12 in let e_a22 = symb_reg env a22 in let e_b11 = symb_reg env b11 in let e_b21 = symb_reg env b21 in let e_b22 = symb_reg env b22 in let x1 = symb_mul env (symb_add env e_a11 e_a22) ...
let
harness
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/matrices_ring_simp.mlw
[ "int.Int", "list.List", "matrices.Matrix", "matrices.MatrixArithmetic" ]
[ "cols", "e_mdl", "env", "int", "mat", "rows", "symb_add", "symb_env", "symb_mul", "symb_reg", "symb_sub", "unit", "x1" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_atom (a b: matrix int) (i j: int) : int -> int
= fun k -> a.elts[i][k] * b.elts[k][j]
function
mul_atom
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/naive.mlw
[ "int.Int", "int.Sum", "map.Map", "matrix.Matrix" ]
[ "int", "matrix" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
matrix_product (m a b: matrix int)
= forall i j. 0 <= i < m.rows -> 0 <= j < m.columns -> m.elts[i][j] = sum (mul_atom a b i j) 0 a.columns let mult_naive (a b: matrix int) : matrix int requires { a.columns = b.rows } ensures { result.rows = a.rows /\ result.columns = b.columns } ensures { matrix_product result a b } = let rs ...
predicate
matrix_product
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/naive.mlw
[ "int.Int", "int.Sum", "map.Map", "matrix.Matrix" ]
[ "get", "int", "make", "matrix", "mul_atom", "rows", "set", "sum" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mdl (m: matrix 'a) : mat {'a}
= create m.rows m.columns m.elts
let function
mdl
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "create", "mat", "matrix", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
with_symb
= { phy : matrix int; ghost sym : expr; }
type
with_symb
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "expr", "int", "matrix", "sym" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
with_symb_vld (env:env) (ws:with_symb)
= e_mdl env ws.sym = ws.phy.mdl /\ e_vld env ws.sym /\ ws.sym.e_rows = ws.phy.mdl.F.rows /\ ws.sym.e_cols = ws.phy.mdl.F.cols
predicate
with_symb_vld
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "cols", "e_mdl", "e_vld", "env", "mdl", "rows", "sym", "with_symb" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
block (a: matrix int) (r dr c dc: int) : matrix int requires { 0 <= r <= r + dr <= a.mdl.F.rows } requires { 0 <= c <= c + dc <= a.mdl.F.cols } ensures { result.mdl = block a.mdl r dr c dc } ensures { result.mdl.F.rows = dr /\ result.mdl.F.cols = dc }
= let res = make dr dc 0 in blit a res r 0 dr c 0 dc; assert { res.mdl == block a.mdl r dr c dc }; res
let
block
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "blit", "cols", "int", "make", "matrix", "mdl", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
block_ws (ghost env:env) (a:matrix int) (r dr c dc: int) : with_symb requires { 0 <= r <= r + dr <= a.mdl.F.rows } requires { 0 <= c <= c + dc <= a.mdl.F.cols } ensures { let rm = result.phy.mdl in rm = block a.mdl r dr c dc /\ rm.F.rows = dr /\ rm.F.cols = dc } ensures { result.sym --> symb_mat r...
= let m = block a r dr c dc in { phy = m; sym = ghost symb_reg env m.mdl } let add (a b: matrix int) : matrix int requires { a.mdl === b.mdl } ensures { result.mdl = add a.mdl b.mdl } ensures { result.mdl === a.mdl } = let res = make a.rows a.columns 0 in for i = 0 to a.rows - 1 do ...
let
block_ws
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "add", "block", "cols", "env", "extends", "get", "int", "j'", "make", "matrix", "mdl", "rows", "set", "sym", "symb_mat", "symb_reg", "with_symb", "with_symb_vld" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
add_ws (ghost env:env) (a b:with_symb) : with_symb requires { a.phy.mdl === b.phy.mdl } requires { with_symb_vld env a /\ with_symb_vld env b } ensures { result.phy.mdl = add a.phy.mdl b.phy.mdl } ensures { result.sym --> symb_add a.sym b.sym } ensures { with_symb_vld env result }
= { phy = add a.phy b.phy; sym = ghost symb_add env a.sym b.sym } let sub (a b: matrix int): matrix int requires { a.mdl === b.mdl } ensures { result.mdl = sub a.mdl b.mdl } ensures { result.mdl === a.mdl} = let res = make a.rows a.columns 0 in for i = 0 to a.rows - 1 do invariant { ...
let
add_ws
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "add", "env", "get", "int", "j'", "make", "matrix", "mdl", "rows", "set", "sub", "sym", "symb_add", "with_symb", "with_symb_vld" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
sub_ws (ghost env:env) (a b:with_symb) : with_symb requires { a.phy.mdl === b.phy.mdl } requires { with_symb_vld env a /\ with_symb_vld env b } ensures { result.phy.mdl = sub a.phy.mdl b.phy.mdl } ensures { result.sym --> symb_sub a.sym b.sym } ensures { with_symb_vld env result }
= { phy = sub a.phy b.phy; sym = ghost symb_sub env a.sym b.sym } let mult_ijk (a b:matrix int) : matrix int requires { a.mdl.F.cols = b.mdl.F.rows } ensures { result.mdl.F.rows = a.mdl.F.rows } ensures { result.mdl.F.cols = b.mdl.F.cols } ensures { result.mdl = mul a.mdl b.mdl } = let r = ro...
let
sub_ws
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "cols", "env", "get", "int", "make", "matrix", "mdl", "mul", "mul_atom", "mul_cell", "rows", "set", "sub", "sum", "sym", "symb_sub", "with_symb", "with_symb_vld" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
assoc_proof (a b c:matrix int) : unit requires { a.mdl.F.cols = b.mdl.F.rows /\ b.mdl.F.cols = c.mdl.F.rows }
= let ab = mult_ikj a b in let bc = mult_ikj b c in let ab_c = mult_ikj ab c in let a_bc = mult_ikj a bc in assert { ab_c.mdl = a_bc.mdl }; assert { ab_c.rows = a_bc.rows && ab_c.columns = a_bc.columns && forall i j. 0 <= i < ab_c.rows /\ 0 <= j < ab_c.columns -> ab_c.elts[i][j] = F.ge...
let
assoc_proof
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "ab", "bc", "cols", "get", "int", "matrix", "mdl", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mul_naive (a b: matrix int) requires { a.mdl.F.cols = b.mdl.F.rows } ensures { result.mdl.F.rows = a.mdl.F.rows } ensures { result.mdl.F.cols = b.mdl.F.cols } ensures { result.mdl = mul a.mdl b.mdl }
= mult_ijk a b
let
mul_naive
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "cols", "int", "matrix", "mdl", "mul", "rows" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
double_block (a:matrix int) (r1 dr1 c1 dc1 r2 dr2 c2 dc2:int) : unit requires { 0 <= r1 <= r1 + dr1 <= a.mdl.F.rows } requires { 0 <= c1 <= c1 + dc1 <= a.mdl.F.cols } requires { 0 <= r2 <= r2 + dr2 <= dr1 } requires { 0 <= c2 <= c2 + dc2 <= dc1 } ensures { block (block a.mdl r1 dr1 c1 dc1) r2 dr2 c2...
= assert { block (block a.mdl r1 dr1 c1 dc1) r2 dr2 c2 dc2 == block a.mdl (r1+r2) dr2 (c1+c2) dc2 }
let
double_block
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "block", "c1", "c2", "cols", "int", "matrix", "mdl", "r1", "r2", "rows", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
padding (a: matrix int) (r c: int) : matrix int requires { a.mdl.F.rows <= r } requires { a.mdl.F.cols <= c } ensures { result.mdl.F.rows = r } ensures { result.mdl.F.cols = c } ensures { a.mdl = block result.mdl 0 a.mdl.F.rows 0 a.mdl.F.cols } ensures { let dr = (r - a.mdl.F.rows) in ...
= let res = make r c 0 in let nr = a.rows in let nc = a.columns in blit a res 0 0 nr 0 0 nc; assert { let dc = c - nc in zero nr dc == block res.mdl 0 nr nc dc }; assert { let dr = r - nr in zero dr nc == block res.mdl nr dr 0 nc }; assert { a.mdl == block res.mdl 0 nr 0...
let
padding
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "blit", "block", "cols", "int", "make", "matrix", "mdl", "rows", "zero" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
strassen (a b: matrix int) (ghost flag:int) : matrix int requires { a.mdl.F.cols = b.mdl.F.rows } requires { flag >= 0 } requires { flag = 0 -> a.mdl.F.rows = 1 \/ a.mdl.F.cols = 1 \/ b.mdl.F.cols = 1 \/ (even a.mdl.F.rows /\ even a.mdl.F.cols /\ even b.mdl.F.cols) } ensures { result.mdl = m...
= let cut_off = begin ensures { result >= 1 } 42 end in let (rw, md, cl)= (a.rows, a.columns, b.columns) in assert { rw = a.mdl.F.rows /\ md = a.mdl.F.cols /\ cl = b.mdl.F.cols }; if rw <= cut_off || md <= cut_off || cl <= cut_off then mul_naive a b else let div2 (n: int) : (int,int) requires ...
let
strassen
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/strassen.mlw
[ "int.EuclideanDivision", "int.Int", "int.Sum", "map.Map", "matrices.BlockMul", "matrices.Matrix", "matrices.MatrixArithmetic", "matrices_ring_simp.Symb", "matrix.Matrix", "number.Parity", "ref.Ref" ]
[ "add_ws", "blit", "block", "block_ws", "c_blocks", "cols", "div", "div2", "double_block", "e_mdl", "even", "get", "int", "make", "matrix", "md", "mdl", "mod", "mul", "mul_naive", "padding", "r_blocks", "rows", "sub_ws", "sym", "symb_env", "symb_mul", "with_symb"...
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
sum_ext (f g: int -> int) (a b: int) : unit requires {forall i. a <= i < b -> f i = g i } ensures { sum f a b = sum g a b }
= ()
let
sum_ext
examples/verifythis_2016_matrix_multiplication
examples/verifythis_2016_matrix_multiplication/sum_extended.mlw
[ "int.Int", "int.Sum" ]
[ "int", "sum", "unit" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
datatype
= TYunit | TYint | TYbool
type
datatype
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[]
types and values
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
value
= Vvoid | Vint int | Vbool bool
type
value
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "int" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
operator
= Oplus | Ominus | Omult | Ole
type
operator
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[]
terms and formulas
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mident
type
mident
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[]
ident for mutable variables
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
mident_decide : forall m1 m2: mident. m1 = m2 \/ m1 <> m2
lemma
mident_decide
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "mident" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ident
type
ident
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[]
ident for immutable variables
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
ident_decide : forall m1 m2: ident. m1 = m2 \/ m1 <> m2
lemma
ident_decide
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "ident" ]
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
term
= | Tvalue value | Tvar ident | Tderef mident | Tbin term operator term
type
term
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "ident", "mident", "operator", "value" ]
Terms
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
fmla
= | Fterm term | Fand fmla fmla | Fnot fmla | Fimplies fmla fmla | Flet ident term fmla (* let id = term in fmla *) | Fforall ident datatype fmla
type
fmla
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "datatype", "ident", "term" ]
Formulas
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
stmt
= | Sskip | Sassign mident term | Sseq stmt stmt | Sif term stmt stmt | Sassert fmla | Swhile term fmla stmt
type
stmt
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "fmla", "mident", "term" ]
Statements
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784
decide_is_skip: forall s:stmt. s = Sskip \/ s <> Sskip
lemma
decide_is_skip
examples/WP_revisited
examples/WP_revisited/blocking_semantics5.mlw
[ "FreshVariables", "SemOp", "Syntax", "Typing", "TypingAndSemantics", "bool.Bool", "int.Int", "list.Append", "list.List", "map.Const", "map.Map" ]
[ "stmt" ]
while cond invariant inv body
https://gitlab.inria.fr/why3/why3
7c59064b4eed9a4059292599f3a657716aa34784