| (C.Appl _, e, []) -> (e,safes,n,nn,x)
| (_,_,_) -> raise (Impossible 7)
-and eat_prods n te =
+and drop_prods n te =
let module C = Cic in
let module R = CicReduction in
match (n, R.whd te) with
(0, _) -> te
- | (n, C.Prod (_,_,ta)) when n > 0 -> eat_prods (n - 1) ta
+ | (n, C.Prod (_,_,ta)) when n > 0 -> drop_prods (n - 1) ta
| (_, _) -> raise (Impossible 8)
and eat_lambdas n te =
C.InductiveDefinition (tl,_,paramsno) ->
let (_,isinductive,_,cl) = List.nth tl i in
let cl' =
- List.map (fun (id,ty,r) -> (id, eat_prods paramsno ty, r)) cl
+ List.map (fun (id,ty,r) -> (id, drop_prods paramsno ty, r)) cl
in
(isinductive,paramsno,cl')
| _ ->
C.InductiveDefinition (tl,_,paramsno) ->
let (_,isinductive,_,cl) = List.nth tl i in
let cl' =
- List.map (fun (id,ty,r) -> (id, eat_prods paramsno ty, r)) cl
+ List.map (fun (id,ty,r) -> (id, drop_prods paramsno ty, r)) cl
in
(isinductive,paramsno,cl')
| _ ->
C.InductiveDefinition (tl,_,paramsno) ->
let (_,isinductive,_,cl) = List.nth tl i in
let cl' =
- List.map (fun (id,ty,r) -> (id, eat_prods paramsno ty, r)) cl
+ List.map (fun (id,ty,r) -> (id, drop_prods paramsno ty, r)) cl
in
(isinductive,paramsno,cl')
| _ ->
C.InductiveDefinition (tl,_,paramsno) ->
let (_,isinductive,_,cl) = List.nth tl i in
let cl' =
- List.map (fun (id,ty,r) -> (id, eat_prods paramsno ty, r)) cl
+ List.map (fun (id,ty,r) -> (id, drop_prods paramsno ty, r)) cl
in
(isinductive,paramsno,cl')
| _ ->
let outsort = type_of_aux env outtype in
let (need_dummy, k) =
let rec guess_args t =
- match decast t with
+ match CicReduction.whd t with
C.Sort _ -> (true, 0)
| C.Prod (_, s, t) ->
let (b, n) = guess_args t in
let (_,ty,_) = List.nth fl i in
ty
- (* CSC: wrong name and position: decast really does Cast-LetIn reduction *)
- and decast =
- let module C = Cic in
- function
- C.Cast (t,_) -> decast t
- | C.LetIn (_,s,t) -> decast (CicSubstitution.subst s t)
- | t -> t
-
and sort_of_prod (t1, t2) =
let module C = Cic in
- match (decast t1, decast t2) with
+ let t1' = CicReduction.whd t1 in
+ let t2' = CicReduction.whd t2 in
+ match (t1', t2') with
(C.Sort s1, C.Sort s2)
when (s2 = C.Prop or s2 = C.Set) -> (* different from Coq manual!!! *)
C.Sort s2
| (C.Sort s1, C.Sort s2) -> C.Sort C.Type (*CSC manca la gestione degli universi!!! *)
| (_,_) ->
raise
- (NotWellTyped ("Prod: sort1= " ^ CicPp.ppterm t1 ^ " ;
- sort2= " ^ CicPp.ppterm t2))
+ (NotWellTyped
+ ("Prod: sort1= " ^ CicPp.ppterm t1' ^ " ; sort2= " ^ CicPp.ppterm t2'))
and eat_prods hetype =
(*CSC: siamo sicuri che le are_convertible non lavorino con termini non *)