intros_tac now directly uses it ==> no more ~mkname arguments.
The generator has been "improved" so that it does not generate any
more two equal names. The drawback is that every identifier is
augmented with a nonce.
let contradiction_tac ~status:(proof,goal)=
Tacticals.then_
(*inutile sia questo che quello prima della chiamata*)
- ~start:
- (PrimitiveTactics.intros_tac ~mknames:(function () -> "boh"))
+ ~start:PrimitiveTactics.intros_tac
~continuation:(Tacticals.then_
~start:(VariousTactics.elim_type_tac ~term:_False)
~continuation:(assumption_tac))
(* now let's change our thesis applying the th and put it with hp *)
- let proof,gl = Tacticals.then_
- ~start:(PrimitiveTactics.apply_tac ~term:!th_to_appl)
- ~continuation:
- (PrimitiveTactics.intros_tac ~mknames:(function () -> fhyp))
- ~status:(s_proof,s_goal) in
+ let proof,gl =
+ Tacticals.then_
+ ~start:(PrimitiveTactics.apply_tac ~term:!th_to_appl)
+ ~continuation:PrimitiveTactics.intros_tac
+ ~status:(s_proof,s_goal) in
let goal = if List.length gl = 1 then List.hd gl
else failwith "a new goal" in
function
C.Cast (te,_) -> collect_context context te
| C.Prod (n,s,t) ->
- let n' =
- match n with
- C.Name _ -> n
- | C.Anonymous -> C.Name (mknames ())
- in
+ let n' = C.Name (mknames n) in
let (context',ty,bo) =
collect_context ((Some (n',(C.Decl s)))::context) t
in
with CicUnification.UnificationFailed as e ->
raise (Fail (Printexc.to_string e))
-let intros_tac ~mknames ~status:(proof, goal) =
+let intros_tac ~status:(proof, goal) =
let module C = Cic in
let module R = CicReduction in
let (_,metasenv,_,_) = proof in
let metano,context,ty = List.find (function (m,_,_) -> m=goal) metasenv in
let newmeta = new_meta ~proof in
- let (context',ty',bo') = lambda_abstract context newmeta ty mknames in
+ let (context',ty',bo') =
+ lambda_abstract context newmeta ty (ProofEngineHelpers.fresh_name)
+ in
let (newproof, _) =
subst_meta_in_proof proof metano bo' [newmeta,context',ty']
in
~continuation:
(Tacticals.then_
~start:(ReductionTactics.simpl_tac ~also_in_hypotheses:false ~term:None)
- ~continuation:(intros_tac ~mknames:(function () -> "FOO")))
+ ~continuation:intros_tac)
;;
val exact_tac:
term: Cic.term -> ProofEngineTypes.tactic
val intros_tac:
- mknames: (unit -> string) -> ProofEngineTypes.tactic
+ ProofEngineTypes.tactic
val cut_tac:
term: Cic.term -> ProofEngineTypes.tactic
val letin_tac:
(* Some easy tactics. *)
(************************************************************)
-(*CSC: generatore di nomi? Chiedere il nome? *)
-let fresh_name =
- let next_fresh_index = ref 0 in
- function () ->
- incr next_fresh_index ;
- "fresh_name" ^ string_of_int !next_fresh_index
-
(* Reduces [term] using [reduction_function] in the current scratch goal [ty] *)
let reduction_tactic_in_scratch reduction_function term ty =
let metasenv =
let can_apply term = can_apply_tactic (PrimitiveTactics.apply_tac ~term)
let apply term = apply_tactic (PrimitiveTactics.apply_tac ~term)
-let intros () =
- apply_tactic (PrimitiveTactics.intros_tac ~mknames:fresh_name)
+let intros () = apply_tactic PrimitiveTactics.intros_tac
let cut term = apply_tactic (PrimitiveTactics.cut_tac ~term)
let letin term = apply_tactic (PrimitiveTactics.letin_tac ~term)
let exact term = apply_tactic (PrimitiveTactics.exact_tac ~term)
* http://cs.unibo.it/helm/.
*)
+(*CSC: generatore di nomi? Chiedere il nome? *)
+let fresh_name =
+ let next_fresh_index = ref 0 in
+ function
+ Cic.Anonymous ->
+ incr next_fresh_index ;
+ "fresh_name" ^ string_of_int !next_fresh_index
+ | Cic.Name name ->
+ incr next_fresh_index ;
+ name ^ string_of_int !next_fresh_index
+
(* identity_relocation_list_for_metavariable i canonical_context *)
(* returns the identity relocation list, which is the list [1 ; ... ; n] *)
(* where n = List.length [canonical_context] *)
* http://cs.unibo.it/helm/.
*)
+val fresh_name : Cic.name -> string
+
(* identity_relocation_list_for_metavariable i canonical_context *)
(* returns the identity relocation list, which is the list [1 ; ... ; n] *)
(* where n = List.length [canonical_context] *)
let module P = PrimitiveTactics in
let module T = Tacticals in
T.then_
- ~start: (P.intros_tac ~mknames:(function () -> "FOO"))
+ ~start:P.intros_tac
~continuation:(
T.then_
~start: (elim_type_tac ~term:(C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/False.ind") 0 [] ))
(* quale uguaglianza usare, eq o eqT ? *)
~continuations:[
T.then_
- ~start:
- (P.intros_tac ~mknames:(function () ->"dummy_for_replace"))
+ ~start:P.intros_tac
~continuation:(T.then_
~start:(rewrite_back_tac ~term:(C.Rel 1)) (* C.Name "dummy_for_replace" *)
~continuation:(ProofEngineStructuralRules.clear