X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Ftactics%2Finversion.ml;h=e381b3003d7b4940eba1b0886c007922066211d0;hb=f9512e878bd27f8cb5261bb18b0da0d42c8184d0;hp=f5e2a847690f2b4c20544c32d9a18ba25108177c;hpb=801f0eb3eabe1cbcd66d6a3f52c24eb8f1189611;p=helm.git diff --git a/components/tactics/inversion.ml b/components/tactics/inversion.ml index f5e2a8476..e381b3003 100644 --- a/components/tactics/inversion.ml +++ b/components/tactics/inversion.ml @@ -171,6 +171,7 @@ let isSetType paramty = ((Pervasives.compare (get_sort_type paramty) (Cic.Sort Cic.Prop)) != 0) +exception EqualityNotDefinedYet let private_inversion_tac ~term = let module T = CicTypeChecker in let module R = CicReduction in @@ -181,7 +182,11 @@ let private_inversion_tac ~term = (*DEBUG*) debug_print (lazy ("private inversion begins")); let (_,metasenv,_,_) = proof in - let uri_of_eq = LibraryObjects.eq_URI () in + let uri_of_eq = + match LibraryObjects.eq_URI () with + None -> raise EqualityNotDefinedYet + | Some uri -> uri + in let (_,context,goalty) = CicUtil.lookup_meta goal metasenv in let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in let uri = baseuri_of_term termty in @@ -301,14 +306,17 @@ let inversion_tac ~term = let (_,metasenv,_,_) = proof in let (_,context,goalty) = CicUtil.lookup_meta goal metasenv in let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in - let uri = baseuri_of_term termty in + let uri, typeno = + match termty with + | Cic.MutInd (uri,typeno,_) + | Cic.Appl(Cic.MutInd (uri,typeno,_)::_) -> uri,typeno + | _ -> assert false + in + (* let uri = baseuri_of_term termty in *) let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in let name,nleft,arity,cons_list = match obj with Cic.InductiveDefinition (tys,_,nleft,_) -> - (*we suppose there is only one inductiveType in the definition, - so typeno=0 identically *) - let typeno = 0 in let (name,_,arity,cons_list) = List.nth tys typeno in (name,nleft,arity,cons_list) |_ -> assert false