234 |
234 |
235 \subsection{Inserting premises and facts}\label{cut_facts_tac} |
235 \subsection{Inserting premises and facts}\label{cut_facts_tac} |
236 \index{tactics!for inserting facts|bold} |
236 \index{tactics!for inserting facts|bold} |
237 \begin{ttbox} |
237 \begin{ttbox} |
238 cut_facts_tac : thm list -> int -> tactic |
238 cut_facts_tac : thm list -> int -> tactic |
239 subgoal_tac : string -> int -> tactic |
239 cut_inst_tac : (string*string)list -> thm -> int -> tactic |
|
240 subgoal_tac : string -> int -> tactic |
240 \end{ttbox} |
241 \end{ttbox} |
241 These tactics add assumptions --- which must be proved, sooner or later --- |
242 These tactics add assumptions --- which must be proved, sooner or later --- |
242 to a given subgoal. |
243 to a given subgoal. |
243 \begin{description} |
244 \begin{description} |
244 \item[\ttindexbold{cut_facts_tac} {\it thms} {\it i}] |
245 \item[\ttindexbold{cut_facts_tac} {\it thms} {\it i}] |
245 adds the {\it thms} as new assumptions to subgoal~$i$. Once they have |
246 adds the {\it thms} as new assumptions to subgoal~$i$. Once they have |
246 been inserted as assumptions, they become subject to {\tt eresolve_tac} |
247 been inserted as assumptions, they become subject to tactics such as {\tt |
247 and {\tt rewrite_goals_tac}. Only rules with no premises are inserted: |
248 eresolve_tac} and {\tt rewrite_goals_tac}. Only rules with no premises |
248 Isabelle cannot use assumptions that contain $\Imp$ or~$\Forall$. Sometimes |
249 are inserted: Isabelle cannot use assumptions that contain $\Imp$ |
249 the theorems are premises of a rule being derived, returned by~{\tt |
250 or~$\Forall$. Sometimes the theorems are premises of a rule being |
250 goal}; instead of calling this tactic, you could state the goal with an |
251 derived, returned by~{\tt goal}; instead of calling this tactic, you |
251 outermost meta-quantifier. |
252 could state the goal with an outermost meta-quantifier. |
|
253 |
|
254 \item[\ttindexbold{cut_inst_tac} {\it insts} {\it thm} {\it i}] |
|
255 instantiates the {\it thm} with the instantiations {\it insts}, as |
|
256 described in \S\ref{res_inst_tac}. It adds the resulting theorem as a |
|
257 new assumption to subgoal~$i$. |
252 |
258 |
253 \item[\ttindexbold{subgoal_tac} {\it formula} {\it i}] |
259 \item[\ttindexbold{subgoal_tac} {\it formula} {\it i}] |
254 adds the {\it formula} as a assumption to subgoal~$i$, and inserts the same |
260 adds the {\it formula} as a assumption to subgoal~$i$, and inserts the same |
255 {\it formula} as a new subgoal, $i+1$. |
261 {\it formula} as a new subgoal, $i+1$. |
256 \end{description} |
262 \end{description} |
573 (\ttindexbold{Some}) or absence (\ttindexbold{None}) of |
579 (\ttindexbold{Some}) or absence (\ttindexbold{None}) of |
574 a value: |
580 a value: |
575 \begin{ttbox} |
581 \begin{ttbox} |
576 datatype 'a option = None | Some of 'a; |
582 datatype 'a option = None | Some of 'a; |
577 \end{ttbox} |
583 \end{ttbox} |
|
584 For clarity, the module name {\tt Sequence} is omitted from the signature |
|
585 specifications below; for instance, {\tt null} appears instead of {\tt |
|
586 Sequence.null}. |
578 |
587 |
579 \subsubsection{Basic operations on sequences} |
588 \subsubsection{Basic operations on sequences} |
580 \begin{ttbox} |
589 \begin{ttbox} |
581 Sequence.null : 'a Sequence.seq |
590 null : 'a seq |
582 Sequence.seqof : (unit -> ('a * 'a Sequence.seq) option) |
591 seqof : (unit -> ('a * 'a seq) option) -> 'a seq |
583 -> 'a Sequence.seq |
592 single : 'a -> 'a seq |
584 Sequence.single : 'a -> 'a Sequence.seq |
593 pull : 'a seq -> ('a * 'a seq) option |
585 Sequence.pull : 'a Sequence.seq -> ('a * 'a Sequence.seq) option |
|
586 \end{ttbox} |
594 \end{ttbox} |
587 \begin{description} |
595 \begin{description} |
588 \item[{\tt Sequence.null}] |
596 \item[{\tt Sequence.null}] |
589 is the empty sequence. |
597 is the empty sequence. |
590 |
598 |
602 \end{description} |
610 \end{description} |
603 |
611 |
604 |
612 |
605 \subsubsection{Converting between sequences and lists} |
613 \subsubsection{Converting between sequences and lists} |
606 \begin{ttbox} |
614 \begin{ttbox} |
607 Sequence.chop: int * 'a Sequence.seq -> 'a list * 'a Sequence.seq |
615 chop : int * 'a seq -> 'a list * 'a seq |
608 Sequence.list_of_s : 'a Sequence.seq -> 'a list |
616 list_of_s : 'a seq -> 'a list |
609 Sequence.s_of_list : 'a list -> 'a Sequence.seq |
617 s_of_list : 'a list -> 'a seq |
610 \end{ttbox} |
618 \end{ttbox} |
611 \begin{description} |
619 \begin{description} |
612 \item[{\tt Sequence.chop} ($n$, $s$)] |
620 \item[{\tt Sequence.chop} ($n$, $s$)] |
613 returns the first~$n$ elements of~$s$ as a list, paired with the remaining |
621 returns the first~$n$ elements of~$s$ as a list, paired with the remaining |
614 elements of~$s$. If $s$ has fewer than~$n$ elements, then so will the |
622 elements of~$s$. If $s$ has fewer than~$n$ elements, then so will the |
622 \end{description} |
630 \end{description} |
623 |
631 |
624 |
632 |
625 \subsubsection{Combining sequences} |
633 \subsubsection{Combining sequences} |
626 \begin{ttbox} |
634 \begin{ttbox} |
627 Sequence.append: 'a Sequence.seq * 'a Sequence.seq -> 'a Sequence.seq |
635 append : 'a seq * 'a seq -> 'a seq |
628 Sequence.interleave : 'a Sequence.seq * 'a Sequence.seq |
636 interleave : 'a seq * 'a seq -> 'a seq |
629 -> 'a Sequence.seq |
637 flats : 'a seq seq -> 'a seq |
630 Sequence.flats : 'a Sequence.seq Sequence.seq -> 'a Sequence.seq |
638 maps : ('a -> 'b) -> 'a seq -> 'b seq |
631 Sequence.maps : ('a -> 'b) -> 'a Sequence.seq -> 'b Sequence.seq |
639 filters : ('a -> bool) -> 'a seq -> 'a seq |
632 Sequence.filters : ('a -> bool) -> 'a Sequence.seq -> 'a Sequence.seq |
|
633 \end{ttbox} |
640 \end{ttbox} |
634 \begin{description} |
641 \begin{description} |
635 \item[{\tt Sequence.append} ($s@1$, $s@2$)] |
642 \item[{\tt Sequence.append} ($s@1$, $s@2$)] |
636 concatenates $s@1$ to $s@2$. |
643 concatenates $s@1$ to $s@2$. |
637 |
644 |