Commit 520e0f12 authored by MARCHE Claude's avatar MARCHE Claude

prover example: fixed all warnings (sometimes with wrong variants...)

parent 46e48687
......@@ -847,8 +847,7 @@ module Impl
use import Firstorder_formula_spec.Spec
use import Types
use import Logic
let rec bind_var_symbol_in_fo_formula "W:diverges:N"
(t:nl_fo_formula int int) (x:int)
let rec bind_var_symbol_in_fo_formula (t:nl_fo_formula int int) (x:int)
(i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr1:func int (fo_term 'b0 'b1))
(ghost bnd1:func int (fo_term 'b0 'b1)) : nl_fo_formula int int
......@@ -1031,8 +1030,7 @@ module Impl
((rename_subst_fo_term bnd1 identity identity)))
end
with bind_var_fo_term_in_fo_formula "W:diverges:N"
(t:nl_fo_formula int int) (x:int)
with bind_var_fo_term_in_fo_formula (t:nl_fo_formula int int) (x:int)
(i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr1:func int (fo_term 'b0 'b1))
(ghost bnd1:func int (fo_term 'b0 'b1)) : nl_fo_formula int int
......@@ -1248,8 +1246,7 @@ module Impl
((rename_subst_fo_term bnd1 identity identity)))
end
let rec unbind_var_symbol_in_fo_formula "W:diverges:N"
(t:nl_fo_formula int int) (i:int)
let rec unbind_var_symbol_in_fo_formula (t:nl_fo_formula int int) (i:int)
(x:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......@@ -1510,8 +1507,7 @@ module Impl
((rename_subst_symbol bnd20 identity)))
end
with unbind_var_fo_term_in_fo_formula "W:diverges:N"
(t:nl_fo_formula int int) (i:int)
with unbind_var_fo_term_in_fo_formula (t:nl_fo_formula int int) (i:int)
(x:nl_fo_term int int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......
......@@ -367,8 +367,7 @@ module Impl
use import Firstorder_formula_list_spec.Spec
use import Types
use import Logic
let rec bind_var_symbol_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
let rec bind_var_symbol_in_fo_formula_list (t:nl_fo_formula_list int int)
(x:int) (i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr1:func int (fo_term 'b0 'b1))
(ghost bnd1:func int (fo_term 'b0 'b1)) : nl_fo_formula_list int int
......@@ -421,8 +420,7 @@ module Impl
((rename_subst_fo_term bnd1 identity identity)))
end
with bind_var_fo_term_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
with bind_var_fo_term_in_fo_formula_list (t:nl_fo_formula_list int int)
(x:int) (i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr1:func int (fo_term 'b0 'b1))
(ghost bnd1:func int (fo_term 'b0 'b1)) : nl_fo_formula_list int int
......@@ -481,8 +479,7 @@ module Impl
((rename_subst_fo_term bnd1 identity identity)))
end
let rec unbind_var_symbol_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
let rec unbind_var_symbol_in_fo_formula_list (t:nl_fo_formula_list int int)
(i:int) (x:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......@@ -557,8 +554,7 @@ module Impl
((rename_subst_symbol bnd20 identity)))
end
with unbind_var_fo_term_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
with unbind_var_fo_term_in_fo_formula_list (t:nl_fo_formula_list int int)
(i:int) (x:nl_fo_term int int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......@@ -657,8 +653,7 @@ module Impl
((rename_subst_fo_term bnd21 identity identity)))
end
let rec subst_base_symbol_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
let rec subst_base_symbol_in_fo_formula_list (t:nl_fo_formula_list int int)
(x:int) (u:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......@@ -733,8 +728,7 @@ module Impl
((rename_subst_symbol bnd20 identity)))
end
with subst_base_fo_term_in_fo_formula_list "W:diverges:N"
(t:nl_fo_formula_list int int)
with subst_base_fo_term_in_fo_formula_list (t:nl_fo_formula_list int int)
(x:int) (u:nl_fo_term int int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr1:func int (fo_term 'b0 'b1))
......
......@@ -156,8 +156,10 @@ module Impl
use import Logic
let rec bind_var_symbol_in_symbol (t:nl_symbol int) (x:int) (i:int)
(ghost fr0:func int (symbol 'b0)) (ghost bnd0:func int (symbol 'b0)) :
nl_symbol int requires { correct_indexes_symbol t }
nl_symbol int
requires { correct_indexes_symbol t }
requires { bound_depth_of_symbol_in_symbol t <= i }
variant { nlsize_symbol t }
ensures { bound_depth_of_symbol_in_symbol result <= i + 1 }
ensures { correct_indexes_symbol result }
ensures { nlmodel_symbol result fr0 bnd0 =
......@@ -172,10 +174,13 @@ module Impl
let rec unbind_var_symbol_in_symbol (t:nl_symbol int) (i:int)
(x:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0)) (ghost bnd20:func int (symbol 'b0)) :
nl_symbol int requires { i >= 0 } requires { correct_indexes_symbol t }
nl_symbol int
requires { i >= 0 }
requires { correct_indexes_symbol t }
requires { bound_depth_of_symbol_in_symbol t <= i + 1 }
requires { correct_indexes_symbol x }
requires { bound_depth_of_symbol_in_symbol x = 0 }
variant { nlsize_symbol t }
ensures { correct_indexes_symbol result }
ensures { bound_depth_of_symbol_in_symbol result <= i }
ensures { nlmodel_symbol result fr0 bnd10 =
......@@ -190,11 +195,12 @@ module Impl
let subst_base_symbol_in_symbol (t:nl_symbol int) (x:int)
(u:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0)) (ghost bnd20:func int (symbol 'b0)) :
nl_symbol int requires { correct_indexes_symbol t }
nl_symbol int
requires { correct_indexes_symbol t }
requires { correct_indexes_symbol u }
requires { bound_depth_of_symbol_in_symbol u = 0 }
ensures { correct_indexes_symbol result }
ensures { bound_depth_of_symbol_in_symbol result =
ensures { bound_depth_of_symbol_in_symbol result =
bound_depth_of_symbol_in_symbol t }
ensures { nlmodel_symbol result fr0 bnd10 =
nlmodel_symbol t (update fr0 x (nlmodel_symbol u fr0 bnd20)) bnd10 }
......
......@@ -576,6 +576,7 @@ module Impl
requires { bound_depth_of_symbol_in_tableau t <= i + 1 }
requires { correct_indexes_symbol x }
requires { bound_depth_of_symbol_in_symbol x = 0 }
variant { nlsize_tableau t }
ensures { correct_indexes_tableau result }
ensures { bound_depth_of_symbol_in_tableau result <= i }
ensures { bound_depth_of_fo_term_in_tableau result =
......@@ -677,6 +678,7 @@ module Impl
requires { correct_indexes_fo_term x }
requires { bound_depth_of_symbol_in_fo_term x = 0 }
requires { bound_depth_of_fo_term_in_fo_term x = 0 }
variant { nlsize_tableau t }
ensures { correct_indexes_tableau result }
ensures { bound_depth_of_fo_term_in_tableau result <= i }
ensures { bound_depth_of_symbol_in_tableau result =
......@@ -808,8 +810,9 @@ module Impl
requires { correct_indexes_tableau t }
requires { correct_indexes_symbol u }
requires { bound_depth_of_symbol_in_symbol u = 0 }
variant { nlsize_tableau t }
ensures { correct_indexes_tableau result }
ensures { bound_depth_of_symbol_in_tableau result =
ensures { bound_depth_of_symbol_in_tableau result =
bound_depth_of_symbol_in_tableau t }
ensures { bound_depth_of_fo_term_in_tableau result =
bound_depth_of_fo_term_in_tableau t }
......@@ -909,8 +912,9 @@ module Impl
requires { correct_indexes_fo_term u }
requires { bound_depth_of_symbol_in_fo_term u = 0 }
requires { bound_depth_of_fo_term_in_fo_term u = 0 }
variant { nlsize_tableau t }
ensures { correct_indexes_tableau result }
ensures { bound_depth_of_symbol_in_tableau result =
ensures { bound_depth_of_symbol_in_tableau result =
bound_depth_of_symbol_in_tableau t }
ensures { bound_depth_of_fo_term_in_tableau result =
bound_depth_of_fo_term_in_tableau t }
......
......@@ -604,8 +604,7 @@ module Impl
use import Firstorder_term_spec.Spec
use import Types
use import Logic
let rec bind_var_symbol_in_fo_term_list "W:diverges:N"
(t:nl_fo_term_list int int) (x:int)
let rec bind_var_symbol_in_fo_term_list (t:nl_fo_term_list int int) (x:int)
(i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr3:func int (fo_term 'b0 'b3))
(ghost bnd3:func int (fo_term 'b0 'b3)) : nl_fo_term_list int int
......@@ -658,8 +657,7 @@ module Impl
((rename_subst_fo_term bnd3 identity identity)))
end
with bind_var_fo_term_in_fo_term_list "W:diverges:N"
(t:nl_fo_term_list int int) (x:int)
with bind_var_fo_term_in_fo_term_list (t:nl_fo_term_list int int) (x:int)
(i:int) (ghost fr0:func int (symbol 'b0))
(ghost bnd0:func int (symbol 'b0)) (ghost fr3:func int (fo_term 'b0 'b3))
(ghost bnd3:func int (fo_term 'b0 'b3)) : nl_fo_term_list int int
......@@ -718,8 +716,7 @@ module Impl
((rename_subst_fo_term bnd3 identity identity)))
end
with bind_var_symbol_in_fo_term "W:diverges:N"
(t:nl_fo_term int int) (x:int) (i:int)
with bind_var_symbol_in_fo_term (t:nl_fo_term int int) (x:int) (i:int)
(ghost fr0:func int (symbol 'b0)) (ghost bnd0:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
(ghost bnd3:func int (fo_term 'b0 'b3)) : nl_fo_term int int
......@@ -771,8 +768,7 @@ module Impl
((rename_subst_fo_term bnd3 identity identity)))
end
with bind_var_fo_term_in_fo_term "W:diverges:N"
(t:nl_fo_term int int) (x:int) (i:int)
with bind_var_fo_term_in_fo_term (t:nl_fo_term int int) (x:int) (i:int)
(ghost fr0:func int (symbol 'b0)) (ghost bnd0:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
(ghost bnd3:func int (fo_term 'b0 'b3)) : nl_fo_term int int
......@@ -814,8 +810,7 @@ module Impl
((rename_subst_fo_term bnd3 identity identity)))
end
let rec unbind_var_symbol_in_fo_term_list "W:diverges:N"
(t:nl_fo_term_list int int)
let rec unbind_var_symbol_in_fo_term_list (t:nl_fo_term_list int int)
(i:int) (x:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
......@@ -890,8 +885,7 @@ module Impl
((rename_subst_symbol bnd20 identity)))
end
with unbind_var_fo_term_in_fo_term_list "W:diverges:N"
(t:nl_fo_term_list int int) (i:int)
with unbind_var_fo_term_in_fo_term_list (t:nl_fo_term_list int int) (i:int)
(x:nl_fo_term int int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
......@@ -990,8 +984,7 @@ module Impl
((rename_subst_fo_term bnd23 identity identity)))
end
with unbind_var_symbol_in_fo_term "W:diverges:N"
(t:nl_fo_term int int) (i:int)
with unbind_var_symbol_in_fo_term (t:nl_fo_term int int) (i:int)
(x:nl_symbol int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
......@@ -1065,8 +1058,7 @@ module Impl
((rename_subst_symbol bnd20 identity)))
end
with unbind_var_fo_term_in_fo_term "W:diverges:N"
(t:nl_fo_term int int) (i:int)
with unbind_var_fo_term_in_fo_term (t:nl_fo_term int int) (i:int)
(x:nl_fo_term int int) (ghost fr0:func int (symbol 'b0))
(ghost bnd10:func int (symbol 'b0))
(ghost fr3:func int (fo_term 'b0 'b3))
......
This diff is collapsed.
module Types
end
module Impl
use import Firstorder_semantics.Sem
use import Firstorder_term_spec.Spec
use import Firstorder_formula_spec.Spec
......@@ -35,12 +35,13 @@ module Impl
use import list.List
use import set.Set as S
use import BacktrackArray.Impl as BA
val ghost sdata_inv_hack (u:unit) : pred sdata
ensures { result = sdata_inv }
let main (base:nlimpl_fo_formula_list) (gnum:int) : unit
requires { nlimpl_fo_formula_list_ok base }
diverges
ensures { forall m:model int 'st,rho:func int 'st.
not(formula_list_conj_semantic base.model_fo_formula_list_field m rho) }
raises { Sat -> forall m:model int 'st,rho:func int 'st.
......@@ -53,6 +54,7 @@ module Impl
assert { root.model_tableau_field = Root } ;
let gnum = phip.final_goals_number in
let rec aux (n:int) : prover_return
diverges
returns { { contradictory_assignment = s } ->
forall m:model int 'st,rho:func int 'st.
let rhos = semantic_subst s m rho in
......@@ -88,7 +90,5 @@ module Impl
not(formula_list_conj_semantic basem m rho) }
with Unsat -> ()
end
end
end
module Types
end
module Impl
use import ProverMain.Impl
use import Firstorder_symbol_impl.Types
use import Firstorder_term_impl.Types
......@@ -19,7 +19,7 @@ module Impl
use import Firstorder_formula_impl.Impl
use import Firstorder_formula_list_impl.Impl
use import int.Int
let imply (a b:nlimpl_fo_formula) : nlimpl_fo_formula
requires { nlimpl_fo_formula_ok a }
requires { nlimpl_fo_formula_ok b }
......@@ -27,14 +27,14 @@ module Impl
=
construct_fo_formula (NLC_Or
(construct_fo_formula (NLC_Not a)) b)
let equiv (a b:nlimpl_fo_formula) : nlimpl_fo_formula
requires { nlimpl_fo_formula_ok a }
requires { nlimpl_fo_formula_ok b }
ensures { nlimpl_fo_formula_ok result }
=
construct_fo_formula (NLC_And (imply a b) (imply b a))
let drinker () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -51,7 +51,7 @@ module Impl
(* exists x, (c0 x -> forall x,c0 x) *)
let phi4 = construct_fo_formula (NLC_Not phi3) in
construct_fo_formula_list (NLC_FOFCons phi4 fonil)
let group () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -60,7 +60,7 @@ module Impl
let c0 = construct_symbol (NLCVar_symbol 0) in (* c0 *)
let c1 = construct_symbol (NLCVar_symbol 1) in (* e *)
let neutral = construct_fo_term (NLC_App c1 fotnil) in
let rec aux (v1 v2 v3:nlimpl_fo_term) : nlimpl_fo_formula
let aux (v1 v2 v3:nlimpl_fo_term) : nlimpl_fo_formula
requires { nlimpl_fo_term_ok v1 }
requires { nlimpl_fo_term_ok v2 }
requires { nlimpl_fo_term_ok v3 }
......@@ -77,13 +77,13 @@ module Impl
let v3 = construct_fo_term (NLCVar_fo_term 3) in (* t *)
let v4 = construct_fo_term (NLCVar_fo_term 4) in (* u *)
let v5 = construct_fo_term (NLCVar_fo_term 5) in (* v *)
(* forall x y, exists z. c0(x,y,z) *)
let phimul = aux v0 v1 v2 in (* c0(x,y,z) *)
let phimul = construct_fo_formula (NLC_Exists 2 phimul) in (* exists z,c0(x,y,z) *)
let phimul = construct_fo_formula (NLC_Forall 1 phimul) in (* forall y,exists z. c0(x,y,z) *)
let phimul = construct_fo_formula (NLC_Forall 0 phimul) in (* forall x y,exists z.c0(x,y,z) *)
(* forall x y z t u v.
(* xy = t /\ yz = v -> (tz = u <-> xv = u) *)
c0(x,y,t) /\ c0(y,z,v) -> (c0(t,z,u) <-> c0(x,v,u)) *)
......@@ -104,18 +104,18 @@ module Impl
let phiass = construct_fo_formula (NLC_Forall 2 phiass) in
let phiass = construct_fo_formula (NLC_Forall 1 phiass) in
let phiass = construct_fo_formula (NLC_Forall 0 phiass) in
(* forall x. c0(e,x,x) /\ c0(x,e,x) *)
let phin0 = aux neutral v0 v0 in
let phin1 = aux v0 neutral v0 in
let phin = construct_fo_formula (NLC_And phin0 phin1) in
let phin = construct_fo_formula (NLC_Forall 0 phin) in
(* forall x. c0(x,x,e) *)
let phi2 = aux v0 v0 neutral in
let phi2 = construct_fo_formula (NLC_Forall 0 phi2) in
(* forall x y z. c0(x,y,z) -> c0(y,x,z) *)
let phigh = aux v0 v1 v2 in
let phig = aux v1 v0 v2 in
......@@ -124,14 +124,14 @@ module Impl
let phig = construct_fo_formula (NLC_Forall 1 phig) in
let phig = construct_fo_formula (NLC_Forall 0 phig) in
let phig = construct_fo_formula (NLC_Not phig) in
let l = construct_fo_formula_list (NLC_FOFCons phimul fonil) in
let l = construct_fo_formula_list (NLC_FOFCons phiass l) in
let l = construct_fo_formula_list (NLC_FOFCons phin l) in
let l = construct_fo_formula_list (NLC_FOFCons phi2 l) in
let l = construct_fo_formula_list (NLC_FOFCons phig l) in
l
let bidon1 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -141,7 +141,7 @@ module Impl
let a = construct_fo_formula (NLC_PApp a fotnil) in
let r = construct_fo_formula (NLC_Not (imply a a)) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let bidon2 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -155,7 +155,7 @@ module Impl
let a = construct_fo_formula (NLC_And a b) in
let r = construct_fo_formula (NLC_Not (imply a o)) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let bidon3 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -170,7 +170,7 @@ module Impl
let r = imply (imply a (imply b c)) (imply (imply a b) (imply a c)) in
let r = construct_fo_formula (NLC_Not r) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let bidon4 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -185,7 +185,7 @@ module Impl
let r = imply (imply a (imply b c)) (imply b (imply a c)) in
let r = construct_fo_formula (NLC_Not r) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let pierce () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -198,7 +198,7 @@ module Impl
let r = imply (imply (imply a b) a) a in
let r = construct_fo_formula (NLC_Not r) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let generate (n:int) : nlimpl_fo_formula_list
requires { n >= 0 }
ensures { nlimpl_fo_formula_list_ok result }
......@@ -215,7 +215,7 @@ module Impl
if m = 0
then equiv symb (aux0 n)
else equiv symb (aux1 (m-1))
with aux0 (m:int) : nlimpl_fo_formula
ensures { nlimpl_fo_formula_ok result }
requires { m >= 0 }
......@@ -229,7 +229,7 @@ module Impl
in
let r = construct_fo_formula (NLC_Not (aux1 n)) in
construct_fo_formula_list (NLC_FOFCons r fonil)
let zenon5 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -249,9 +249,9 @@ module Impl
let l = construct_fo_formula_list (NLC_FOFCons e2 l) in
let l = construct_fo_formula_list (NLC_FOFCons ng l) in
l
(* Quite good ! *)
let zenon6 () : nlimpl_fo_formula_list
ensures { nlimpl_fo_formula_list_ok result }
=
......@@ -289,7 +289,7 @@ module Impl
let l = construct_fo_formula_list (NLC_FOFCons h4 l) in
let l = construct_fo_formula_list (NLC_FOFCons g l) in
l
let zenon10 (n:int) : nlimpl_fo_formula_list
requires { n >= 0 }
ensures { nlimpl_fo_formula_list_ok result }
......@@ -321,10 +321,11 @@ module Impl
let l = construct_fo_formula_list (NLC_FOFCons h fonil) in
let l = construct_fo_formula_list (NLC_FOFCons g l) in
l
use import FormulaTransformations.Impl as F
let test () : unit
diverges
raises { F.Sat -> true }
=
(*let fonil = construct_fo_formula_list NLC_FOFNil in
......@@ -351,6 +352,5 @@ module Impl
let fl2 = construct_fo_formula_list (NLC_FOFCons phi0 fl1) in*)
let _ = main (zenon10 2) 1 in
()
end
end
This diff is collapsed.
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