| NReference.Ref (_, uri, (NReference.Fix (fixno,_)|NReference.CoFix fixno))->
(match get_checked_obj uri with
| _,height,_,_, NCic.Fixpoint (is_fix,funcs,att) when is_fix = b ->
- let rlv, name, _, ty, bo = List.nth funcs fixno in
- rlv, name, bo, ty, att, height
+ funcs, att, height
| _ ->prerr_endline "get_checked_(co)fix on a non (co)fix 2";assert false)
| r -> prerr_endline ("get_checked_(co)fix on " ^ NReference.string_of_reference r); assert false
;;
-let get_checked_fix r = get_checked_fix_or_cofix true r;;
-let get_checked_cofix r = get_checked_fix_or_cofix false r;;
+let get_checked_fixes r = get_checked_fix_or_cofix true r;;
+let get_checked_cofixes r = get_checked_fix_or_cofix false r;;
let get_indty_leftno = function
| NReference.Ref (_, uri, NReference.Ind _)
NReference.reference ->
bool * int * NCic.inductiveType list * NCic.i_attr * int
-val get_checked_fix:
+val get_checked_fixes:
NReference.reference ->
- NCic.relevance * string * NCic.term * NCic.term * NCic.f_attr * int
+ NCic.inductiveFun list * NCic.f_attr * int
-val get_checked_cofix:
+val get_checked_cofixes:
NReference.reference ->
- NCic.relevance * string * NCic.term * NCic.term * NCic.f_attr * int
+ NCic.inductiveFun list * NCic.f_attr * int
val get_indty_leftno: NReference.reference -> int
let _,_,body,_,_,height = NCicEnvironment.get_checked_def refer in
if delta > height then config else aux (0, [], body, s)
| (_, _, NCic.Const (NReference.Ref
- (_,_,NReference.Fix (_,recindex)) as refer),s) as config ->
- let _,_,body,_, _, height = NCicEnvironment.get_checked_fix refer in
+ (_,_,NReference.Fix (fixno,recindex)) as refer),s) as config ->
+ let fixes,_, height = NCicEnvironment.get_checked_fixes refer in
if delta > height then config else
(match
try Some (RS.from_stack (List.nth s recindex))
let new_s =
replace recindex s (RS.compute_to_stack ~reduce:aux ~unwind c)
in
+ let _,_,_,_,body = List.nth fixes fixno in
aux (0, [], body, new_s)
| _ -> config)
| (_, _, NCic.Const _, _) as config -> config
| (k, e, NCic.Match (_,_,term,pl),s) as config ->
let decofix = function
- | (_,_,NCic.Const(NReference.Ref(_,_,NReference.CoFix _)as refer),s)->
- let _,_,body,_,_,_ = NCicEnvironment.get_checked_cofix refer in
+ | (_,_,NCic.Const(NReference.Ref(_,_,NReference.CoFix c)as refer),s)->
+ let cofixes,_,_ = NCicEnvironment.get_checked_cofixes refer in
+ let _,_,_,_,body = List.nth cofixes c in
reduce ~delta:0 ~subst context (0,[],body,s)
| config -> config
in
and guarded_by_destructors ~subst ~metasenv context recfuns t =
let recursor f k t = NCicUtils.fold shift_k k (fun k () -> f k) () t in
- let rec aux (context, recfuns, x, safes as k) = function
+ let rec aux (context, recfuns, x, safes as k) t =
+ match R.whd ~subst context t with (* TODO: use ~delta:false as mush as poss*)
| C.Rel m as t when List.mem_assoc m recfuns ->
raise (NotGuarded (lazy
(NCicPp.ppterm ~subst ~metasenv ~context t ^ " passed around")))
raise (NotGuarded (lazy
(NCicPp.ppterm ~context ~subst ~metasenv rec_arg ^ " not smaller")));
List.iter (aux k) tl
+ (*
+ | C.Appl (C.Const ((Ref.Ref (_,_,Ref.Fix (i,j))) as r)::args) ->
+ List.iter (aux k) args;
+ let fixes,_,_ = E.get_checked_fixes r in
+ let _,_,_,_,bo = List.nth fixes i in
+ let bo_wout_lam, context = eat_lambdas ~subst ~metasenv context j in
+ (* debruijna body..... *) assert false
+*)
| C.Match (Ref.Ref (_,uri,_) as ref,outtype,term,pl) as t ->
(match R.whd ~subst context term with
| C.Rel m | C.Appl (C.Rel m :: _ ) as t when List.mem m safes || m = x ->