Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cb790d9c authored by MARCHE Claude's avatar MARCHE Claude
Browse files

Fixed missing type var instantiation in unfold, rewrite and apply

parent 476ef72f
No related branches found
No related tags found
1 merge request!2Isabelle configure realization1
...@@ -75,7 +75,7 @@ let apply pr : Task.task Trans.tlist = Trans.store (fun task -> ...@@ -75,7 +75,7 @@ let apply pr : Task.task Trans.tlist = Trans.store (fun task ->
let d = Opt.get d in let d = Opt.get d in
let t = term_decl d in let t = term_decl d in
let (lp, lv, nt) = intros t in let (lp, lv, nt) = intros t in
let (_ty, subst) = try first_order_matching lv [nt] [g] with let (subst_ty, subst) = try first_order_matching lv [nt] [g] with
| Reduction_engine.NoMatch (Some (t1, t2)) -> | Reduction_engine.NoMatch (Some (t1, t2)) ->
(if (Debug.test_flag debug_matching) then (if (Debug.test_flag debug_matching) then
Format.printf "Term %a and %a can not be matched. Failure in matching@." Format.printf "Term %a and %a can not be matched. Failure in matching@."
...@@ -88,9 +88,9 @@ let apply pr : Task.task Trans.tlist = Trans.store (fun task -> ...@@ -88,9 +88,9 @@ let apply pr : Task.task Trans.tlist = Trans.store (fun task ->
else ()); raise (Arg_trans_pattern ("apply", p1, p2)) else ()); raise (Arg_trans_pattern ("apply", p1, p2))
| Reduction_engine.NoMatch None -> raise (Arg_trans ("apply")) | Reduction_engine.NoMatch None -> raise (Arg_trans ("apply"))
in in
let inst_nt = t_subst subst nt in let inst_nt = t_ty_subst subst_ty subst nt in
if (Term.t_equal_nt_nl inst_nt g) then if (Term.t_equal_nt_nl inst_nt g) then
let nlp = List.map (t_subst subst) lp in let nlp = List.map (t_ty_subst subst_ty subst) lp in
let lt = List.map (fun ng -> Task.add_decl task (create_prop_decl Pgoal let lt = List.map (fun ng -> Task.add_decl task (create_prop_decl Pgoal
(create_prsymbol (gen_ident "G")) ng)) nlp in (create_prsymbol (gen_ident "G")) ng)) nlp in
lt lt
...@@ -121,7 +121,8 @@ let replace_subst lp lv f1 f2 t = ...@@ -121,7 +121,8 @@ let replace_subst lp lv f1 f2 t =
let rec replace lv f1 f2 t : Term.term = let rec replace lv f1 f2 t : Term.term =
match !is_replaced with match !is_replaced with
| Some subst -> replace_in_term (t_subst subst f1) (t_subst subst f2) t | Some(subst_ty,subst) ->
replace_in_term (t_ty_subst subst_ty subst f1) (t_ty_subst subst_ty subst f2) t
| None -> | None ->
begin begin
let fom = try Some (first_order_matching lv [f1] [t]) with let fom = try Some (first_order_matching lv [f1] [t]) with
...@@ -138,12 +139,12 @@ let replace_subst lp lv f1 f2 t = ...@@ -138,12 +139,12 @@ let replace_subst lp lv f1 f2 t =
| Reduction_engine.NoMatch None -> None in | Reduction_engine.NoMatch None -> None in
(match fom with (match fom with
| None -> t_map (fun t -> replace lv f1 f2 t) t | None -> t_map (fun t -> replace lv f1 f2 t) t
| Some (_ty, subst) -> | Some (subst_ty, subst) ->
let sf1 = t_subst subst f1 in let sf1 = t_ty_subst subst_ty subst f1 in
if (Term.t_equal sf1 t) then if (Term.t_equal sf1 t) then
begin begin
is_replaced := Some subst; is_replaced := Some (subst_ty,subst);
t_subst subst f2 t_ty_subst subst_ty subst f2
end end
else else
replace lv f1 f2 t) replace lv f1 f2 t)
...@@ -151,8 +152,8 @@ let replace_subst lp lv f1 f2 t = ...@@ -151,8 +152,8 @@ let replace_subst lp lv f1 f2 t =
let t = t_map (replace lv f1 f2) t in let t = t_map (replace lv f1 f2) t in
match !is_replaced with match !is_replaced with
| None -> raise (Arg_trans "matching/replace") | None -> raise (Arg_trans "matching/replace")
| Some subst -> | Some(subst_ty,subst) ->
(List.map (t_subst subst) lp, t) (List.map (t_ty_subst subst_ty subst) lp, t)
let rewrite_in rev h h1 = let rewrite_in rev h h1 =
let found_eq = let found_eq =
...@@ -257,10 +258,14 @@ let t_replace_app unf ls_defn t = ...@@ -257,10 +258,14 @@ let t_replace_app unf ls_defn t =
let (vl, tls) = ls_defn in let (vl, tls) = ls_defn in
match t.t_node with match t.t_node with
| Tapp (ls, tl) when ls_equal unf ls -> | Tapp (ls, tl) when ls_equal unf ls ->
let mvs = let add (mt,mv) x y =
List.fold_left2 (fun acc (v: vsymbol) (t: term) -> Ty.ty_match mt x.vs_ty (t_type y), Mvs.add x y mv
Mvs.add v t acc) Mvs.empty vl tl in in
t_subst mvs tls let mtv,mvs =
List.fold_left2 add (Ty.Mtv.empty,Mvs.empty) vl tl
in
let mtv = Ty.oty_match mtv tls.t_ty t.t_ty in
t_ty_subst mtv mvs tls
| _ -> t | _ -> t
let rec t_ls_replace ls ls_defn t = let rec t_ls_replace ls ls_defn t =
......
...@@ -87,6 +87,16 @@ module TestAutoFocus ...@@ -87,6 +87,16 @@ module TestAutoFocus
end end
module TestRewritePoly
use import int.Int
use import list.List
use import list.Append
goal g : (Cons 1 Nil) ++ ((Cons 2 Nil) ++ Nil) = Cons 1 (Cons 2 Nil)
end
module Power module Power
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<prover id="0" name="Alt-Ergo" version="1.30" timelimit="1" steplimit="0" memlimit="1000"/> <prover id="0" name="Alt-Ergo" version="1.30" timelimit="1" steplimit="0" memlimit="1000"/>
<prover id="1" name="Z3" version="4.5.0" timelimit="1" steplimit="0" memlimit="1000"/> <prover id="1" name="Z3" version="4.5.0" timelimit="1" steplimit="0" memlimit="1000"/>
<prover id="2" name="CVC4" version="1.5" timelimit="1" steplimit="0" memlimit="1000"/> <prover id="2" name="CVC4" version="1.5" timelimit="1" steplimit="0" memlimit="1000"/>
<prover id="3" name="CVC4" version="1.4" timelimit="1" steplimit="0" memlimit="1000"/>
<file name="../demo-itp.mlw"> <file name="../demo-itp.mlw">
<theory name="M" proved="true" sum="d41d8cd98f00b204e9800998ecf8427e"> <theory name="M" proved="true" sum="d41d8cd98f00b204e9800998ecf8427e">
</theory> </theory>
...@@ -52,6 +53,14 @@ ...@@ -52,6 +53,14 @@
<goal name="g2"> <goal name="g2">
</goal> </goal>
</theory> </theory>
<theory name="TestRewritePoly" sum="f0130f227c41947e0998709cc1c49883">
<goal name="g">
<transf name="rewrite" arg1="Append_assoc">
<goal name="g.0">
</goal>
</transf>
</goal>
</theory>
<theory name="Power" sum="53cae56d1419c17b838380453eb24720"> <theory name="Power" sum="53cae56d1419c17b838380453eb24720">
<goal name="power_1" proved="true"> <goal name="power_1" proved="true">
<proof prover="1"><result status="valid" time="0.17"/></proof> <proof prover="1"><result status="valid" time="0.17"/></proof>
...@@ -64,16 +73,71 @@ ...@@ -64,16 +73,71 @@
</goal> </goal>
</transf> </transf>
</goal> </goal>
<goal name="power_sum"> <goal name="power_sum" proved="true">
<transf name="induction" arg1="n"> <transf name="induction" proved="true" arg1="n">
<goal name="power_sum.0" proved="true"> <goal name="power_sum.0" proved="true">
<proof prover="1"><result status="valid" time="0.01"/></proof> <proof prover="1"><result status="valid" time="0.01"/></proof>
<proof prover="2"><result status="unknown" time="1.00"/></proof> <proof prover="2"><result status="unknown" time="1.00"/></proof>
</goal> </goal>
<goal name="power_sum.1"> <goal name="power_sum.1" proved="true">
<proof prover="0" obsolete="true"><result status="valid" time="0.87" steps="15"/></proof> <proof prover="0" obsolete="true"><result status="valid" time="0.87" steps="15"/></proof>
<proof prover="1" obsolete="true"><result status="timeout" time="1.00"/></proof> <proof prover="1" obsolete="true"><result status="timeout" time="1.00"/></proof>
<proof prover="2" obsolete="true"><result status="unknown" time="1.01"/></proof> <proof prover="2" obsolete="true"><result status="unknown" time="1.01"/></proof>
<transf name="case" proved="true" arg1="(n=0)">
<goal name="power_sum.1.0" proved="true">
<proof prover="1"><result status="valid" time="0.01"/></proof>
<proof prover="2"><result status="unknown" time="1.00"/></proof>
</goal>
<goal name="power_sum.1.1" proved="true">
<proof prover="0"><result status="timeout" time="1.00"/></proof>
<proof prover="1"><result status="timeout" time="1.00"/></proof>
<proof prover="2"><result status="unknown" time="1.10"/></proof>
<proof prover="3"><result status="unknown" time="0.00"/></proof>
<transf name="instantiate" proved="true" arg1="Hrec" arg2="(n-1)">
<goal name="power_sum.1.1.0" proved="true">
<proof prover="0"><result status="timeout" time="1.01"/></proof>
<proof prover="1"><result status="timeout" time="1.00"/></proof>
<proof prover="2"><result status="timeout" time="1.00"/></proof>
<proof prover="3"><result status="unknown" time="0.00"/></proof>
<transf name="replace" proved="true" arg1="(n+m)" arg2="((n-1)+m+1)">
<goal name="power_sum.1.1.0.0" proved="true">
<proof prover="0"><result status="valid" time="0.08" steps="14"/></proof>
<proof prover="1"><result status="timeout" time="1.00"/></proof>
<proof prover="2"><result status="timeout" time="1.00"/></proof>
</goal>
<goal name="power_sum.1.1.0.1" proved="true">
<proof prover="2"><result status="valid" time="0.00"/></proof>
</goal>
</transf>
</goal>
</transf>
</goal>
</transf>
<transf name="instantiate" proved="true" arg1="Hrec" arg2="(n-1)">
<goal name="power_sum.1.0" proved="true">
<transf name="replace" proved="true" arg1="(n+m)" arg2="((n-1)+m+1)">
<goal name="power_sum.1.0.0" proved="true">
<proof prover="0"><result status="valid" time="0.22" steps="29"/></proof>
<proof prover="1"><result status="timeout" time="1.00"/></proof>
<proof prover="2"><result status="timeout" time="1.00"/></proof>
</goal>
<goal name="power_sum.1.0.1" proved="true">
<proof prover="2"><result status="valid" time="0.00"/></proof>
</goal>
</transf>
</goal>
</transf>
<transf name="replace" arg1="(n+m)" arg2="((n-1)+m+1)">
<goal name="power_sum.1.0">
<proof prover="0"><result status="timeout" time="1.00"/></proof>
<proof prover="1"><result status="timeout" time="1.00"/></proof>
<proof prover="2"><result status="unknown" time="1.74"/></proof>
<proof prover="3"><result status="unknown" time="0.01"/></proof>
</goal>
<goal name="power_sum.1.1" proved="true">
<proof prover="2"><result status="valid" time="0.00"/></proof>
</goal>
</transf>
</goal> </goal>
</transf> </transf>
</goal> </goal>
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment