# HG changeset patch # User wenzelm # Date 1451505915 -3600 # Node ID 208c99a0092ece58cfd3e884ac9e2d56b1a3e9d5 # Parent 74709e9c4f1776fe50f7c3d80801f46e55b1ec5e modernized Isabelle document markup; diff -r 74709e9c4f17 -r 208c99a0092e src/Doc/Main/Main_Doc.thy --- a/src/Doc/Main/Main_Doc.thy Wed Dec 30 20:50:08 2015 +0100 +++ b/src/Doc/Main/Main_Doc.thy Wed Dec 30 21:05:15 2015 +0100 @@ -3,7 +3,7 @@ imports Main begin -setup {* +setup \ let fun pretty_term_type_only ctxt (t, T) = (if fastype_of t = Sign.certify_typ (Proof_Context.theory_of ctxt) T then () @@ -16,14 +16,14 @@ Thy_Output.output ctxt (Thy_Output.maybe_pretty_source pretty_term_type_only ctxt source [arg])) end -*} -setup {* +\ +setup \ Thy_Output.antiquotation @{binding expanded_typ} (Args.typ >> single) (fn {source, context, ...} => Thy_Output.output context o Thy_Output.maybe_pretty_source Syntax.pretty_typ context source) -*} +\ (*>*) -text{* +text\ \begin{abstract} This document lists the main types, functions and syntax provided by theory @{theory Main}. It is meant as a quick overview of what is available. For infix operators and their precedences see the final section. The sophisticated class structure is only hinted at. For details see @{url "http://isabelle.in.tum.de/library/HOL/"}. @@ -32,7 +32,7 @@ \section*{HOL} The basic logic: @{prop "x = y"}, @{const True}, @{const False}, @{prop"Not P"}, @{prop"P & Q"}, @{prop "P | Q"}, @{prop "P --> Q"}, @{prop"ALL x. P"}, @{prop"EX x. P"}, @{prop"EX! x. P"}, @{term"THE x. P"}. -\smallskip +\<^smallskip> \begin{tabular}{@ {} l @ {~::~} l @ {}} @{const HOL.undefined} & @{typeof HOL.undefined}\\ @@ -42,7 +42,7 @@ \subsubsection*{Syntax} \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{term"~(x = y)"} & @{term[source]"\ (x = y)"} & (\verb$~=$)\\ +@{term"~(x = y)"} & @{term[source]"\ (x = y)"} & (\<^verbatim>\~=\)\\ @{term[source]"P \ Q"} & @{term"P \ Q"} \\ @{term"If x y z"} & @{term[source]"If x y z"}\\ @{term"Let e\<^sub>1 (%x. e\<^sub>2)"} & @{term[source]"Let e\<^sub>1 (\x. e\<^sub>2)"}\\ @@ -53,10 +53,10 @@ A collection of classes defining basic orderings: preorder, partial order, linear order, dense linear order and wellorder. -\smallskip +\<^smallskip> \begin{supertabular}{@ {} l @ {~::~} l l @ {}} -@{const Orderings.less_eq} & @{typeof Orderings.less_eq} & (\verb$<=$)\\ +@{const Orderings.less_eq} & @{typeof Orderings.less_eq} & (\<^verbatim>\<=\)\\ @{const Orderings.less} & @{typeof Orderings.less}\\ @{const Orderings.Least} & @{typeof Orderings.Least}\\ @{const Orderings.min} & @{typeof Orderings.min}\\ @@ -70,7 +70,7 @@ \subsubsection*{Syntax} \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{term[source]"x \ y"} & @{term"x \ y"} & (\verb$>=$)\\ +@{term[source]"x \ y"} & @{term"x \ y"} & (\<^verbatim>\>=\)\\ @{term[source]"x > y"} & @{term"x > y"}\\ @{term"ALL x<=y. P"} & @{term[source]"\x. x \ y \ P"}\\ @{term"EX x<=y. P"} & @{term[source]"\x. x \ y \ P"}\\ @@ -93,8 +93,7 @@ \subsubsection*{Syntax} -Available by loading theory @{text Lattice_Syntax} in directory @{text -Library}. +Available by loading theory \Lattice_Syntax\ in directory \Library\. \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} @{text[source]"x \ y"} & @{term"x \ y"}\\ @@ -114,9 +113,9 @@ @{const Set.empty} & @{term_type_only "Set.empty" "'a set"}\\ @{const Set.insert} & @{term_type_only insert "'a\'a set\'a set"}\\ @{const Collect} & @{term_type_only Collect "('a\bool)\'a set"}\\ -@{const Set.member} & @{term_type_only Set.member "'a\'a set\bool"} & (\texttt{:})\\ -@{const Set.union} & @{term_type_only Set.union "'a set\'a set \ 'a set"} & (\texttt{Un})\\ -@{const Set.inter} & @{term_type_only Set.inter "'a set\'a set \ 'a set"} & (\texttt{Int})\\ +@{const Set.member} & @{term_type_only Set.member "'a\'a set\bool"} & (\<^verbatim>\:\)\\ +@{const Set.union} & @{term_type_only Set.union "'a set\'a set \ 'a set"} & (\<^verbatim>\Un\)\\ +@{const Set.inter} & @{term_type_only Set.inter "'a set\'a set \ 'a set"} & (\<^verbatim>\Int\)\\ @{const UNION} & @{term_type_only UNION "'a set\('a \ 'b set) \ 'b set"}\\ @{const INTER} & @{term_type_only INTER "'a set\('a \ 'b set) \ 'b set"}\\ @{const Union} & @{term_type_only Union "'a set set\'a set"}\\ @@ -131,14 +130,14 @@ \subsubsection*{Syntax} \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{text"{a\<^sub>1,\,a\<^sub>n}"} & @{text"insert a\<^sub>1 (\ (insert a\<^sub>n {})\)"}\\ +\{a\<^sub>1,\,a\<^sub>n}\ & \insert a\<^sub>1 (\ (insert a\<^sub>n {})\)\\\ @{term"a ~: A"} & @{term[source]"\(x \ A)"}\\ @{term"A \ B"} & @{term[source]"A \ B"}\\ @{term"A \ B"} & @{term[source]"A < B"}\\ @{term[source]"A \ B"} & @{term[source]"B \ A"}\\ @{term[source]"A \ B"} & @{term[source]"B < A"}\\ @{term"{x. P}"} & @{term[source]"Collect (\x. P)"}\\ -@{text"{t | x\<^sub>1 \ x\<^sub>n. P}"} & @{text"{v. \x\<^sub>1 \ x\<^sub>n. v = t \ P}"}\\ +\{t | x\<^sub>1 \ x\<^sub>n. P}\ & \{v. \x\<^sub>1 \ x\<^sub>n. v = t \ P}\\\ @{term[source]"\x\I. A"} & @{term[source]"UNION I (\x. A)"} & (\texttt{UN})\\ @{term[source]"\x. A"} & @{term[source]"UNION UNIV (\x. A)"}\\ @{term[source]"\x\I. A"} & @{term[source]"INTER I (\x. A)"} & (\texttt{INT})\\ @@ -166,14 +165,14 @@ \begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} @{term"fun_upd f x y"} & @{term[source]"fun_upd f x y"}\\ -@{text"f(x\<^sub>1:=y\<^sub>1,\,x\<^sub>n:=y\<^sub>n)"} & @{text"f(x\<^sub>1:=y\<^sub>1)\(x\<^sub>n:=y\<^sub>n)"}\\ +\f(x\<^sub>1:=y\<^sub>1,\,x\<^sub>n:=y\<^sub>n)\ & \f(x\<^sub>1:=y\<^sub>1)\(x\<^sub>n:=y\<^sub>n)\\\ \end{tabular} \section*{Hilbert\_Choice} Hilbert's selection ($\varepsilon$) operator: @{term"SOME x. P"}. -\smallskip +\<^smallskip> \begin{tabular}{@ {} l @ {~::~} l @ {}} @{const Hilbert_Choice.inv_into} & @{term_type_only Hilbert_Choice.inv_into "'a set \ ('a \ 'b) \ ('b \ 'a)"} @@ -200,7 +199,7 @@ \section*{Sum\_Type} -Type constructor @{text"+"}. +Type constructor \+\. \begin{tabular}{@ {} l @ {~::~} l @ {}} @{const Sum_Type.Inl} & @{typeof Sum_Type.Inl}\\ @@ -211,7 +210,7 @@ \section*{Product\_Type} -Types @{typ unit} and @{text"\"}. +Types @{typ unit} and \\\. \begin{supertabular}{@ {} l @ {~::~} l @ {}} @{const Product_Type.Unity} & @{typeof Product_Type.Unity}\\ @@ -228,11 +227,11 @@ \begin{tabular}{@ {} l @ {\quad$\equiv$\quad} ll @ {}} @{term"Pair a b"} & @{term[source]"Pair a b"}\\ @{term"case_prod (\x y. t)"} & @{term[source]"case_prod (\x y. t)"}\\ -@{term"A \ B"} & @{text"Sigma A (\\<^raw:\_>. B)"} +@{term"A \ B"} & \Sigma A (\\<^raw:\_>. B)\ \end{tabular} Pairs may be nested. Nesting to the right is printed as a tuple, -e.g.\ \mbox{@{term"(a,b,c)"}} is really \mbox{@{text"(a, (b, c))"}.} +e.g.\ \mbox{@{term"(a,b,c)"}} is really \mbox{\(a, (b, c))\.} Pattern matching with pairs and tuples extends to all binders, e.g.\ \mbox{@{prop"ALL (x,y):A. P"},} @{term"{(x,y). P}"}, etc. @@ -262,12 +261,12 @@ \subsubsection*{Syntax} \begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{term"converse r"} & @{term[source]"converse r"} & (\verb$^-1$) +@{term"converse r"} & @{term[source]"converse r"} & (\<^verbatim>\^-1\) \end{tabular} -\medskip +\<^medskip> \noindent -Type synonym \ @{typ"'a rel"} @{text"="} @{expanded_typ "'a rel"} +Type synonym \ @{typ"'a rel"} \=\ @{expanded_typ "'a rel"} \section*{Equiv\_Relations} @@ -300,9 +299,9 @@ \subsubsection*{Syntax} \begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{term"rtrancl r"} & @{term[source]"rtrancl r"} & (\verb$^*$)\\ -@{term"trancl r"} & @{term[source]"trancl r"} & (\verb$^+$)\\ -@{term"reflcl r"} & @{term[source]"reflcl r"} & (\verb$^=$) +@{term"rtrancl r"} & @{term[source]"rtrancl r"} & (\<^verbatim>\^*\)\\ +@{term"trancl r"} & @{term[source]"trancl r"} & (\<^verbatim>\^+\)\\ +@{term"reflcl r"} & @{term[source]"reflcl r"} & (\<^verbatim>\^=\) \end{tabular} @@ -314,11 +313,11 @@ overloaded operators: \begin{supertabular}{@ {} l @ {~::~} l l @ {}} -@{text "0"} & @{typeof zero}\\ -@{text "1"} & @{typeof one}\\ +\0\ & @{typeof zero}\\ +\1\ & @{typeof one}\\ @{const plus} & @{typeof plus}\\ @{const minus} & @{typeof minus}\\ -@{const uminus} & @{typeof uminus} & (\verb$-$)\\ +@{const uminus} & @{typeof uminus} & (\<^verbatim>\-\)\\ @{const times} & @{typeof times}\\ @{const inverse} & @{typeof inverse}\\ @{const divide} & @{typeof divide}\\ @@ -339,7 +338,7 @@ \section*{Nat} @{datatype nat} -\bigskip +\<^bigskip> \begin{tabular}{@ {} lllllll @ {}} @{term "op + :: nat \ nat \ nat"} & @@ -366,7 +365,7 @@ \section*{Int} Type @{typ int} -\bigskip +\<^bigskip> \begin{tabular}{@ {} llllllll @ {}} @{term "op + :: int \ int \ int"} & @@ -390,7 +389,7 @@ \begin{tabular}{@ {} l @ {~::~} l l @ {}} @{const Int.nat} & @{typeof Int.nat}\\ @{const Int.of_int} & @{typeof Int.of_int}\\ -@{const Int.Ints} & @{term_type_only Int.Ints "'a::ring_1 set"} & (\verb$Ints$) +@{const Int.Ints} & @{term_type_only Int.Ints "'a::ring_1 set"} & (\<^verbatim>\Ints\) \end{tabular} \subsubsection*{Syntax} @@ -415,10 +414,10 @@ \subsubsection*{Syntax} \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} -@{term"setsum (%x. x) A"} & @{term[source]"setsum (\x. x) A"} & (\verb$SUM$)\\ +@{term"setsum (%x. x) A"} & @{term[source]"setsum (\x. x) A"} & (\<^verbatim>\SUM\)\\ @{term"setsum (%x. t) A"} & @{term[source]"setsum (\x. t) A"}\\ @{term[source]"\x|P. t"} & @{term"\x|P. t"}\\ -\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\"} instead of @{text"\"}} & (\verb$PROD$)\\ +\multicolumn{2}{@ {}l@ {}}{Similarly for \\\ instead of \\\} & (\<^verbatim>\PROD\)\\ \end{supertabular} @@ -461,12 +460,12 @@ @{term "atLeastAtMost x y"} & @{term[source] "atLeastAtMost x y"}\\ @{term[source] "\i\n. A"} & @{term[source] "\i \ {..n}. A"}\\ @{term[source] "\ii \ {.."} instead of @{text"\"}}\\ +\multicolumn{2}{@ {}l@ {}}{Similarly for \\\ instead of \\\}\\ @{term "setsum (%x. t) {a..b}"} & @{term[source] "setsum (\x. t) {a..b}"}\\ @{term "setsum (%x. t) {a..x. t) {a..x. t) {..b}"}\\ @{term "setsum (%x. t) {..x. t) {.."} instead of @{text"\"}}\\ +\multicolumn{2}{@ {}l@ {}}{Similarly for \\\ instead of \\\}\\ \end{supertabular} @@ -480,7 +479,7 @@ \section*{Option} @{datatype option} -\bigskip +\<^bigskip> \begin{tabular}{@ {} l @ {~::~} l @ {}} @{const Option.the} & @{typeof Option.the}\\ @@ -492,7 +491,7 @@ \section*{List} @{datatype list} -\bigskip +\<^bigskip> \begin{supertabular}{@ {} l @ {~::~} l @ {}} @{const List.append} & @{typeof List.append}\\ @@ -546,18 +545,18 @@ \subsubsection*{Syntax} \begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} -@{text"[x\<^sub>1,\,x\<^sub>n]"} & @{text"x\<^sub>1 # \ # x\<^sub>n # []"}\\ +\[x\<^sub>1,\,x\<^sub>n]\ & \x\<^sub>1 # \ # x\<^sub>n # []\\\ @{term"[m.. xs]"} & @{term"map (%x. e) xs"}\\ +\[e. x \ xs]\ & @{term"map (%x. e) xs"}\\ @{term"[x \ xs. b]"} & @{term[source]"filter (\x. b) xs"} \\ @{term"xs[n := x]"} & @{term[source]"list_update xs n x"}\\ @{term"\x\xs. e"} & @{term[source]"listsum (map (\x. e) xs)"}\\ \end{supertabular} -\medskip +\<^medskip> -List comprehension: @{text"[e. q\<^sub>1, \, q\<^sub>n]"} where each -qualifier @{text q\<^sub>i} is either a generator \mbox{@{text"pat \ e"}} or a +List comprehension: \[e. q\<^sub>1, \, q\<^sub>n]\ where each +qualifier \q\<^sub>i\ is either a generator \mbox{\pat \ e\} or a guard, i.e.\ boolean expression. \section*{Map} @@ -582,8 +581,8 @@ \begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} @{term"Map.empty"} & @{term"\x. None"}\\ @{term"m(x:=Some y)"} & @{term[source]"m(x:=Some y)"}\\ -@{text"m(x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n)"} & @{text[source]"m(x\<^sub>1\y\<^sub>1)\(x\<^sub>n\y\<^sub>n)"}\\ -@{text"[x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n]"} & @{text[source]"Map.empty(x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n)"}\\ +\m(x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n)\ & @{text[source]"m(x\<^sub>1\y\<^sub>1)\(x\<^sub>n\y\<^sub>n)"}\\ +\[x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n]\ & @{text[source]"Map.empty(x\<^sub>1\y\<^sub>1,\,x\<^sub>n\y\<^sub>n)"}\\ @{term"map_upds m xs ys"} & @{term[source]"map_upds m xs ys"}\\ \end{tabular} @@ -593,38 +592,38 @@ \begin{tabular}{llll} & Operator & precedence & associativity \\ \hline -Meta-logic & @{text"\"} & 1 & right \\ -& @{text"\"} & 2 \\ +Meta-logic & \\\ & 1 & right \\ +& \\\ & 2 \\ \hline -Logic & @{text"\"} & 35 & right \\ -&@{text"\"} & 30 & right \\ -&@{text"\"}, @{text"\"} & 25 & right\\ -&@{text"="}, @{text"\"} & 50 & left\\ +Logic & \\\ & 35 & right \\ +&\\\ & 30 & right \\ +&\\\, \\\ & 25 & right\\ +&\=\, \\\ & 50 & left\\ \hline -Orderings & @{text"\"}, @{text"<"}, @{text"\"}, @{text">"} & 50 \\ +Orderings & \\\, \<\, \\\, \>\ & 50 \\ \hline -Sets & @{text"\"}, @{text"\"}, @{text"\"}, @{text"\"} & 50 \\ -&@{text"\"}, @{text"\"} & 50 \\ -&@{text"\"} & 70 & left \\ -&@{text"\"} & 65 & left \\ +Sets & \\\, \\\, \\\, \\\ & 50 \\ +&\\\, \\\ & 50 \\ +&\\\ & 70 & left \\ +&\\\ & 65 & left \\ \hline -Functions and Relations & @{text"\"} & 55 & left\\ -&@{text"`"} & 90 & right\\ -&@{text"O"} & 75 & right\\ -&@{text"``"} & 90 & right\\ -&@{text"^^"} & 80 & right\\ +Functions and Relations & \\\ & 55 & left\\ +&\`\ & 90 & right\\ +&\O\ & 75 & right\\ +&\``\ & 90 & right\\ +&\^^\ & 80 & right\\ \hline -Numbers & @{text"+"}, @{text"-"} & 65 & left \\ -&@{text"*"}, @{text"/"} & 70 & left \\ -&@{text"div"}, @{text"mod"} & 70 & left\\ -&@{text"^"} & 80 & right\\ -&@{text"dvd"} & 50 \\ +Numbers & \+\, \-\ & 65 & left \\ +&\*\, \/\ & 70 & left \\ +&\div\, \mod\ & 70 & left\\ +&\^\ & 80 & right\\ +&\dvd\ & 50 \\ \hline -Lists & @{text"#"}, @{text"@"} & 65 & right\\ -&@{text"!"} & 100 & left +Lists & \#\, \@\ & 65 & right\\ +&\!\ & 100 & left \end{tabular} \end{center} -*} +\ (*<*) end (*>*) \ No newline at end of file