30293

1 
(*<*)

30401

2 
theory Main_Doc

30293

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"<"}:

30401

59 
preorder, partial order, linear order, dense linear order and wellorder.

30293

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"}\\

30386

74 
\multicolumn{2}{@ {}l@ {}}{Similarly for $<$, $\ge$ and $>$, and for @{text"\<exists>"}}\\

30293

75 
@{term"LEAST x. P"} & @{term[source]"Least (\<lambda>x. P)"}\\


76 
\end{supertabular}


77 

30401

78 


79 
\section{Lattices}


80 


81 
Classes semilattice, lattice, distributive lattice and complete lattice (the


82 
latter in theory @{theory Set}).


83 


84 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


85 
@{const Lattices.inf} & @{typeof Lattices.inf}\\


86 
@{const Lattices.sup} & @{typeof Lattices.sup}\\


87 
@{const Set.Inf} & @{term_type_only Set.Inf "'a set \<Rightarrow> 'a::complete_lattice"}\\


88 
@{const Set.Sup} & @{term_type_only Set.Sup "'a set \<Rightarrow> 'a::complete_lattice"}\\


89 
\end{tabular}


90 


91 
\subsubsection*{Syntax}


92 


93 
Only available locally:


94 


95 
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


96 
@{text[source]"x \<sqsubseteq> y"} & @{term"x \<le> y"}\\


97 
@{text[source]"x \<sqsubset> y"} & @{term"x < y"}\\


98 
@{text[source]"x \<sqinter> y"} & @{term"inf x y"}\\


99 
@{text[source]"x \<squnion> y"} & @{term"sup x y"}\\


100 
@{text[source]"\<Sqinter> A"} & @{term"Sup A"}\\


101 
@{text[source]"\<Squnion> A"} & @{term"Inf A"}\\


102 
\end{supertabular}


103 


104 

30293

105 
\section{Set}


106 


107 
Sets are predicates: @{text[source]"'a set = 'a \<Rightarrow> bool"}


108 
\bigskip


109 


110 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}

30370

111 
@{const Set.empty} & @{term_type_only "Set.empty" "'a set"}\\

30293

112 
@{const insert} & @{term_type_only insert "'a\<Rightarrow>'a set\<Rightarrow>'a set"}\\


113 
@{const Collect} & @{term_type_only Collect "('a\<Rightarrow>bool)\<Rightarrow>'a set"}\\

30370

114 
@{const "op :"} & @{term_type_only "op :" "'a\<Rightarrow>'a set\<Rightarrow>bool"} \qquad(\textsc{ascii} @{text":"})\\


