(* TODO unify exceptions *)
-exception WrongUriToInductiveDefinition;;
-exception Impossible of int;;
-exception ReferenceToConstant;;
-exception ReferenceToVariable;;
-exception ReferenceToCurrentProof;;
-exception ReferenceToInductiveDefinition;;
-
-let debug = false
-let profile = false
-let debug_print s = if debug then prerr_endline (Lazy.force s)
-
-let fdebug = ref 1;;
-let debug t env s =
- let rec debug_aux t i =
- let module C = Cic in
- let module U = UriManager in
- CicPp.ppobj (C.Variable ("DEBUG", None, t, [], [])) ^ "\n" ^ i
- in
- if !fdebug = 0 then
- debug_print (lazy (s ^ "\n" ^ List.fold_right debug_aux (t::env) ""))
-;;
-
module type Strategy =
sig
type stack_term
in
aux (k, e, he, tl' @ s)
| (_, _, NCic.Const
- (NReference.Ref (_,_,NReference.Def) as refer), s) as config ->
- let _,_,body,_,_,height = NCicEnvironment.get_checked_def refer in
- if delta > height then config else aux (0, [], body, s)
+ (NReference.Ref (height,_,NReference.Def) as refer), s) as config ->
+ if delta > height then config else
+ let _,_,body,_,_,_ = NCicEnvironment.get_checked_def refer in
+ aux (0, [], body, s)
| (_, _, NCic.Const (NReference.Ref
- (_,_,NReference.Fix (fixno,recindex)) as refer),s) as config ->
- let fixes,_, height = NCicEnvironment.get_checked_fixes refer in
+ (height,_,NReference.Fix (fixno,recindex)) as refer),s) as config ->
if delta > height then config else
(match
try Some (RS.from_stack (List.nth s recindex))
with
| None -> config
| Some recparam ->
+ let fixes,_,_ = NCicEnvironment.get_checked_fixes_or_cofixes refer in
match reduce ~delta:0 ~subst context recparam with
| (_,_,NCic.Const (NReference.Ref (_,_,NReference.Con _)), _) as c ->
let new_s =
| (k, e, NCic.Match (_,_,term,pl),s) as config ->
let decofix = function
| (_,_,NCic.Const(NReference.Ref(_,_,NReference.CoFix c)as refer),s)->
- let cofixes,_,_ = NCicEnvironment.get_checked_cofixes refer in
+ let cofixes,_,_ = NCicEnvironment.get_checked_fixes_or_cofixes refer in
let _,_,_,_,body = List.nth cofixes c in
reduce ~delta:0 ~subst context (0,[],body,s)
| config -> config