]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_proof_checking/cicReduction.ml
* (Head) beta reduction functions factorized
[helm.git] / helm / ocaml / cic_proof_checking / cicReduction.ml
index 63a8f550323a8ac9ad9fd8fd90b609158ef230f4..14b858491d8c55c8e4c9010ecb5781836e796845 100644 (file)
@@ -1086,3 +1086,19 @@ let normalize ?delta ?subst ctx term =
   t
   
   
+(* performs an head beta/cast reduction *)
+let rec head_beta_reduce =
+ function
+    (Cic.Appl (Cic.Lambda (_,_,t)::he'::tl')) ->
+      let he'' = CicSubstitution.subst he' t in
+       if tl' = [] then
+        he''
+       else
+        let he''' =
+         match he'' with
+            Cic.Appl l -> Cic.Appl (l@tl')
+          | _ -> Cic.Appl (he''::tl')
+        in
+         head_beta_reduce he'''
+  | Cic.Cast (te,_) -> head_beta_reduce te
+  | t -> t