| C.Abst _ as t -> t (*CSC l should be empty ????? *)
| C.MutInd (uri,_,_) as t -> if l = [] then t else C.Appl (t::l)
| C.MutConstruct (uri,_,_,_) as t -> if l = [] then t else C.Appl (t::l)
- | C.MutCase (mutind,cookingsno,i,_,term,pl) as t ->
+ | C.MutCase (mutind,cookingsno,i,_,term,pl) as t->
let decofix =
function
C.CoFix (i,fl) as t ->
whdaux (ts@l) (List.nth pl (j-1))
| C.Abst _| C.Cast _ | C.Implicit ->
raise (Impossible 2) (* we don't trust our whd ;-) *)
- | _ -> t
+ | _ -> if l = [] then t else C.Appl (t::l)
)
| C.Fix (i,fl) as t ->
let (_,recindex,_,body) = List.nth fl i in
;;
(* t1, t2 must be well-typed *)
-let are_convertible t1 t2 =
+let are_convertible =
let module U = UriManager in
let rec aux t1 t2 =
- debug t1 [t2] "PREWHD";
+ let aux2 t1 t2 =
(* this trivial euristic cuts down the total time of about five times ;-) *)
(* this because most of the time t1 and t2 are "sintactically" the same *)
if t1 = t2 then
else
begin
let module C = Cic in
- let t1' = whd t1
- and t2' = whd t2 in
- debug t1' [t2'] "POSTWHD";
- (*if !fdebug = 0 then ignore(Unix.system "read" );*)
- match (t1',t2') with
+ match (t1,t2) with
(C.Rel n1, C.Rel n2) -> n1 = n2
| (C.Var uri1, C.Var uri2) -> U.eq uri1 uri2
| (C.Meta n1, C.Meta n2) -> n1 = n2
| (C.Abst _, _) | (_, C.Abst _) | (C.Cast _, _) | (_, C.Cast _)
| (C.Implicit, _) | (_, C.Implicit) ->
raise (Impossible 3) (* we don't trust our whd ;-) *)
- | (_,_) ->
- debug t1' [t2'] "NOT-CONVERTIBLE" ;
- false
+ | (_,_) -> false
+ end
+ in
+ if aux2 t1 t2 then true
+ else
+ begin
+ debug t1 [t2] "PREWHD";
+ let t1' = whd t1
+ and t2' = whd t2 in
+ debug t1' [t2'] "POSTWHD";
+ aux2 t1' t2'
end
in
- aux t1 t2
+ aux
;;