X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_kernel%2FnCicReduction.ml;h=1815ceedfcf5c87e9d387068ffbfb039c76763ff;hb=32d3f10c1904d450ce8ea3525230acc6980a5601;hp=0393fbcdd7f5927d06cb44c0903f8d91f352ec3d;hpb=7bc72d8afaebb1d2070a26b07f9bf4242b648e2c;p=helm.git diff --git a/helm/software/components/ng_kernel/nCicReduction.ml b/helm/software/components/ng_kernel/nCicReduction.ml index 0393fbcdd..1815ceedf 100644 --- a/helm/software/components/ng_kernel/nCicReduction.ml +++ b/helm/software/components/ng_kernel/nCicReduction.ml @@ -15,6 +15,8 @@ module C = NCic module Ref = NReference module E = NCicEnvironment +exception AssertFailure of string Lazy.t;; + module type Strategy = sig type stack_term type env_term @@ -400,8 +402,18 @@ let from_stack = RS.from_stack let unwind = R.unwind let _ = - NCicUtils.set_head_beta_reduce (fun ~upto t -> head_beta_reduce ~upto t) + NCicUtils.set_head_beta_reduce (fun ~upto t -> head_beta_reduce ~upto t); + NCicPp.set_head_beta_reduce (fun ~upto t -> head_beta_reduce ~upto t); ;; +(* if n < 0, then splits all prods from an arity, returning a sort *) +let rec split_prods ~subst context n te = + match (n, R.whd ~subst context te) with + | (0, _) -> context,te + | (n, C.Sort _) when n <= 0 -> context,te + | (n, C.Prod (name,so,ta)) -> + split_prods ~subst ((name,(C.Decl so))::context) (n - 1) ta + | (_, _) -> raise (AssertFailure (lazy "split_prods")) +;; (* vim:set foldmethod=marker: *)