]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaEngine.ml
1. Tactic generalize ported to patterns and activated in matita.
[helm.git] / helm / matita / matitaEngine.ml
index a9c85e7d86f1ccd3b0dc6ddcb4b336ca5b725e9c..7302e3bde0ff6d5e2b5b012192e87f78fa56ad14 100644 (file)
@@ -30,8 +30,12 @@ let tactic_of_ast = function
   | TacticAst.Reflexivity _ -> Tactics.reflexivity
   | TacticAst.Assumption _ -> Tactics.assumption
   | TacticAst.Contradiction _ -> Tactics.contradiction
+(*
+  | TacticAst.Discriminate (_,id) -> Tactics.discriminate id
+*)
   | TacticAst.Exists _ -> Tactics.exists
   | TacticAst.Fourier _ -> Tactics.fourier
+  | TacticAst.Generalize (_,term,pat) -> Tactics.generalize term pat
   | TacticAst.Goal (_, n) -> Tactics.set_goal n
   | TacticAst.Left _ -> Tactics.left
   | TacticAst.Right _ -> Tactics.right
@@ -58,7 +62,6 @@ let tactic_of_ast = function
   | TacticAst.Change_pattern of 'term pattern * 'term * 'ident option
   | TacticAst.Change of 'term * 'term * 'ident option
   | TacticAst.Decompose of 'ident * 'ident list
-  | TacticAst.Discriminate of 'ident
   | TacticAst.Fold of reduction_kind * 'term
   | TacticAst.Injection of 'ident
   | TacticAst.Replace_pattern of 'term pattern * 'term
@@ -81,7 +84,6 @@ let tactic_of_ast = function
   | TacticAst.LApply (_, term, substs) ->
      let f (name, term) = Cic.Name name, term in
      Tactics.lapply ~substs:(List.map f substs) term
-  | _ -> assert false
 
 let eval_tactical status tac =
   let apply_tactic tactic =
@@ -408,6 +410,10 @@ let disambiguate_tactic status = function
       let status, cic1 = disambiguate_term status what in
       let status, cic2 = disambiguate_term status with_what in
       status, TacticAst.Change (loc, cic1, cic2, ident)
+  | TacticAst.Generalize (loc,term,pattern) ->
+      let status,term = disambiguate_term status term in
+      let pattern = disambiguate_pattern status.aliases pattern in
+      status, TacticAst.Generalize(loc,term,pattern)
 (*
   (* TODO Zack a lot more of tactics to be implemented here ... *)
   | TacticAst.Change_pattern of 'term pattern * 'term * 'ident option
@@ -451,10 +457,6 @@ let disambiguate_tactic status = function
      let status, term = disambiguate_term status term in
      let status, substs = List.fold_left f (status, []) substs in 
      status, TacticAst.LApply (loc, term, substs)
-  
-  | x -> 
-      print_endline ("Not yet implemented:" ^ TacticAstPp.pp_tactic x);
-      assert false
 
 let rec disambiguate_tactical status = function 
   | TacticAst.Tactic (loc, tactic) ->