generator.
(* !!!!! fix !!!!!!!!!! *)
let contradiction_tac ~status:(proof,goal)=
Tacticals.then_
- ~start:(PrimitiveTactics.intros_tac ~name:"bo?" ) (*inutile sia questo che quello prima della chiamata*)
+ (*inutile sia questo che quello prima della chiamata*)
+ ~start:
+ (PrimitiveTactics.intros_tac ~mknames:(function () -> "boh"))
~continuation:(Tacticals.then_
~start:(VariousTactics.elim_type_tac ~term:_False)
~continuation:(assumption_tac))
let proof,gl = Tacticals.then_
~start:(PrimitiveTactics.apply_tac ~term:!th_to_appl)
- ~continuation:(PrimitiveTactics.intros_tac ~name:fhyp)
+ ~continuation:
+ (PrimitiveTactics.intros_tac ~mknames:(function () -> fhyp))
~status:(s_proof,s_goal) in
let goal = if List.length gl = 1 then List.hd gl
else failwith "a new goal" in
(* and [bo] = Lambda/LetIn [context].(Meta [newmeta]) *)
(* So, lambda_abstract is the core of the implementation of *)
(* the Intros tactic. *)
-let lambda_abstract context newmeta ty name =
+let lambda_abstract context newmeta ty mknames =
let module C = Cic in
let rec collect_context context =
function
let n' =
match n with
C.Name _ -> n
-(*CSC: generatore di nomi? Chiedere il nome? *)
- | C.Anonymous -> C.Name name
+ | C.Anonymous -> C.Name (mknames ())
in
let (context',ty,bo) =
collect_context ((Some (n',(C.Decl s)))::context) t
with CicUnification.UnificationFailed as e ->
raise (Fail (Printexc.to_string e))
-let intros_tac ~name ~status:(proof, goal) =
+let intros_tac ~mknames ~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 name in
+ let (context',ty',bo') = lambda_abstract context newmeta ty mknames 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 ~name:"FOO"))
+ ~continuation:(intros_tac ~mknames:(function () -> "FOO")))
;;
val exact_tac:
term: Cic.term -> ProofEngineTypes.tactic
val intros_tac:
- name: string -> ProofEngineTypes.tactic
+ mknames: (unit -> string) -> ProofEngineTypes.tactic
val cut_tac:
term: Cic.term -> ProofEngineTypes.tactic
val letin_tac:
(*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
+ 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 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 ~name:(fresh_name ()))
+ apply_tactic (PrimitiveTactics.intros_tac ~mknames:fresh_name)
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)
let module P = PrimitiveTactics in
let module T = Tacticals in
T.then_
- ~start: (P.intros_tac ~name:"FOO")
+ ~start: (P.intros_tac ~mknames:(function () -> "FOO"))
~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 ~name:"dummy_for_replace")
+ ~start:
+ (P.intros_tac ~mknames:(function () ->"dummy_for_replace"))
~continuation:(T.then_
~start:(rewrite_back_tac ~term:(C.Rel 1)) (* C.Name "dummy_for_replace" *)
~continuation:(ProofEngineStructuralRules.clear