Commit 1d343bdb authored by MARCHE Claude's avatar MARCHE Claude

New transformation eliminate_definition_if_poly, seems to work so far

parent b3443c82
...@@ -147,6 +147,7 @@ LIB_MLW = ity expr dexpr ...@@ -147,6 +147,7 @@ LIB_MLW = ity expr dexpr
LIB_PARSER = ptree glob parser typing lexer LIB_PARSER = ptree glob parser typing lexer
LIB_TRANSFORM = simplify_formula inlining split_goal induction \ LIB_TRANSFORM = simplify_formula inlining split_goal induction \
detect_polymorphism \
eliminate_definition eliminate_algebraic \ eliminate_definition eliminate_algebraic \
eliminate_inductive eliminate_let eliminate_if \ eliminate_inductive eliminate_let eliminate_if \
libencoding discriminate encoding encoding_select \ libencoding discriminate encoding encoding_select \
...@@ -156,8 +157,7 @@ LIB_TRANSFORM = simplify_formula inlining split_goal induction \ ...@@ -156,8 +157,7 @@ LIB_TRANSFORM = simplify_formula inlining split_goal induction \
introduction abstraction close_epsilon lift_epsilon \ introduction abstraction close_epsilon lift_epsilon \
eliminate_epsilon \ eliminate_epsilon \
eval_match instantiate_predicate smoke_detector \ eval_match instantiate_predicate smoke_detector \
reduction_engine compute induction_pr prop_curry \ reduction_engine compute induction_pr prop_curry
detect_polymorphism
LIB_PRINTER = alt_ergo why3printer smtv1 smtv2 coq pvs isabelle \ LIB_PRINTER = alt_ergo why3printer smtv1 smtv2 coq pvs isabelle \
simplify gappa cvc3 yices mathematica simplify gappa cvc3 yices mathematica
......
...@@ -79,9 +79,12 @@ let find_in_decl d = ...@@ -79,9 +79,12 @@ let find_in_decl d =
(**) (**)
let rec find_in_theory th = List.iter find_in_tdecl th.th_decls let (*
rec find_in_theory th = List.iter find_in_tdecl th.th_decls
and find_in_tdecl td = and
*)
find_in_tdecl td =
match td.td_node with match td.td_node with
| Decl d -> find_in_decl d | Decl d -> find_in_decl d
| Use _th -> | Use _th ->
......
val meta_monomorphic_types_only : Theory.meta
...@@ -431,7 +431,7 @@ let meta_elim = register_meta "eliminate_algebraic" [MTstring] ...@@ -431,7 +431,7 @@ let meta_elim = register_meta "eliminate_algebraic" [MTstring]
\"keep_types\" : @[keep algebraic type definitions@]@\n\ \"keep_types\" : @[keep algebraic type definitions@]@\n\
\"keep_enums\" : @[keep monomorphic enumeration types@]@\n\ \"keep_enums\" : @[keep monomorphic enumeration types@]@\n\
\"keep_recs\" : @[keep non-recursive records@]@\n\ \"keep_recs\" : @[keep non-recursive records@]@\n\
\"no_index\" : @[do not generate indexing funcitons@]@]" \"no_index\" : @[do not generate indexing functions@]@]"
let eliminate_algebraic = Trans.compose compile_match let eliminate_algebraic = Trans.compose compile_match
(Trans.on_meta meta_elim (fun ml -> (Trans.on_meta meta_elim (fun ml ->
......
...@@ -173,6 +173,19 @@ let () = ...@@ -173,6 +173,19 @@ let () =
~desc:"Same@ as@ eliminate_recursion,@ but@ only@ for@ mutually@ \ ~desc:"Same@ as@ eliminate_recursion,@ but@ only@ for@ mutually@ \
recursive@ definitions." recursive@ definitions."
(** conditional transformations, only applied when polymorphic types occur *)
let eliminate_definition_if_poly =
Trans.on_meta Detect_polymorphism.meta_monomorphic_types_only
(function
| [] -> eliminate_definition
| _ -> Trans.identity)
let () =
Trans.register_transform "eliminate_definition_if_poly"
eliminate_definition_if_poly
~desc:"Same@ as@ eliminate_definition@ but@ only@ if@ polymorphism@ appear.";
(** Bisect *) (** Bisect *)
open Task open Task
open Theory open Theory
......
...@@ -31,6 +31,16 @@ goal g : match Cons 42 Nil with Nil -> false | Cons x _ -> x=42 end ...@@ -31,6 +31,16 @@ goal g : match Cons 42 Nil with Nil -> false | Cons x _ -> x=42 end
end end
theory MonoSymb
function id (x:int) : int = x
goal g: forall x:int. id x = x
(* bin/why3prove.byte tests/test-poly.why --debug detect_poly -a detect_polymorphism -D why3 -T PolySymb -G g *)
end
theory PolySymb theory PolySymb
function id (x:'a) : 'a = x function id (x:'a) : 'a = x
......
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