doc-src/TutorialI/Misc/def_rewr.thy
author nipkow
Tue, 29 Aug 2000 16:05:13 +0200
changeset 9723 a977245dfc8a
parent 9689 751fde5307e4
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     1
(*<*)
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     2
theory def_rewr = Main:;
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     3
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     4
(*>*)text{*\noindent Constant definitions (\S\ref{sec:ConstDefinitions}) can
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     5
be used as simplification rules, but by default they are not.  Hence the
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     6
simplifier does not expand them automatically, just as it should be:
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     7
definitions are introduced for the purpose of abbreviating complex
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     8
concepts. Of course we need to expand the definitions initially to derive
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     9
enough lemmas that characterize the concept sufficiently for us to forget the
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    10
original definition. For example, given
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    11
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    12
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    13
constdefs exor :: "bool \\<Rightarrow> bool \\<Rightarrow> bool"
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    14
         "exor A B \\<equiv> (A \\<and> \\<not>B) \\<or> (\\<not>A \\<and> B)";
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    15
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    16
text{*\noindent
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    17
we may want to prove
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    18
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    19
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    20
lemma "exor A (\\<not>A)";
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    21
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    22
txt{*\noindent
9689
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    23
Typically, the opening move consists in \emph{unfolding} the definition(s), which we need to
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    24
get started, but nothing else:\indexbold{*unfold}\indexbold{definition!unfolding}
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    25
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    26
9689
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    27
apply(simp only:exor_def);
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    28
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    29
txt{*\noindent
9689
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    30
In this particular case, the resulting goal
9723
a977245dfc8a *** empty log message ***
nipkow
parents: 9689
diff changeset
    31
\begin{isabelle}
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    32
~1.~A~{\isasymand}~{\isasymnot}~{\isasymnot}~A~{\isasymor}~{\isasymnot}~A~{\isasymand}~{\isasymnot}~A%
9723
a977245dfc8a *** empty log message ***
nipkow
parents: 9689
diff changeset
    33
\end{isabelle}
9689
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    34
can be proved by simplification. Thus we could have proved the lemma outright
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    35
*}(*<*)oops;lemma "exor A (\\<not>A)";(*>*)
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    36
by(simp add: exor_def)
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    37
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    38
text{*\noindent
9689
751fde5307e4 *** empty log message ***
nipkow
parents: 8745
diff changeset
    39
Of course we can also unfold definitions in the middle of a proof.
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    40
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    41
You should normally not turn a definition permanently into a simplification
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    42
rule because this defeats the whole purpose of an abbreviation.
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    43
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    44
(*<*)end(*>*)