doc-src/HOL/HOL.tex
changeset 42924 bd8d78745a7d
parent 42914 e6ed6b951201
child 43270 bc72c1ccc89e
equal deleted inserted replaced
42923:3ba51a3acff0 42924:bd8d78745a7d
   308 like all other Isabelle theories, uses meta-equality~({\tt==}) for
   308 like all other Isabelle theories, uses meta-equality~({\tt==}) for
   309 definitions.
   309 definitions.
   310 \begin{warn}
   310 \begin{warn}
   311 The definitions above should never be expanded and are shown for completeness
   311 The definitions above should never be expanded and are shown for completeness
   312 only.  Instead users should reason in terms of the derived rules shown below
   312 only.  Instead users should reason in terms of the derived rules shown below
   313 or, better still, using high-level tactics
   313 or, better still, using high-level tactics.
   314 (see~{\S}\ref{sec:HOL:generic-packages}).
       
   315 \end{warn}
   314 \end{warn}
   316 
   315 
   317 Some of the rules mention type variables; for example, \texttt{refl}
   316 Some of the rules mention type variables; for example, \texttt{refl}
   318 mentions the type variable~{\tt'a}.  This allows you to instantiate
   317 mentions the type variable~{\tt'a}.  This allows you to instantiate
   319 type variables explicitly by calling \texttt{res_inst_tac}.
   318 type variables explicitly by calling \texttt{res_inst_tac}.
   878 
   877 
   879 There is also a large collection of monotonicity theorems for constructions
   878 There is also a large collection of monotonicity theorems for constructions
   880 on sets in the file \texttt{HOL/mono.ML}.
   879 on sets in the file \texttt{HOL/mono.ML}.
   881 
   880 
   882 
   881 
   883 \section{Generic packages}
   882 \section{Simplification and substitution}
   884 \label{sec:HOL:generic-packages}
       
   885 
       
   886 HOL instantiates most of Isabelle's generic packages, making available the
       
   887 simplifier and the classical reasoner.
       
   888 
       
   889 \subsection{Simplification and substitution}
       
   890 
   883 
   891 Simplification tactics tactics such as \texttt{Asm_simp_tac} and \texttt{Full_simp_tac} use the default simpset
   884 Simplification tactics tactics such as \texttt{Asm_simp_tac} and \texttt{Full_simp_tac} use the default simpset
   892 (\texttt{simpset()}), which works for most purposes.  A quite minimal
   885 (\texttt{simpset()}), which works for most purposes.  A quite minimal
   893 simplification set for higher-order logic is~\ttindexbold{HOL_ss};
   886 simplification set for higher-order logic is~\ttindexbold{HOL_ss};
   894 even more frugal is \ttindexbold{HOL_basic_ss}.  Equality~($=$), which
   887 even more frugal is \ttindexbold{HOL_basic_ss}.  Equality~($=$), which
   930 
   923 
   931 HOL provides the tactic \ttindex{hyp_subst_tac}, which substitutes for an
   924 HOL provides the tactic \ttindex{hyp_subst_tac}, which substitutes for an
   932 equality throughout a subgoal and its hypotheses.  This tactic uses HOL's
   925 equality throughout a subgoal and its hypotheses.  This tactic uses HOL's
   933 general substitution rule.
   926 general substitution rule.
   934 
   927 
   935 \subsubsection{Case splitting}
   928 \subsection{Case splitting}
   936 \label{subsec:HOL:case:splitting}
   929 \label{subsec:HOL:case:splitting}
   937 
   930 
   938 HOL also provides convenient means for case splitting during rewriting. Goals
   931 HOL also provides convenient means for case splitting during rewriting. Goals
   939 containing a subterm of the form \texttt{if}~$b$~{\tt then\dots else\dots}
   932 containing a subterm of the form \texttt{if}~$b$~{\tt then\dots else\dots}
   940 often require a case distinction on $b$. This is expressed by the theorem
   933 often require a case distinction on $b$. This is expressed by the theorem
   986 \begin{ttbox}
   979 \begin{ttbox}
   987 \ttindexbold{Addsplits}: thm list -> unit
   980 \ttindexbold{Addsplits}: thm list -> unit
   988 \ttindexbold{Delsplits}: thm list -> unit
   981 \ttindexbold{Delsplits}: thm list -> unit
   989 \end{ttbox}
   982 \end{ttbox}
   990 for adding splitting rules to, and deleting them from the current simpset.
   983 for adding splitting rules to, and deleting them from the current simpset.
   991 
       
   992 \subsection{Classical reasoning}
       
   993 
       
   994 HOL derives classical introduction rules for $\disj$ and~$\exists$, as well as
       
   995 classical elimination rules for~$\imp$ and~$\bimp$, and the swap rule; recall
       
   996 Fig.\ts\ref{hol-lemmas2} above.
       
   997 
       
   998 The classical reasoner is installed.  Tactics such as \texttt{Blast_tac} and
       
   999 {\tt Best_tac} refer to the default claset (\texttt{claset()}), which works
       
  1000 for most purposes.  Named clasets include \ttindexbold{prop_cs}, which
       
  1001 includes the propositional rules, and \ttindexbold{HOL_cs}, which also
       
  1002 includes quantifier rules.  See the file \texttt{HOL/cladata.ML} for lists of
       
  1003 the classical rules,
       
  1004 and \iflabelundefined{chap:classical}{the {\em Reference Manual\/}}%
       
  1005 {Chap.\ts\ref{chap:classical}} for more discussion of classical proof methods.
       
  1006 
       
  1007 
       
  1008 %FIXME outdated, both from the Isabelle and SVC perspective
       
  1009 % \section{Calling the decision procedure SVC}\label{sec:HOL:SVC}
       
  1010 
       
  1011 % \index{SVC decision procedure|(}
       
  1012 
       
  1013 % The Stanford Validity Checker (SVC) is a tool that can check the validity of
       
  1014 % certain types of formulae.  If it is installed on your machine, then
       
  1015 % Isabelle/HOL can be configured to call it through the tactic
       
  1016 % \ttindex{svc_tac}.  It is ideal for large tautologies and complex problems in
       
  1017 % linear arithmetic.  Subexpressions that SVC cannot handle are automatically
       
  1018 % replaced by variables, so you can call the tactic on any subgoal.  See the
       
  1019 % file \texttt{HOL/ex/svc_test.ML} for examples.
       
  1020 % \begin{ttbox} 
       
  1021 % svc_tac   : int -> tactic
       
  1022 % Svc.trace : bool ref      \hfill{\bf initially false}
       
  1023 % \end{ttbox}
       
  1024 
       
  1025 % \begin{ttdescription}
       
  1026 % \item[\ttindexbold{svc_tac} $i$] attempts to prove subgoal~$i$ by translating
       
  1027 %   it into a formula recognized by~SVC\@.  If it succeeds then the subgoal is
       
  1028 %   removed.  It fails if SVC is unable to prove the subgoal.  It crashes with
       
  1029 %   an error message if SVC appears not to be installed.  Numeric variables may
       
  1030 %   have types \texttt{nat}, \texttt{int} or \texttt{real}.
       
  1031 
       
  1032 % \item[\ttindexbold{Svc.trace}] is a flag that, if set, causes \texttt{svc_tac}
       
  1033 %   to trace its operations: abstraction of the subgoal, translation to SVC
       
  1034 %   syntax, SVC's response.
       
  1035 % \end{ttdescription}
       
  1036 
       
  1037 % Here is an example, with tracing turned on:
       
  1038 % \begin{ttbox}
       
  1039 % set Svc.trace;
       
  1040 % {\out val it : bool = true}
       
  1041 % Goal "(#3::nat)*a <= #2 + #4*b + #6*c  & #11 <= #2*a + b + #2*c & \ttback
       
  1042 % \ttback     a + #3*b <= #5 + #2*c  --> #2 + #3*b <= #2*a + #6*c";
       
  1043 
       
  1044 % by (svc_tac 1);
       
  1045 % {\out Subgoal abstracted to}
       
  1046 % {\out #3 * a <= #2 + #4 * b + #6 * c &}
       
  1047 % {\out #11 <= #2 * a + b + #2 * c & a + #3 * b <= #5 + #2 * c -->}
       
  1048 % {\out #2 + #3 * b <= #2 * a + #6 * c}
       
  1049 % {\out Calling SVC:}
       
  1050 % {\out (=> (<= 0  (F_c) )  (=> (<= 0  (F_b) )  (=> (<= 0  (F_a) )}
       
  1051 % {\out   (=> (AND (<= {* 3  (F_a) }  {+ {+ 2  {* 4  (F_b) } }  }
       
  1052 % {\out {* 6  (F_c) } } )  (AND (<= 11  {+ {+ {* 2  (F_a) }  (F_b) }}
       
  1053 % {\out   {* 2  (F_c) } } )  (<= {+ (F_a)  {* 3  (F_b) } }  {+ 5  }
       
  1054 % {\out {* 2  (F_c) } } ) ) )  (< {+ 2  {* 3  (F_b) } }  {+ 1  {+ }
       
  1055 % {\out {* 2  (F_a) }  {* 6  (F_c) } } } ) ) ) ) ) }
       
  1056 % {\out SVC Returns:}
       
  1057 % {\out VALID}
       
  1058 % {\out Level 1}
       
  1059 % {\out #3 * a <= #2 + #4 * b + #6 * c &}
       
  1060 % {\out #11 <= #2 * a + b + #2 * c & a + #3 * b <= #5 + #2 * c -->}
       
  1061 % {\out #2 + #3 * b <= #2 * a + #6 * c}
       
  1062 % {\out No subgoals!}
       
  1063 % \end{ttbox}
       
  1064 
       
  1065 
       
  1066 % \begin{warn}
       
  1067 % Calling \ttindex{svc_tac} entails an above-average risk of
       
  1068 % unsoundness.  Isabelle does not check SVC's result independently.  Moreover,
       
  1069 % the tactic translates the submitted formula using code that lies outside
       
  1070 % Isabelle's inference core.  Theorems that depend upon results proved using SVC
       
  1071 % (and other oracles) are displayed with the annotation \texttt{[!]} attached.
       
  1072 % You can also use \texttt{\#der (rep_thm $th$)} to examine the proof object of
       
  1073 % theorem~$th$, as described in the \emph{Reference Manual}.  
       
  1074 % \end{warn}
       
  1075 
       
  1076 % To start, first download SVC from the Internet at URL
       
  1077 % \begin{ttbox}
       
  1078 % http://agamemnon.stanford.edu/~levitt/vc/index.html
       
  1079 % \end{ttbox}
       
  1080 % and install it using the instructions supplied.  SVC requires two environment
       
  1081 % variables:
       
  1082 % \begin{ttdescription}
       
  1083 % \item[\ttindexbold{SVC_HOME}] is an absolute pathname to the SVC
       
  1084 %     distribution directory. 
       
  1085     
       
  1086 %   \item[\ttindexbold{SVC_MACHINE}] identifies the type of computer and
       
  1087 %     operating system.  
       
  1088 % \end{ttdescription}
       
  1089 % You can set these environment variables either using the Unix shell or through
       
  1090 % an Isabelle \texttt{settings} file.  Isabelle assumes SVC to be installed if
       
  1091 % \texttt{SVC_HOME} is defined.
       
  1092 
       
  1093 % \paragraph*{Acknowledgement.}  This interface uses code supplied by S{\o}ren
       
  1094 % Heilmann.
       
  1095 
       
  1096 
       
  1097 % \index{SVC decision procedure|)}
       
  1098 
       
  1099 
       
  1100 
   984 
  1101 
   985 
  1102 \section{Types}\label{sec:HOL:Types}
   986 \section{Types}\label{sec:HOL:Types}
  1103 This section describes HOL's basic predefined types ($\alpha \times \beta$,
   987 This section describes HOL's basic predefined types ($\alpha \times \beta$,
  1104 $\alpha + \beta$, $nat$ and $\alpha \; list$) and ways for introducing new
   988 $\alpha + \beta$, $nat$ and $\alpha \; list$) and ways for introducing new