Commit b926f9f0 authored by François Bobot's avatar François Bobot

encoding : guard encoding

Currently all the variables that appear in the return value
are used as supplementarry argument.
parent 7f8a73c9
...@@ -128,7 +128,7 @@ LIB_TRANSFORM = simplify_recursive_definition simplify_formula \ ...@@ -128,7 +128,7 @@ LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
eliminate_inductive eliminate_let eliminate_if \ eliminate_inductive eliminate_let eliminate_if \
encoding_enumeration encoding encoding_decorate_mono \ encoding_enumeration encoding encoding_decorate_mono \
libencoding encoding_decorate encoding_bridge \ libencoding encoding_decorate encoding_bridge \
encoding_explicit encoding_sort \ encoding_explicit encoding_guard encoding_sort \
encoding_instantiate simplify_array filter_trigger \ encoding_instantiate simplify_array filter_trigger \
encoding_arrays \ encoding_arrays \
introduction abstraction close_epsilon lift_epsilon introduction abstraction close_epsilon lift_epsilon
......
This diff is collapsed.
...@@ -50,13 +50,16 @@ let rec term_of_ty tvmap ty = match ty.ty_node with ...@@ -50,13 +50,16 @@ let rec term_of_ty tvmap ty = match ty.ty_node with
t_app (ls_of_ts ts) (List.map (term_of_ty tvmap) tl) ty_type t_app (ls_of_ts ts) (List.map (term_of_ty tvmap) tl) ty_type
(* rewrite a closed formula modulo its free typevars *) (* rewrite a closed formula modulo its free typevars *)
let f_type_close fn f = let type_close tvs fn f =
let tvs = f_ty_freevars Stv.empty f in
let get_vs tv = create_vsymbol (id_clone tv.tv_name) ty_type in let get_vs tv = create_vsymbol (id_clone tv.tv_name) ty_type in
let tvm = Stv.fold (fun v m -> Mtv.add v (get_vs v) m) tvs Mtv.empty in let tvm = Stv.fold (fun v m -> Mtv.add v (get_vs v) m) tvs Mtv.empty in
let vl = Mtv.fold (fun _ vs acc -> vs::acc) tvm [] in let vl = Mtv.fold (fun _ vs acc -> vs::acc) tvm [] in
f_forall_close_simp vl [] (fn tvm f) f_forall_close_simp vl [] (fn tvm f)
let f_type_close fn f =
let tvs = f_ty_freevars Stv.empty f in
type_close tvs fn f
(* convert a type declaration to a list of lsymbol declarations *) (* convert a type declaration to a list of lsymbol declarations *)
let lsdecl_of_tydecl tdl = let lsdecl_of_tydecl tdl =
let add td acc = match td with let add td acc = match td with
...@@ -106,8 +109,8 @@ let rec t_monomorph ty_base kept lsmap consts vmap t = ...@@ -106,8 +109,8 @@ let rec t_monomorph ty_base kept lsmap consts vmap t =
let ls = ls_of_const ty_base t in let ls = ls_of_const ty_base t in
consts := Sls.add ls !consts; consts := Sls.add ls !consts;
t_app ls [] ty_base t_app ls [] ty_base
| Tapp (fs,_) when is_ls_of_ts fs -> (* | Tapp (fs,_) when is_ls_of_ts fs -> *)
t (* t *)
| Tapp (fs,tl) -> | Tapp (fs,tl) ->
let fs = lsmap fs in let fs = lsmap fs in
let ty = of_option fs.ls_value in let ty = of_option fs.ls_value in
...@@ -176,7 +179,7 @@ let d_monomorph ty_base kept lsmap d = ...@@ -176,7 +179,7 @@ let d_monomorph ty_base kept lsmap d =
| Dlogic ldl -> | Dlogic ldl ->
let conv (ls,ld) = let conv (ls,ld) =
let ls = let ls =
if ls_equal ls ps_equ || is_ls_of_ts ls then ls else lsmap ls if ls_equal ls ps_equ (* || is_ls_of_ts ls *) then ls else lsmap ls
in in
match ld with match ld with
| Some ld -> | Some ld ->
......
...@@ -39,6 +39,9 @@ val is_ls_of_ts : lsymbol -> bool ...@@ -39,6 +39,9 @@ val is_ls_of_ts : lsymbol -> bool
(* convert a type to a term of type ty_type *) (* convert a type to a term of type ty_type *)
val term_of_ty : vsymbol Mtv.t -> ty -> term val term_of_ty : vsymbol Mtv.t -> ty -> term
(* rewrite a closed formula modulo the given free typevars *)
val type_close : Stv.t -> (vsymbol Mtv.t -> 'a -> fmla) -> 'a -> fmla
(* rewrite a closed formula modulo its free typevars *) (* rewrite a closed formula modulo its free typevars *)
val f_type_close : (vsymbol Mtv.t -> fmla -> fmla) -> fmla -> fmla val f_type_close : (vsymbol Mtv.t -> fmla -> fmla) -> fmla -> fmla
......
...@@ -47,7 +47,14 @@ theory Test_simplify_array2 ...@@ -47,7 +47,14 @@ theory Test_simplify_array2
type t2 'a type t2 'a
goal G1 : forall y:int. forall x:t2 int. forall m: t int (t2 int). goal G1 : forall y:int. forall x:t2 int. forall m: t int (t2 int).
get (set m y x) y = x get (set m y x) y = x
end
theory Test_guard
type t
logic f t : t
logic a : t
logic b : t
goal G : forall x:t. f a = x
end end
theory Test_conjunction theory Test_conjunction
......
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