Commit 94223ac7 authored by Martin Clochard's avatar Martin Clochard

verifythis_2016_matrix_multiplication:

- Define set with create (and constrained a benign mistake on axioms)
- s/FloatMatrix/Matrix
parent 1dbdd078
......@@ -29,8 +29,9 @@ theory MatrixGen
axiom set_def4:
forall m: mat 'a, i j: int, v: 'a. 0 <= i < rows m -> 0 <= j < cols m ->
forall i' j': int. (i <> i' \/ j <> j') ->
get (set m i j v) i' j' = get m i' j'
forall i' j': int. 0 <= i' < rows m /\ 0 <= j' < cols m /\
(i <> i' \/ j <> j') ->
get (set m i j v) i' j' = get m i' j'
predicate (==) (m1 m2: mat 'a) =
rows m1 = rows m2 && cols m1 = cols m2 &&
......@@ -46,12 +47,18 @@ theory MatrixGen
end
theory FloatMatrix
theory Matrix
clone export MatrixGen
use import int.Int
use HighOrd
use import int.Int
type mat 'a
function rows (mat 'a) : int
function cols (mat 'a) : int
function get (mat 'a) int int : 'a
function create (r c: int) (f: int -> int -> 'a) : mat 'a
......@@ -67,6 +74,21 @@ theory FloatMatrix
forall r c: int, f: int -> int -> 'a, i j: int.
0 <= i < r -> 0 <= j < c -> get (create r c f) i j = f i j
function set (m:mat 'a) (x y:int) (z:'a) : mat 'a =
create m.rows m.cols (\x1 y1. if x1 = x && y1 = y then z else get m x1 y1)
clone export MatrixGen with type mat 'a = mat 'a,
function rows = rows,
function cols = cols,
function get = get,
function set = set,
lemma set_def1,
lemma set_def2,
lemma set_def3,
lemma set_def4
use import int.Int
end
theory FixedMatrix
......@@ -125,7 +147,7 @@ module MatrixArithmetic
use import int.Int
use import int.Sum
use import sum_extended.Sum_extended
use import FloatMatrix
use import Matrix
(* Zero matrix *)
constant zerof : int -> int -> int = \_ _. 0
......@@ -267,7 +289,7 @@ module BlockMul
use import int.Int
use import int.Sum
use import sum_extended.Sum_extended
use import FloatMatrix
use import Matrix
use import MatrixArithmetic
function ofs2 (a: mat int) (ai aj: int) : int -> int -> int
......
......@@ -4,10 +4,22 @@
<why3session shape_version="4">
<prover id="0" name="CVC4" version="1.4" timelimit="5" steplimit="0" memlimit="1000"/>
<prover id="1" name="Alt-Ergo" version="1.01" timelimit="5" steplimit="0" memlimit="1000"/>
<file name="../matrices.mlw" expanded="true">
<theory name="MatrixGen" sum="d41d8cd98f00b204e9800998ecf8427e" expanded="true">
<file name="../matrices.mlw">
<theory name="MatrixGen" sum="d41d8cd98f00b204e9800998ecf8427e">
</theory>
<theory name="FloatMatrix" sum="d41d8cd98f00b204e9800998ecf8427e" expanded="true">
<theory name="Matrix" sum="862099dd531bba3a8ce8aca77f580ae7">
<goal name="set_def1">
<proof prover="1"><result status="valid" time="0.00" steps="9"/></proof>
</goal>
<goal name="set_def2">
<proof prover="1"><result status="valid" time="0.00" steps="11"/></proof>
</goal>
<goal name="set_def3">
<proof prover="1"><result status="valid" time="0.01" steps="13"/></proof>
</goal>
<goal name="set_def4">
<proof prover="1"><result status="valid" time="0.00" steps="22"/></proof>
</goal>
</theory>
<theory name="FixedMatrix" sum="81d1f6ecddc981db1f906002ad2c6515">
<goal name="rows_and_cols_nonnegative">
......@@ -19,7 +31,7 @@
<proof prover="1"><result status="valid" time="0.00" steps="1"/></proof>
</goal>
</theory>
<theory name="MatrixArithmetic" sum="95c5ea5a8476dec9b6807e6463fa7c50">
<theory name="MatrixArithmetic" sum="179a17c543d2ee8c5d1128db6e7ac5b9">
<goal name="zero_neutral">
<transf name="split_goal_wp">
<goal name="zero_neutral.1" expl="1.">
......@@ -64,7 +76,7 @@
<proof prover="0"><result status="valid" time="0.07"/></proof>
</goal>
<goal name="opposite_add">
<proof prover="0"><result status="valid" time="0.25"/></proof>
<proof prover="0"><result status="valid" time="0.49"/></proof>
</goal>
<goal name="WP_parameter mul_assoc_get" expl="VC for mul_assoc_get">
<transf name="split_goal_wp">
......@@ -72,7 +84,7 @@
<proof prover="1"><result status="valid" time="0.02" steps="21"/></proof>
</goal>
<goal name="WP_parameter mul_assoc_get.2" expl="2. precondition">
<proof prover="1"><result status="valid" time="2.40" steps="94"/></proof>
<proof prover="1"><result status="valid" time="3.14" steps="94"/></proof>
</goal>
<goal name="WP_parameter mul_assoc_get.3" expl="3. assertion">
<proof prover="1"><result status="valid" time="0.06" steps="37"/></proof>
......@@ -145,10 +157,10 @@
</transf>
</goal>
<goal name="mul_zero_right">
<proof prover="1"><result status="valid" time="1.91" steps="404"/></proof>
<proof prover="1"><result status="valid" time="1.91" steps="394"/></proof>
</goal>
<goal name="mul_zero_left">
<proof prover="1"><result status="valid" time="1.65" steps="396"/></proof>
<proof prover="1"><result status="valid" time="1.65" steps="387"/></proof>
</goal>
<goal name="mul_opp">
<transf name="split_goal_wp">
......@@ -162,14 +174,14 @@
<proof prover="0"><result status="valid" time="0.04"/></proof>
</goal>
<goal name="mul_opp.4" expl="4.">
<proof prover="1"><result status="valid" time="3.92" steps="2401"/></proof>
<proof prover="0"><result status="valid" time="0.05"/></proof>
</goal>
</transf>
</goal>
</theory>
<theory name="BlockMul" sum="08ae5cbffa4e68e45d31bc65f734c776">
<theory name="BlockMul" sum="a0d8b3f3a9391a77a23d88b4d4a63f23">
<goal name="WP_parameter block_mul_ij" expl="VC for block_mul_ij">
<proof prover="1"><result status="valid" time="2.31" steps="880"/></proof>
<proof prover="1"><result status="valid" time="1.25" steps="880"/></proof>
</goal>
<goal name="WP_parameter mul_split" expl="VC for mul_split">
<proof prover="1"><result status="valid" time="0.29" steps="218"/></proof>
......
......@@ -3,7 +3,7 @@ module Symb
use import int.Int
use import list.List
use import matrices.FloatMatrix
use import matrices.Matrix
use import matrices.MatrixArithmetic
namespace LOCAL
......
......@@ -4,7 +4,7 @@ module MatrixMultiplication
use import int.Sum
use import ref.Ref
use import map.Map
use import matrices.FloatMatrix as F
use import matrices.Matrix as F
use import matrices.MatrixArithmetic
use import matrices.BlockMul
use import matrices_ring_simp.Symb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment