30293
|
1 |
(*<*)
|
|
2 |
theory MainDoc
|
|
3 |
imports Main
|
|
4 |
begin
|
|
5 |
|
|
6 |
ML {*
|
|
7 |
fun pretty_term_type_only ctxt (t, T) =
|
|
8 |
(if fastype_of t = Sign.certify_typ (ProofContext.theory_of ctxt) T then ()
|
|
9 |
else error "term_type_only: type mismatch";
|
|
10 |
Syntax.pretty_typ ctxt T)
|
|
11 |
|
|
12 |
val _ = ThyOutput.add_commands
|
|
13 |
[("term_type_only", ThyOutput.args (Args.term -- Args.typ_abbrev) (ThyOutput.output pretty_term_type_only))];
|
|
14 |
*}
|
|
15 |
(*>*)
|
|
16 |
text{*
|
|
17 |
|
|
18 |
\begin{abstract}
|
|
19 |
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. The sophisicated class structure is only hinted at.
|
|
20 |
\end{abstract}
|
|
21 |
|
|
22 |
\section{HOL}
|
|
23 |
|
|
24 |
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"}.
|
|
25 |
|
|
26 |
Overloaded operators:
|
|
27 |
|
|
28 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
29 |
@{text "0"} & @{typeof HOL.zero}\\
|
|
30 |
@{text "1"} & @{typeof HOL.one}\\
|
|
31 |
@{const HOL.plus} & @{typeof HOL.plus}\\
|
|
32 |
@{const HOL.minus} & @{typeof HOL.minus}\\
|
|
33 |
@{const HOL.uminus} & @{typeof HOL.uminus}\\
|
|
34 |
@{const HOL.times} & @{typeof HOL.times}\\
|
|
35 |
@{const HOL.inverse} & @{typeof HOL.inverse}\\
|
|
36 |
@{const HOL.divide} & @{typeof HOL.divide}\\
|
|
37 |
@{const HOL.abs} & @{typeof HOL.abs}\\
|
|
38 |
@{const HOL.sgn} & @{typeof HOL.sgn}\\
|
|
39 |
@{const HOL.less_eq} & @{typeof HOL.less_eq}\\
|
|
40 |
@{const HOL.less} & @{typeof HOL.less}\\
|
|
41 |
@{const HOL.default} & @{typeof HOL.default}\\
|
|
42 |
@{const HOL.undefined} & @{typeof HOL.undefined}\\
|
|
43 |
\end{supertabular}
|
|
44 |
|
|
45 |
\subsubsection*{Syntax}
|
|
46 |
|
|
47 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
48 |
@{term"~(x = y)"} & @{term[source]"\<not> (x = y)"}\\
|
|
49 |
@{term[source]"P \<longleftrightarrow> Q"} & @{term"P \<longleftrightarrow> Q"}\\
|
|
50 |
@{term"If x y z"} & @{term[source]"If x y z"}\\
|
|
51 |
@{term"Let e\<^isub>1 (%x. e\<^isub>2)"} & @{term[source]"Let e\<^isub>1 (\<lambda>x. e\<^isub>2)"}\\
|
|
52 |
@{term"abs x"} & @{term[source]"abs x"}\\
|
|
53 |
@{term"uminus x"} & @{term[source]"uminus x"}\\
|
|
54 |
\end{supertabular}
|
|
55 |
|
|
56 |
\section{Orderings}
|
|
57 |
|
|
58 |
A collection of classes constraining @{text"\<le>"} and @{text"<"}:
|
|
59 |
preorders, partial orders, linear orders, dense linear orders and wellorders.
|
|
60 |
|
|
61 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
62 |
@{const Orderings.Least} & @{typeof Orderings.Least}\\
|
|
63 |
@{const Orderings.min} & @{typeof Orderings.min}\\
|
|
64 |
@{const Orderings.max} & @{typeof Orderings.max}\\
|
|
65 |
@{const Orderings.mono} & @{typeof Orderings.mono}\\
|
|
66 |
\end{tabular}
|
|
67 |
|
|
68 |
\subsubsection*{Syntax}
|
|
69 |
|
|
70 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
71 |
@{term[source]"x \<ge> y"} & @{term"x \<ge> y"}\\
|
|
72 |
@{term[source]"x > y"} & @{term"x > y"}\\
|
|
73 |
@{term"ALL x<=y. P"} & @{term[source]"\<forall>x. x \<le> y \<longrightarrow> P"}\\
|
|
74 |
@{term"ALL x<y. P"} & @{term[source]"\<forall>x. x < y \<longrightarrow> P"}\\
|
|
75 |
@{term"ALL x>=y. P"} & @{term[source]"\<forall>x. x \<ge> y \<longrightarrow> P"}\\
|
|
76 |
@{term"ALL x>y. P"} & @{term[source]"\<forall>x. x > y \<longrightarrow> P"}\\
|
30370
|
77 |
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<exists>"} instead of @{text"\<forall>"}}\\
|
30293
|
78 |
@{term"LEAST x. P"} & @{term[source]"Least (\<lambda>x. P)"}\\
|
|
79 |
\end{supertabular}
|
|
80 |
|
|
81 |
\section{Set}
|
|
82 |
|
|
83 |
Sets are predicates: @{text[source]"'a set = 'a \<Rightarrow> bool"}
|
|
84 |
\bigskip
|
|
85 |
|
|
86 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
30370
|
87 |
@{const Set.empty} & @{term_type_only "Set.empty" "'a set"}\\
|
30293
|
88 |
@{const insert} & @{term_type_only insert "'a\<Rightarrow>'a set\<Rightarrow>'a set"}\\
|
|
89 |
@{const Collect} & @{term_type_only Collect "('a\<Rightarrow>bool)\<Rightarrow>'a set"}\\
|
30370
|
90 |
@{const "op :"} & @{term_type_only "op :" "'a\<Rightarrow>'a set\<Rightarrow>bool"} \qquad(\textsc{ascii} @{text":"})\\
|
|
91 |
@{const Set.Un} & @{term_type_only Set.Un "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} \qquad(\textsc{ascii} @{text"Un"})\\
|
|
92 |
@{const Set.Int} & @{term_type_only Set.Int "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} \qquad(\textsc{ascii} @{text"Int"})\\
|
30293
|
93 |
@{const UNION} & @{term_type_only UNION "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\
|
|
94 |
@{const INTER} & @{term_type_only INTER "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\
|
|
95 |
@{const Union} & @{term_type_only Union "'a set set\<Rightarrow>'a set"}\\
|
|
96 |
@{const Inter} & @{term_type_only Inter "'a set set\<Rightarrow>'a set"}\\
|
|
97 |
@{const Pow} & @{term_type_only Pow "'a set \<Rightarrow>'a set set"}\\
|
|
98 |
@{const UNIV} & @{term_type_only UNIV "'a set"}\\
|
|
99 |
@{const image} & @{term_type_only image "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set"}\\
|
|
100 |
@{const Ball} & @{term_type_only Ball "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\
|
|
101 |
@{const Bex} & @{term_type_only Bex "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\
|
|
102 |
\end{supertabular}
|
|
103 |
|
|
104 |
\subsubsection*{Syntax}
|
|
105 |
|
|
106 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
107 |
@{text"{x\<^isub>1,\<dots>,x\<^isub>n}"} & @{text"insert x\<^isub>1 (\<dots> (insert x\<^isub>n {})\<dots>)"}\\
|
|
108 |
@{term"x ~: A"} & @{term[source]"\<not>(x \<in> A)"}\\
|
|
109 |
@{term"A \<subseteq> B"} & @{term[source]"A \<le> B"}\\
|
|
110 |
@{term"A \<subset> B"} & @{term[source]"A < B"}\\
|
|
111 |
@{term[source]"A \<supseteq> B"} & @{term[source]"B \<le> A"}\\
|
|
112 |
@{term[source]"A \<supset> B"} & @{term[source]"B < A"}\\
|
|
113 |
@{term"{x. P}"} & @{term[source]"Collect(\<lambda>x. P)"}\\
|
30370
|
114 |
@{term[mode=xsymbols]"UN x:I. A"} & @{term[source]"UNION I (\<lambda>x. A)"}\\
|
|
115 |
@{term[mode=xsymbols]"UN x. A"} & @{term[source]"UNION UNIV (\<lambda>x. A)"}\\
|
|
116 |
@{term[mode=xsymbols]"INT x:I. A"} & @{term[source]"INTER I (\<lambda>x. A)"}\\
|
|
117 |
@{term[mode=xsymbols]"INT x. A"} & @{term[source]"INTER UNIV (\<lambda>x. A)"}\\
|
30293
|
118 |
@{term"ALL x:A. P"} & @{term[source]"Ball A (\<lambda>x. P)"}\\
|
|
119 |
@{term"EX x:A. P"} & @{term[source]"Bex A (\<lambda>x. P)"}\\
|
|
120 |
@{term"range f"} & @{term[source]"f ` UNIV"}\\
|
|
121 |
\end{supertabular}
|
|
122 |
|
|
123 |
|
|
124 |
\section{Fun}
|
|
125 |
|
|
126 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
127 |
@{const "Fun.id"} & @{typeof Fun.id}\\
|
|
128 |
@{const "Fun.comp"} & @{typeof Fun.comp}\\
|
|
129 |
@{const "Fun.inj_on"} & @{term_type_only Fun.inj_on "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>bool"}\\
|
|
130 |
@{const "Fun.inj"} & @{typeof Fun.inj}\\
|
|
131 |
@{const "Fun.surj"} & @{typeof Fun.surj}\\
|
|
132 |
@{const "Fun.bij"} & @{typeof Fun.bij}\\
|
|
133 |
@{const "Fun.bij_betw"} & @{term_type_only Fun.bij_betw "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set\<Rightarrow>bool"}\\
|
|
134 |
@{const "Fun.fun_upd"} & @{typeof Fun.fun_upd}\\
|
|
135 |
\end{supertabular}
|
|
136 |
|
|
137 |
\subsubsection*{Syntax}
|
|
138 |
|
|
139 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
140 |
@{term"fun_upd f x y"} & @{term[source]"fun_upd f x y"}\\
|
|
141 |
@{text"f(x\<^isub>1:=y\<^isub>1,\<dots>,x\<^isub>n:=y\<^isub>n)"} & @{text"f(x\<^isub>1:=y\<^isub>1)\<dots>(x\<^isub>n:=y\<^isub>n)"}\\
|
|
142 |
\end{tabular}
|
|
143 |
|
|
144 |
|
|
145 |
\section{Fixed Points}
|
|
146 |
|
|
147 |
Theory: @{theory Inductive}.
|
|
148 |
|
|
149 |
Least and greatest fixed points in a complete lattice @{typ 'a}:
|
|
150 |
|
|
151 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
152 |
@{const Inductive.lfp} & @{typeof Inductive.lfp}\\
|
|
153 |
@{const Inductive.gfp} & @{typeof Inductive.gfp}\\
|
|
154 |
\end{tabular}
|
|
155 |
|
|
156 |
Note that in particular sets (@{typ"'a \<Rightarrow> bool"}) are complete lattices.
|
|
157 |
|
|
158 |
\section{Sum\_Type}
|
|
159 |
|
|
160 |
Type constructor @{text"+"}.
|
|
161 |
|
|
162 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
163 |
@{const Sum_Type.Inl} & @{typeof Sum_Type.Inl}\\
|
|
164 |
@{const Sum_Type.Inr} & @{typeof Sum_Type.Inr}\\
|
|
165 |
@{const Sum_Type.Plus} & @{term_type_only Sum_Type.Plus "'a set\<Rightarrow>'b set\<Rightarrow>('a+'b)set"}
|
|
166 |
\end{tabular}
|
|
167 |
|
|
168 |
|
|
169 |
\section{Product\_Type}
|
|
170 |
|
|
171 |
Types @{typ unit} and @{text"\<times>"}.
|
|
172 |
|
|
173 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
174 |
@{const Product_Type.Unity} & @{typeof Product_Type.Unity}\\
|
|
175 |
@{const Pair} & @{typeof Pair}\\
|
|
176 |
@{const fst} & @{typeof fst}\\
|
|
177 |
@{const snd} & @{typeof snd}\\
|
|
178 |
@{const split} & @{typeof split}\\
|
|
179 |
@{const curry} & @{typeof curry}\\
|
|
180 |
@{const Product_Type.Times} & @{typeof Product_Type.Times}\\
|
|
181 |
@{const Product_Type.Sigma} & @{term_type_only Product_Type.Sigma "'a set\<Rightarrow>('a\<Rightarrow>'b set)\<Rightarrow>('a*'b)set"}\\
|
|
182 |
\end{supertabular}
|
|
183 |
|
|
184 |
\subsubsection*{Syntax}
|
|
185 |
|
|
186 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
187 |
@{term"Pair a b"} & @{term[source]"Pair a b"}\\
|
|
188 |
@{term"split (\<lambda>x y. t)"} & @{term[source]"split (\<lambda>x y. t)"}\\
|
|
189 |
\end{tabular}
|
|
190 |
|
|
191 |
Pairs may be nested. Nesting to the right is printed as a tuple,
|
|
192 |
e.g.\ \mbox{@{term"(a,b,c)"}} is really @{text"(a,(b,c))"}.
|
|
193 |
Pattern matching with pairs and tuples extends to all binders,
|
|
194 |
e.g.\ @{prop"ALL (x,y):A. P"}, @{term"{(x,y). P}"}, etc.
|
|
195 |
|
|
196 |
|
|
197 |
\section{Relation}
|
|
198 |
|
|
199 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
200 |
@{const Relation.converse} & @{term_type_only Relation.converse "('a * 'b)set \<Rightarrow> ('b*'a)set"}\\
|
|
201 |
@{const Relation.rel_comp} & @{term_type_only Relation.rel_comp "('a*'b)set\<Rightarrow>('c*'a)set\<Rightarrow>('c*'b)set"}\\
|
|
202 |
@{const Relation.Image} & @{term_type_only Relation.Image "('a*'b)set\<Rightarrow>'a set\<Rightarrow>'b set"}\\
|
|
203 |
@{const Relation.inv_image} & @{term_type_only Relation.inv_image "('a*'a)set\<Rightarrow>('b\<Rightarrow>'a)\<Rightarrow>('b*'b)set"}\\
|
|
204 |
@{const Relation.Id_on} & @{term_type_only Relation.Id_on "'a set\<Rightarrow>('a*'a)set"}\\
|
|
205 |
@{const Relation.Id} & @{term_type_only Relation.Id "('a*'a)set"}\\
|
|
206 |
@{const Relation.Domain} & @{term_type_only Relation.Domain "('a*'b)set\<Rightarrow>'a set"}\\
|
|
207 |
@{const Relation.Range} & @{term_type_only Relation.Range "('a*'b)set\<Rightarrow>'b set"}\\
|
|
208 |
@{const Relation.Field} & @{term_type_only Relation.Field "('a*'a)set\<Rightarrow>'a set"}\\
|
|
209 |
@{const Relation.refl_on} & @{term_type_only Relation.refl_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\
|
|
210 |
@{const Relation.refl} & @{term_type_only Relation.refl "('a*'a)set\<Rightarrow>bool"}\\
|
|
211 |
@{const Relation.sym} & @{term_type_only Relation.sym "('a*'a)set\<Rightarrow>bool"}\\
|
|
212 |
@{const Relation.antisym} & @{term_type_only Relation.antisym "('a*'a)set\<Rightarrow>bool"}\\
|
|
213 |
@{const Relation.trans} & @{term_type_only Relation.trans "('a*'a)set\<Rightarrow>bool"}\\
|
|
214 |
@{const Relation.irrefl} & @{term_type_only Relation.irrefl "('a*'a)set\<Rightarrow>bool"}\\
|
|
215 |
@{const Relation.total_on} & @{term_type_only Relation.total_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\
|
|
216 |
@{const Relation.total} & @{term_type_only Relation.total "('a*'a)set\<Rightarrow>bool"}\\
|
|
217 |
\end{supertabular}
|
|
218 |
|
|
219 |
\subsubsection*{Syntax}
|
|
220 |
|
|
221 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
222 |
@{term"converse r"} & @{term[source]"converse r"}
|
|
223 |
\end{tabular}
|
|
224 |
|
|
225 |
\section{Equiv\_Relations}
|
|
226 |
|
|
227 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
228 |
@{const Equiv_Relations.equiv} & @{term_type_only Equiv_Relations.equiv "'a set \<Rightarrow> ('a*'a)set\<Rightarrow>bool"}\\
|
|
229 |
@{const Equiv_Relations.quotient} & @{term_type_only Equiv_Relations.quotient "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set set"}\\
|
|
230 |
@{const Equiv_Relations.congruent} & @{term_type_only Equiv_Relations.congruent "('a*'a)set\<Rightarrow>('a\<Rightarrow>'b)\<Rightarrow>bool"}\\
|
|
231 |
@{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"}\\
|
|
232 |
%@ {const Equiv_Relations.} & @ {term_type_only Equiv_Relations. ""}\\
|
|
233 |
\end{supertabular}
|
|
234 |
|
|
235 |
\subsubsection*{Syntax}
|
|
236 |
|
|
237 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
238 |
@{term"congruent r f"} & @{term[source]"congruent r f"}\\
|
|
239 |
@{term"congruent2 r r f"} & @{term[source]"congruent2 r r f"}\\
|
|
240 |
\end{tabular}
|
|
241 |
|
|
242 |
|
|
243 |
\section{Transitive\_Closure}
|
|
244 |
|
|
245 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
246 |
@{const Transitive_Closure.rtrancl} & @{term_type_only Transitive_Closure.rtrancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\
|
|
247 |
@{const Transitive_Closure.trancl} & @{term_type_only Transitive_Closure.trancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\
|
|
248 |
@{const Transitive_Closure.reflcl} & @{term_type_only Transitive_Closure.reflcl "('a*'a)set\<Rightarrow>('a*'a)set"}\\
|
|
249 |
\end{tabular}
|
|
250 |
|
|
251 |
\subsubsection*{Syntax}
|
|
252 |
|
|
253 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
254 |
@{term"rtrancl r"} & @{term[source]"rtrancl r"}\\
|
|
255 |
@{term"trancl r"} & @{term[source]"trancl r"}\\
|
|
256 |
@{term"reflcl r"} & @{term[source]"reflcl r"}
|
|
257 |
\end{tabular}
|
|
258 |
|
|
259 |
|
|
260 |
\section{Algebra}
|
|
261 |
|
|
262 |
Theories @{theory OrderedGroup} and @{theory Ring_and_Field} define a large
|
|
263 |
collection of classes describing common algebraic structures from semigroups
|
|
264 |
up to fields. Everything is done in terms of @{const plus}, @{const times}
|
|
265 |
and other overloaded operators.
|
|
266 |
|
|
267 |
|
|
268 |
\section{Nat}
|
|
269 |
|
|
270 |
@{datatype nat}
|
|
271 |
\bigskip
|
|
272 |
|
|
273 |
\begin{tabular}{@ {} lllllll @ {}}
|
|
274 |
@{term "op + :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
275 |
@{term "op - :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
276 |
@{term "op * :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
277 |
@{term "op ^ :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
278 |
@{term "op div :: nat \<Rightarrow> nat \<Rightarrow> nat"}&
|
|
279 |
@{term "op mod :: nat \<Rightarrow> nat \<Rightarrow> nat"}&
|
|
280 |
@{term "op dvd :: nat \<Rightarrow> nat \<Rightarrow> bool"}\\
|
|
281 |
@{term "op \<le> :: nat \<Rightarrow> nat \<Rightarrow> bool"} &
|
|
282 |
@{term "op < :: nat \<Rightarrow> nat \<Rightarrow> bool"} &
|
|
283 |
@{term "min :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
284 |
@{term "max :: nat \<Rightarrow> nat \<Rightarrow> nat"} &
|
|
285 |
@{term "Min :: nat set \<Rightarrow> nat"} &
|
|
286 |
@{term "Max :: nat set \<Rightarrow> nat"}\\
|
|
287 |
\end{tabular}
|
|
288 |
|
|
289 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
290 |
@{const Nat.of_nat} & @{typeof Nat.of_nat}
|
|
291 |
\end{tabular}
|
|
292 |
|
|
293 |
\section{Int}
|
|
294 |
|
|
295 |
Type @{typ int}
|
|
296 |
\bigskip
|
|
297 |
|
|
298 |
\begin{tabular}{@ {} llllllll @ {}}
|
|
299 |
@{term "op + :: int \<Rightarrow> int \<Rightarrow> int"} &
|
|
300 |
@{term "op - :: int \<Rightarrow> int \<Rightarrow> int"} &
|
|
301 |
@{term "uminus :: int \<Rightarrow> int"} &
|
|
302 |
@{term "op * :: int \<Rightarrow> int \<Rightarrow> int"} &
|
|
303 |
@{term "op ^ :: int \<Rightarrow> nat \<Rightarrow> int"} &
|
|
304 |
@{term "op div :: int \<Rightarrow> int \<Rightarrow> int"}&
|
|
305 |
@{term "op mod :: int \<Rightarrow> int \<Rightarrow> int"}&
|
|
306 |
@{term "op dvd :: int \<Rightarrow> int \<Rightarrow> bool"}\\
|
|
307 |
@{term "op \<le> :: int \<Rightarrow> int \<Rightarrow> bool"} &
|
|
308 |
@{term "op < :: int \<Rightarrow> int \<Rightarrow> bool"} &
|
|
309 |
@{term "min :: int \<Rightarrow> int \<Rightarrow> int"} &
|
|
310 |
@{term "max :: int \<Rightarrow> int \<Rightarrow> int"} &
|
|
311 |
@{term "Min :: int set \<Rightarrow> int"} &
|
|
312 |
@{term "Max :: int set \<Rightarrow> int"}\\
|
|
313 |
@{term "abs :: int \<Rightarrow> int"} &
|
|
314 |
@{term "sgn :: int \<Rightarrow> int"}\\
|
|
315 |
\end{tabular}
|
|
316 |
|
|
317 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
318 |
@{const Int.nat} & @{typeof Int.nat}\\
|
|
319 |
@{const Int.of_int} & @{typeof Int.of_int}\\
|
|
320 |
@{const Int.Ints} & @{term_type_only Int.Ints "'a::ring_1 set"}\\
|
|
321 |
\end{tabular}
|
|
322 |
|
|
323 |
\subsubsection*{Syntax}
|
|
324 |
|
|
325 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
326 |
@{term"of_nat::nat\<Rightarrow>int"} & @{term[source]"of_nat"}\\
|
|
327 |
\end{tabular}
|
|
328 |
|
|
329 |
|
|
330 |
\section{Wellfounded}
|
|
331 |
|
|
332 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
333 |
@{const Wellfounded.wf} & @{term_type_only Wellfounded.wf "('a*'a)set\<Rightarrow>bool"}\\
|
|
334 |
@{const Wellfounded.acyclic} & @{term_type_only Wellfounded.acyclic "('a*'a)set\<Rightarrow>bool"}\\
|
|
335 |
@{const Wellfounded.acc} & @{term_type_only Wellfounded.acc "('a*'a)set\<Rightarrow>'a set"}\\
|
|
336 |
@{const Wellfounded.measure} & @{term_type_only Wellfounded.measure "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set"}\\
|
|
337 |
@{const Wellfounded.lex_prod} & @{term_type_only Wellfounded.lex_prod "('a*'a)set\<Rightarrow>('b*'b)set\<Rightarrow>(('a*'b)*('a*'b))set"}\\
|
|
338 |
@{const Wellfounded.mlex_prod} & @{term_type_only Wellfounded.mlex_prod "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set\<Rightarrow>('a*'a)set"}\\
|
|
339 |
@{const Wellfounded.less_than} & @{term_type_only Wellfounded.less_than "(nat*nat)set"}\\
|
|
340 |
@{const Wellfounded.pred_nat} & @{term_type_only Wellfounded.pred_nat "(nat*nat)set"}\\
|
|
341 |
\end{supertabular}
|
|
342 |
|
|
343 |
|
30384
|
344 |
\section{SetInterval}
|
30321
|
345 |
|
|
346 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
30370
|
347 |
@{const lessThan} & @{term_type_only lessThan "'a::ord \<Rightarrow> 'a set"}\\
|
|
348 |
@{const atMost} & @{term_type_only atMost "'a::ord \<Rightarrow> 'a set"}\\
|
|
349 |
@{const greaterThan} & @{term_type_only greaterThan "'a::ord \<Rightarrow> 'a set"}\\
|
|
350 |
@{const atLeast} & @{term_type_only atLeast "'a::ord \<Rightarrow> 'a set"}\\
|
|
351 |
@{const greaterThanLessThan} & @{term_type_only greaterThanLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\
|
|
352 |
@{const atLeastLessThan} & @{term_type_only atLeastLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\
|
|
353 |
@{const greaterThanAtMost} & @{term_type_only greaterThanAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\
|
|
354 |
@{const atLeastAtMost} & @{term_type_only atLeastAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\
|
30321
|
355 |
\end{supertabular}
|
|
356 |
|
|
357 |
\subsubsection*{Syntax}
|
|
358 |
|
|
359 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
360 |
@{term "lessThan y"} & @{term[source] "lessThan y"}\\
|
|
361 |
@{term "atMost y"} & @{term[source] "atMost y"}\\
|
|
362 |
@{term "greaterThan x"} & @{term[source] "greaterThan x"}\\
|
|
363 |
@{term "atLeast x"} & @{term[source] "atLeast x"}\\
|
|
364 |
@{term "greaterThanLessThan x y"} & @{term[source] "greaterThanLessThan x y"}\\
|
|
365 |
@{term "atLeastLessThan x y"} & @{term[source] "atLeastLessThan x y"}\\
|
|
366 |
@{term "greaterThanAtMost x y"} & @{term[source] "greaterThanAtMost x y"}\\
|
|
367 |
@{term "atLeastAtMost x y"} & @{term[source] "atLeastAtMost x y"}\\
|
30370
|
368 |
@{term[mode=xsymbols] "UN i:{..n}. A"} & @{term[source] "\<Union> i \<in> {..n}. A"}\\
|
|
369 |
@{term[mode=xsymbols] "UN i:{..<n}. A"} & @{term[source] "\<Union> i \<in> {..<n}. A"}\\
|
|
370 |
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<Inter>"} instead of @{text"\<Union>"}}\\
|
30321
|
371 |
@{term "setsum (%x. t) {a..b}"} & @{term[source] "setsum (\<lambda>x. t) {a..b}"}\\
|
30370
|
372 |
@{term "setsum (%x. t) {a..<b}"} & @{term[source] "setsum (\<lambda>x. t) {a..<b}"}\\
|
30372
|
373 |
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<Prod>"} instead of @{text"\<Sum>"}}\\
|
30321
|
374 |
\end{supertabular}
|
|
375 |
|
|
376 |
???????
|
|
377 |
|
30293
|
378 |
\section{Power}
|
|
379 |
|
|
380 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
381 |
@{const Power.power} & @{typeof Power.power}
|
|
382 |
\end{tabular}
|
|
383 |
|
|
384 |
|
|
385 |
\section{Iterated Functions and Relations}
|
|
386 |
|
|
387 |
Theory: @{theory Relation_Power}
|
|
388 |
|
|
389 |
Iterated functions \ @{term[source]"(f::'a\<Rightarrow>'a) ^ n"} \
|
|
390 |
and relations \ @{term[source]"(r::('a\<times>'a)set) ^ n"}.
|
|
391 |
|
|
392 |
|
|
393 |
\section{Option}
|
|
394 |
|
|
395 |
@{datatype option}
|
|
396 |
\bigskip
|
|
397 |
|
|
398 |
\begin{tabular}{@ {} l @ {~::~} l @ {}}
|
|
399 |
@{const Option.the} & @{typeof Option.the}\\
|
|
400 |
@{const Option.map} & @{typ[source]"('a \<Rightarrow> 'b) \<Rightarrow> 'a option \<Rightarrow> 'b option"}\\
|
|
401 |
@{const Option.set} & @{term_type_only Option.set "'a option \<Rightarrow> 'a set"}
|
|
402 |
\end{tabular}
|
|
403 |
|
|
404 |
\section{List}
|
|
405 |
|
|
406 |
@{datatype list}
|
|
407 |
\bigskip
|
|
408 |
|
|
409 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
410 |
@{const List.append} & @{typeof List.append}\\
|
|
411 |
@{const List.butlast} & @{typeof List.butlast}\\
|
|
412 |
@{const List.concat} & @{typeof List.concat}\\
|
|
413 |
@{const List.distinct} & @{typeof List.distinct}\\
|
|
414 |
@{const List.drop} & @{typeof List.drop}\\
|
|
415 |
@{const List.dropWhile} & @{typeof List.dropWhile}\\
|
|
416 |
@{const List.filter} & @{typeof List.filter}\\
|
|
417 |
@{const List.foldl} & @{typeof List.foldl}\\
|
|
418 |
@{const List.foldr} & @{typeof List.foldr}\\
|
|
419 |
@{const List.hd} & @{typeof List.hd}\\
|
|
420 |
@{const List.last} & @{typeof List.last}\\
|
|
421 |
@{const List.length} & @{typeof List.length}\\
|
|
422 |
@{const List.lenlex} & @{term_type_only List.lenlex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\
|
|
423 |
@{const List.lex} & @{term_type_only List.lex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\
|
|
424 |
@{const List.lexn} & @{term_type_only List.lexn "('a*'a)set\<Rightarrow>nat\<Rightarrow>('a list * 'a list)set"}\\
|
|
425 |
@{const List.lexord} & @{term_type_only List.lexord "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\
|
|
426 |
@{const List.listrel} & @{term_type_only List.listrel "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\
|
|
427 |
@{const List.lists} & @{term_type_only List.lists "'a set\<Rightarrow>'a list set"}\\
|
|
428 |
@{const List.listset} & @{term_type_only List.listset "'a set list \<Rightarrow> 'a list set"}\\
|
|
429 |
@{const List.listsum} & @{typeof List.listsum}\\
|
|
430 |
@{const List.list_all2} & @{typeof List.list_all2}\\
|
|
431 |
@{const List.list_update} & @{typeof List.list_update}\\
|
|
432 |
@{const List.map} & @{typeof List.map}\\
|
|
433 |
@{const List.measures} & @{term_type_only List.measures "('a\<Rightarrow>nat)list\<Rightarrow>('a*'a)set"}\\
|
|
434 |
@{const List.remdups} & @{typeof List.remdups}\\
|
|
435 |
@{const List.removeAll} & @{typeof List.removeAll}\\
|
|
436 |
@{const List.remove1} & @{typeof List.remove1}\\
|
|
437 |
@{const List.replicate} & @{typeof List.replicate}\\
|
|
438 |
@{const List.rev} & @{typeof List.rev}\\
|
|
439 |
@{const List.rotate} & @{typeof List.rotate}\\
|
|
440 |
@{const List.rotate1} & @{typeof List.rotate1}\\
|
|
441 |
@{const List.set} & @{term_type_only List.set "'a list \<Rightarrow> 'a set"}\\
|
|
442 |
@{const List.sort} & @{typeof List.sort}\\
|
|
443 |
@{const List.sorted} & @{typeof List.sorted}\\
|
|
444 |
@{const List.splice} & @{typeof List.splice}\\
|
|
445 |
@{const List.sublist} & @{typeof List.sublist}\\
|
|
446 |
@{const List.take} & @{typeof List.take}\\
|
|
447 |
@{const List.takeWhile} & @{typeof List.takeWhile}\\
|
|
448 |
@{const List.tl} & @{typeof List.tl}\\
|
|
449 |
@{const List.upt} & @{typeof List.upt}\\
|
|
450 |
@{const List.upto} & @{typeof List.upto}\\
|
|
451 |
@{const List.zip} & @{typeof List.zip}\\
|
|
452 |
\end{supertabular}
|
|
453 |
|
|
454 |
\subsubsection*{Syntax}
|
|
455 |
|
|
456 |
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
457 |
@{text"[x\<^isub>1,\<dots>,x\<^isub>n]"} & @{text"x\<^isub>1 # \<dots> # x\<^isub>n # []"}\\
|
|
458 |
@{term"[m..<n]"} & @{term[source]"upt m n"}\\
|
|
459 |
@{term"[i..j]"} & @{term[source]"upto i j"}\\
|
|
460 |
@{text"[e. x \<leftarrow> xs]"} & @{term"map (%x. e) xs"}\\
|
|
461 |
@{term"[x \<leftarrow> xs. b]"} & @{term[source]"filter (\<lambda>x. b) xs"} \\
|
|
462 |
@{term"xs[n := x]"} & @{term[source]"list_update xs n x"}\\
|
|
463 |
@{term"\<Sum>x\<leftarrow>xs. e"} & @{term[source]"listsum (map (\<lambda>x. e) xs)"}\\
|
|
464 |
\end{supertabular}
|
|
465 |
\medskip
|
|
466 |
|
|
467 |
Comprehension: @{text"[e. q\<^isub>1, \<dots>, q\<^isub>n]"} where each
|
|
468 |
qualifier @{text q\<^isub>i} is either a generator @{text"pat \<leftarrow> e"} or a
|
|
469 |
guard, i.e.\ boolean expression.
|
|
470 |
|
|
471 |
\section{Map}
|
|
472 |
|
|
473 |
Maps model partial functions and are often used as finite tables. However,
|
|
474 |
the domain of a map may be infinite.
|
|
475 |
|
|
476 |
@{text"'a \<rightharpoonup> 'b = 'a \<Rightarrow> 'b option"}
|
|
477 |
\bigskip
|
|
478 |
|
|
479 |
\begin{supertabular}{@ {} l @ {~::~} l @ {}}
|
|
480 |
@{const Map.empty} & @{typeof Map.empty}\\
|
|
481 |
@{const Map.map_add} & @{typeof Map.map_add}\\
|
|
482 |
@{const Map.map_comp} & @{typeof Map.map_comp}\\
|
|
483 |
@{const Map.restrict_map} & @{term_type_only Map.restrict_map "('a\<Rightarrow>'b option)\<Rightarrow>'a set\<Rightarrow>('a\<Rightarrow>'b option)"}\\
|
|
484 |
@{const Map.dom} & @{term_type_only Map.dom "('a\<Rightarrow>'b option)\<Rightarrow>'a set"}\\
|
|
485 |
@{const Map.ran} & @{term_type_only Map.ran "('a\<Rightarrow>'b option)\<Rightarrow>'b set"}\\
|
|
486 |
@{const Map.map_le} & @{typeof Map.map_le}\\
|
|
487 |
@{const Map.map_of} & @{typeof Map.map_of}\\
|
|
488 |
@{const Map.map_upds} & @{typeof Map.map_upds}\\
|
|
489 |
\end{supertabular}
|
|
490 |
|
|
491 |
\subsubsection*{Syntax}
|
|
492 |
|
|
493 |
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}
|
|
494 |
@{text"empty"} & @{term"\<lambda>x. None"}\\
|
|
495 |
@{term"m(x:=Some y)"} & @{term[source]"m(x:=Some y)"}\\
|
|
496 |
@{text"m(x\<^isub>1\<mapsto>y\<^isub>1,\<dots>,x\<^isub>n\<mapsto>y\<^isub>n)"} & @{text[source]"m(x\<^isub>1\<mapsto>y\<^isub>1)\<dots>(x\<^isub>n\<mapsto>y\<^isub>n)"}\\
|
|
497 |
@{term"map_upds m xs ys"} & @{term[source]"map_upds m xs ys"}\\
|
|
498 |
\end{tabular}
|
|
499 |
|
|
500 |
*}
|
|
501 |
(*<*)
|
|
502 |
end
|
|
503 |
(*>*) |