Nous avons procédé ce jeudi matin 08 avril 2021 à une MAJ de sécurité urgente. Nous sommes passé de la version 13.9.3 à la version 13.9.5 les releases notes correspondantes sont ici:
https://about.gitlab.com/releases/2021/03/17/security-release-gitlab-13-9-4-released/
https://about.gitlab.com/releases/2021/03/31/security-release-gitlab-13-10-1-released/

vstte10_queens: simplified code

parent ed905bca
......@@ -158,68 +158,60 @@ module MachineArithmetic
forall q: int. 0 <= q < pos ->
0 <= to_int board[q] < to_int (length board)
exception MInconsistent int63
exception MInconsistent
let mcheck_is_consistent (board: array int63) (pos: int63)
requires { 0 <= to_int pos < to_int (length board) }
requires { is_board board (to_int pos + 1) }
= try
let rec forloop q (* for q = 0 to pos-1 do *) =
requires { 0 <= to_int q <= to_int pos }
requires { is_board board (to_int pos + 1) }
variant { to_int pos - to_int q }
raises { MInconsistent -> true }
if q < pos then begin
let bq = board[q] in
let bpos = board[pos] in
if bq = bpos then raise (MInconsistent q);
if bq - bpos = pos - q then raise (MInconsistent q);
if bpos - bq = pos - q then raise (MInconsistent q);
forloop (q + of_int 1)
end in
forloop (of_int 0);
let q = ref (of_int 0) in
while !q < pos do
invariant { 0 <= to_int !q <= to_int pos }
invariant { is_board board (to_int pos + 1) }
variant { to_int pos - to_int !q }
let bq = board[!q] in
let bpos = board[pos] in
if bq = bpos then raise MInconsistent;
if bq - bpos = pos - !q then raise MInconsistent;
if bpos - bq = pos - !q then raise MInconsistent;
q := !q + of_int 1
done;
True
with MInconsistent _ ->
with MInconsistent ->
False
end
use mach.onetime.OneTime as O
use mach.peano.Peano as P
type oref = { mutable ot : O.t }
let rec mcount_bt_queens (board: array int63) (n: int63) (pos: int63) : O.t
let rec mcount_bt_queens
(solutions: ref P.t) (board: array int63) (n: int63) (pos: int63)
requires { to_int (length board) = to_int n }
requires { 0 <= to_int pos <= to_int n }
requires { is_board board (to_int pos) }
variant { to_int n - to_int pos }
ensures { result.O.valid }
ensures { is_board board (to_int pos) }
=
if eq pos n then
O.succ (O.zero ())
else begin
let s = { ot = O.zero () } in
let rec forloop (i: int63) = (* for i = 0 to n-1 do *)
requires { 0 <= to_int i <= to_int n }
requires { s.ot.O.valid }
requires { is_board board (to_int pos) }
variant { to_int n - to_int i }
ensures { s.ot.O.valid }
ensures { is_board board (to_int pos) }
if i < n then begin
board[pos] <- i;
if mcheck_is_consistent board pos then
s.ot <- O.add s.ot (mcount_bt_queens board n (pos + of_int 1));
forloop (i + of_int 1)
end in
forloop (of_int 0);
s.ot
end
let mcount_queens (board: array int63) (n: int63) : O.t
solutions := P.succ !solutions
else
let i = ref (of_int 0) in
while !i < n do
invariant { 0 <= to_int !i <= to_int n }
invariant { is_board board (to_int pos) }
variant { to_int n - to_int !i }
board[pos] <- !i;
if mcheck_is_consistent board pos then
mcount_bt_queens solutions board n (pos + of_int 1);
i := !i + of_int 1
done
let mcount_queens (board: array int63) (n: int63) : P.t
requires { to_int (length board) = to_int n }
ensures { true }
= mcount_bt_queens board n (of_int 0)
=
let solutions = ref (P.zero ()) in
mcount_bt_queens solutions board n (of_int 0);
!solutions
let test_mcount_8 () =
let n = of_int 8 in
......
......@@ -8,6 +8,7 @@
<prover id="3" name="Z3" version="3.2" timelimit="8" memlimit="1000"/>
<prover id="4" name="Alt-Ergo" version="0.95.2" timelimit="6" memlimit="0"/>
<prover id="5" name="Z3" version="4.3.1" timelimit="6" memlimit="1000"/>
<prover id="6" name="Alt-Ergo" version="0.99.1" timelimit="6" memlimit="1000"/>
<file name="../vstte10_queens.mlw" expanded="true">
<theory name="NQueens" sum="05ca6b285c56c769408f7ad47741cffe">
<goal name="eq_board_set">
......@@ -50,131 +51,102 @@
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="0"/></proof>
</goal>
</theory>
<theory name="MachineArithmetic" sum="b8c9688f207f76a2a08d9e9c133a76ab" expanded="true">
<goal name="WP_parameter mcheck_is_consistent" expl="VC for mcheck_is_consistent" expanded="true">
<theory name="MachineArithmetic" sum="46f56a2ef8fda5724c437496801b4e23" expanded="true">
<goal name="WP_parameter mcheck_is_consistent" expl="VC for mcheck_is_consistent">
<proof prover="0"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens" expl="VC for mcount_bt_queens" expanded="true">
<transf name="split_goal_wp" expanded="true">
<goal name="WP_parameter mcount_bt_queens.1" expl="1. precondition">
<proof prover="5"><result status="valid" time="0.02"/></proof>
<goal name="WP_parameter mcount_bt_queens" expl="VC for mcount_bt_queens">
<transf name="split_goal_wp">
<goal name="WP_parameter mcount_bt_queens.1" expl="1. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="9"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.2" expl="2. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="12"/></proof>
<goal name="WP_parameter mcount_bt_queens.2" expl="2. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="8"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.3" expl="3. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="12"/></proof>
<goal name="WP_parameter mcount_bt_queens.3" expl="3. loop invariant init">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="9"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.4" expl="4. index in array bounds">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="15"/></proof>
<goal name="WP_parameter mcount_bt_queens.4" expl="4. loop invariant init">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="9"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.5" expl="5. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="17"/></proof>
<goal name="WP_parameter mcount_bt_queens.5" expl="5. type invariant">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="14"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.6" expl="6. precondition">
<proof prover="0"><result status="valid" time="0.05"/></proof>
<goal name="WP_parameter mcount_bt_queens.6" expl="6. index in array bounds">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="14"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.7" expl="7. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="20"/></proof>
<goal name="WP_parameter mcount_bt_queens.7" expl="7. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="16"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.8" expl="8. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.04" steps="43"/></proof>
<goal name="WP_parameter mcount_bt_queens.8" expl="8. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.16" steps="121"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.9" expl="9. variant decrease">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
<goal name="WP_parameter mcount_bt_queens.9" expl="9. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="19"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.10" expl="10. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
<goal name="WP_parameter mcount_bt_queens.10" expl="10. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.04" steps="47"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.11" expl="11. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
<goal name="WP_parameter mcount_bt_queens.11" expl="11. variant decrease">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="22"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.12" expl="12. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="23"/></proof>
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="22"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.13" expl="13. precondition" expanded="true">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="28"/></proof>
<goal name="WP_parameter mcount_bt_queens.13" expl="13. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="22"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.14" expl="14. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="34"/></proof>
<goal name="WP_parameter mcount_bt_queens.14" expl="14. precondition">
<proof prover="0"><result status="valid" time="0.05"/></proof>
<proof prover="4" memlimit="1000"><result status="valid" time="0.00" steps="22"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.15" expl="15. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.08" steps="64"/></proof>
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="26"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.16" expl="16. variant decrease">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="37"/></proof>
<goal name="WP_parameter mcount_bt_queens.16" expl="16. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.08" steps="61"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.17" expl="17. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="37"/></proof>
<goal name="WP_parameter mcount_bt_queens.17" expl="17. loop invariant preservation">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="30"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.18" expl="18. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.03" steps="37"/></proof>
<goal name="WP_parameter mcount_bt_queens.18" expl="18. loop invariant preservation">
<proof prover="4" memlimit="1000"><result status="valid" time="0.28" steps="57"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.19" expl="19. precondition">
<proof prover="0"><result status="valid" time="0.05"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.20" expl="20. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="42"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.21" expl="21. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="42"/></proof>
<goal name="WP_parameter mcount_bt_queens.19" expl="19. loop variant decrease">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="30"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.22" expl="22. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="20"/></proof>
<goal name="WP_parameter mcount_bt_queens.20" expl="20. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="19"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.23" expl="23. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="43"/></proof>
<goal name="WP_parameter mcount_bt_queens.21" expl="21. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="47"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.24" expl="24. variant decrease">
<goal name="WP_parameter mcount_bt_queens.22" expl="22. loop invariant preservation">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.25" expl="25. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
<goal name="WP_parameter mcount_bt_queens.23" expl="23. loop invariant preservation">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="45"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.26" expl="26. precondition">
<goal name="WP_parameter mcount_bt_queens.24" expl="24. loop variant decrease">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="23"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.27" expl="27. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.08" steps="42"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.28" expl="28. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="28"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.29" expl="29. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="28"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.30" expl="30. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="15"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.31" expl="31. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="15"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.32" expl="32. integer overflow">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="10"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.33" expl="33. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="11"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.34" expl="34. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="11"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.35" expl="35. precondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="11"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.36" expl="36. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="15"/></proof>
<goal name="WP_parameter mcount_bt_queens.25" expl="25. type invariant">
<proof prover="0"><result status="valid" time="0.05"/></proof>
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="14"/></proof>
</goal>
<goal name="WP_parameter mcount_bt_queens.37" expl="37. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="15"/></proof>
<goal name="WP_parameter mcount_bt_queens.26" expl="26. postcondition">
<proof prover="4" memlimit="1000"><result status="valid" time="0.01" steps="14"/></proof>
</goal>
</transf>
</goal>
<goal name="WP_parameter mcount_queens" expl="VC for mcount_queens">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="11"/></proof>
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="12"/></proof>
<proof prover="6"><result status="valid" time="0.01" steps="10"/></proof>
</goal>
<goal name="WP_parameter test_mcount_8" expl="VC for test_mcount_8">
<proof prover="4" memlimit="1000"><result status="valid" time="0.02" steps="7"/></proof>
<proof prover="5"><result status="valid" time="0.01"/></proof>
<proof prover="6"><result status="valid" time="0.00" steps="6"/></proof>
</goal>
</theory>
</file>
......
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