diff options
| author | Hugo Herbelin | 2014-10-31 17:29:49 +0100 |
|---|---|---|
| committer | Hugo Herbelin | 2014-10-31 18:49:05 +0100 |
| commit | 1177da32723fd46a82b66ca7ffe4d13d93480da6 (patch) | |
| tree | 8d66f89beafc497e529bdcefd2372bdd23d90cba /pretyping | |
| parent | 801cd9cb0559d3b78216da166044bd02348ed9af (diff) | |
Reorganization of the test for generic selection of occurrences in
clause; extended it so that an induction over "x" is considered
generic when the clause has the form "in H |-" (w/o the conclusion)
and x does not occur in the conclusion.
Diffstat (limited to 'pretyping')
| -rw-r--r-- | pretyping/locusops.ml | 14 | ||||
| -rw-r--r-- | pretyping/locusops.mli | 2 | ||||
| -rw-r--r-- | pretyping/unification.ml | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/pretyping/locusops.ml b/pretyping/locusops.ml index 7e825b6c24..cc19f01f80 100644 --- a/pretyping/locusops.ml +++ b/pretyping/locusops.ml @@ -102,7 +102,13 @@ let occurrences_of_goal cls = let in_every_hyp cls = Option.is_empty cls.onhyps -let has_selected_occurrences cls = - cls.concl_occs != AllOccurrences || - not (Option.is_empty cls.onhyps) && List.exists (fun ((occs,_),hl) -> - occs != AllOccurrences || hl != InHyp) (Option.get cls.onhyps) +let clause_with_generic_occurrences cls = + let hyps = match cls.onhyps with + | None -> true + | Some hyps -> + List.for_all + (function ((AllOccurrences,_),InHyp) -> true | _ -> false) hyps in + let concl = match cls.concl_occs with + | AllOccurrences | NoOccurrences -> true + | _ -> false in + hyps && concl diff --git a/pretyping/locusops.mli b/pretyping/locusops.mli index c1bf2d9eae..1d7c6b72eb 100644 --- a/pretyping/locusops.mli +++ b/pretyping/locusops.mli @@ -42,4 +42,4 @@ val occurrences_of_hyp : Id.t -> clause -> (occurrences * hyp_location_flag) val occurrences_of_goal : clause -> occurrences val in_every_hyp : clause -> bool -val has_selected_occurrences : clause -> bool +val clause_with_generic_occurrences : 'a clause_expr -> bool diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 3f2963bfe5..3f6a4e307f 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -1468,7 +1468,7 @@ let make_abstraction_core name (test,out) env sigma c ty occs check_occs concl = else x in - let likefirst = not (has_selected_occurrences occs) in + let likefirst = clause_with_generic_occurrences occs in let mkvarid () = mkVar id in let compute_dependency _ (hyp,_,_ as d) (sign,depdecls) = match occurrences_of_hyp hyp occs with @@ -1508,7 +1508,7 @@ let make_abstraction_core name (test,out) env sigma c ty occs check_occs concl = in let lastlhyp = if List.is_empty depdecls then None else Some (pi1(List.last depdecls)) in - (id,sign,depdecls,lastlhyp,ccl,out test) + (id,sign,depdecls,lastlhyp,ccl,out test) with SubtermUnificationError e -> raise (PretypeError (env,sigma,CannotUnifyOccurrences e)) |
