src/Doc/Tutorial/Misc/types.thy
author wenzelm
Sat, 05 Apr 2014 15:03:40 +0200
changeset 56421 1ffd7eaa778b
parent 48985 5386df44a037
child 67406 23307fd33906
permissions -rw-r--r--
updated to jedit_build-20140405: Code2HTML.jar, CommonControls.jar, Console.jar, kappalayout.jar, Navigator.jar, SideKick.jar, doc with jEdit manuals (ant dist-manuals);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17914
99ead7a7eb42 fix headers;
wenzelm
parents: 12327
diff changeset
     1
(*<*)theory "types" imports Main begin(*>*)
42765
aec61b60ff7b modernized specifications;
wenzelm
parents: 27015
diff changeset
     2
type_synonym number = nat
aec61b60ff7b modernized specifications;
wenzelm
parents: 27015
diff changeset
     3
type_synonym gate = "bool \<Rightarrow> bool \<Rightarrow> bool"
aec61b60ff7b modernized specifications;
wenzelm
parents: 27015
diff changeset
     4
type_synonym ('a, 'b) alist = "('a \<times> 'b) list"
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     5
11428
332347b9b942 tidying the index
paulson
parents: 10885
diff changeset
     6
text{*\noindent
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     7
Internally all synonyms are fully expanded.  As a consequence Isabelle's
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     8
output never contains synonyms.  Their main purpose is to improve the
8771
026f37a86ea7 *** empty log message ***
nipkow
parents: 8745
diff changeset
     9
readability of theories.  Synonyms can be used just like any other
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    10
type.
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    11
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    12
10885
90695f46440b lcp's pass over the book, chapters 1-8
paulson
parents: 10788
diff changeset
    13
subsection{*Constant Definitions*}
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    14
11428
332347b9b942 tidying the index
paulson
parents: 10885
diff changeset
    15
text{*\label{sec:ConstDefinitions}\indexbold{definitions}%
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    16
Nonrecursive definitions can be made with the \commdx{definition}
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    17
command, for example @{text nand} and @{text xor} gates
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    18
(based on type @{typ gate} above):
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    19
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    20
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    21
definition nand :: gate where "nand A B \<equiv> \<not>(A \<and> B)"
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    22
definition xor  :: gate where "xor  A B \<equiv> A \<and> \<not>B \<or> \<not>A \<and> B"
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    23
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    24
text{*\noindent%
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    25
The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 8771
diff changeset
    26
that must be used in constant definitions.
11457
279da0358aa9 additional revisions to chapters 1, 2
paulson
parents: 11456
diff changeset
    27
Pattern-matching is not allowed: each definition must be of
279da0358aa9 additional revisions to chapters 1, 2
paulson
parents: 11456
diff changeset
    28
the form $f\,x@1\,\dots\,x@n~\isasymequiv~t$.
279da0358aa9 additional revisions to chapters 1, 2
paulson
parents: 11456
diff changeset
    29
Section~\ref{sec:Simp-with-Defs} explains how definitions are used
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 17914
diff changeset
    30
in proofs. The default name of each definition is $f$@{text"_def"}, where
10788
ea48dd8b0232 *** empty log message ***
nipkow
parents: 9933
diff changeset
    31
$f$ is the name of the defined constant.*}
ea48dd8b0232 *** empty log message ***
nipkow
parents: 9933
diff changeset
    32
(*<*)end(*>*)