doc-src/Logics/Old_HOL.tex
changeset 705 9fb068497df4
parent 629 c97f5a7cf763
child 841 14b96e3bd4ab
equal deleted inserted replaced
704:b71b6be59354 705:9fb068497df4
   845   \it symbol    & \it meta-type &           & \it description \\ 
   845   \it symbol    & \it meta-type &           & \it description \\ 
   846   \cdx{Pair}    & $[\alpha,\beta]\To \alpha\times\beta$
   846   \cdx{Pair}    & $[\alpha,\beta]\To \alpha\times\beta$
   847         & & ordered pairs $\langle a,b\rangle$ \\
   847         & & ordered pairs $\langle a,b\rangle$ \\
   848   \cdx{fst}     & $\alpha\times\beta \To \alpha$        & & first projection\\
   848   \cdx{fst}     & $\alpha\times\beta \To \alpha$        & & first projection\\
   849   \cdx{snd}     & $\alpha\times\beta \To \beta$         & & second projection\\
   849   \cdx{snd}     & $\alpha\times\beta \To \beta$         & & second projection\\
   850   \cdx{split}   & $[\alpha\times\beta, [\alpha,\beta]\To\gamma] \To \gamma$ 
   850   \cdx{split}   & $[[\alpha,\beta]\To\gamma, \alpha\times\beta] \To \gamma$ 
   851         & & generalized projection\\
   851         & & generalized projection\\
   852   \cdx{Sigma}  & 
   852   \cdx{Sigma}  & 
   853         $[\alpha\,set, \alpha\To\beta\,set]\To(\alpha\times\beta)set$ &
   853         $[\alpha\,set, \alpha\To\beta\,set]\To(\alpha\times\beta)set$ &
   854         & general sum of sets
   854         & general sum of sets
   855 \end{constants}
   855 \end{constants}
   856 \begin{ttbox}\makeatletter
   856 \begin{ttbox}\makeatletter
   857 \tdx{fst_def}      fst(p)     == @a. ? b. p = <a,b>
   857 \tdx{fst_def}      fst(p)     == @a. ? b. p = <a,b>
   858 \tdx{snd_def}      snd(p)     == @b. ? a. p = <a,b>
   858 \tdx{snd_def}      snd(p)     == @b. ? a. p = <a,b>
   859 \tdx{split_def}    split(p,c) == c(fst(p),snd(p))
   859 \tdx{split_def}    split(c,p) == c(fst(p),snd(p))
   860 \tdx{Sigma_def}    Sigma(A,B) == UN x:A. UN y:B(x). \{<x,y>\}
   860 \tdx{Sigma_def}    Sigma(A,B) == UN x:A. UN y:B(x). \{<x,y>\}
   861 
   861 
   862 
   862 
   863 \tdx{Pair_inject}  [| <a, b> = <a',b'>;  [| a=a';  b=b' |] ==> R |] ==> R
   863 \tdx{Pair_inject}  [| <a, b> = <a',b'>;  [| a=a';  b=b' |] ==> R |] ==> R
   864 \tdx{fst_conv}     fst(<a,b>) = a
   864 \tdx{fst_conv}     fst(<a,b>) = a
   865 \tdx{snd_conv}     snd(<a,b>) = b
   865 \tdx{snd_conv}     snd(<a,b>) = b
   866 \tdx{split}        split(<a,b>, c) = c(a,b)
   866 \tdx{split}        split(c, <a,b>) = c(a,b)
   867 
   867 
   868 \tdx{surjective_pairing}  p = <fst(p),snd(p)>
   868 \tdx{surjective_pairing}  p = <fst(p),snd(p)>
   869 
   869 
   870 \tdx{SigmaI}       [| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)
   870 \tdx{SigmaI}       [| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)
   871 
   871 
   879 \begin{figure}
   879 \begin{figure}
   880 \begin{constants}
   880 \begin{constants}
   881   \it symbol    & \it meta-type &           & \it description \\ 
   881   \it symbol    & \it meta-type &           & \it description \\ 
   882   \cdx{Inl}     & $\alpha \To \alpha+\beta$    & & first injection\\
   882   \cdx{Inl}     & $\alpha \To \alpha+\beta$    & & first injection\\
   883   \cdx{Inr}     & $\beta \To \alpha+\beta$     & & second injection\\
   883   \cdx{Inr}     & $\beta \To \alpha+\beta$     & & second injection\\
   884   \cdx{sum_case} & $[\alpha+\beta, \alpha\To\gamma, \beta\To\gamma] \To\gamma$
   884   \cdx{sum_case} & $[\alpha\To\gamma, \beta\To\gamma, \alpha+\beta] \To\gamma$
   885         & & conditional
   885         & & conditional
   886 \end{constants}
   886 \end{constants}
   887 \begin{ttbox}\makeatletter
   887 \begin{ttbox}\makeatletter
   888 \tdx{sum_case_def}   sum_case == (\%p f g. @z. (!x. p=Inl(x) --> z=f(x)) &
   888 \tdx{sum_case_def}   sum_case == (\%f g p. @z. (!x. p=Inl(x) --> z=f(x)) &
   889                                         (!y. p=Inr(y) --> z=g(y)))
   889                                         (!y. p=Inr(y) --> z=g(y)))
   890 
   890 
   891 \tdx{Inl_not_Inr}    ~ Inl(a)=Inr(b)
   891 \tdx{Inl_not_Inr}    ~ Inl(a)=Inr(b)
   892 
   892 
   893 \tdx{inj_Inl}        inj(Inl)
   893 \tdx{inj_Inl}        inj(Inl)
   894 \tdx{inj_Inr}        inj(Inr)
   894 \tdx{inj_Inr}        inj(Inr)
   895 
   895 
   896 \tdx{sumE}           [| !!x::'a. P(Inl(x));  !!y::'b. P(Inr(y)) |] ==> P(s)
   896 \tdx{sumE}           [| !!x::'a. P(Inl(x));  !!y::'b. P(Inr(y)) |] ==> P(s)
   897 
   897 
   898 \tdx{sum_case_Inl}   sum_case(Inl(x), f, g) = f(x)
   898 \tdx{sum_case_Inl}   sum_case(f, g, Inl(x)) = f(x)
   899 \tdx{sum_case_Inr}   sum_case(Inr(x), f, g) = g(x)
   899 \tdx{sum_case_Inr}   sum_case(f, g, Inr(x)) = g(x)
   900 
   900 
   901 \tdx{surjective_sum} sum_case(s, \%x::'a. f(Inl(x)), \%y::'b. f(Inr(y))) = f(s)
   901 \tdx{surjective_sum} sum_case(\%x::'a. f(Inl(x)), \%y::'b. f(Inr(y)), s) = f(s)
   902 \end{ttbox}
   902 \end{ttbox}
   903 \caption{Type $\alpha+\beta$}\label{hol-sum}
   903 \caption{Type $\alpha+\beta$}\label{hol-sum}
   904 \end{figure}
   904 \end{figure}
   905 
   905 
   906 
   906 
   930 as {\tt step_tac}, {\tt fast_tac}, {\tt best_tac}, etc., refer to it.
   930 as {\tt step_tac}, {\tt fast_tac}, {\tt best_tac}, etc., refer to it.
   931 \HOL\ defines the following classical rule sets:
   931 \HOL\ defines the following classical rule sets:
   932 \begin{ttbox} 
   932 \begin{ttbox} 
   933 prop_cs    : claset
   933 prop_cs    : claset
   934 HOL_cs     : claset
   934 HOL_cs     : claset
   935 HOL_dup_cs : claset
       
   936 set_cs     : claset
   935 set_cs     : claset
   937 \end{ttbox}
   936 \end{ttbox}
   938 \begin{ttdescription}
   937 \begin{ttdescription}
   939 \item[\ttindexbold{prop_cs}] contains the propositional rules, namely
   938 \item[\ttindexbold{prop_cs}] contains the propositional rules, namely
   940 those for~$\top$, $\bot$, $\conj$, $\disj$, $\neg$, $\imp$ and~$\bimp$,
   939 those for~$\top$, $\bot$, $\conj$, $\disj$, $\neg$, $\imp$ and~$\bimp$,
   943 \item[\ttindexbold{HOL_cs}] extends {\tt prop_cs} with the safe rules
   942 \item[\ttindexbold{HOL_cs}] extends {\tt prop_cs} with the safe rules
   944   {\tt allI} and~{\tt exE} and the unsafe rules {\tt allE}
   943   {\tt allI} and~{\tt exE} and the unsafe rules {\tt allE}
   945   and~{\tt exI}, as well as rules for unique existence.  Search using
   944   and~{\tt exI}, as well as rules for unique existence.  Search using
   946   this classical set is incomplete: quantified formulae are used at most
   945   this classical set is incomplete: quantified formulae are used at most
   947   once.
   946   once.
   948 
       
   949 \item[\ttindexbold{HOL_dup_cs}] extends {\tt prop_cs} with the safe rules
       
   950   {\tt allI} and~{\tt exE} and the unsafe rules \tdx{all_dupE}
       
   951   and~\tdx{exCI}, as well as rules for unique existence.  Search using
       
   952   this is complete --- quantified formulae may be duplicated --- but
       
   953   frequently fails to terminate.  It is generally unsuitable for
       
   954   depth-first search.
       
   955 
   947 
   956 \item[\ttindexbold{set_cs}] extends {\tt HOL_cs} with rules for the bounded
   948 \item[\ttindexbold{set_cs}] extends {\tt HOL_cs} with rules for the bounded
   957   quantifiers, subsets, comprehensions, unions and intersections,
   949   quantifiers, subsets, comprehensions, unions and intersections,
   958   complements, finite sets, images and ranges.
   950   complements, finite sets, images and ranges.
   959 \end{ttdescription}
   951 \end{ttdescription}
   992 \index{*"- symbol}
   984 \index{*"- symbol}
   993 \begin{constants}
   985 \begin{constants}
   994   \it symbol    & \it meta-type & \it priority & \it description \\ 
   986   \it symbol    & \it meta-type & \it priority & \it description \\ 
   995   \cdx{0}       & $nat$         & & zero \\
   987   \cdx{0}       & $nat$         & & zero \\
   996   \cdx{Suc}     & $nat \To nat$ & & successor function\\
   988   \cdx{Suc}     & $nat \To nat$ & & successor function\\
   997   \cdx{nat_case} & $[nat, \alpha, nat\To\alpha] \To\alpha$
   989   \cdx{nat_case} & $[\alpha, nat\To\alpha, nat] \To\alpha$
   998         & & conditional\\
   990         & & conditional\\
   999   \cdx{nat_rec} & $[nat, \alpha, [nat, \alpha]\To\alpha] \To \alpha$
   991   \cdx{nat_rec} & $[nat, \alpha, [nat, \alpha]\To\alpha] \To \alpha$
  1000         & & primitive recursor\\
   992         & & primitive recursor\\
  1001   \cdx{pred_nat} & $(nat\times nat) set$ & & predecessor relation\\
   993   \cdx{pred_nat} & $(nat\times nat) set$ & & predecessor relation\\
  1002   \tt *         & $[nat,nat]\To nat$    &  Left 70      & multiplication \\
   994   \tt *         & $[nat,nat]\To nat$    &  Left 70      & multiplication \\
  1006   \tt -         & $[nat,nat]\To nat$    &  Left 65      & subtraction
   998   \tt -         & $[nat,nat]\To nat$    &  Left 65      & subtraction
  1007 \end{constants}
   999 \end{constants}
  1008 \subcaption{Constants and infixes}
  1000 \subcaption{Constants and infixes}
  1009 
  1001 
  1010 \begin{ttbox}\makeatother
  1002 \begin{ttbox}\makeatother
  1011 \tdx{nat_case_def}  nat_case == (\%n a f. @z. (n=0 --> z=a) & 
  1003 \tdx{nat_case_def}  nat_case == (\%a f n. @z. (n=0 --> z=a) & 
  1012                                        (!x. n=Suc(x) --> z=f(x)))
  1004                                        (!x. n=Suc(x) --> z=f(x)))
  1013 \tdx{pred_nat_def}  pred_nat == \{p. ? n. p = <n, Suc(n)>\} 
  1005 \tdx{pred_nat_def}  pred_nat == \{p. ? n. p = <n, Suc(n)>\} 
  1014 \tdx{less_def}      m<n      == <m,n>:pred_nat^+
  1006 \tdx{less_def}      m<n      == <m,n>:pred_nat^+
  1015 \tdx{nat_rec_def}   nat_rec(n,c,d) == 
  1007 \tdx{nat_rec_def}   nat_rec(n,c,d) == 
  1016                wfrec(pred_nat, n, \%l g.nat_case(l, c, \%m.d(m,g(m))))
  1008                wfrec(pred_nat, n, nat_case(\%g.c, \%m g. d(m,g(m))))
  1017 
  1009 
  1018 \tdx{add_def}   m+n     == nat_rec(m, n, \%u v.Suc(v))
  1010 \tdx{add_def}   m+n     == nat_rec(m, n, \%u v.Suc(v))
  1019 \tdx{diff_def}  m-n     == nat_rec(n, m, \%u v. nat_rec(v, 0, \%x y.x))
  1011 \tdx{diff_def}  m-n     == nat_rec(n, m, \%u v. nat_rec(v, 0, \%x y.x))
  1020 \tdx{mult_def}  m*n     == nat_rec(m, 0, \%u v. n + v)
  1012 \tdx{mult_def}  m*n     == nat_rec(m, 0, \%u v. n + v)
  1021 \tdx{mod_def}   m mod n == wfrec(trancl(pred_nat), m, \%j f. if(j<n,j,f(j-n)))
  1013 \tdx{mod_def}   m mod n == wfrec(trancl(pred_nat), m, \%j f. if(j<n,j,f(j-n)))
  1038 
  1030 
  1039 \tdx{pred_natI}      <n, Suc(n)> : pred_nat
  1031 \tdx{pred_natI}      <n, Suc(n)> : pred_nat
  1040 \tdx{pred_natE}
  1032 \tdx{pred_natE}
  1041     [| p : pred_nat;  !!x n. [| p = <n, Suc(n)> |] ==> R |] ==> R
  1033     [| p : pred_nat;  !!x n. [| p = <n, Suc(n)> |] ==> R |] ==> R
  1042 
  1034 
  1043 \tdx{nat_case_0}     nat_case(0, a, f) = a
  1035 \tdx{nat_case_0}     nat_case(a, f, 0) = a
  1044 \tdx{nat_case_Suc}   nat_case(Suc(k), a, f) = f(k)
  1036 \tdx{nat_case_Suc}   nat_case(a, f, Suc(k)) = f(k)
  1045 
  1037 
  1046 \tdx{wf_pred_nat}    wf(pred_nat)
  1038 \tdx{wf_pred_nat}    wf(pred_nat)
  1047 \tdx{nat_rec_0}      nat_rec(0,c,h) = c
  1039 \tdx{nat_rec_0}      nat_rec(0,c,h) = c
  1048 \tdx{nat_rec_Suc}    nat_rec(Suc(n), c, h) = h(n, nat_rec(n,c,h))
  1040 \tdx{nat_rec_Suc}    nat_rec(Suc(n), c, h) = h(n, nat_rec(n,c,h))
  1049 \subcaption{Case analysis and primitive recursion}
  1041 \subcaption{Case analysis and primitive recursion}
  1162 \begin{figure}
  1154 \begin{figure}
  1163 \begin{ttbox}\makeatother
  1155 \begin{ttbox}\makeatother
  1164 \tdx{list_rec_Nil}    list_rec([],c,h) = c  
  1156 \tdx{list_rec_Nil}    list_rec([],c,h) = c  
  1165 \tdx{list_rec_Cons}   list_rec(a#l, c, h) = h(a, l, list_rec(l,c,h))
  1157 \tdx{list_rec_Cons}   list_rec(a#l, c, h) = h(a, l, list_rec(l,c,h))
  1166 
  1158 
  1167 \tdx{list_case_Nil}   list_case([],c,h) = c 
  1159 \tdx{list_case_Nil}   list_case(c, h, []) = c 
  1168 \tdx{list_case_Cons}  list_case(x#xs, c, h) = h(x, xs)
  1160 \tdx{list_case_Cons}  list_case(c, h, x#xs) = h(x, xs)
  1169 
  1161 
  1170 \tdx{map_Nil}         map(f,[]) = []
  1162 \tdx{map_Nil}         map(f,[]) = []
  1171 \tdx{map_Cons}        map(f, x \# xs) = f(x) \# map(f,xs)
  1163 \tdx{map_Cons}        map(f, x \# xs) = f(x) \# map(f,xs)
  1172 
  1164 
  1173 \tdx{null_Nil}        null([]) = True
  1165 \tdx{null_Nil}        null([]) = True
  1208   \begin{array}{r@{\;}l@{}l}
  1200   \begin{array}{r@{\;}l@{}l}
  1209   "case " e " of" & "[]"    & " => " a\\
  1201   "case " e " of" & "[]"    & " => " a\\
  1210               "|" & x"\#"xs & " => " b
  1202               "|" & x"\#"xs & " => " b
  1211   \end{array} 
  1203   \end{array} 
  1212   & \equiv &
  1204   & \equiv &
  1213   "list_case"(e, a, \lambda x\;xs.b)
  1205   "list_case"(a, \lambda x\;xs.b, e)
  1214 \end{eqnarray*}}%
  1206 \end{eqnarray*}}%
  1215 The theory includes \cdx{list_rec}, a primitive recursion operator
  1207 The theory includes \cdx{list_rec}, a primitive recursion operator
  1216 for lists.  It is derived from well-founded recursion, a general principle
  1208 for lists.  It is derived from well-founded recursion, a general principle
  1217 that can express arbitrary total recursive functions.
  1209 that can express arbitrary total recursive functions.
  1218 
  1210