25 'instance' (nameref ('<' | subseteq) nameref | nameref '::' simplearity) |
25 'instance' (nameref ('<' | subseteq) nameref | nameref '::' simplearity) |
26 ; |
26 ; |
27 \end{rail} |
27 \end{rail} |
28 |
28 |
29 \begin{descr} |
29 \begin{descr} |
|
30 |
30 \item [$\AXCLASS~c \subseteq \vec c~~axms$] defines an axiomatic type class as |
31 \item [$\AXCLASS~c \subseteq \vec c~~axms$] defines an axiomatic type class as |
31 the intersection of existing classes, with additional axioms holding. Class |
32 the intersection of existing classes, with additional axioms holding. Class |
32 axioms may not contain more than one type variable. The class axioms (with |
33 axioms may not contain more than one type variable. The class axioms (with |
33 implicit sort constraints added) are bound to the given names. Furthermore |
34 implicit sort constraints added) are bound to the given names. Furthermore |
34 a class introduction rule is generated (being bound as $c{.}intro$); this |
35 a class introduction rule is generated (being bound as $c{.}intro$); this |
49 \item [$intro_classes$] repeatedly expands all class introduction rules of |
50 \item [$intro_classes$] repeatedly expands all class introduction rules of |
50 this theory. Note that this method usually needs not be named explicitly, |
51 this theory. Note that this method usually needs not be named explicitly, |
51 as it is already included in the default proof step (of $\PROOFNAME$, |
52 as it is already included in the default proof step (of $\PROOFNAME$, |
52 $\BYNAME$, etc.). In particular, instantiation of trivial (syntactic) |
53 $\BYNAME$, etc.). In particular, instantiation of trivial (syntactic) |
53 classes may be performed by a single ``$\DDOT$'' proof step. |
54 classes may be performed by a single ``$\DDOT$'' proof step. |
|
55 |
54 \end{descr} |
56 \end{descr} |
55 |
57 |
56 |
58 |
57 \subsection{Locales and local contexts}\label{sec:locale} |
59 \subsection{Locales and local contexts}\label{sec:locale} |
58 |
60 |
151 |
153 |
152 \begin{descr} |
154 \begin{descr} |
153 |
155 |
154 \item [$\FIXES{~x::\tau~(mx)}$] declares a local parameter of type $\tau$ |
156 \item [$\FIXES{~x::\tau~(mx)}$] declares a local parameter of type $\tau$ |
155 and mixfix annotation $mx$ (both are optional). The special syntax |
157 and mixfix annotation $mx$ (both are optional). The special syntax |
156 declaration $(structure)$ means that $x$ may be referenced |
158 declaration ``$(structure)$'' means that $x$ may be referenced |
157 implicitly in this context. %see also FIXME |
159 implicitly in this context. |
158 |
160 |
159 \item [$\ASSUMES{a}{\vec\phi}$] introduces local premises, similar to |
161 \item [$\ASSUMES{a}{\vec\phi}$] introduces local premises, similar to |
160 $\ASSUMENAME$ within a proof (cf.\ \S\ref{sec:proof-context}). |
162 $\ASSUMENAME$ within a proof (cf.\ \S\ref{sec:proof-context}). |
161 |
163 |
162 \item [$\DEFINES{a}{x \equiv t}$] defines a previously declared parameter. |
164 \item [$\DEFINES{a}{x \equiv t}$] defines a previously declared parameter. |
402 \end{descr} |
405 \end{descr} |
403 |
406 |
404 \indexisaratt{tagged}\indexisaratt{untagged} |
407 \indexisaratt{tagged}\indexisaratt{untagged} |
405 \indexisaratt{THEN}\indexisaratt{COMP} |
408 \indexisaratt{THEN}\indexisaratt{COMP} |
406 \indexisaratt{where}\indexisaratt{unfolded}\indexisaratt{folded} |
409 \indexisaratt{where}\indexisaratt{unfolded}\indexisaratt{folded} |
407 \indexisaratt{standard}\indexisaratt{elim-format} |
410 \indexisaratt{standard}\indexisarattof{Pure}{elim-format} |
408 \indexisaratt{no-vars} |
411 \indexisaratt{no-vars} |
409 \begin{matharray}{rcl} |
412 \begin{matharray}{rcl} |
410 tagged & : & \isaratt \\ |
413 tagged & : & \isaratt \\ |
411 untagged & : & \isaratt \\[0.5ex] |
414 untagged & : & \isaratt \\[0.5ex] |
412 THEN & : & \isaratt \\ |
415 THEN & : & \isaratt \\ |
431 ('unfolded' | 'folded') thmrefs |
434 ('unfolded' | 'folded') thmrefs |
432 ; |
435 ; |
433 \end{rail} |
436 \end{rail} |
434 |
437 |
435 \begin{descr} |
438 \begin{descr} |
|
439 |
436 \item [$tagged~name~args$ and $untagged~name$] add and remove $tags$ of some |
440 \item [$tagged~name~args$ and $untagged~name$] add and remove $tags$ of some |
437 theorem. Tags may be any list of strings that serve as comment for some |
441 theorem. Tags may be any list of strings that serve as comment for some |
438 tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the |
442 tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the |
439 result). The first string is considered the tag name, the rest its |
443 result). The first string is considered the tag name, the rest its |
440 arguments. Note that untag removes any tags of the same name. |
444 arguments. Note that untag removes any tags of the same name. |
|
445 |
441 \item [$THEN~n~a$ and $COMP~n~a$] compose rules. $THEN$ resolves with the |
446 \item [$THEN~n~a$ and $COMP~n~a$] compose rules. $THEN$ resolves with the |
442 $n$-th premise of $a$; the $COMP$ version skips the automatic lifting |
447 $n$-th premise of $a$; the $COMP$ version skips the automatic lifting |
443 process that is normally intended (cf.\ \texttt{RS} and \texttt{COMP} in |
448 process that is normally intended (cf.\ \texttt{RS} and \texttt{COMP} in |
444 \cite[\S5]{isabelle-ref}). |
449 \cite[\S5]{isabelle-ref}). |
|
450 |
445 \item [$where~\vec x = \vec t$] perform named instantiation of schematic |
451 \item [$where~\vec x = \vec t$] perform named instantiation of schematic |
446 variables occurring in a theorem. Unlike instantiation tactics such as |
452 variables occurring in a theorem. Unlike instantiation tactics such as |
447 $rule_tac$ (see \S\ref{sec:tactic-commands}), actual schematic variables |
453 $rule_tac$ (see \S\ref{sec:tactic-commands}), actual schematic variables |
448 have to be specified (e.g.\ $\Var{x@3}$). |
454 have to be specified (e.g.\ $\Var{x@3}$). |
|
455 |
449 \item [$unfolded~\vec a$ and $folded~\vec a$] expand and fold back again the |
456 \item [$unfolded~\vec a$ and $folded~\vec a$] expand and fold back again the |
450 given meta-level definitions throughout a rule. |
457 given meta-level definitions throughout a rule. |
|
458 |
451 \item [$standard$] puts a theorem into the standard form of object-rules, just |
459 \item [$standard$] puts a theorem into the standard form of object-rules, just |
452 as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}). |
460 as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}). |
453 \item [$elim_format$] turns a destruction rule into elimination rule format; |
461 |
454 see also the ML function \texttt{make\_elim} (see \cite{isabelle-ref}). |
462 \item [$elim_format$] turns a destruction rule into elimination rule format, |
|
463 by resolving with the rule $\PROP A \Imp (\PROP A \Imp \PROP B) \Imp \PROP |
|
464 B$. |
|
465 |
|
466 Note that the Classical Reasoner (\S\ref{sec:classical-att}) provides its |
|
467 own version of this operation. |
|
468 |
455 \item [$no_vars$] replaces schematic variables by free ones; this is mainly |
469 \item [$no_vars$] replaces schematic variables by free ones; this is mainly |
456 for tuning output of pretty printed theorems. |
470 for tuning output of pretty printed theorems. |
|
471 |
457 \end{descr} |
472 \end{descr} |
458 |
473 |
459 |
474 |
460 \subsection{Further tactic emulations}\label{sec:tactics} |
475 \subsection{Further tactic emulations}\label{sec:tactics} |
461 |
476 |
536 insts: ((name '=' term) + 'and') 'in' |
551 insts: ((name '=' term) + 'and') 'in' |
537 ; |
552 ; |
538 \end{rail} |
553 \end{rail} |
539 |
554 |
540 \begin{descr} |
555 \begin{descr} |
|
556 |
541 \item [$rule_tac$ etc.] do resolution of rules with explicit instantiation. |
557 \item [$rule_tac$ etc.] do resolution of rules with explicit instantiation. |
542 This works the same way as the ML tactics \texttt{res_inst_tac} etc. (see |
558 This works the same way as the ML tactics \texttt{res_inst_tac} etc. (see |
543 \cite[\S3]{isabelle-ref}). |
559 \cite[\S3]{isabelle-ref}). |
544 |
560 |
545 Note that multiple rules may be only given there is no instantiation. Then |
561 Note that multiple rules may be only given there is no instantiation. Then |
546 $rule_tac$ is the same as \texttt{resolve_tac} in ML (see |
562 $rule_tac$ is the same as \texttt{resolve_tac} in ML (see |
547 \cite[\S3]{isabelle-ref}). |
563 \cite[\S3]{isabelle-ref}). |
|
564 |
548 \item [$cut_tac$] inserts facts into the proof state as assumption of a |
565 \item [$cut_tac$] inserts facts into the proof state as assumption of a |
549 subgoal, see also \texttt{cut_facts_tac} in \cite[\S3]{isabelle-ref}. Note |
566 subgoal, see also \texttt{cut_facts_tac} in \cite[\S3]{isabelle-ref}. Note |
550 that the scope of schematic variables is spread over the main goal statement. |
567 that the scope of schematic variables is spread over the main goal |
551 Instantiations may be given as well, see also ML tactic |
568 statement. Instantiations may be given as well, see also ML tactic |
552 \texttt{cut_inst_tac} in \cite[\S3]{isabelle-ref}. |
569 \texttt{cut_inst_tac} in \cite[\S3]{isabelle-ref}. |
|
570 |
553 \item [$thin_tac~\phi$] deletes the specified assumption from a subgoal; note |
571 \item [$thin_tac~\phi$] deletes the specified assumption from a subgoal; note |
554 that $\phi$ may contain schematic variables. See also \texttt{thin_tac} in |
572 that $\phi$ may contain schematic variables. See also \texttt{thin_tac} in |
555 \cite[\S3]{isabelle-ref}. |
573 \cite[\S3]{isabelle-ref}. |
|
574 |
556 \item [$subgoal_tac~\phi$] adds $\phi$ as an assumption to a subgoal. See |
575 \item [$subgoal_tac~\phi$] adds $\phi$ as an assumption to a subgoal. See |
557 also \texttt{subgoal_tac} and \texttt{subgoals_tac} in |
576 also \texttt{subgoal_tac} and \texttt{subgoals_tac} in |
558 \cite[\S3]{isabelle-ref}. |
577 \cite[\S3]{isabelle-ref}. |
|
578 |
559 \item [$rename_tac~\vec x$] renames parameters of a goal according to the list |
579 \item [$rename_tac~\vec x$] renames parameters of a goal according to the list |
560 $\vec x$, which refers to the \emph{suffix} of variables. |
580 $\vec x$, which refers to the \emph{suffix} of variables. |
|
581 |
561 \item [$rotate_tac~n$] rotates the assumptions of a goal by $n$ positions: |
582 \item [$rotate_tac~n$] rotates the assumptions of a goal by $n$ positions: |
562 from right to left if $n$ is positive, and from left to right if $n$ is |
583 from right to left if $n$ is positive, and from left to right if $n$ is |
563 negative; the default value is $1$. See also \texttt{rotate_tac} in |
584 negative; the default value is $1$. See also \texttt{rotate_tac} in |
564 \cite[\S3]{isabelle-ref}. |
585 \cite[\S3]{isabelle-ref}. |
|
586 |
565 \item [$tactic~text$] produces a proof method from any ML text of type |
587 \item [$tactic~text$] produces a proof method from any ML text of type |
566 \texttt{tactic}. Apart from the usual ML environment and the current |
588 \texttt{tactic}. Apart from the usual ML environment and the current |
567 implicit theory context, the ML code may refer to the following locally |
589 implicit theory context, the ML code may refer to the following locally |
568 bound values: |
590 bound values: |
569 |
591 |
864 bestsimp & : & \isarmeth \\ |
886 bestsimp & : & \isarmeth \\ |
865 \end{matharray} |
887 \end{matharray} |
866 |
888 |
867 \indexouternonterm{clasimpmod} |
889 \indexouternonterm{clasimpmod} |
868 \begin{rail} |
890 \begin{rail} |
869 'auto' '!'? (nat nat)? (clasimpmod * ) |
891 'auto' '!'? (nat nat)? (clasimpmod *) |
870 ; |
892 ; |
871 ('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') '!'? (clasimpmod * ) |
893 ('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') '!'? (clasimpmod *) |
872 ; |
894 ; |
873 |
895 |
874 clasimpmod: ('simp' (() | 'add' | 'del' | 'only') | |
896 clasimpmod: ('simp' (() | 'add' | 'del' | 'only') | |
875 ('cong' | 'split') (() | 'add' | 'del') | |
897 ('cong' | 'split') (() | 'add' | 'del') | |
876 'iff' (((() | 'add') '?'?) | 'del') | |
898 'iff' (((() | 'add') '?'?) | 'del') | |
943 effect on automated proof tools, but only on the single-step $rule$ method |
965 effect on automated proof tools, but only on the single-step $rule$ method |
944 (see \S\ref{sec:misc-meth-att}). |
966 (see \S\ref{sec:misc-meth-att}). |
945 \end{descr} |
967 \end{descr} |
946 |
968 |
947 |
969 |
|
970 \subsubsection{Classical operations}\label{sec:classical-att} |
|
971 |
|
972 \indexisaratt{elim-format}\indexisaratt{swapped} |
|
973 |
|
974 \begin{matharray}{rcl} |
|
975 elim_format & : & \isaratt \\ |
|
976 swapped & : & \isaratt \\ |
|
977 \end{matharray} |
|
978 |
|
979 \begin{descr} |
|
980 |
|
981 \item [$elim_format$] turns a destruction rule into elimination rule format; |
|
982 this operation is similar to the the intuitionistic version |
|
983 (\S\ref{sec:misc-meth-att}), but each premise of the resulting rule acquires |
|
984 an additional local fact of the negated main thesis -- according to the |
|
985 classical principle $(\neg A \Imp A) \Imp A$. |
|
986 |
|
987 \item [$swapped$] turns an introduction rule into an elimination, by resolving |
|
988 with the classical swap principle $(\neg B \Imp A) \Imp (\neg A \Imp B)$. |
|
989 |
|
990 \end{descr} |
|
991 |
|
992 |
948 \subsection{Proof by cases and induction}\label{sec:cases-induct} |
993 \subsection{Proof by cases and induction}\label{sec:cases-induct} |
949 |
994 |
950 \subsubsection{Rule contexts}\label{sec:rule-cases} |
995 \subsubsection{Rule contexts}\label{sec:rule-cases} |
951 |
996 |
952 \indexisarcmd{case}\indexisarcmd{print-cases} |
997 \indexisarcmd{case}\indexisarcmd{print-cases} |
968 \medskip |
1013 \medskip |
969 |
1014 |
970 The $\CASENAME$ command provides a shorthand to refer to certain parts of |
1015 The $\CASENAME$ command provides a shorthand to refer to certain parts of |
971 logical context symbolically. Proof methods may provide an environment of |
1016 logical context symbolically. Proof methods may provide an environment of |
972 named ``cases'' of the form $c\colon \vec x, \vec \phi$. Then the effect of |
1017 named ``cases'' of the form $c\colon \vec x, \vec \phi$. Then the effect of |
973 $\CASE{c}$ is exactly the same as $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$. |
1018 ``$\CASE{c}$'' is that of ``$\FIX{\vec x}~\ASSUME{c}{\vec\phi}$''; term |
974 |
1019 bindings may be covered as well, such as $\Var{case}$. |
975 FIXME |
1020 |
976 |
1021 Normally the ``terminology'' of a case value (i.e.\ the parameters $\vec x$) |
977 It is important to note that $\CASENAME$ does \emph{not} provide any means to |
1022 are marked as hidden. Using the alternative form ``$(\CASE{c}~\vec x)$'' |
978 peek at the current goal state, which is treated as strictly non-observable in |
1023 enables proof writers to choose their own naming for the subsequent proof |
979 Isar! Instead, the cases considered here usually emerge in a canonical way |
1024 text. |
980 from certain pieces of specification that appear in the theory somewhere else |
|
981 (e.g.\ in an inductive definition, or recursive function). |
|
982 |
|
983 FIXME |
|
984 |
1025 |
985 \medskip |
1026 \medskip |
|
1027 |
|
1028 It is important to note that $\CASENAME$ does \emph{not} provide direct means |
|
1029 to peek at the current goal state, which is generally considered |
|
1030 non-observable in Isar. The text of the cases basically emerge from standard |
|
1031 elimination or induction rules, which in turn are derived from previous theory |
|
1032 specifications in a canonical way (say via $\isarkeyword{inductive}$). |
986 |
1033 |
987 Named cases may be exhibited in the current proof context only if both the |
1034 Named cases may be exhibited in the current proof context only if both the |
988 proof method and the rules involved support this. Case names and parameters |
1035 proof method and the rules involved support this. Case names and parameters |
989 of basic rules may be declared by hand as well, by using appropriate |
1036 of basic rules may be declared by hand as well, by using appropriate |
990 attributes. Thus variant versions of rules that have been derived manually |
1037 attributes. Thus variant versions of rules that have been derived manually |
997 'case' caseref | ('(' caseref ((name | underscore) +) ')') |
1044 'case' caseref | ('(' caseref ((name | underscore) +) ')') |
998 ; |
1045 ; |
999 caseref: nameref attributes? |
1046 caseref: nameref attributes? |
1000 ; |
1047 ; |
1001 |
1048 |
1002 casenames (name + ) |
1049 casenames (name +) |
1003 ; |
1050 ; |
1004 'params' ((name * ) + 'and') |
1051 'params' ((name *) + 'and') |
1005 ; |
1052 ; |
1006 'consumes' nat? |
1053 'consumes' nat? |
1007 ; |
1054 ; |
1008 \end{rail} |
1055 \end{rail} |
1009 %FIXME bug in rail |
1056 |
1010 |
1057 \begin{descr} |
1011 \begin{descr} |
1058 |
1012 \item [$\CASE{c}$] invokes a named local context $c\colon \vec x, \vec \phi$, |
1059 \item [$\CASE{c}$] invokes a named local context $c\colon \vec x, \vec \phi$, |
1013 as provided by an appropriate proof method (such as $cases$ and $induct$, |
1060 as provided by an appropriate proof method (such as $cases$ and $induct$, |
1014 see \S\ref{sec:cases-induct-meth}). The command $\CASE{c}$ abbreviates |
1061 see \S\ref{sec:cases-induct-meth}). The command $\CASE{c}$ abbreviates |
1015 $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$. |
1062 $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$. |
|
1063 |
1016 \item [$\isarkeyword{print_cases}$] prints all local contexts of the current |
1064 \item [$\isarkeyword{print_cases}$] prints all local contexts of the current |
1017 state, using Isar proof language notation. This is a diagnostic command; |
1065 state, using Isar proof language notation. This is a diagnostic command; |
1018 $undo$ does not apply. |
1066 $undo$ does not apply. |
|
1067 |
1019 \item [$case_names~\vec c$] declares names for the local contexts of premises |
1068 \item [$case_names~\vec c$] declares names for the local contexts of premises |
1020 of some theorem; $\vec c$ refers to the \emph{suffix} of the list of |
1069 of some theorem; $\vec c$ refers to the \emph{suffix} of the list of |
1021 premises. |
1070 premises. |
|
1071 |
1022 \item [$params~\vec p@1 \dots \vec p@n$] renames the innermost parameters of |
1072 \item [$params~\vec p@1 \dots \vec p@n$] renames the innermost parameters of |
1023 premises $1, \dots, n$ of some theorem. An empty list of names may be given |
1073 premises $1, \dots, n$ of some theorem. An empty list of names may be given |
1024 to skip positions, leaving the present parameters unchanged. |
1074 to skip positions, leaving the present parameters unchanged. |
1025 |
1075 |
1026 Note that the default usage of case rules does \emph{not} directly expose |
1076 Note that the default usage of case rules does \emph{not} directly expose |
1027 parameters to the proof context (see also \S\ref{sec:cases-induct-meth}). |
1077 parameters to the proof context (see also \S\ref{sec:cases-induct-meth}). |
|
1078 |
1028 \item [$consumes~n$] declares the number of ``major premises'' of a rule, |
1079 \item [$consumes~n$] declares the number of ``major premises'' of a rule, |
1029 i.e.\ the number of facts to be consumed when it is applied by an |
1080 i.e.\ the number of facts to be consumed when it is applied by an |
1030 appropriate proof method (cf.\ \S\ref{sec:cases-induct-meth}). The default |
1081 appropriate proof method (cf.\ \S\ref{sec:cases-induct-meth}). The default |
1031 value of $consumes$ is $n = 1$, which is appropriate for the usual kind of |
1082 value of $consumes$ is $n = 1$, which is appropriate for the usual kind of |
1032 cases and induction rules for inductive sets (cf.\ |
1083 cases and induction rules for inductive sets (cf.\ |
1129 This enables the writer to specify only induction variables, or both |
1182 This enables the writer to specify only induction variables, or both |
1130 predicates and variables, for example. |
1183 predicates and variables, for example. |
1131 |
1184 |
1132 Additional parameters (including the $open$ option) may be given in the same |
1185 Additional parameters (including the $open$ option) may be given in the same |
1133 way as for $cases$, see above. |
1186 way as for $cases$, see above. |
|
1187 |
1134 \end{descr} |
1188 \end{descr} |
1135 |
1189 |
1136 Above methods produce named local contexts (cf.\ \S\ref{sec:rule-cases}), as |
1190 Above methods produce named local contexts (cf.\ \S\ref{sec:rule-cases}), as |
1137 determined by the instantiated rule \emph{before} it has been applied to the |
1191 determined by the instantiated rule \emph{before} it has been applied to the |
1138 internal proof state.\footnote{As a general principle, Isar proof text may |
1192 internal proof state.\footnote{As a general principle, Isar proof text may |
1202 |
1256 |
1203 \begin{descr} |
1257 \begin{descr} |
1204 |
1258 |
1205 \item [$\isarkeyword{print_induct_rules}$] prints cases and induct rules for |
1259 \item [$\isarkeyword{print_induct_rules}$] prints cases and induct rules for |
1206 sets and types of the current context. |
1260 sets and types of the current context. |
1207 |
1261 |
1208 \item [$cases$ and $induct$] (as attributes) augment the corresponding context |
1262 \item [$cases$ and $induct$] (as attributes) augment the corresponding context |
1209 of rules for reasoning about inductive sets and types, using the |
1263 of rules for reasoning about inductive sets and types, using the |
1210 corresponding methods of the same name. Certain definitional packages of |
1264 corresponding methods of the same name. Certain definitional packages of |
1211 object-logics usually declare emerging cases and induction rules as |
1265 object-logics usually declare emerging cases and induction rules as |
1212 expected, so users rarely need to intervene. |
1266 expected, so users rarely need to intervene. |