8745
|
1 |
(*<*)
|
|
2 |
theory "types" = Main:;
|
|
3 |
(*>*)types number = nat
|
9933
|
4 |
gate = "bool \<Rightarrow> bool \<Rightarrow> bool"
|
|
5 |
('a,'b)alist = "('a \<times> 'b)list";
|
8745
|
6 |
|
|
7 |
text{*\noindent\indexbold{*types}%
|
|
8 |
Internally all synonyms are fully expanded. As a consequence Isabelle's
|
|
9 |
output never contains synonyms. Their main purpose is to improve the
|
8771
|
10 |
readability of theories. Synonyms can be used just like any other
|
8745
|
11 |
type:
|
|
12 |
*}
|
|
13 |
|
|
14 |
consts nand :: gate
|
|
15 |
exor :: gate;
|
|
16 |
|
|
17 |
text{*
|
|
18 |
\subsection{Constant definitions}
|
|
19 |
\label{sec:ConstDefinitions}
|
|
20 |
\indexbold{definition}
|
|
21 |
|
9792
|
22 |
The above constants @{term"nand"} and @{term"exor"} are non-recursive and can
|
8745
|
23 |
therefore be defined directly by
|
|
24 |
*}
|
|
25 |
|
9933
|
26 |
defs nand_def: "nand A B \<equiv> \<not>(A \<and> B)"
|
|
27 |
exor_def: "exor A B \<equiv> A \<and> \<not>B \<or> \<not>A \<and> B";
|
8745
|
28 |
|
|
29 |
text{*\noindent%
|
9792
|
30 |
where \isacommand{defs}\indexbold{*defs} is a keyword and
|
|
31 |
@{thm[source]nand_def} and @{thm[source]exor_def} are user-supplied names.
|
8745
|
32 |
The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality
|
9541
|
33 |
that must be used in constant definitions.
|
8745
|
34 |
Declarations and definitions can also be merged
|
|
35 |
*}
|
|
36 |
|
|
37 |
constdefs nor :: gate
|
9933
|
38 |
"nor A B \<equiv> \<not>(A \<or> B)"
|
8745
|
39 |
exor2 :: gate
|
9933
|
40 |
"exor2 A B \<equiv> (A \<or> B) \<and> (\<not>A \<or> \<not>B)";
|
8745
|
41 |
|
|
42 |
text{*\noindent\indexbold{*constdefs}%
|
9792
|
43 |
in which case the default name of each definition is $f$@{text"_def"}, where
|
8745
|
44 |
$f$ is the name of the defined constant.*}(*<*)
|
|
45 |
end
|
|
46 |
(*>*)
|