Commit 08e10dd9 authored by MARCHE Claude's avatar MARCHE Claude

Fix stmv2 printer for algebraic data types: CVC4 requires a strict syntax

parent b62e0ffd
prelude "(set-logic ALL_SUPPORTED)"
(*
prelude "(set-logic AUFNIRA)" (* how come bv is supported by cvc4 in this logic ?!? *) prelude "(set-logic AUFNIRA)" (* how come bv is supported by cvc4 in this logic ?!? *)
*)
(** A : Array (** A : Array
UF : Uninterpreted Function UF : Uninterpreted Function
DT : Datatypes (not needed at the end ...) DT : Datatypes (not needed at the end ...)
......
...@@ -24,7 +24,7 @@ transformation "eliminate_builtin" ...@@ -24,7 +24,7 @@ transformation "eliminate_builtin"
transformation "detect_polymorphism" transformation "detect_polymorphism"
transformation "eliminate_definition_if_poly" transformation "eliminate_definition_if_poly"
transformation "eliminate_inductive" transformation "eliminate_inductive"
transformation "eliminate_algebraic" transformation "eliminate_algebraic_if_poly"
transformation "eliminate_epsilon" transformation "eliminate_epsilon"
transformation "simplify_formula" transformation "simplify_formula"
......
This diff is collapsed.
...@@ -256,11 +256,20 @@ let print_prop_decl info fmt k pr f = match k with ...@@ -256,11 +256,20 @@ let print_prop_decl info fmt k pr f = match k with
let print_constructor_decl info fmt (ls,args) = let print_constructor_decl info fmt (ls,args) =
match args with match args with
| [] -> print_ident fmt ls.ls_name | [] -> fprintf fmt "(%a)" print_ident ls.ls_name
| _ -> | _ ->
fprintf fmt "@[(%a@ %a)@]" fprintf fmt "@[(%a@ " print_ident ls.ls_name;
print_ident ls.ls_name let _ =
(print_list space (print_type info)) ls.ls_args List.fold_left2
(fun i ty pr ->
begin match pr with
| Some pr -> fprintf fmt "(%a" print_ident pr.ls_name
| None -> fprintf fmt "(%a_proj_%d" print_ident ls.ls_name i
end;
fprintf fmt " %a)" (print_type info) ty;
succ i) 1 ls.ls_args args
in
fprintf fmt ")@]"
let print_data_decl info fmt (ts,cl) = let print_data_decl info fmt (ts,cl) =
fprintf fmt "@[(%a@ %a)@]" fprintf fmt "@[(%a@ %a)@]"
......
...@@ -493,3 +493,17 @@ let () = ...@@ -493,3 +493,17 @@ let () =
~desc:"Replace@ algebraic@ data@ types@ by@ first-order@ definitions."; ~desc:"Replace@ algebraic@ data@ types@ by@ first-order@ definitions.";
Trans.register_transform "eliminate_projections" eliminate_projections Trans.register_transform "eliminate_projections" eliminate_projections
~desc:"Define@ algebraic@ projection@ symbols@ separately." ~desc:"Define@ algebraic@ projection@ symbols@ separately."
(** conditional transformations, only applied when polymorphic types occur *)
let eliminate_algebraic_if_poly =
Trans.on_meta Detect_polymorphism.meta_monomorphic_types_only
(function
| [] -> eliminate_algebraic
| _ -> Trans.identity)
let () =
Trans.register_transform "eliminate_algebraic_if_poly"
eliminate_algebraic_if_poly
~desc:"Same@ as@ eliminate_algebraic@ but@ only@ if@ polymorphism@ appear."
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