Commit 349a0eb4 authored by Andrei Paskevich's avatar Andrei Paskevich

add inline_goal to transform/inlining

+ change inline_trivial: now we only inline right-linear
definitions where no variable occurs deeper than level 1.

Attention: this inlines definitions with arbitrarily complex
ground terms on the right-hand side - which might be a BAD IDEA,
but I still want to give it a try.

+ add find_logic_definition to Decl
parent e9bd8564
......@@ -592,6 +592,14 @@ let find_inductive_cases kn ps =
match (Mid.find ps.ls_name kn).d_node with
| Dind dl -> List.assq ps dl
| Dlogic _ -> []
| Dtype _ -> []
| _ -> assert false
let find_logic_definition kn ls =
match (Mid.find ls.ls_name kn).d_node with
| Dlogic dl -> List.assq ls dl
| Dind _ -> None
| Dtype _ -> None
| _ -> assert false
let find_prop kn pr =
......
......@@ -155,6 +155,7 @@ exception NonExhaustiveExpr of (pattern list * expr)
val find_constructors : known_map -> tysymbol -> lsymbol list
val find_inductive_cases : known_map -> lsymbol -> (prsymbol * fmla) list
val find_logic_definition : known_map -> lsymbol -> ls_defn option
val find_prop : known_map -> prsymbol -> fmla
val find_prop_decl : known_map -> prsymbol -> prop_kind * fmla
This diff is collapsed.
......@@ -17,8 +17,7 @@
(* *)
(**************************************************************************)
(** Inline the definitions not recursive *)
(** Inline non-recursive definitions *)
val meta : Theory.meta
......@@ -26,20 +25,26 @@ val meta : Theory.meta
val t :
?use_meta:bool ->
?in_goal:bool ->
notdeft:(Term.term -> bool) ->
notdeff:(Term.fmla -> bool) ->
notls :(Term.lsymbol -> bool) ->
Task.task Trans.trans
(** [t ~use_meta ~notdeft ~notdeff ~notls] returns a transformation which
inlines a symbol definition in the other definitions and propositions when
it verifies all of these conditions :
- Its definitions doesn't verify [notdeft] in case of a logic function or
[notdeff] in case of a predicate
- Its logic symbol doesn't verify [notls]
- use_meta is not set or its logic symbol is not tagged by "inline : no"
(** [t ~use_meta ~in_goal ~notdeft ~notdeff ~notls] returns a transformation
that expands a symbol [ls] in the subsequent declarations unless [ls]
satisfies one of the following conditions:
- [ls] is defined via a (mutually) recursive definition;
- [ls] is an inductive predicate or an algebraic type constructor;
- [ls] is a function symbol and [notdeft] returns true on its definition;
- [ls] is a predicate symbol and [notdeff] returns true on its definition;
- [notls ls] returns [true];
- [use_meta] is set and [ls] is tagged by "inline : no"
Notice that [use_meta], [notdeft], [notdeff], [notls] restrict only which
symbols are inlined not when.
If [in_goal] is set, only the top-most symbols in the goal are expanded.
*)
(** {2 Registered Transformation} *)
......@@ -47,7 +52,8 @@ val t :
val all : Task.task Trans.trans
(** [all] corresponds to the transformation "inline_all" *)
val goal : Task.task Trans.trans
(** [goal] corresponds to the transformation "inline_goal" *)
val trivial : Task.task Trans.trans
(** [trivial] corresponds to the transformation "inline_trivial"
......@@ -55,6 +61,7 @@ val trivial : Task.task Trans.trans
logic c : t = a
logic f(x : t,...., ) : t = g(y : t2,...) *)
(*
(** Functions to use in other transformations if inlining is needed *)
type env
......@@ -69,3 +76,4 @@ val addps : env -> Term.lsymbol -> Term.vsymbol list -> Term.fmla -> env
val replacet : env -> Term.term -> Term.term
val replacep : env -> Term.fmla -> Term.fmla
*)
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