wanted, hyp_paths, goal_path ]
];
direction: [
- [ IDENT "left" -> `Left
- | SYMBOL ">" -> `Left
- | IDENT "right" -> `Right
- | SYMBOL "<" -> `Right ]
+ [ SYMBOL ">" -> `LeftToRight
+ | SYMBOL "<" -> `RightToLeft ]
];
tactic: [
[ IDENT "absurd"; t = tactic_term ->
* http://helm.cs.unibo.it/
*)
-type direction = [ `Left | `Right ]
+type direction = [ `LeftToRight | `RightToLeft ]
type reduction_kind = [ `Reduce | `Simpl | `Whd | `Normalize ]
type loc = CicAst.location
sprintf "replace %s with %s" (pp_pattern pattern) (pp_term_ast t)
| Rewrite (_, pos, t, pattern) ->
sprintf "rewrite %s %s %s"
- (if pos = `Left then "left" else "right") (pp_term_ast t)
+ (if pos = `LeftToRight then ">" else "<")
+ (pp_term_ast t)
(pp_pattern pattern)
| Right _ -> "right"
| Ring _ -> "ring"
))
~continuation:
(T.then_
- ~start:(EqualityTactics.rewrite_simpl_tac ~term ())
+ ~start:
+ (EqualityTactics.rewrite_simpl_tac
+ ~direction:`LeftToRight
+ ~pattern:(ProofEngineTypes.conclusion_pattern None)
+ term)
~continuation:EqualityTactics.reflexivity_tac
)
])
~continuation:
(
T.then_
- ~start:(EqualityTactics.rewrite_back_simpl_tac
- ~term ())
+ ~start:
+ (EqualityTactics.rewrite_simpl_tac
+ ~direction:`RightToLeft
+ ~pattern:(ProofEngineTypes.conclusion_pattern None)
+ term)
~continuation:(IntroductionTactics.constructor_tac ~n:1)
))
(proof',goal')
*)
-let rewrite ~term:equality ?where ?(direction=`Left) (proof,goal) =
+let rewrite_tac ~direction ~pattern equality =
+ let rewrite_tac ~direction ~pattern equality status =
(*
let module C = Cic in
let module U = UriManager in
let module PEH = ProofEngineHelpers in
let module PT = PrimitiveTactics in
let module HLO = HelmLibraryObjects in
+ let proof,goal = status in
let if_left a b =
match direction with
| `Right -> b
in
assert (List.length goals = 0) ;
(proof',[fresh_meta])
-*) assert false
+ ProofEngineTypes.mk_tactic (rewrite_tac ?where ~term)
+*) assert false in
+ ProofEngineTypes.mk_tactic (rewrite_tac ~direction ~pattern equality)
-let rewrite_tac ?where ~term () =
- let rewrite_tac ?where ~term status =
- rewrite ?where ~term ~direction:`Right status
- in
- ProofEngineTypes.mk_tactic (rewrite_tac ?where ~term)
-
-let rewrite_simpl_tac ?where ~term () =
- let rewrite_simpl_tac ?where ~term status =
+let rewrite_simpl_tac ~direction ~pattern equality =
+ let rewrite_simpl_tac ~direction ~pattern equality status =
ProofEngineTypes.apply_tactic
(Tacticals.then_
- ~start:(rewrite_tac ?where ~term ())
+ ~start:(rewrite_tac ~direction:`LeftToRight ~pattern equality)
~continuation:
(ReductionTactics.simpl_tac
~pattern:(ProofEngineTypes.conclusion_pattern None)))
status
in
- ProofEngineTypes.mk_tactic (rewrite_simpl_tac ~term)
-;;
-
-let rewrite_back_tac ?where ~term () =
- let rewrite_back_tac ?where ~term status =
- rewrite ?where ~term ~direction:`Left status
- in
- ProofEngineTypes.mk_tactic (rewrite_back_tac ?where ~term)
-
-let rewrite_back_simpl_tac ?where ~term () =
- let rewrite_back_simpl_tac ?where ~term status =
- ProofEngineTypes.apply_tactic
- (Tacticals.then_
- ~start:(rewrite_back_tac ?where ~term ())
- ~continuation:
- (ReductionTactics.simpl_tac
- ~pattern:(ProofEngineTypes.conclusion_pattern None)))
- status
- in
- ProofEngineTypes.mk_tactic (rewrite_back_simpl_tac ~term)
+ ProofEngineTypes.mk_tactic (rewrite_simpl_tac ~direction ~pattern equality)
;;
let replace_tac ~pattern ~with_what =
*)
val rewrite_tac:
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
+ direction:[`LeftToRight | `RightToLeft] ->
+ pattern:ProofEngineTypes.pattern -> Cic.term -> ProofEngineTypes.tactic
val rewrite_simpl_tac:
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
-val rewrite_back_tac:
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
-val rewrite_back_simpl_tac:
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
+ direction:[`LeftToRight | `RightToLeft] ->
+ pattern:ProofEngineTypes.pattern -> Cic.term -> ProofEngineTypes.tactic
val replace_tac:
pattern:ProofEngineTypes.pattern ->
let metasenv' = (fresh_meta,context,a_eq_b)::metasenv in
debug("chamo rewrite tac su"^CicPp.ppterm (C.Meta (fresh_meta,irl)));
let (proof,goals) = apply_tactic
- (EqualityTactics.rewrite_simpl_tac ~term:(C.Meta (fresh_meta,irl)) ())
+ (EqualityTactics.rewrite_simpl_tac
+ ~direction:`LeftToRight
+ ~pattern:(ProofEngineTypes.conclusion_pattern None)
+ (C.Meta (fresh_meta,irl)))
((curi,metasenv',pbo,pty),goal)
in
let new_goals = fresh_meta::goals in
let reflexivity = EqualityTactics.reflexivity_tac
let replace = EqualityTactics.replace_tac
let rewrite = EqualityTactics.rewrite_tac
-let rewrite_back = EqualityTactics.rewrite_back_tac
-let rewrite_back_simpl = EqualityTactics.rewrite_back_simpl_tac
let rewrite_simpl = EqualityTactics.rewrite_simpl_tac
let right = IntroductionTactics.right_tac
let ring = Ring.ring_tac
pattern:ProofEngineTypes.pattern ->
with_what:Cic.term -> ProofEngineTypes.tactic
val rewrite :
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
-val rewrite_back :
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
-val rewrite_back_simpl :
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
+ direction:[ `LeftToRight | `RightToLeft ] ->
+ pattern:ProofEngineTypes.pattern -> Cic.term -> ProofEngineTypes.tactic
val rewrite_simpl :
- ?where:ProofEngineTypes.pattern ->
- term:Cic.term -> unit -> ProofEngineTypes.tactic
+ direction:[ `LeftToRight | `RightToLeft ] ->
+ pattern:ProofEngineTypes.pattern -> Cic.term -> ProofEngineTypes.tactic
val right : ProofEngineTypes.tactic
val ring : ProofEngineTypes.tactic
val set_goal : int -> ProofEngineTypes.tactic