doc-src/TutorialI/Misc/asm_simp.thy
author nipkow
Sun, 06 Aug 2000 15:26:53 +0200
changeset 9541 d17c0b34d5c8
parent 9494 44fefb6e9994
child 9792 bbefb6ce5cb2
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 asm_simp = 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{*
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     5
By default, assumptions are part of the simplification process: they are used
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     6
as simplification rules and are simplified themselves. For example:
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     7
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     8
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     9
lemma "\\<lbrakk> xs @ zs = ys @ xs; [] @ xs = [] @ [] \\<rbrakk> \\<Longrightarrow> ys = zs";
9458
c613cd06d5cf apply. -> by
nipkow
parents: 8823
diff changeset
    10
by simp;
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
text{*\noindent
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 9494
diff changeset
    13
The second assumption simplifies to @{term"xs = []"}, which in turn
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 9494
diff changeset
    14
simplifies the first assumption to @{term"zs = ys"}, thus reducing the
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 9494
diff changeset
    15
conclusion to @{term"ys = ys"} and hence to \isa{True}.
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    16
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    17
In some cases this may be too much of a good thing and may lead to
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    18
nontermination:
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    19
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    20
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    21
lemma "\\<forall>x. f x = g (f (g x)) \\<Longrightarrow> f [] = f [] @ []";
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    22
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    23
txt{*\noindent
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    24
cannot be solved by an unmodified application of \isa{simp} because the
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 9494
diff changeset
    25
simplification rule @{term"f x = g (f (g x))"} extracted from the assumption
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    26
does not terminate. Isabelle notices certain simple forms of
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    27
nontermination but not this one. The problem can be circumvented by
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    28
explicitly telling the simplifier to ignore the assumptions:
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    29
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    30
9458
c613cd06d5cf apply. -> by
nipkow
parents: 8823
diff changeset
    31
by(simp (no_asm));
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    32
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    33
text{*\noindent
8823
bd8f8dbda512 updated syntax of simp options: (no_asm) etc.;
wenzelm
parents: 8745
diff changeset
    34
There are three options that influence the treatment of assumptions:
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    35
\begin{description}
9494
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    36
\item[\isa{(no_asm)}]\indexbold{*no_asm}
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    37
 means that assumptions are completely ignored.
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    38
\item[\isa{(no_asm_simp)}]\indexbold{*no_asm_simp}
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    39
 means that the assumptions are not simplified but
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    40
  are used in the simplification of the conclusion.
9494
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    41
\item[\isa{(no_asm_use)}]\indexbold{*no_asm_use}
44fefb6e9994 *** empty log message ***
nipkow
parents: 9458
diff changeset
    42
 means that the assumptions are simplified but are not
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    43
  used in the simplification of each other or the conclusion.
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    44
\end{description}
8823
bd8f8dbda512 updated syntax of simp options: (no_asm) etc.;
wenzelm
parents: 8745
diff changeset
    45
Neither \isa{(no_asm_simp)} nor \isa{(no_asm_use)} allow to simplify the above
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    46
problematic subgoal.
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    47
8823
bd8f8dbda512 updated syntax of simp options: (no_asm) etc.;
wenzelm
parents: 8745
diff changeset
    48
Note that only one of the above options is allowed, and it must precede all
bd8f8dbda512 updated syntax of simp options: (no_asm) etc.;
wenzelm
parents: 8745
diff changeset
    49
other arguments.
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    50
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    51
(*<*)end(*>*)