aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorEnrico Tassi2014-05-19 12:47:36 +0200
committerEnrico Tassi2014-06-08 11:17:05 +0200
commite1ba72037191b1d4be9de8a0a8fc1faa24eeb12c (patch)
tree473bbf9f27b67fc1f33e46d2fa90f3b8c031ca2b /kernel
parentcaf650182e3b223a51af7197296a5f3513a08611 (diff)
ind_tables: always declare side effects (Closes: HOTT#110)
declare takes care of ignoring side effects that are available in the global environment. This is yet another instance of what the "abominion" (aka abstract) can do: the code was checking for the existence in the environment of the elimination principle, and not regenerating it (nor declaring the corresponding side effect) if the elimination principle is used twice. Of course to functionalize the imperative actions on the environment when two proofs generated by abstract use the same elim principle, such elim principle has to be inlined twice, once in each abstracted proof. In other words, a side effect generated by a tactic inside an abstract is *global* but will be made local, si it must always be declared, no matter what. Now the system works like this: - side effects are always declared, even if a caching mechanism thinks the constant is already there (it can be there, no need to regenerate it but the intent to generate it *must* be declared anyhow) - at Qed time, we filter the list of side effects and decide which ones are really needed to be inlined. bottom line: STOP using abstract.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/declareops.ml2
-rw-r--r--kernel/term_typing.ml4
2 files changed, 5 insertions, 1 deletions
diff --git a/kernel/declareops.ml b/kernel/declareops.ml
index dd906bab24..149eeba287 100644
--- a/kernel/declareops.ml
+++ b/kernel/declareops.ml
@@ -284,7 +284,7 @@ type side_effects = side_effect list
let no_seff = ([] : side_effects)
let iter_side_effects f l = List.iter f (List.rev l)
let fold_side_effects f a l = List.fold_left f a l
-let uniquize_side_effects l = l (** FIXME: there is something dubious here *)
+let uniquize_side_effects l = CList.uniquize l
let union_side_effects l1 l2 = l1 @ l2
let flatten_side_effects l = List.flatten l
let side_effects_of_list l = l
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml
index 8c4ec8cbfc..770c720d89 100644
--- a/kernel/term_typing.ml
+++ b/kernel/term_typing.ml
@@ -64,6 +64,10 @@ let handle_side_effects env body side_eff =
let cbl = match se with
| SEsubproof (c,cb) -> [c,cb]
| SEscheme (cl,_) -> List.map (fun (_,c,cb) -> c,cb) cl in
+ let not_exists (c,_) =
+ try ignore(Environ.lookup_constant c env); false
+ with Not_found -> true in
+ let cbl = List.filter not_exists cbl in
let cname c =
let name = string_of_con c in
for i = 0 to String.length name - 1 do