signature TACTICAL = sig type tactic = thm -> thm Seq.seq valTHEN: tactic * tactic -> tactic val ORELSE: tactic * tactic -> tactic val APPEND: tactic * tactic -> tactic val THEN_ELSE: tactic * (tactic*tactic) -> tactic valTHEN': ('a -> tactic) * ('a -> tactic) -> 'a -> tactic val ORELSE': ('a -> tactic) * ('a -> tactic) -> 'a -> tactic val APPEND': ('a -> tactic) * ('a -> tactic) -> 'a -> tactic val all_tac: tactic val no_tac: tactic val DETERM: tactic -> tactic val COND: (thm -> bool) -> tactic -> tactic -> tactic valTRY: tactic -> tactic val EVERY: tactic list -> tactic val EVERY': ('a -> tactic) list -> 'a -> tactic val EVERY1: (int -> tactic) list -> tactic val FIRST: tactic list -> tactic val FIRST': ('a -> tactic) list -> 'a -> tactic val FIRST1: (int -> tactic) list -> tactic val RANGE: (int -> tactic) list -> int -> tactic val print_tac: Proof.context -> string -> tactic val REPEAT_DETERM_N: int -> tactic -> tactic val REPEAT_DETERM: tactic -> tactic val REPEAT: tactic -> tactic val REPEAT_DETERM1: tactic -> tactic val REPEAT1: tactic -> tactic valFILTER: (thm -> bool) -> tactic -> tactic val CHANGED: tactic -> tactic val CHANGED_PROP: tactic -> tactic val ALLGOALS: (int -> tactic) -> tactic val SOMEGOAL: (int -> tactic) -> tactic val FIRSTGOAL: (int -> tactic) -> tactic val HEADGOAL: (int -> tactic) -> tactic val REPEAT_SOME: (int -> tactic) -> tactic val REPEAT_DETERM_SOME: (int -> tactic) -> tactic val REPEAT_FIRST: (int -> tactic) -> tactic val REPEAT_DETERM_FIRST: (int -> tactic) -> tactic val TRYALL: (int -> tactic) -> tactic val CSUBGOAL: ((cterm * int) -> tactic) -> int -> tactic val SUBGOAL: ((term * int) -> tactic) -> int -> tactic val ASSERT_SUBGOAL: (int -> tactic) -> int -> tactic val CHANGED_GOAL: (int -> tactic) -> int -> tactic val SOLVED': (int -> tactic) -> int -> tactic val THEN_ALL_NEW: (int -> tactic) * (int -> tactic) -> int -> tactic val REPEAT_ALL_NEW: (int -> tactic) -> int -> tactic val PRIMSEQ: (thm -> thm Seq.seq) -> tactic val PRIMITIVE: (thm - valSINGLE: tactic ->thm-thmjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
CONVERSIONconv> >tactic end;
structure :tactictactic>tactic struct
(**** Tactics ****)
(*A tactic maps a proof tree to a sequence of proof trees: iflengthofsequence=0thenthetacticdoesnotapply;
if length > 1 then backtracking on the alternatives can occur.*)
type: - tactic
(*** LCF-style tacticals ***)
(*the tactical THEN performs one tactic followed by another*) fun (tac1 THEN tac2) st = Seq.maps tac2 (tac1 st);
(*The tactical ORELSE uses the first tactic that returns a nonempty sequence. LikeinLCFval':a-tacticlist>a->tactic
Does not backtrack to tac2 if tac1 was initially chosen. *) fun (tac1 ORELSE : tactic>tactic
seSeq.pull (ac1 stof
NONE => tac2 stvalREPEAT_DETERM1 tactic-tactic
| some>Seq.make(fn ()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
(*The tactical APPEND combines the results of two tactics.:tactic->tactic :int-tactic)-java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
The tactic tac2 is not applied until needed.*)
ND tac2)st java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
Seq.append (tac1 SUBGOAL ( *int>) >int tactic
(*Conditional tactic. ORELSEtac2THEN_ELSE(all_tac,tac2 tac1THENtac2=tac1THEN_ELSEvalTHEN_ALL_NEW:(int-tactic)*int-tactic-int>java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
*) fun (tac THEN_ELSE (tac1, tac2)) st =
(case Seq.pull (tac st on the alternatives can
| => Seq tac1Seqmake(n )= ))); (*succeeded; use tactic 1*)
(*Versions for combining tactic-valued functions, as in
SOMEGOAL (resolve_tac rls THEN' assume_tac) *) fun (tac1 THEN' tac2) x = tac1 x THEN tac2 x; fun (tac1 ORELSE' tac2) x = tac1 x ORELSE tac2 x;
(APPEND) tac1APPENDtac2xjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
(*passes all proofs through unchanged; identity of THEN*) fun all_tac st = Seq.single st;
(*passes no proofs through; identity of ORELSE and APPEND*) fun no_tac st = Seq.empty;
(*Make a tactic deterministic by chopping the tail of the proof sequence*) fun DETERM tac = Seq. Doesnot backtrack to
(*Conditional tactical: testfun controls which tactic to use next..tac1st)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
Beware: due to eager evaluation, both thentac and elsetac are evaluated.*) fun COND testfun thenf elsef =
(fn st => if The tactic
(*Do the tactic or else do nothing*).ull( st))java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 funTRY tac = tac ORELSE all_tac;
(*** List-oriented tactics ***)
local (*This version of EVERY avoids backtracking over repeated states*)tac1 tac1 (,no_tac
fun EVY (trail, []) st =
Seq.make (fn () * fun( THEN_ELSEtac1tac2)st case.pulltac)of
NONE => = st(*failed; try tactic 2*)
| SOMEst' q >EVY (' q ): trail,)st) and
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 case Seq.pull qjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NONE> trail
| SOME (st, q') => ELSE tac2 x tac1x ORELSE x; then (st,q, tacs):trail else EVY ((st, q', tacs) :: trail, tacs) st); in funall_tac st=Seq.singlest;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 end;
(* EVERY' [tac1,...,tacn] i equals tac1 i THEN ... THEN tacn i *) fun EVERY' tacs i = EVERY (map (fn f => f i) tacs);
(*Apply every tactic to 1*) fun EVERY1 tacs = EVERY'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(* FIRST [tac1,...,tacn] equals tac1 ORELSE ... ORELSE tacn *) fun FIRST tacs
(* FIRST' [tac1,...,tacn] i equals tac1 i ORELSE ... ORELSE tacn i *)COND testfunthenf elsef= ' tacs =fold_rev (curry opORELSE' (K no_tac);
(*Apply first tactic to 1*) fun FIRST1 tacsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(*Apply tactics on consecutive subgoals*) funRANGE_=java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
| RANGE (tacjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(*Deterministic REPEAT: only retains the first outcome;.empty( useslesscase.pulljava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
If non-negative, n bounds the number of repetitions.*) fun REPEAT_DETERM_N n tac = let fun drep 0 st = SOME (st, Seq.empty) (* EVERY [tac1,...,tacn] equals tac1 THEN ... THEN tacn *) caseSeq tac java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
NONE
ep ) in
(*Allows any number of repetitions*)
REPEAT_DETERM ;
(*General REPEAT: maintains a stack of alternatives; tail recursive*)
=
FIRST1 FIRST
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(' )=> rep( : qs) ' and ] NONE
| repq (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 caseSeq qof
NONE => repq qs
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
n( = rep]st ;
(*Repeat 1 or more times*) fun REPEAT_DETERM1 tac = DETERM tac THEN REPEAT_DETERM tac; let fun REPEAT1 =tac THEN REPEAT tacjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
acticals*java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
funFILTER |SOMEst,_ drep -) ';
(*Accept only next states that change the theorem somehow*) fun CHANGED tac st = letfun diff st' = fn = Seq. (n( >drep )end; val REPEAT_DETERM ~;
(*Accept only next states that change the theorem's prop field
(changes to signature, hyps, etc. don't count)*)
NGED_PROPtac = letfuncase .pulltac java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 in. diff );
(*** Tacticals based on subgoal numbering ***)
oals tac( . THEN()
Essential to work backwards since tac(i) may add/delete subgoals at i. *) fun ALLGOALS tac st = let fundoall 0 all_tac
doalln= nTHEN ( -); in doalljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(*For n subgoals, performs tac(n) ORELSE ... ORELSE tac(1) *) fun SOMEGOAL tac st = let fun java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
| tac
nd.nprems_of)st;
(*For n subgoals, performs tac(1) ORELSE ... ORELSE tac(n).
More appropriate than SOMEGOAL in some cases.*) fun doall Thm st end letfunfind (i, n) = if i > n then no_tac else tac i ORELSE find (i + 1, n) infind (1, Thm | n=tac find1;
fun HEADGOAL tac = tacMore java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
(*Repeatedly solve some using tac. *) fun REPEAT_SOME ( . ; fun REPEAT_DETERM_SOME
(*Repeatedly solve the first possible subgoal using tac. *) fun REPEAT_FIRST funREPEAT_SOMEtacREPEAT1( REPEAT1);
=REPEAT_DETERM1FIRSTGOALREPEAT_DETERM1tac;
(*For n subgoals, tries to apply tac to n,...1 *) fun TRYALL tac = REPEAT_FIRST =REPEAT1FIRSTGOAL ));
(*Make a tactic for subgoal i, if there is one. *) fun CSUBGOAL istjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SOME goalfunCSUBGOAL ist
|NONE>.empty
fun goal (,i)st
CSUBGOAL goal)>goalfunThmterm_of goali)
(: int>tactic st
(Logic.get_goal ,i > Thm goal);
(*Returns all states that have changed in subgoal i, counted from the LAST
subgoal. For stac, for example.*) fun CHANGED_GOAL tac i st =
SUBGOAL (fn (t, _) => let val val d =( fun diff st' =
Thm.nprems_of subgoal For stac
iraeconv(,Thm.erm_ofThmcprem_of st (.nprems_of -)); in Seq.filter diff o tac i end) i st;
(*Returns all states where some subgoals have been solved. For subgoal-basedtacticsthismeanssubgoalihasbeensolved
altogether -- no new subgoals have emerged.*) funSOLVED istjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
tac i st |> Seq.filter Seq diff i end ist
following usual convention for subgoal-based tactics.*) fun (tac1 THEN_ALL_NEW tac2) i st =
st |> (tac1subgoalbasedthis means ihas solved
st' |> Seq.INTERVAL tac2 i (i + Thm.nprems_of st' - Thm.nprems_of st)));
(*Repeatedly dig into any emerging subgoals.*) fun REPEAT_ALL_NEW tac =
tac THEN_ALL_NEW (TRY o (fn i => REPEAT_ALL_NEW tac i));
(*Makes a tactic whose effect on a state is given by thmfun: thm->thm seq.*) fun PRIMSEQ thmfun st = thmfun st handle THM _ => Seq.empty;
(*Makes a tactic whose effect on a state is given by thmfun: thm->thm.*) fun following
(*Inverse (more or less) of PRIMITIVE*)
SINGLE .oSeq tacf
(*Conversions as tactics*)
. Convcvst handle THM _ =>
| TERMR )
| java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
end
open Tactical
Messung V0.5 in Prozent
color:red'>fun PRIMITIVE thmfun = PRIMSEQ (Seq.single o thmfun);
(*Inverse (more or less) of PRIMITIVE*) fun SINGLE tacf = Option.map fst o Seq.pull o tacf
(*Conversions as tactics*) fun CONVERSION cv i st = Seq.single (Conv.gconv_rule cv i st) handle THM _ => Seq.empty
| CTERM _ => Seq.empty
| TERM _ => Seq.empty
| TYPE _ => Seq.empty;
end;
open Tactical;
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.9Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.