and is_really_smaller ~subst ~metasenv (context, recfuns, x, safes as k) te =
match R.whd ~subst context te with
| C.Rel m when List.mem m safes -> true
- | C.Rel _ -> false
- | C.LetIn _ -> raise (AssertFailure (lazy "letin after whd"))
- | C.Sort _ | C.Implicit _ | C.Prod _ | C.Lambda _
- | C.Const (Ref.Ref (_,_,(Ref.Decl | Ref.Def | Ref.Ind _ | Ref.CoFix _))) ->
- raise (AssertFailure (lazy "not a constructor"))
- | C.Appl ([]|[_]) -> raise (AssertFailure (lazy "empty/unary appl"))
- | C.Appl (he::_) ->
- (*CSC: sulla coda ci vogliono dei controlli? secondo noi no, ma *)
- (*CSC: solo perche' non abbiamo trovato controesempi *)
- (*TASSI: da capire soprattutto se he รจ un altro fix che non ha ridotto...*)
- is_really_smaller ~subst ~metasenv k he
+ | C.Lambda (name, s, t) ->
+ is_really_smaller ~subst ~metasenv (shift_k (name, C.Decl s) k) t
+ | C.Rel _
+ | C.Appl _
| C.Const (Ref.Ref (_,_,Ref.Con _)) -> false
| C.Const (Ref.Ref (_,_,Ref.Fix _)) -> assert false
(*| C.Fix (_, fl) ->
is_really_smaller ~subst (tys@context) n_plus_len nn_plus_len kl
x_plus_len safes' bo
) fl true*)
- | C.Meta _ ->
- true (* XXX if this check is repeated when the user completes the
- definition *)
+ | C.Meta _ -> true
| C.Match (Ref.Ref (_,uri,_) as ref,outtype,term,pl) ->
(match term with
| C.Rel m | C.Appl (C.Rel m :: _ ) when List.mem m safes || m = x ->
is_really_smaller ~subst ~metasenv k e)
pl cl
| _ -> List.for_all (is_really_smaller ~subst ~metasenv k) pl)
+ | _ -> assert false
and returns_a_coinductive ~subst context ty =
match R.whd ~subst context ty with