src/HOL/IMP/Expr.ML
author wenzelm
Thu, 15 Nov 2001 18:20:13 +0100
changeset 12207 4dff931b852f
parent 6141 a6922171b396
permissions -rw-r--r--
added Induct/Binary_Trees.thy, Induct/Tree_Forest (converted from former ex/TF.ML ex/TF.thy ex/Term.ML ex/Term.thy);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/IMP/Expr.ML
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     3
    Author:     Heiko Loetzbeyer & Robert Sandner & Tobias Nipkow, TUM
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     4
    Copyright   1994 TUM
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     5
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     6
Arithmetic expressions and Boolean expressions.
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     7
Not used in the rest of the language, but included for completeness.
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     8
*)
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
     9
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    10
val evala_elim_cases = 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    11
    map evala.mk_cases
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    12
       ["(N(n),sigma) -a-> i", 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    13
	"(X(x),sigma) -a-> i",
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    14
	"(Op1 f e,sigma) -a-> i", 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    15
	"(Op2 f a1 a2,sigma)  -a-> i"];
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    16
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    17
val evalb_elim_cases = 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    18
    map evalb.mk_cases
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    19
       ["(true,sigma) -b-> x", 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    20
	"(false,sigma) -b-> x",
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    21
	"(ROp f a0 a1,sigma) -b-> x", 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    22
	"(noti(b),sigma) -b-> x",
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    23
	"(b0 andi b1,sigma) -b-> x", 
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5535
diff changeset
    24
	"(b0 ori b1,sigma) -b-> x"];
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    25
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    26
val evalb_simps = map (fn s => prove_goal Expr.thy s
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    27
    (fn _ => [fast_tac (HOL_cs addSIs evalb.intrs addSEs evalb_elim_cases) 1]))
1729
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    28
  ["((true,sigma) -b-> w) = (w=True)",
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    29
   "((false,sigma) -b-> w) = (w=False)",
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    30
   "((ROp f a0 a1,sigma) -b-> w) = \
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    31
\   (? m. (a0,sigma) -a-> m & (? n. (a1,sigma) -a-> n & w = f m n))",
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    32
   "((noti(b),sigma) -b-> w) = (? x. (b,sigma) -b-> x & w = (~x))",
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    33
   "((b0 andi b1,sigma) -b-> w) = \
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    34
\   (? x. (b0,sigma) -b-> x & (? y. (b1,sigma) -b-> y & w = (x&y)))",
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    35
   "((b0 ori b1,sigma) -b-> w) = \
e4f8682eea2e Removal of special syntax for -a-> and -b->
paulson
parents: 1697
diff changeset
    36
\   (? x. (b0,sigma) -b-> x & (? y. (b1,sigma) -b-> y & w = (x|y)))"];
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    37
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4303
diff changeset
    38
Goal "!n. ((a,s) -a-> n) = (A a s = n)";
5183
89f162de39cf Adapted to new datatype package.
berghofe
parents: 5069
diff changeset
    39
by (induct_tac "a" 1);
5535
678999604ee9 deleted needless parentheses
paulson
parents: 5223
diff changeset
    40
by (auto_tac (claset() addSIs evala.intrs addSEs evala_elim_cases,
678999604ee9 deleted needless parentheses
paulson
parents: 5223
diff changeset
    41
	      simpset()));
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    42
qed_spec_mp "aexp_iff";
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    43
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4303
diff changeset
    44
Goal "!w. ((b,s) -b-> w) = (B b s = w)";
5183
89f162de39cf Adapted to new datatype package.
berghofe
parents: 5069
diff changeset
    45
by (induct_tac "b" 1);
5535
678999604ee9 deleted needless parentheses
paulson
parents: 5223
diff changeset
    46
by (auto_tac (claset(), 
678999604ee9 deleted needless parentheses
paulson
parents: 5223
diff changeset
    47
	      simpset() addsimps aexp_iff::evalb_simps));
1697
687f0710c22d Arithemtic and boolean expressions are now in a separate theory.
nipkow
parents:
diff changeset
    48
qed_spec_mp "bexp_iff";