115 
@{const Set.Un} & @{term_type_only Set.Un "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} \qquad(\textsc{ascii} @{text"Un"})\\


116 
@{const Set.Int} & @{term_type_only Set.Int "'a set\<Rightarrow>'a set \<Rightarrow> 'a set"} \qquad(\textsc{ascii} @{text"Int"})\\

30293

117 
@{const UNION} & @{term_type_only UNION "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\


118 
@{const INTER} & @{term_type_only INTER "'a set\<Rightarrow>('a \<Rightarrow> 'b set) \<Rightarrow> 'b set"}\\


119 
@{const Union} & @{term_type_only Union "'a set set\<Rightarrow>'a set"}\\


120 
@{const Inter} & @{term_type_only Inter "'a set set\<Rightarrow>'a set"}\\


121 
@{const Pow} & @{term_type_only Pow "'a set \<Rightarrow>'a set set"}\\


122 
@{const UNIV} & @{term_type_only UNIV "'a set"}\\


123 
@{const image} & @{term_type_only image "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set"}\\


124 
@{const Ball} & @{term_type_only Ball "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\


125 
@{const Bex} & @{term_type_only Bex "'a set\<Rightarrow>('a\<Rightarrow>bool)\<Rightarrow>bool"}\\


126 
\end{supertabular}


127 


128 
\subsubsection*{Syntax}


129 


130 
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


131 
@{text"{x\<^isub>1,\<dots>,x\<^isub>n}"} & @{text"insert x\<^isub>1 (\<dots> (insert x\<^isub>n {})\<dots>)"}\\


132 
@{term"x ~: A"} & @{term[source]"\<not>(x \<in> A)"}\\


133 
@{term"A \<subseteq> B"} & @{term[source]"A \<le> B"}\\


134 
@{term"A \<subset> B"} & @{term[source]"A < B"}\\


135 
@{term[source]"A \<supseteq> B"} & @{term[source]"B \<le> A"}\\


136 
@{term[source]"A \<supset> B"} & @{term[source]"B < A"}\\


137 
@{term"{x. P}"} & @{term[source]"Collect(\<lambda>x. P)"}\\

30370

138 
@{term[mode=xsymbols]"UN x:I. A"} & @{term[source]"UNION I (\<lambda>x. A)"}\\


139 
@{term[mode=xsymbols]"UN x. A"} & @{term[source]"UNION UNIV (\<lambda>x. A)"}\\


140 
@{term[mode=xsymbols]"INT x:I. A"} & @{term[source]"INTER I (\<lambda>x. A)"}\\


141 
@{term[mode=xsymbols]"INT x. A"} & @{term[source]"INTER UNIV (\<lambda>x. A)"}\\

30293

142 
@{term"ALL x:A. P"} & @{term[source]"Ball A (\<lambda>x. P)"}\\


143 
@{term"EX x:A. P"} & @{term[source]"Bex A (\<lambda>x. P)"}\\


144 
@{term"range f"} & @{term[source]"f ` UNIV"}\\


145 
\end{supertabular}


146 


147 


148 
\section{Fun}


149 


150 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


151 
@{const "Fun.id"} & @{typeof Fun.id}\\


152 
@{const "Fun.comp"} & @{typeof Fun.comp}\\


153 
@{const "Fun.inj_on"} & @{term_type_only Fun.inj_on "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>bool"}\\


154 
@{const "Fun.inj"} & @{typeof Fun.inj}\\


155 
@{const "Fun.surj"} & @{typeof Fun.surj}\\


156 
@{const "Fun.bij"} & @{typeof Fun.bij}\\


157 
@{const "Fun.bij_betw"} & @{term_type_only Fun.bij_betw "('a\<Rightarrow>'b)\<Rightarrow>'a set\<Rightarrow>'b set\<Rightarrow>bool"}\\


158 
@{const "Fun.fun_upd"} & @{typeof Fun.fun_upd}\\


159 
\end{supertabular}


160 


161 
\subsubsection*{Syntax}


162 


163 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


164 
@{term"fun_upd f x y"} & @{term[source]"fun_upd f x y"}\\


165 
@{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)"}\\


166 
\end{tabular}


167 


168 


169 
\section{Fixed Points}


170 


171 
Theory: @{theory Inductive}.


172 


173 
Least and greatest fixed points in a complete lattice @{typ 'a}:


174 


175 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


176 
@{const Inductive.lfp} & @{typeof Inductive.lfp}\\


177 
@{const Inductive.gfp} & @{typeof Inductive.gfp}\\


178 
\end{tabular}


179 


180 
Note that in particular sets (@{typ"'a \<Rightarrow> bool"}) are complete lattices.


181 


182 
\section{Sum\_Type}


183 


184 
Type constructor @{text"+"}.


185 


186 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


187 
@{const Sum_Type.Inl} & @{typeof Sum_Type.Inl}\\


188 
@{const Sum_Type.Inr} & @{typeof Sum_Type.Inr}\\


189 
@{const Sum_Type.Plus} & @{term_type_only Sum_Type.Plus "'a set\<Rightarrow>'b set\<Rightarrow>('a+'b)set"}


190 
\end{tabular}


191 


192 


193 
\section{Product\_Type}


194 


195 
Types @{typ unit} and @{text"\<times>"}.


196 


197 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


198 
@{const Product_Type.Unity} & @{typeof Product_Type.Unity}\\


199 
@{const Pair} & @{typeof Pair}\\


200 
@{const fst} & @{typeof fst}\\


201 
@{const snd} & @{typeof snd}\\


202 
@{const split} & @{typeof split}\\


203 
@{const curry} & @{typeof curry}\\


204 
@{const Product_Type.Times} & @{typeof Product_Type.Times}\\


205 
@{const Product_Type.Sigma} & @{term_type_only Product_Type.Sigma "'a set\<Rightarrow>('a\<Rightarrow>'b set)\<Rightarrow>('a*'b)set"}\\


206 
\end{supertabular}


207 


208 
\subsubsection*{Syntax}


209 


210 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


211 
@{term"Pair a b"} & @{term[source]"Pair a b"}\\


212 
@{term"split (\<lambda>x y. t)"} & @{term[source]"split (\<lambda>x y. t)"}\\


213 
\end{tabular}


214 


215 
Pairs may be nested. Nesting to the right is printed as a tuple,


216 
e.g.\ \mbox{@{term"(a,b,c)"}} is really @{text"(a,(b,c))"}.


217 
Pattern matching with pairs and tuples extends to all binders,


218 
e.g.\ @{prop"ALL (x,y):A. P"}, @{term"{(x,y). P}"}, etc.


219 


220 


221 
\section{Relation}


222 

30401

223 
\begin{tabular}{@ {} l @ {~::~} l @ {}}

30293

224 
@{const Relation.converse} & @{term_type_only Relation.converse "('a * 'b)set \<Rightarrow> ('b*'a)set"}\\


225 
@{const Relation.rel_comp} & @{term_type_only Relation.rel_comp "('a*'b)set\<Rightarrow>('c*'a)set\<Rightarrow>('c*'b)set"}\\


226 
@{const Relation.Image} & @{term_type_only Relation.Image "('a*'b)set\<Rightarrow>'a set\<Rightarrow>'b set"}\\


227 
@{const Relation.inv_image} & @{term_type_only Relation.inv_image "('a*'a)set\<Rightarrow>('b\<Rightarrow>'a)\<Rightarrow>('b*'b)set"}\\


228 
@{const Relation.Id_on} & @{term_type_only Relation.Id_on "'a set\<Rightarrow>('a*'a)set"}\\


229 
@{const Relation.Id} & @{term_type_only Relation.Id "('a*'a)set"}\\


230 
@{const Relation.Domain} & @{term_type_only Relation.Domain "('a*'b)set\<Rightarrow>'a set"}\\


231 
@{const Relation.Range} & @{term_type_only Relation.Range "('a*'b)set\<Rightarrow>'b set"}\\


232 
@{const Relation.Field} & @{term_type_only Relation.Field "('a*'a)set\<Rightarrow>'a set"}\\


233 
@{const Relation.refl_on} & @{term_type_only Relation.refl_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\


234 
@{const Relation.refl} & @{term_type_only Relation.refl "('a*'a)set\<Rightarrow>bool"}\\


235 
@{const Relation.sym} & @{term_type_only Relation.sym "('a*'a)set\<Rightarrow>bool"}\\


236 
@{const Relation.antisym} & @{term_type_only Relation.antisym "('a*'a)set\<Rightarrow>bool"}\\


237 
@{const Relation.trans} & @{term_type_only Relation.trans "('a*'a)set\<Rightarrow>bool"}\\


238 
@{const Relation.irrefl} & @{term_type_only Relation.irrefl "('a*'a)set\<Rightarrow>bool"}\\


239 
@{const Relation.total_on} & @{term_type_only Relation.total_on "'a set\<Rightarrow>('a*'a)set\<Rightarrow>bool"}\\

30401

240 
@{const Relation.total} & @{term_type_only Relation.total "('a*'a)set\<Rightarrow>bool"}


241 
\end{tabular}

30293

242 


243 
\subsubsection*{Syntax}


244 


245 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


246 
@{term"converse r"} & @{term[source]"converse r"}


247 
\end{tabular}


248 


249 
\section{Equiv\_Relations}


250 


251 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


252 
@{const Equiv_Relations.equiv} & @{term_type_only Equiv_Relations.equiv "'a set \<Rightarrow> ('a*'a)set\<Rightarrow>bool"}\\


253 
@{const Equiv_Relations.quotient} & @{term_type_only Equiv_Relations.quotient "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set set"}\\


254 
@{const Equiv_Relations.congruent} & @{term_type_only Equiv_Relations.congruent "('a*'a)set\<Rightarrow>('a\<Rightarrow>'b)\<Rightarrow>bool"}\\


255 
@{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"}\\


256 
%@ {const Equiv_Relations.} & @ {term_type_only Equiv_Relations. ""}\\


257 
\end{supertabular}


258 


259 
\subsubsection*{Syntax}


260 


261 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


262 
@{term"congruent r f"} & @{term[source]"congruent r f"}\\


263 
@{term"congruent2 r r f"} & @{term[source]"congruent2 r r f"}\\


264 
\end{tabular}


265 


266 


267 
\section{Transitive\_Closure}


268 


269 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


270 
@{const Transitive_Closure.rtrancl} & @{term_type_only Transitive_Closure.rtrancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\


271 
@{const Transitive_Closure.trancl} & @{term_type_only Transitive_Closure.trancl "('a*'a)set\<Rightarrow>('a*'a)set"}\\


272 
@{const Transitive_Closure.reflcl} & @{term_type_only Transitive_Closure.reflcl "('a*'a)set\<Rightarrow>('a*'a)set"}\\


273 
\end{tabular}


274 


275 
\subsubsection*{Syntax}


276 


277 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


278 
@{term"rtrancl r"} & @{term[source]"rtrancl r"}\\


279 
@{term"trancl r"} & @{term[source]"trancl r"}\\


280 
@{term"reflcl r"} & @{term[source]"reflcl r"}


281 
\end{tabular}


282 


283 


284 
\section{Algebra}


285 


286 
Theories @{theory OrderedGroup} and @{theory Ring_and_Field} define a large


287 
collection of classes describing common algebraic structures from semigroups


288 
up to fields. Everything is done in terms of @{const plus}, @{const times}


289 
and other overloaded operators.


290 


291 


292 
\section{Nat}


293 


294 
@{datatype nat}


295 
\bigskip


296 


297 
\begin{tabular}{@ {} lllllll @ {}}


298 
@{term "op + :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


299 
@{term "op  :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


300 
@{term "op * :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


301 
@{term "op ^ :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


302 
@{term "op div :: nat \<Rightarrow> nat \<Rightarrow> nat"}&


303 
@{term "op mod :: nat \<Rightarrow> nat \<Rightarrow> nat"}&


304 
@{term "op dvd :: nat \<Rightarrow> nat \<Rightarrow> bool"}\\


305 
@{term "op \<le> :: nat \<Rightarrow> nat \<Rightarrow> bool"} &


306 
@{term "op < :: nat \<Rightarrow> nat \<Rightarrow> bool"} &


307 
@{term "min :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


308 
@{term "max :: nat \<Rightarrow> nat \<Rightarrow> nat"} &


309 
@{term "Min :: nat set \<Rightarrow> nat"} &


310 
@{term "Max :: nat set \<Rightarrow> nat"}\\


311 
\end{tabular}


312 


313 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


314 
@{const Nat.of_nat} & @{typeof Nat.of_nat}


315 
\end{tabular}


316 


317 
\section{Int}


318 


319 
Type @{typ int}


320 
\bigskip


321 


322 
\begin{tabular}{@ {} llllllll @ {}}


323 
@{term "op + :: int \<Rightarrow> int \<Rightarrow> int"} &


324 
@{term "op  :: int \<Rightarrow> int \<Rightarrow> int"} &


325 
@{term "uminus :: int \<Rightarrow> int"} &


326 
@{term "op * :: int \<Rightarrow> int \<Rightarrow> int"} &


327 
@{term "op ^ :: int \<Rightarrow> nat \<Rightarrow> int"} &


328 
@{term "op div :: int \<Rightarrow> int \<Rightarrow> int"}&


329 
@{term "op mod :: int \<Rightarrow> int \<Rightarrow> int"}&


330 
@{term "op dvd :: int \<Rightarrow> int \<Rightarrow> bool"}\\


331 
@{term "op \<le> :: int \<Rightarrow> int \<Rightarrow> bool"} &


332 
@{term "op < :: int \<Rightarrow> int \<Rightarrow> bool"} &


333 
@{term "min :: int \<Rightarrow> int \<Rightarrow> int"} &


334 
@{term "max :: int \<Rightarrow> int \<Rightarrow> int"} &


335 
@{term "Min :: int set \<Rightarrow> int"} &


336 
@{term "Max :: int set \<Rightarrow> int"}\\


337 
@{term "abs :: int \<Rightarrow> int"} &


338 
@{term "sgn :: int \<Rightarrow> int"}\\


339 
\end{tabular}


340 


341 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


342 
@{const Int.nat} & @{typeof Int.nat}\\


343 
@{const Int.of_int} & @{typeof Int.of_int}\\


344 
@{const Int.Ints} & @{term_type_only Int.Ints "'a::ring_1 set"}\\


345 
\end{tabular}


346 


347 
\subsubsection*{Syntax}


348 


349 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


350 
@{term"of_nat::nat\<Rightarrow>int"} & @{term[source]"of_nat"}\\


351 
\end{tabular}


352 


353 

30401

354 
\section{Finite\_Set}


355 


356 


357 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


358 
@{const Finite_Set.finite} & @{term_type_only Finite_Set.finite "'a set\<Rightarrow>bool"}\\


359 
@{const Finite_Set.card} & @{term_type_only Finite_Set.card "'a set => nat"}\\


360 
@{const Finite_Set.fold} & @{term_type_only Finite_Set.fold "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a set \<Rightarrow> 'b"}\\


361 
@{const Finite_Set.fold_image} & @{typ "('b \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a set \<Rightarrow> 'b"}\\


362 
@{const Finite_Set.setsum} & @{term_type_only Finite_Set.setsum "('a => 'b) => 'a set => 'b::comm_monoid_add"}\\


363 
@{const Finite_Set.setprod} & @{term_type_only Finite_Set.setprod "('a => 'b) => 'a set => 'b::comm_monoid_mult"}\\


364 
\end{supertabular}


365 


366 


367 
\subsubsection*{Syntax}


368 


369 
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


370 
@{term"setsum (%x. x) A"} & @{term[source]"setsum (\<lambda>x. x) A"}\\


371 
@{term"setsum (%x. t) A"} & @{term[source]"setsum (\<lambda>x. t) A"}\\


372 
@{term[source]"\<Sum>xP. t"} & @{term"\<Sum>xP. t"}\\


373 
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<Prod>"} instead of @{text"\<Sum>"}}\\


374 
\end{supertabular}


375 


376 

30293

377 
\section{Wellfounded}


378 


379 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


380 
@{const Wellfounded.wf} & @{term_type_only Wellfounded.wf "('a*'a)set\<Rightarrow>bool"}\\


381 
@{const Wellfounded.acyclic} & @{term_type_only Wellfounded.acyclic "('a*'a)set\<Rightarrow>bool"}\\


382 
@{const Wellfounded.acc} & @{term_type_only Wellfounded.acc "('a*'a)set\<Rightarrow>'a set"}\\


383 
@{const Wellfounded.measure} & @{term_type_only Wellfounded.measure "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set"}\\


384 
@{const Wellfounded.lex_prod} & @{term_type_only Wellfounded.lex_prod "('a*'a)set\<Rightarrow>('b*'b)set\<Rightarrow>(('a*'b)*('a*'b))set"}\\


385 
@{const Wellfounded.mlex_prod} & @{term_type_only Wellfounded.mlex_prod "('a\<Rightarrow>nat)\<Rightarrow>('a*'a)set\<Rightarrow>('a*'a)set"}\\


386 
@{const Wellfounded.less_than} & @{term_type_only Wellfounded.less_than "(nat*nat)set"}\\


387 
@{const Wellfounded.pred_nat} & @{term_type_only Wellfounded.pred_nat "(nat*nat)set"}\\


388 
\end{supertabular}


389 


390 

30384

391 
\section{SetInterval}

30321

392 


393 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}

30370

394 
@{const lessThan} & @{term_type_only lessThan "'a::ord \<Rightarrow> 'a set"}\\


395 
@{const atMost} & @{term_type_only atMost "'a::ord \<Rightarrow> 'a set"}\\


396 
@{const greaterThan} & @{term_type_only greaterThan "'a::ord \<Rightarrow> 'a set"}\\


397 
@{const atLeast} & @{term_type_only atLeast "'a::ord \<Rightarrow> 'a set"}\\


398 
@{const greaterThanLessThan} & @{term_type_only greaterThanLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\


399 
@{const atLeastLessThan} & @{term_type_only atLeastLessThan "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\


400 
@{const greaterThanAtMost} & @{term_type_only greaterThanAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\


401 
@{const atLeastAtMost} & @{term_type_only atLeastAtMost "'a::ord \<Rightarrow> 'a \<Rightarrow> 'a set"}\\

30321

402 
\end{supertabular}


403 


404 
\subsubsection*{Syntax}


405 


406 
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


407 
@{term "lessThan y"} & @{term[source] "lessThan y"}\\


408 
@{term "atMost y"} & @{term[source] "atMost y"}\\


409 
@{term "greaterThan x"} & @{term[source] "greaterThan x"}\\


410 
@{term "atLeast x"} & @{term[source] "atLeast x"}\\


411 
@{term "greaterThanLessThan x y"} & @{term[source] "greaterThanLessThan x y"}\\


412 
@{term "atLeastLessThan x y"} & @{term[source] "atLeastLessThan x y"}\\


413 
@{term "greaterThanAtMost x y"} & @{term[source] "greaterThanAtMost x y"}\\


414 
@{term "atLeastAtMost x y"} & @{term[source] "atLeastAtMost x y"}\\

30370

415 
@{term[mode=xsymbols] "UN i:{..n}. A"} & @{term[source] "\<Union> i \<in> {..n}. A"}\\


416 
@{term[mode=xsymbols] "UN i:{..<n}. A"} & @{term[source] "\<Union> i \<in> {..<n}. A"}\\


417 
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<Inter>"} instead of @{text"\<Union>"}}\\

30321

418 
@{term "setsum (%x. t) {a..b}"} & @{term[source] "setsum (\<lambda>x. t) {a..b}"}\\

30370

419 
@{term "setsum (%x. t) {a..<b}"} & @{term[source] "setsum (\<lambda>x. t) {a..<b}"}\\

30386

420 
@{term "setsum (%x. t) {..b}"} & @{term[source] "setsum (\<lambda>x. t) {..b}"}\\


421 
@{term "setsum (%x. t) {..<b}"} & @{term[source] "setsum (\<lambda>x. t) {..<b}"}\\

30372

422 
\multicolumn{2}{@ {}l@ {}}{Similarly for @{text"\<Prod>"} instead of @{text"\<Sum>"}}\\

30321

423 
\end{supertabular}


424 


425 

30293

426 
\section{Power}


427 


428 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


429 
@{const Power.power} & @{typeof Power.power}


430 
\end{tabular}


431 


432 


433 
\section{Iterated Functions and Relations}


434 


435 
Theory: @{theory Relation_Power}


436 


437 
Iterated functions \ @{term[source]"(f::'a\<Rightarrow>'a) ^ n"} \


438 
and relations \ @{term[source]"(r::('a\<times>'a)set) ^ n"}.


439 


440 


441 
\section{Option}


442 


443 
@{datatype option}


444 
\bigskip


445 


446 
\begin{tabular}{@ {} l @ {~::~} l @ {}}


447 
@{const Option.the} & @{typeof Option.the}\\


448 
@{const Option.map} & @{typ[source]"('a \<Rightarrow> 'b) \<Rightarrow> 'a option \<Rightarrow> 'b option"}\\


449 
@{const Option.set} & @{term_type_only Option.set "'a option \<Rightarrow> 'a set"}


450 
\end{tabular}


451 


452 
\section{List}


453 


454 
@{datatype list}


455 
\bigskip


456 


457 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


458 
@{const List.append} & @{typeof List.append}\\


459 
@{const List.butlast} & @{typeof List.butlast}\\


460 
@{const List.concat} & @{typeof List.concat}\\


461 
@{const List.distinct} & @{typeof List.distinct}\\


462 
@{const List.drop} & @{typeof List.drop}\\


463 
@{const List.dropWhile} & @{typeof List.dropWhile}\\


464 
@{const List.filter} & @{typeof List.filter}\\


465 
@{const List.foldl} & @{typeof List.foldl}\\


466 
@{const List.foldr} & @{typeof List.foldr}\\


467 
@{const List.hd} & @{typeof List.hd}\\


468 
@{const List.last} & @{typeof List.last}\\


469 
@{const List.length} & @{typeof List.length}\\


470 
@{const List.lenlex} & @{term_type_only List.lenlex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\


471 
@{const List.lex} & @{term_type_only List.lex "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\


472 
@{const List.lexn} & @{term_type_only List.lexn "('a*'a)set\<Rightarrow>nat\<Rightarrow>('a list * 'a list)set"}\\


473 
@{const List.lexord} & @{term_type_only List.lexord "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\


474 
@{const List.listrel} & @{term_type_only List.listrel "('a*'a)set\<Rightarrow>('a list * 'a list)set"}\\


475 
@{const List.lists} & @{term_type_only List.lists "'a set\<Rightarrow>'a list set"}\\


476 
@{const List.listset} & @{term_type_only List.listset "'a set list \<Rightarrow> 'a list set"}\\


477 
@{const List.listsum} & @{typeof List.listsum}\\


478 
@{const List.list_all2} & @{typeof List.list_all2}\\


479 
@{const List.list_update} & @{typeof List.list_update}\\


480 
@{const List.map} & @{typeof List.map}\\


481 
@{const List.measures} & @{term_type_only List.measures "('a\<Rightarrow>nat)list\<Rightarrow>('a*'a)set"}\\


482 
@{const List.remdups} & @{typeof List.remdups}\\


483 
@{const List.removeAll} & @{typeof List.removeAll}\\


484 
@{const List.remove1} & @{typeof List.remove1}\\


485 
@{const List.replicate} & @{typeof List.replicate}\\


486 
@{const List.rev} & @{typeof List.rev}\\


487 
@{const List.rotate} & @{typeof List.rotate}\\


488 
@{const List.rotate1} & @{typeof List.rotate1}\\


489 
@{const List.set} & @{term_type_only List.set "'a list \<Rightarrow> 'a set"}\\


490 
@{const List.sort} & @{typeof List.sort}\\


491 
@{const List.sorted} & @{typeof List.sorted}\\


492 
@{const List.splice} & @{typeof List.splice}\\


493 
@{const List.sublist} & @{typeof List.sublist}\\


494 
@{const List.take} & @{typeof List.take}\\


495 
@{const List.takeWhile} & @{typeof List.takeWhile}\\


496 
@{const List.tl} & @{typeof List.tl}\\


497 
@{const List.upt} & @{typeof List.upt}\\


498 
@{const List.upto} & @{typeof List.upto}\\


499 
@{const List.zip} & @{typeof List.zip}\\


500 
\end{supertabular}


501 


502 
\subsubsection*{Syntax}


503 


504 
\begin{supertabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


505 
@{text"[x\<^isub>1,\<dots>,x\<^isub>n]"} & @{text"x\<^isub>1 # \<dots> # x\<^isub>n # []"}\\


506 
@{term"[m..<n]"} & @{term[source]"upt m n"}\\


507 
@{term"[i..j]"} & @{term[source]"upto i j"}\\


508 
@{text"[e. x \<leftarrow> xs]"} & @{term"map (%x. e) xs"}\\


509 
@{term"[x \<leftarrow> xs. b]"} & @{term[source]"filter (\<lambda>x. b) xs"} \\


510 
@{term"xs[n := x]"} & @{term[source]"list_update xs n x"}\\


511 
@{term"\<Sum>x\<leftarrow>xs. e"} & @{term[source]"listsum (map (\<lambda>x. e) xs)"}\\


512 
\end{supertabular}


513 
\medskip


514 


515 
Comprehension: @{text"[e. q\<^isub>1, \<dots>, q\<^isub>n]"} where each


516 
qualifier @{text q\<^isub>i} is either a generator @{text"pat \<leftarrow> e"} or a


517 
guard, i.e.\ boolean expression.


518 


519 
\section{Map}


520 


521 
Maps model partial functions and are often used as finite tables. However,


522 
the domain of a map may be infinite.


523 


524 
@{text"'a \<rightharpoonup> 'b = 'a \<Rightarrow> 'b option"}


525 
\bigskip


526 


527 
\begin{supertabular}{@ {} l @ {~::~} l @ {}}


528 
@{const Map.empty} & @{typeof Map.empty}\\


529 
@{const Map.map_add} & @{typeof Map.map_add}\\


530 
@{const Map.map_comp} & @{typeof Map.map_comp}\\


531 
@{const Map.restrict_map} & @{term_type_only Map.restrict_map "('a\<Rightarrow>'b option)\<Rightarrow>'a set\<Rightarrow>('a\<Rightarrow>'b option)"}\\


532 
@{const Map.dom} & @{term_type_only Map.dom "('a\<Rightarrow>'b option)\<Rightarrow>'a set"}\\


533 
@{const Map.ran} & @{term_type_only Map.ran "('a\<Rightarrow>'b option)\<Rightarrow>'b set"}\\


534 
@{const Map.map_le} & @{typeof Map.map_le}\\


535 
@{const Map.map_of} & @{typeof Map.map_of}\\


536 
@{const Map.map_upds} & @{typeof Map.map_upds}\\


537 
\end{supertabular}


538 


539 
\subsubsection*{Syntax}


540 


541 
\begin{tabular}{@ {} l @ {\quad$\equiv$\quad} l @ {}}


542 
@{text"empty"} & @{term"\<lambda>x. None"}\\


543 
@{term"m(x:=Some y)"} & @{term[source]"m(x:=Some y)"}\\


544 
@{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)"}\\


545 
@{term"map_upds m xs ys"} & @{term[source]"map_upds m xs ys"}\\


546 
\end{tabular}


547 


548 
*}


549 
(*<*)


550 
end


551 
(*>*) 