]> matita.cs.unibo.it Git - helm.git/commitdiff
Simplification euristic improved.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 4 Dec 2002 14:29:52 +0000 (14:29 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 4 Dec 2002 14:29:52 +0000 (14:29 +0000)
It is now able to simplify a Fix which expands to an expressions which
simplifiable Fixes therein.

helm/gTopLevel/proofEngineReduction.ml

index 21f2cbebf72aa68f375e204345dbed3a52b717c0..04bfe9ae5e297de46e120cb3dc092826343995d6 100644 (file)
@@ -42,6 +42,7 @@ exception ReferenceToVariable;;
 exception ReferenceToCurrentProof;;
 exception ReferenceToInductiveDefinition;;
 exception WrongUriToInductiveDefinition;;
+exception WrongUriToConstant;;
 exception RelToHiddenHypothesis;;
 
 let alpha_equivalence =
@@ -475,7 +476,7 @@ exception AlreadySimplified;;
 (*CSC: It does not perform simplification in a Case *)
 let simpl context =
  (* reduceaux is equal to the reduceaux locally defined inside *)
- (*reduce, but for the const case.                             *) 
+ (* reduce, but for the const case.                            *) 
  (**** Step 1 ****)
  let rec reduceaux context l =
   let module C = Cic in
@@ -584,12 +585,15 @@ let simpl context =
                in
                 (**** Step 3 ****)
                 let term_to_fold =
-                 match constant_args with
-                    [] -> C.Const (uri,exp_named_subst')
-                  | _ -> C.Appl ((C.Const(uri,exp_named_subst'))::constant_args)
+                 let body' = CicSubstitution.subst_vars exp_named_subst' body in
+                  match constant_args with
+                     [] -> body'
+                   | _ -> C.Appl (body'::constant_args)
                 in
-                 let reduced_term_to_fold = reduce context term_to_fold in
-                  replace (=) reduced_term_to_fold term_to_fold res
+                 let simplified_term_to_fold =
+                  reduceaux context [] term_to_fold
+                 in
+                  replace (=) simplified_term_to_fold term_to_fold res
               with
                  WrongShape ->
                   (* The constant does not unfold to a Fix lambda-abstracted  *)