aboutsummaryrefslogtreecommitdiff
path: root/pretyping/inductiveops.ml
diff options
context:
space:
mode:
authorGaëtan Gilbert2019-06-13 15:39:43 +0200
committerGaëtan Gilbert2020-07-01 13:06:22 +0200
commit2ded4c25e532c5dfca0483c211653768ebed01a7 (patch)
treea04b2f787490c8971590e6bdf7dd1ec4220e0290 /pretyping/inductiveops.ml
parentb017e302f69f20fc4fc3d4088a305194f6c387fa (diff)
UIP in SProp
Diffstat (limited to 'pretyping/inductiveops.ml')
-rw-r--r--pretyping/inductiveops.ml20
1 files changed, 16 insertions, 4 deletions
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index e77c5082dd..23145b1629 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -66,6 +66,8 @@ let relevance_of_inductive_family env ((ind,_),_ : inductive_family) =
type inductive_type = IndType of inductive_family * EConstr.constr list
+let ind_of_ind_type = function IndType (((ind,_),_),_) -> ind
+
let make_ind_type (indf, realargs) = IndType (indf,realargs)
let dest_ind_type (IndType (indf,realargs)) = (indf,realargs)
@@ -332,16 +334,26 @@ let get_constructors env (ind,params) =
let get_projections = Environ.get_projections
-let make_case_or_project env sigma indf ci pred c branches =
+let make_case_invert env (IndType (((ind,u),params),indices)) ci =
+ if Typeops.should_invert_case env ci
+ then
+ let univs = EConstr.EInstance.make u in
+ let params = Array.map_of_list EConstr.of_constr params in
+ let args = Array.append params (Array.of_list indices) in
+ CaseInvert {univs;args}
+ else NoInvert
+
+let make_case_or_project env sigma indt ci pred c branches =
let open EConstr in
- let projs = get_projections env (fst (fst indf)) in
+ let IndType (((ind,_),_),_) = indt in
+ let projs = get_projections env ind in
match projs with
- | None -> (mkCase (ci, pred, c, branches))
+ | None ->
+ mkCase (ci, pred, make_case_invert env indt ci, c, branches)
| Some ps ->
assert(Array.length branches == 1);
let na, ty, t = destLambda sigma pred in
let () =
- let (ind, _), _ = dest_ind_family indf in
let mib, _ = Inductive.lookup_mind_specif env ind in
if (* dependent *) not (Vars.noccurn sigma 1 t) &&
not (has_dependent_elim mib) then