author | wenzelm |
Fri, 12 Aug 2016 20:58:05 +0200 | |
changeset 63681 | d2448471ffba |
parent 63680 | 6e1e8b5abbfa |
child 63884 | d588f684ccaf |
permissions | -rw-r--r-- |
30293 | 1 |
(*<*) |
30401 | 2 |
theory Main_Doc |
30293 | 3 |
imports Main |
4 |
begin |
|
5 |
||
61996 | 6 |
setup \<open> |
43564
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
7 |
let |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
8 |
fun pretty_term_type_only ctxt (t, T) = |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
9 |
(if fastype_of t = Sign.certify_typ (Proof_Context.theory_of ctxt) T then () |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
10 |
else error "term_type_only: type mismatch"; |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
11 |
Syntax.pretty_typ ctxt T) |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
12 |
in |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
13 |
Thy_Output.antiquotation @{binding term_type_only} |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
14 |
(Args.term -- Args.typ_abbrev) |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
15 |
(fn {source, context = ctxt, ...} => fn arg => |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
16 |
Thy_Output.output ctxt |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
17 |
(Thy_Output.maybe_pretty_source pretty_term_type_only ctxt source [arg])) |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42361
diff
changeset
|
18 |
end |
61996 | 19 |
\<close> |
20 |
setup \<open> |
|
47189
e9a3dd1c4cf9
improved robustness with new antiquoation by Makarius
nipkow
parents:
47187
diff
changeset
|
21 |
Thy_Output.antiquotation @{binding expanded_typ} (Args.typ >> single) |
e9a3dd1c4cf9
improved robustness with new antiquoation by Makarius
nipkow
parents:
47187
diff
changeset
|
22 |
(fn {source, context, ...} => Thy_Output.output context o |
e9a3dd1c4cf9
improved robustness with new antiquoation by Makarius
nipkow
parents:
47187
diff
changeset
|
23 |
Thy_Output.maybe_pretty_source Syntax.pretty_typ context source) |
61996 | 24 |
\<close> |
30293 | 25 |
(*>*) |
61996 | 26 |
text\<open> |
30293 | 27 |
|
28 |
\begin{abstract} |
|
63680 | 29 |
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>\<open>http://isabelle.in.tum.de/library/HOL\<close>. |
30293 | 30 |
\end{abstract} |
31 |
||
50581 | 32 |
\section*{HOL} |
30293 | 33 |
|
30440 | 34 |
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"}. |
61996 | 35 |
\<^smallskip> |
30440 | 36 |
|
37 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
38 |
@{const HOL.undefined} & @{typeof HOL.undefined}\\ |
|
39 |
@{const HOL.default} & @{typeof HOL.default}\\ |
|
40 |
\end{tabular} |
|
41 |
||
42 |
\subsubsection*{Syntax} |
|
30293 | 43 |
|
30440 | 44 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 45 |
@{term"~(x = y)"} & @{term[source]"\<not> (x = y)"} & (\<^verbatim>\<open>~=\<close>)\\ |
30440 | 46 |
@{term[source]"P \<longleftrightarrow> Q"} & @{term"P \<longleftrightarrow> Q"} \\ |
47 |
@{term"If x y z"} & @{term[source]"If x y z"}\\ |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51489
diff
changeset
|
48 |
@{term"Let e\<^sub>1 (%x. e\<^sub>2)"} & @{term[source]"Let e\<^sub>1 (\<lambda>x. e\<^sub>2)"}\\ |
30440 | 49 |
\end{supertabular} |
50 |
||
51 |
||
50581 | 52 |
\section*{Orderings} |
30440 | 53 |
|
54 |
A collection of classes defining basic orderings: |
|
55 |
preorder, partial order, linear order, dense linear order and wellorder. |
|
61996 | 56 |
\<^smallskip> |
30293 | 57 |
|
30425 | 58 |
\begin{supertabular}{@ {} l @ {~::~} l l @ {}} |
61996 | 59 |
@{const Orderings.less_eq} & @{typeof Orderings.less_eq} & (\<^verbatim>\<open><=\<close>)\\ |
35277 | 60 |
@{const Orderings.less} & @{typeof Orderings.less}\\ |
30440 | 61 |
@{const Orderings.Least} & @{typeof Orderings.Least}\\ |
62 |
@{const Orderings.min} & @{typeof Orderings.min}\\ |
|
63 |
@{const Orderings.max} & @{typeof Orderings.max}\\ |
|
64 |
@{const[source] top} & @{typeof Orderings.top}\\ |
|
65 |
@{const[source] bot} & @{typeof Orderings.bot}\\ |
|
66 |
@{const Orderings.mono} & @{typeof Orderings.mono}\\ |
|
67 |
@{const Orderings.strict_mono} & @{typeof Orderings.strict_mono}\\ |
|
30293 | 68 |
\end{supertabular} |
69 |
||
70 |
\subsubsection*{Syntax} |
|
71 |
||
30440 | 72 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 73 |
@{term[source]"x \<ge> y"} & @{term"x \<ge> y"} & (\<^verbatim>\<open>>=\<close>)\\ |
30293 | 74 |
@{term[source]"x > y"} & @{term"x > y"}\\ |
75 |
@{term"ALL x<=y. P"} & @{term[source]"\<forall>x. x \<le> y \<longrightarrow> P"}\\ |
|
30440 | 76 |
@{term"EX x<=y. P"} & @{term[source]"\<exists>x. x \<le> y \<and> P"}\\ |
77 |
\multicolumn{2}{@ {}l@ {}}{Similarly for $<$, $\ge$ and $>$}\\ |
|
30293 | 78 |
@{term"LEAST x. P"} & @{term[source]"Least (\<lambda>x. P)"}\\ |
79 |
\end{supertabular} |
|
80 |
||
30401 | 81 |
|
50581 | 82 |
\section*{Lattices} |
30401 | 83 |
|
84 |
Classes semilattice, lattice, distributive lattice and complete lattice (the |
|
85 |
latter in theory @{theory Set}). |
|
86 |
||
87 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
88 |
@{const Lattices.inf} & @{typeof Lattices.inf}\\ |
|
89 |
@{const Lattices.sup} & @{typeof Lattices.sup}\\ |
|
44969 | 90 |
@{const Complete_Lattices.Inf} & @{term_type_only Complete_Lattices.Inf "'a set \<Rightarrow> 'a::Inf"}\\ |
91 |
@{const Complete_Lattices.Sup} & @{term_type_only Complete_Lattices.Sup "'a set \<Rightarrow> 'a::Sup"}\\ |
|
30401 | 92 |
\end{tabular} |
93 |
||
94 |
\subsubsection*{Syntax} |
|
95 |
||
61996 | 96 |
Available by loading theory \<open>Lattice_Syntax\<close> in directory \<open>Library\<close>. |
30401 | 97 |
|
98 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
99 |
@{text[source]"x \<sqsubseteq> y"} & @{term"x \<le> y"}\\ |
|
100 |
@{text[source]"x \<sqsubset> y"} & @{term"x < y"}\\ |
|
101 |
@{text[source]"x \<sqinter> y"} & @{term"inf x y"}\\ |
|
102 |
@{text[source]"x \<squnion> y"} & @{term"sup x y"}\\ |
|
62204 | 103 |
@{text[source]"\<Sqinter>A"} & @{term"Inf A"}\\ |
104 |
@{text[source]"\<Squnion>A"} & @{term"Sup A"}\\ |
|
30440 | 105 |
@{text[source]"\<top>"} & @{term[source] top}\\ |
106 |
@{text[source]"\<bottom>"} & @{term[source] bot}\\ |
|
30401 | 107 |
\end{supertabular} |
108 |
||
109 |
||
50581 | 110 |
\section*{Set} |
30293 | 111 |
|
30425 | 112 |
\begin{supertabular}{@ {} l @ {~::~} l l @ {}} |
30370 | 113 |
@{const Set.empty} & @{term_type_only "Set.empty" "'a set"}\\ |
32142 | 114 |
@{const Set.insert} & @{term_type_only insert "'a\<Rightarrow>'a set\<Rightarrow>'a set"}\\ |
30293 | 115 |
@{const Collect} & @{term_type_only Collect "('a\<Rightarrow>bool)\<Rightarrow>'a set"}\\ |
61996 | 116 |
@{const Set.member} & @{term_type_only Set.member "'a\<Rightarrow>'a set\<Rightarrow>bool"} & (\<^verbatim>\<open>:\<close>)\\ |
117 |
@{const Set.union} & @{term_type_only Set.union "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} & (\<^verbatim>\<open>Un\<close>)\\ |
|
118 |
@{const Set.inter} & @{term_type_only Set.inter "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} & (\<^verbatim>\<open>Int\<close>)\\ |
|
30293 | 119 |
@{const UNION} & @{term_type_only UNION "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\ |
120 |
@{const INTER} & @{term_type_only INTER "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\ |
|
121 |
@{const Union} & @{term_type_only Union "'a set set\<Rightarrow>'a set"}\\ |
|
122 |
@{const Inter} & @{term_type_only Inter "'a set set\<Rightarrow>'a set"}\\ |
|
123 |
@{const Pow} & @{term_type_only Pow "'a set \<Rightarrow>'a set set"}\\ |
|
124 |
@{const UNIV} & @{term_type_only UNIV "'a set"}\\ |
|
125 |
@{const image} & @{term_type_only image "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set"}\\ |
|
126 |
@{const Ball} & @{term_type_only Ball "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\ |
|
127 |
@{const Bex} & @{term_type_only Bex "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\ |
|
128 |
\end{supertabular} |
|
129 |
||
130 |
\subsubsection*{Syntax} |
|
131 |
||
30425 | 132 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 133 |
\<open>{a\<^sub>1,\<dots>,a\<^sub>n}\<close> & \<open>insert a\<^sub>1 (\<dots> (insert a\<^sub>n {})\<dots>)\<close>\\ |
53328 | 134 |
@{term"a ~: A"} & @{term[source]"\<not>(x \<in> A)"}\\ |
30293 | 135 |
@{term"A \<subseteq> B"} & @{term[source]"A \<le> B"}\\ |
136 |
@{term"A \<subset> B"} & @{term[source]"A < B"}\\ |
|
137 |
@{term[source]"A \<supseteq> B"} & @{term[source]"B \<le> A"}\\ |
|
138 |
@{term[source]"A \<supset> B"} & @{term[source]"B < A"}\\ |
|
30440 | 139 |
@{term"{x. P}"} & @{term[source]"Collect (\<lambda>x. P)"}\\ |
61996 | 140 |
\<open>{t | x\<^sub>1 \<dots> x\<^sub>n. P}\<close> & \<open>{v. \<exists>x\<^sub>1 \<dots> x\<^sub>n. v = t \<and> P}\<close>\\ |
61995
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
141 |
@{term[source]"\<Union>x\<in>I. A"} & @{term[source]"UNION I (\<lambda>x. A)"} & (\texttt{UN})\\ |
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
142 |
@{term[source]"\<Union>x. A"} & @{term[source]"UNION UNIV (\<lambda>x. A)"}\\ |
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
143 |
@{term[source]"\<Inter>x\<in>I. A"} & @{term[source]"INTER I (\<lambda>x. A)"} & (\texttt{INT})\\ |
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
144 |
@{term[source]"\<Inter>x. A"} & @{term[source]"INTER UNIV (\<lambda>x. A)"}\\ |
30293 | 145 |
@{term"ALL x:A. P"} & @{term[source]"Ball A (\<lambda>x. P)"}\\ |
146 |
@{term"EX x:A. P"} & @{term[source]"Bex A (\<lambda>x. P)"}\\ |
|
147 |
@{term"range f"} & @{term[source]"f ` UNIV"}\\ |
|
148 |
\end{supertabular} |
|
149 |
||
150 |
||
50581 | 151 |
\section*{Fun} |
30293 | 152 |
|
32933 | 153 |
\begin{supertabular}{@ {} l @ {~::~} l l @ {}} |
30293 | 154 |
@{const "Fun.id"} & @{typeof Fun.id}\\ |
32933 | 155 |
@{const "Fun.comp"} & @{typeof Fun.comp} & (\texttt{o})\\ |
30293 | 156 |
@{const "Fun.inj_on"} & @{term_type_only Fun.inj_on "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>bool"}\\ |
157 |
@{const "Fun.inj"} & @{typeof Fun.inj}\\ |
|
158 |
@{const "Fun.surj"} & @{typeof Fun.surj}\\ |
|
159 |
@{const "Fun.bij"} & @{typeof Fun.bij}\\ |
|
160 |
@{const "Fun.bij_betw"} & @{term_type_only Fun.bij_betw "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set\<Rightarrow>bool"}\\ |
|
161 |
@{const "Fun.fun_upd"} & @{typeof Fun.fun_upd}\\ |
|
162 |
\end{supertabular} |
|
163 |
||
164 |
\subsubsection*{Syntax} |
|
165 |
||
166 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
167 |
@{term"fun_upd f x y"} & @{term[source]"fun_upd f x y"}\\ |
|
61996 | 168 |
\<open>f(x\<^sub>1:=y\<^sub>1,\<dots>,x\<^sub>n:=y\<^sub>n)\<close> & \<open>f(x\<^sub>1:=y\<^sub>1)\<dots>(x\<^sub>n:=y\<^sub>n)\<close>\\ |
30293 | 169 |
\end{tabular} |
170 |
||
171 |
||
50581 | 172 |
\section*{Hilbert\_Choice} |
33019 | 173 |
|
174 |
Hilbert's selection ($\varepsilon$) operator: @{term"SOME x. P"}. |
|
61996 | 175 |
\<^smallskip> |
33019 | 176 |
|
177 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
33057 | 178 |
@{const Hilbert_Choice.inv_into} & @{term_type_only Hilbert_Choice.inv_into "'a set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'a)"} |
33019 | 179 |
\end{tabular} |
180 |
||
181 |
\subsubsection*{Syntax} |
|
182 |
||
183 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
33057 | 184 |
@{term inv} & @{term[source]"inv_into UNIV"} |
33019 | 185 |
\end{tabular} |
186 |
||
50581 | 187 |
\section*{Fixed Points} |
30293 | 188 |
|
189 |
Theory: @{theory Inductive}. |
|
190 |
||
191 |
Least and greatest fixed points in a complete lattice @{typ 'a}: |
|
192 |
||
193 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
194 |
@{const Inductive.lfp} & @{typeof Inductive.lfp}\\ |
|
195 |
@{const Inductive.gfp} & @{typeof Inductive.gfp}\\ |
|
196 |
\end{tabular} |
|
197 |
||
198 |
Note that in particular sets (@{typ"'a \<Rightarrow> bool"}) are complete lattices. |
|
199 |
||
50581 | 200 |
\section*{Sum\_Type} |
30293 | 201 |
|
61996 | 202 |
Type constructor \<open>+\<close>. |
30293 | 203 |
|
204 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
205 |
@{const Sum_Type.Inl} & @{typeof Sum_Type.Inl}\\ |
|
206 |
@{const Sum_Type.Inr} & @{typeof Sum_Type.Inr}\\ |
|
207 |
@{const Sum_Type.Plus} & @{term_type_only Sum_Type.Plus "'a set\<Rightarrow>'b set\<Rightarrow>('a+'b)set"} |
|
208 |
\end{tabular} |
|
209 |
||
210 |
||
50581 | 211 |
\section*{Product\_Type} |
30293 | 212 |
|
61996 | 213 |
Types @{typ unit} and \<open>\<times>\<close>. |
30293 | 214 |
|
215 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
216 |
@{const Product_Type.Unity} & @{typeof Product_Type.Unity}\\ |
|
217 |
@{const Pair} & @{typeof Pair}\\ |
|
218 |
@{const fst} & @{typeof fst}\\ |
|
219 |
@{const snd} & @{typeof snd}\\ |
|
61424
c3658c18b7bc
prod_case as canonical name for product type eliminator
haftmann
parents:
60352
diff
changeset
|
220 |
@{const case_prod} & @{typeof case_prod}\\ |
30293 | 221 |
@{const curry} & @{typeof curry}\\ |
222 |
@{const Product_Type.Sigma} & @{term_type_only Product_Type.Sigma "'a set\<Rightarrow>('a\<Rightarrow>'b set)\<Rightarrow>('a*'b)set"}\\ |
|
223 |
\end{supertabular} |
|
224 |
||
225 |
\subsubsection*{Syntax} |
|
226 |
||
30440 | 227 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} ll @ {}} |
30293 | 228 |
@{term"Pair a b"} & @{term[source]"Pair a b"}\\ |
61424
c3658c18b7bc
prod_case as canonical name for product type eliminator
haftmann
parents:
60352
diff
changeset
|
229 |
@{term"case_prod (\<lambda>x y. t)"} & @{term[source]"case_prod (\<lambda>x y. t)"}\\ |
61996 | 230 |
@{term"A \<times> B"} & \<open>Sigma A (\<lambda>\<^raw:\_>. B)\<close> |
30293 | 231 |
\end{tabular} |
232 |
||
233 |
Pairs may be nested. Nesting to the right is printed as a tuple, |
|
61996 | 234 |
e.g.\ \mbox{@{term"(a,b,c)"}} is really \mbox{\<open>(a, (b, c))\<close>.} |
30293 | 235 |
Pattern matching with pairs and tuples extends to all binders, |
30440 | 236 |
e.g.\ \mbox{@{prop"ALL (x,y):A. P"},} @{term"{(x,y). P}"}, etc. |
30293 | 237 |
|
238 |
||
50581 | 239 |
\section*{Relation} |
30293 | 240 |
|
47187 | 241 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
30293 | 242 |
@{const Relation.converse} & @{term_type_only Relation.converse "('a * 'b)set \<Rightarrow> ('b*'a)set"}\\ |
47682 | 243 |
@{const Relation.relcomp} & @{term_type_only Relation.relcomp "('a*'b)set\<Rightarrow>('b*'c)set\<Rightarrow>('a*'c)set"}\\ |
30293 | 244 |
@{const Relation.Image} & @{term_type_only Relation.Image "('a*'b)set\<Rightarrow>'a set\<Rightarrow>'b set"}\\ |
245 |
@{const Relation.inv_image} & @{term_type_only Relation.inv_image "('a*'a)set\<Rightarrow>('b\<Rightarrow>'a)\<Rightarrow>('b*'b)set"}\\ |
|
246 |
@{const Relation.Id_on} & @{term_type_only Relation.Id_on "'a set\<Rightarrow>('a*'a)set"}\\ |
|
247 |
@{const Relation.Id} & @{term_type_only Relation.Id "('a*'a)set"}\\ |
|
248 |
@{const Relation.Domain} & @{term_type_only Relation.Domain "('a*'b)set\<Rightarrow>'a set"}\\ |
|
249 |
@{const Relation.Range} & @{term_type_only Relation.Range "('a*'b)set\<Rightarrow>'b set"}\\ |
|
250 |
@{const Relation.Field} & @{term_type_only Relation.Field "('a*'a)set\<Rightarrow>'a set"}\\ |
|
251 |
@{const Relation.refl_on} & @{term_type_only Relation.refl_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\ |
|
252 |
@{const Relation.refl} & @{term_type_only Relation.refl "('a*'a)set\<Rightarrow>bool"}\\ |
|
253 |
@{const Relation.sym} & @{term_type_only Relation.sym "('a*'a)set\<Rightarrow>bool"}\\ |
|
254 |
@{const Relation.antisym} & @{term_type_only Relation.antisym "('a*'a)set\<Rightarrow>bool"}\\ |
|
255 |
@{const Relation.trans} & @{term_type_only Relation.trans "('a*'a)set\<Rightarrow>bool"}\\ |
|
256 |
@{const Relation.irrefl} & @{term_type_only Relation.irrefl "('a*'a)set\<Rightarrow>bool"}\\ |
|
257 |
@{const Relation.total_on} & @{term_type_only Relation.total_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\ |
|
30440 | 258 |
@{const Relation.total} & @{term_type_only Relation.total "('a*'a)set\<Rightarrow>bool"}\\ |
47187 | 259 |
\end{tabular} |
30293 | 260 |
|
261 |
\subsubsection*{Syntax} |
|
262 |
||
30440 | 263 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 264 |
@{term"converse r"} & @{term[source]"converse r"} & (\<^verbatim>\<open>^-1\<close>) |
30293 | 265 |
\end{tabular} |
61996 | 266 |
\<^medskip> |
47187 | 267 |
|
268 |
\noindent |
|
61996 | 269 |
Type synonym \ @{typ"'a rel"} \<open>=\<close> @{expanded_typ "'a rel"} |
30293 | 270 |
|
50581 | 271 |
\section*{Equiv\_Relations} |
30293 | 272 |
|
273 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
274 |
@{const Equiv_Relations.equiv} & @{term_type_only Equiv_Relations.equiv "'a set \<Rightarrow> ('a*'a)set\<Rightarrow>bool"}\\ |
|
275 |
@{const Equiv_Relations.quotient} & @{term_type_only Equiv_Relations.quotient "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set set"}\\ |
|
276 |
@{const Equiv_Relations.congruent} & @{term_type_only Equiv_Relations.congruent "('a*'a)set\<Rightarrow>('a\<Rightarrow>'b)\<Rightarrow>bool"}\\ |
|
277 |
@{const Equiv_Relations.congruent2} & @{term_type_only Equiv_Relations.congruent2 "('a*'a)set\<Rightarrow>('b*'b)set\<Rightarrow>('a\<Rightarrow>'b\<Rightarrow>'c)\<Rightarrow>bool"}\\ |
|
278 |
%@ {const Equiv_Relations.} & @ {term_type_only Equiv_Relations. ""}\\ |
|
279 |
\end{supertabular} |
|
280 |
||
281 |
\subsubsection*{Syntax} |
|
282 |
||
283 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
284 |
@{term"congruent r f"} & @{term[source]"congruent r f"}\\ |
|
285 |
@{term"congruent2 r r f"} & @{term[source]"congruent2 r r f"}\\ |
|
286 |
\end{tabular} |
|
287 |
||
288 |
||
50581 | 289 |
\section*{Transitive\_Closure} |
30293 | 290 |
|
291 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
292 |
@{const Transitive_Closure.rtrancl} & @{term_type_only Transitive_Closure.rtrancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\ |
|
293 |
@{const Transitive_Closure.trancl} & @{term_type_only Transitive_Closure.trancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\ |
|
294 |
@{const Transitive_Closure.reflcl} & @{term_type_only Transitive_Closure.reflcl "('a*'a)set\<Rightarrow>('a*'a)set"}\\ |
|
45618 | 295 |
@{const Transitive_Closure.acyclic} & @{term_type_only Transitive_Closure.acyclic "('a*'a)set\<Rightarrow>bool"}\\ |
30988 | 296 |
@{const compower} & @{term_type_only "op ^^ :: ('a*'a)set\<Rightarrow>nat\<Rightarrow>('a*'a)set" "('a*'a)set\<Rightarrow>nat\<Rightarrow>('a*'a)set"}\\ |
30293 | 297 |
\end{tabular} |
298 |
||
299 |
\subsubsection*{Syntax} |
|
300 |
||
30440 | 301 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 302 |
@{term"rtrancl r"} & @{term[source]"rtrancl r"} & (\<^verbatim>\<open>^*\<close>)\\ |
303 |
@{term"trancl r"} & @{term[source]"trancl r"} & (\<^verbatim>\<open>^+\<close>)\\ |
|
304 |
@{term"reflcl r"} & @{term[source]"reflcl r"} & (\<^verbatim>\<open>^=\<close>) |
|
30293 | 305 |
\end{tabular} |
306 |
||
307 |
||
50581 | 308 |
\section*{Algebra} |
30293 | 309 |
|
35061 | 310 |
Theories @{theory Groups}, @{theory Rings}, @{theory Fields} and @{theory |
30440 | 311 |
Divides} define a large collection of classes describing common algebraic |
312 |
structures from semigroups up to fields. Everything is done in terms of |
|
313 |
overloaded operators: |
|
314 |
||
315 |
\begin{supertabular}{@ {} l @ {~::~} l l @ {}} |
|
61996 | 316 |
\<open>0\<close> & @{typeof zero}\\ |
317 |
\<open>1\<close> & @{typeof one}\\ |
|
30440 | 318 |
@{const plus} & @{typeof plus}\\ |
319 |
@{const minus} & @{typeof minus}\\ |
|
61996 | 320 |
@{const uminus} & @{typeof uminus} & (\<^verbatim>\<open>-\<close>)\\ |
30440 | 321 |
@{const times} & @{typeof times}\\ |
322 |
@{const inverse} & @{typeof inverse}\\ |
|
323 |
@{const divide} & @{typeof divide}\\ |
|
324 |
@{const abs} & @{typeof abs}\\ |
|
325 |
@{const sgn} & @{typeof sgn}\\ |
|
326 |
@{const dvd_class.dvd} & @{typeof "dvd_class.dvd"}\\ |
|
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
58101
diff
changeset
|
327 |
@{const Rings.divide} & @{typeof Rings.divide}\\ |
30440 | 328 |
@{const div_class.mod} & @{typeof "div_class.mod"}\\ |
329 |
\end{supertabular} |
|
330 |
||
331 |
\subsubsection*{Syntax} |
|
332 |
||
333 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
334 |
@{term"abs x"} & @{term[source]"abs x"} |
|
335 |
\end{tabular} |
|
30293 | 336 |
|
337 |
||
50581 | 338 |
\section*{Nat} |
30293 | 339 |
|
340 |
@{datatype nat} |
|
61996 | 341 |
\<^bigskip> |
30293 | 342 |
|
343 |
\begin{tabular}{@ {} lllllll @ {}} |
|
344 |
@{term "op + :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
|
345 |
@{term "op - :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
|
346 |
@{term "op * :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
|
47187 | 347 |
@{term "op ^ :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
30293 | 348 |
@{term "op div :: nat \<Rightarrow> nat \<Rightarrow> nat"}& |
349 |
@{term "op mod :: nat \<Rightarrow> nat \<Rightarrow> nat"}& |
|
350 |
@{term "op dvd :: nat \<Rightarrow> nat \<Rightarrow> bool"}\\ |
|
351 |
@{term "op \<le> :: nat \<Rightarrow> nat \<Rightarrow> bool"} & |
|
352 |
@{term "op < :: nat \<Rightarrow> nat \<Rightarrow> bool"} & |
|
353 |
@{term "min :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
|
354 |
@{term "max :: nat \<Rightarrow> nat \<Rightarrow> nat"} & |
|
355 |
@{term "Min :: nat set \<Rightarrow> nat"} & |
|
356 |
@{term "Max :: nat set \<Rightarrow> nat"}\\ |
|
357 |
\end{tabular} |
|
358 |
||
359 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
30988 | 360 |
@{const Nat.of_nat} & @{typeof Nat.of_nat}\\ |
361 |
@{term "op ^^ :: ('a \<Rightarrow> 'a) \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'a"} & |
|
362 |
@{term_type_only "op ^^ :: ('a \<Rightarrow> 'a) \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'a" "('a \<Rightarrow> 'a) \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'a"} |
|
30293 | 363 |
\end{tabular} |
364 |
||
50581 | 365 |
\section*{Int} |
30293 | 366 |
|
367 |
Type @{typ int} |
|
61996 | 368 |
\<^bigskip> |
30293 | 369 |
|
370 |
\begin{tabular}{@ {} llllllll @ {}} |
|
371 |
@{term "op + :: int \<Rightarrow> int \<Rightarrow> int"} & |
|
372 |
@{term "op - :: int \<Rightarrow> int \<Rightarrow> int"} & |
|
373 |
@{term "uminus :: int \<Rightarrow> int"} & |
|
374 |
@{term "op * :: int \<Rightarrow> int \<Rightarrow> int"} & |
|
375 |
@{term "op ^ :: int \<Rightarrow> nat \<Rightarrow> int"} & |
|
376 |
@{term "op div :: int \<Rightarrow> int \<Rightarrow> int"}& |
|
377 |
@{term "op mod :: int \<Rightarrow> int \<Rightarrow> int"}& |
|
378 |
@{term "op dvd :: int \<Rightarrow> int \<Rightarrow> bool"}\\ |
|
379 |
@{term "op \<le> :: int \<Rightarrow> int \<Rightarrow> bool"} & |
|
380 |
@{term "op < :: int \<Rightarrow> int \<Rightarrow> bool"} & |
|
381 |
@{term "min :: int \<Rightarrow> int \<Rightarrow> int"} & |
|
382 |
@{term "max :: int \<Rightarrow> int \<Rightarrow> int"} & |
|
383 |
@{term "Min :: int set \<Rightarrow> int"} & |
|
384 |
@{term "Max :: int set \<Rightarrow> int"}\\ |
|
385 |
@{term "abs :: int \<Rightarrow> int"} & |
|
386 |
@{term "sgn :: int \<Rightarrow> int"}\\ |
|
387 |
\end{tabular} |
|
388 |
||
30440 | 389 |
\begin{tabular}{@ {} l @ {~::~} l l @ {}} |
30293 | 390 |
@{const Int.nat} & @{typeof Int.nat}\\ |
391 |
@{const Int.of_int} & @{typeof Int.of_int}\\ |
|
61996 | 392 |
@{const Int.Ints} & @{term_type_only Int.Ints "'a::ring_1 set"} & (\<^verbatim>\<open>Ints\<close>) |
30293 | 393 |
\end{tabular} |
394 |
||
395 |
\subsubsection*{Syntax} |
|
396 |
||
397 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
398 |
@{term"of_nat::nat\<Rightarrow>int"} & @{term[source]"of_nat"}\\ |
|
399 |
\end{tabular} |
|
400 |
||
401 |
||
50581 | 402 |
\section*{Finite\_Set} |
30401 | 403 |
|
404 |
||
405 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
406 |
@{const Finite_Set.finite} & @{term_type_only Finite_Set.finite "'a set\<Rightarrow>bool"}\\ |
|
407 |
@{const Finite_Set.card} & @{term_type_only Finite_Set.card "'a set => nat"}\\ |
|
408 |
@{const Finite_Set.fold} & @{term_type_only Finite_Set.fold "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a set \<Rightarrow> 'b"}\\ |
|
54744
1e7f2d296e19
more algebraic terminology for theories about big operators
haftmann
parents:
54703
diff
changeset
|
409 |
@{const Groups_Big.setsum} & @{term_type_only Groups_Big.setsum "('a => 'b) => 'a set => 'b::comm_monoid_add"}\\ |
1e7f2d296e19
more algebraic terminology for theories about big operators
haftmann
parents:
54703
diff
changeset
|
410 |
@{const Groups_Big.setprod} & @{term_type_only Groups_Big.setprod "('a => 'b) => 'a set => 'b::comm_monoid_mult"}\\ |
30401 | 411 |
\end{supertabular} |
412 |
||
413 |
||
414 |
\subsubsection*{Syntax} |
|
415 |
||
30440 | 416 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l l @ {}} |
61996 | 417 |
@{term"setsum (%x. x) A"} & @{term[source]"setsum (\<lambda>x. x) A"} & (\<^verbatim>\<open>SUM\<close>)\\ |
30401 | 418 |
@{term"setsum (%x. t) A"} & @{term[source]"setsum (\<lambda>x. t) A"}\\ |
419 |
@{term[source]"\<Sum>x|P. t"} & @{term"\<Sum>x|P. t"}\\ |
|
61996 | 420 |
\multicolumn{2}{@ {}l@ {}}{Similarly for \<open>\<Prod>\<close> instead of \<open>\<Sum>\<close>} & (\<^verbatim>\<open>PROD\<close>)\\ |
30401 | 421 |
\end{supertabular} |
422 |
||
423 |
||
50581 | 424 |
\section*{Wellfounded} |
30293 | 425 |
|
426 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
427 |
@{const Wellfounded.wf} & @{term_type_only Wellfounded.wf "('a*'a)set\<Rightarrow>bool"}\\ |
|
428 |
@{const Wellfounded.acc} & @{term_type_only Wellfounded.acc "('a*'a)set\<Rightarrow>'a set"}\\ |
|
429 |
@{const Wellfounded.measure} & @{term_type_only Wellfounded.measure "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set"}\\ |
|
430 |
@{const Wellfounded.lex_prod} & @{term_type_only Wellfounded.lex_prod "('a*'a)set\<Rightarrow>('b*'b)set\<Rightarrow>(('a*'b)*('a*'b))set"}\\ |
|
431 |
@{const Wellfounded.mlex_prod} & @{term_type_only Wellfounded.mlex_prod "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set\<Rightarrow>('a*'a)set"}\\ |
|
432 |
@{const Wellfounded.less_than} & @{term_type_only Wellfounded.less_than "(nat*nat)set"}\\ |
|
433 |
@{const Wellfounded.pred_nat} & @{term_type_only Wellfounded.pred_nat "(nat*nat)set"}\\ |
|
434 |
\end{supertabular} |
|
435 |
||
436 |
||
50581 | 437 |
\section*{Set\_Interval} % @{theory Set_Interval} |
30321 | 438 |
|
439 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
30370 | 440 |
@{const lessThan} & @{term_type_only lessThan "'a::ord \<Rightarrow> 'a set"}\\ |
441 |
@{const atMost} & @{term_type_only atMost "'a::ord \<Rightarrow> 'a set"}\\ |
|
442 |
@{const greaterThan} & @{term_type_only greaterThan "'a::ord \<Rightarrow> 'a set"}\\ |
|
443 |
@{const atLeast} & @{term_type_only atLeast "'a::ord \<Rightarrow> 'a set"}\\ |
|
444 |
@{const greaterThanLessThan} & @{term_type_only greaterThanLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\ |
|
445 |
@{const atLeastLessThan} & @{term_type_only atLeastLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\ |
|
446 |
@{const greaterThanAtMost} & @{term_type_only greaterThanAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\ |
|
447 |
@{const atLeastAtMost} & @{term_type_only atLeastAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\ |
|
30321 | 448 |
\end{supertabular} |
449 |
||
450 |
\subsubsection*{Syntax} |
|
451 |
||
452 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
453 |
@{term "lessThan y"} & @{term[source] "lessThan y"}\\ |
|
454 |
@{term "atMost y"} & @{term[source] "atMost y"}\\ |
|
455 |
@{term "greaterThan x"} & @{term[source] "greaterThan x"}\\ |
|
456 |
@{term "atLeast x"} & @{term[source] "atLeast x"}\\ |
|
457 |
@{term "greaterThanLessThan x y"} & @{term[source] "greaterThanLessThan x y"}\\ |
|
458 |
@{term "atLeastLessThan x y"} & @{term[source] "atLeastLessThan x y"}\\ |
|
459 |
@{term "greaterThanAtMost x y"} & @{term[source] "greaterThanAtMost x y"}\\ |
|
460 |
@{term "atLeastAtMost x y"} & @{term[source] "atLeastAtMost x y"}\\ |
|
61995
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
461 |
@{term[source] "\<Union>i\<le>n. A"} & @{term[source] "\<Union>i \<in> {..n}. A"}\\ |
74709e9c4f17
clarified print modes: Isabelle symbols are used by default, but "latex" mode needs to be for some syntax forms;
wenzelm
parents:
61943
diff
changeset
|
462 |
@{term[source] "\<Union>i<n. A"} & @{term[source] "\<Union>i \<in> {..<n}. A"}\\ |
61996 | 463 |
\multicolumn{2}{@ {}l@ {}}{Similarly for \<open>\<Inter>\<close> instead of \<open>\<Union>\<close>}\\ |
30321 | 464 |
@{term "setsum (%x. t) {a..b}"} & @{term[source] "setsum (\<lambda>x. t) {a..b}"}\\ |
30370 | 465 |
@{term "setsum (%x. t) {a..<b}"} & @{term[source] "setsum (\<lambda>x. t) {a..<b}"}\\ |
30386 | 466 |
@{term "setsum (%x. t) {..b}"} & @{term[source] "setsum (\<lambda>x. t) {..b}"}\\ |
467 |
@{term "setsum (%x. t) {..<b}"} & @{term[source] "setsum (\<lambda>x. t) {..<b}"}\\ |
|
61996 | 468 |
\multicolumn{2}{@ {}l@ {}}{Similarly for \<open>\<Prod>\<close> instead of \<open>\<Sum>\<close>}\\ |
30321 | 469 |
\end{supertabular} |
470 |
||
471 |
||
50581 | 472 |
\section*{Power} |
30293 | 473 |
|
474 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
475 |
@{const Power.power} & @{typeof Power.power} |
|
476 |
\end{tabular} |
|
477 |
||
478 |
||
50581 | 479 |
\section*{Option} |
30293 | 480 |
|
481 |
@{datatype option} |
|
61996 | 482 |
\<^bigskip> |
30293 | 483 |
|
484 |
\begin{tabular}{@ {} l @ {~::~} l @ {}} |
|
485 |
@{const Option.the} & @{typeof Option.the}\\ |
|
55466 | 486 |
@{const map_option} & @{typ[source]"('a \<Rightarrow> 'b) \<Rightarrow> 'a option \<Rightarrow> 'b option"}\\ |
55518
1ddb2edf5ceb
folded 'Option.set' into BNF-generated 'set_option'
blanchet
parents:
55466
diff
changeset
|
487 |
@{const set_option} & @{term_type_only set_option "'a option \<Rightarrow> 'a set"}\\ |
41532 | 488 |
@{const Option.bind} & @{term_type_only Option.bind "'a option \<Rightarrow> ('a \<Rightarrow> 'b option) \<Rightarrow> 'b option"} |
30293 | 489 |
\end{tabular} |
490 |
||
50581 | 491 |
\section*{List} |
30293 | 492 |
|
493 |
@{datatype list} |
|
61996 | 494 |
\<^bigskip> |
30293 | 495 |
|
496 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
497 |
@{const List.append} & @{typeof List.append}\\ |
|
498 |
@{const List.butlast} & @{typeof List.butlast}\\ |
|
499 |
@{const List.concat} & @{typeof List.concat}\\ |
|
500 |
@{const List.distinct} & @{typeof List.distinct}\\ |
|
501 |
@{const List.drop} & @{typeof List.drop}\\ |
|
502 |
@{const List.dropWhile} & @{typeof List.dropWhile}\\ |
|
503 |
@{const List.filter} & @{typeof List.filter}\\ |
|
47187 | 504 |
@{const List.find} & @{typeof List.find}\\ |
46133
d9fe85d3d2cd
incorporated canonical fold combinator on lists into body of List theory; refactored passages on List.fold(l/r)
haftmann
parents:
45618
diff
changeset
|
505 |
@{const List.fold} & @{typeof List.fold}\\ |
d9fe85d3d2cd
incorporated canonical fold combinator on lists into body of List theory; refactored passages on List.fold(l/r)
haftmann
parents:
45618
diff
changeset
|
506 |
@{const List.foldr} & @{typeof List.foldr}\\ |
30293 | 507 |
@{const List.foldl} & @{typeof List.foldl}\\ |
508 |
@{const List.hd} & @{typeof List.hd}\\ |
|
509 |
@{const List.last} & @{typeof List.last}\\ |
|
510 |
@{const List.length} & @{typeof List.length}\\ |
|
511 |
@{const List.lenlex} & @{term_type_only List.lenlex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\ |
|
512 |
@{const List.lex} & @{term_type_only List.lex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\ |
|
513 |
@{const List.lexn} & @{term_type_only List.lexn "('a*'a)set\<Rightarrow>nat\<Rightarrow>('a list * 'a list)set"}\\ |
|
514 |
@{const List.lexord} & @{term_type_only List.lexord "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\ |
|
46488 | 515 |
@{const List.listrel} & @{term_type_only List.listrel "('a*'b)set\<Rightarrow>('a list * 'b list)set"}\\ |
40272 | 516 |
@{const List.listrel1} & @{term_type_only List.listrel1 "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\ |
30293 | 517 |
@{const List.lists} & @{term_type_only List.lists "'a set\<Rightarrow>'a list set"}\\ |
518 |
@{const List.listset} & @{term_type_only List.listset "'a set list \<Rightarrow> 'a list set"}\\ |
|
58101 | 519 |
@{const Groups_List.listsum} & @{typeof Groups_List.listsum}\\ |
30293 | 520 |
@{const List.list_all2} & @{typeof List.list_all2}\\ |
521 |
@{const List.list_update} & @{typeof List.list_update}\\ |
|
522 |
@{const List.map} & @{typeof List.map}\\ |
|
523 |
@{const List.measures} & @{term_type_only List.measures "('a\<Rightarrow>nat)list\<Rightarrow>('a*'a)set"}\\ |
|
32933 | 524 |
@{const List.nth} & @{typeof List.nth}\\ |
30293 | 525 |
@{const List.remdups} & @{typeof List.remdups}\\ |
526 |
@{const List.removeAll} & @{typeof List.removeAll}\\ |
|
527 |
@{const List.remove1} & @{typeof List.remove1}\\ |
|
528 |
@{const List.replicate} & @{typeof List.replicate}\\ |
|
529 |
@{const List.rev} & @{typeof List.rev}\\ |
|
530 |
@{const List.rotate} & @{typeof List.rotate}\\ |
|
531 |
@{const List.rotate1} & @{typeof List.rotate1}\\ |
|
532 |
@{const List.set} & @{term_type_only List.set "'a list \<Rightarrow> 'a set"}\\ |
|
533 |
@{const List.sort} & @{typeof List.sort}\\ |
|
534 |
@{const List.sorted} & @{typeof List.sorted}\\ |
|
535 |
@{const List.splice} & @{typeof List.splice}\\ |
|
536 |
@{const List.sublist} & @{typeof List.sublist}\\ |
|
537 |
@{const List.take} & @{typeof List.take}\\ |
|
538 |
@{const List.takeWhile} & @{typeof List.takeWhile}\\ |
|
539 |
@{const List.tl} & @{typeof List.tl}\\ |
|
540 |
@{const List.upt} & @{typeof List.upt}\\ |
|
541 |
@{const List.upto} & @{typeof List.upto}\\ |
|
542 |
@{const List.zip} & @{typeof List.zip}\\ |
|
543 |
\end{supertabular} |
|
544 |
||
545 |
\subsubsection*{Syntax} |
|
546 |
||
547 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
61996 | 548 |
\<open>[x\<^sub>1,\<dots>,x\<^sub>n]\<close> & \<open>x\<^sub>1 # \<dots> # x\<^sub>n # []\<close>\\ |
30293 | 549 |
@{term"[m..<n]"} & @{term[source]"upt m n"}\\ |
550 |
@{term"[i..j]"} & @{term[source]"upto i j"}\\ |
|
61996 | 551 |
\<open>[e. x \<leftarrow> xs]\<close> & @{term"map (%x. e) xs"}\\ |
30293 | 552 |
@{term"[x \<leftarrow> xs. b]"} & @{term[source]"filter (\<lambda>x. b) xs"} \\ |
553 |
@{term"xs[n := x]"} & @{term[source]"list_update xs n x"}\\ |
|
554 |
@{term"\<Sum>x\<leftarrow>xs. e"} & @{term[source]"listsum (map (\<lambda>x. e) xs)"}\\ |
|
555 |
\end{supertabular} |
|
61996 | 556 |
\<^medskip> |
30293 | 557 |
|
61996 | 558 |
List comprehension: \<open>[e. q\<^sub>1, \<dots>, q\<^sub>n]\<close> where each |
559 |
qualifier \<open>q\<^sub>i\<close> is either a generator \mbox{\<open>pat \<leftarrow> e\<close>} or a |
|
30293 | 560 |
guard, i.e.\ boolean expression. |
561 |
||
50581 | 562 |
\section*{Map} |
30293 | 563 |
|
564 |
Maps model partial functions and are often used as finite tables. However, |
|
565 |
the domain of a map may be infinite. |
|
566 |
||
567 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}} |
|
568 |
@{const Map.empty} & @{typeof Map.empty}\\ |
|
569 |
@{const Map.map_add} & @{typeof Map.map_add}\\ |
|
570 |
@{const Map.map_comp} & @{typeof Map.map_comp}\\ |
|
571 |
@{const Map.restrict_map} & @{term_type_only Map.restrict_map "('a\<Rightarrow>'b option)\<Rightarrow>'a set\<Rightarrow>('a\<Rightarrow>'b option)"}\\ |
|
572 |
@{const Map.dom} & @{term_type_only Map.dom "('a\<Rightarrow>'b option)\<Rightarrow>'a set"}\\ |
|
573 |
@{const Map.ran} & @{term_type_only Map.ran "('a\<Rightarrow>'b option)\<Rightarrow>'b set"}\\ |
|
574 |
@{const Map.map_le} & @{typeof Map.map_le}\\ |
|
575 |
@{const Map.map_of} & @{typeof Map.map_of}\\ |
|
576 |
@{const Map.map_upds} & @{typeof Map.map_upds}\\ |
|
577 |
\end{supertabular} |
|
578 |
||
579 |
\subsubsection*{Syntax} |
|
580 |
||
581 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}} |
|
30403 | 582 |
@{term"Map.empty"} & @{term"\<lambda>x. None"}\\ |
30293 | 583 |
@{term"m(x:=Some y)"} & @{term[source]"m(x:=Some y)"}\\ |
61996 | 584 |
\<open>m(x\<^sub>1\<mapsto>y\<^sub>1,\<dots>,x\<^sub>n\<mapsto>y\<^sub>n)\<close> & @{text[source]"m(x\<^sub>1\<mapsto>y\<^sub>1)\<dots>(x\<^sub>n\<mapsto>y\<^sub>n)"}\\ |
585 |
\<open>[x\<^sub>1\<mapsto>y\<^sub>1,\<dots>,x\<^sub>n\<mapsto>y\<^sub>n]\<close> & @{text[source]"Map.empty(x\<^sub>1\<mapsto>y\<^sub>1,\<dots>,x\<^sub>n\<mapsto>y\<^sub>n)"}\\ |
|
30293 | 586 |
@{term"map_upds m xs ys"} & @{term[source]"map_upds m xs ys"}\\ |
587 |
\end{tabular} |
|
588 |
||
50581 | 589 |
\section*{Infix operators in Main} % @{theory Main} |
590 |
||
591 |
\begin{center} |
|
50605 | 592 |
\begin{tabular}{llll} |
593 |
& Operator & precedence & associativity \\ |
|
594 |
\hline |
|
61996 | 595 |
Meta-logic & \<open>\<Longrightarrow>\<close> & 1 & right \\ |
596 |
& \<open>\<equiv>\<close> & 2 \\ |
|
50605 | 597 |
\hline |
61996 | 598 |
Logic & \<open>\<and>\<close> & 35 & right \\ |
599 |
&\<open>\<or>\<close> & 30 & right \\ |
|
600 |
&\<open>\<longrightarrow>\<close>, \<open>\<longleftrightarrow>\<close> & 25 & right\\ |
|
601 |
&\<open>=\<close>, \<open>\<noteq>\<close> & 50 & left\\ |
|
50605 | 602 |
\hline |
61996 | 603 |
Orderings & \<open>\<le>\<close>, \<open><\<close>, \<open>\<ge>\<close>, \<open>>\<close> & 50 \\ |
50605 | 604 |
\hline |
61996 | 605 |
Sets & \<open>\<subseteq>\<close>, \<open>\<subset>\<close>, \<open>\<supseteq>\<close>, \<open>\<supset>\<close> & 50 \\ |
606 |
&\<open>\<in>\<close>, \<open>\<notin>\<close> & 50 \\ |
|
607 |
&\<open>\<inter>\<close> & 70 & left \\ |
|
608 |
&\<open>\<union>\<close> & 65 & left \\ |
|
50605 | 609 |
\hline |
61996 | 610 |
Functions and Relations & \<open>\<circ>\<close> & 55 & left\\ |
611 |
&\<open>`\<close> & 90 & right\\ |
|
612 |
&\<open>O\<close> & 75 & right\\ |
|
613 |
&\<open>``\<close> & 90 & right\\ |
|
614 |
&\<open>^^\<close> & 80 & right\\ |
|
50605 | 615 |
\hline |
61996 | 616 |
Numbers & \<open>+\<close>, \<open>-\<close> & 65 & left \\ |
617 |
&\<open>*\<close>, \<open>/\<close> & 70 & left \\ |
|
618 |
&\<open>div\<close>, \<open>mod\<close> & 70 & left\\ |
|
619 |
&\<open>^\<close> & 80 & right\\ |
|
620 |
&\<open>dvd\<close> & 50 \\ |
|
50605 | 621 |
\hline |
61996 | 622 |
Lists & \<open>#\<close>, \<open>@\<close> & 65 & right\\ |
623 |
&\<open>!\<close> & 100 & left |
|
50581 | 624 |
\end{tabular} |
625 |
\end{center} |
|
61996 | 626 |
\<close> |
30293 | 627 |
(*<*) |
628 |
end |
|
629 |
(*>*) |