src/ZF/IMP/Equiv.ML
author paulson
Mon, 28 Dec 1998 16:54:53 +0100
changeset 6047 f2e0938ba38d
parent 5268 59ef39008514
child 6141 a6922171b396
permissions -rw-r--r--
converted to use new primrec section and update operator
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 808
diff changeset
     1
(*  Title:      ZF/IMP/Equiv.ML
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 808
diff changeset
     3
    Author:     Heiko Loetzbeyer & Robert Sandner, TUM
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
     4
    Copyright   1994 TUM
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
     5
*)
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
     6
5268
59ef39008514 even more tidying of Goal commands
paulson
parents: 5137
diff changeset
     7
Goal "[| a: aexp; sigma: loc -> nat |] ==> \
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
     8
\        <a,sigma> -a-> n <-> A(a,sigma) = n";
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
     9
by (res_inst_tac [("x","n")] spec 1);                       (* quantify n *)
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    10
by (etac aexp.induct 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    11
by (ALLGOALS (fast_tac (claset() addSIs evala.intrs
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    12
                                 addSEs aexp_elim_cases 
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    13
                                 addss (simpset()))));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 672
diff changeset
    14
qed "aexp_iff";
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    15
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    16
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    17
val aexp1 = aexp_iff RS iffD1;
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    18
val aexp2 = aexp_iff RS iffD2;
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    19
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    20
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    21
val bexp_elim_cases = 
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    22
   [
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    23
    evalb.mk_cases bexp.con_defs "<true,sigma> -b-> x",
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    24
    evalb.mk_cases bexp.con_defs "<false,sigma> -b-> x",
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    25
    evalb.mk_cases bexp.con_defs "<ROp(f,a0,a1),sigma> -b-> x",
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    26
    evalb.mk_cases bexp.con_defs "<noti(b),sigma> -b-> x",
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    27
    evalb.mk_cases bexp.con_defs "<b0 andi b1,sigma> -b-> x",
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    28
    evalb.mk_cases bexp.con_defs "<b0 ori b1,sigma> -b-> x"
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    29
   ];
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    30
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    31
5268
59ef39008514 even more tidying of Goal commands
paulson
parents: 5137
diff changeset
    32
Goal "[| b: bexp; sigma: loc -> nat |] ==> \
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    33
\        <b,sigma> -b-> w <-> B(b,sigma) = w";
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    34
by (res_inst_tac [("x","w")] spec 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    35
by (etac bexp.induct 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    36
by (ALLGOALS (fast_tac (claset() addSIs evalb.intrs
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    37
                                 addSEs bexp_elim_cases 
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    38
                                 addss (simpset() addsimps [aexp_iff]))));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 672
diff changeset
    39
qed "bexp_iff";
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    40
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    41
val bexp1 = bexp_iff RS iffD1;
518
4530c45370b4 Proof beautification
nipkow
parents: 511
diff changeset
    42
val bexp2 = bexp_iff RS iffD2;
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    43
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    44
5137
60205b0de9b9 Huge tidy-up: removal of leading \!\!
paulson
parents: 5068
diff changeset
    45
Goal "<c,sigma> -c-> sigma' ==> <sigma,sigma'> : C(c)";
1742
328fb06a1648 Updated for new form of induction rules
paulson
parents: 1461
diff changeset
    46
by (etac evalc.induct 1);
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    47
by (ALLGOALS (asm_simp_tac (simpset() addsimps [bexp1])));
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    48
(* skip *)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1742
diff changeset
    49
by (Fast_tac 1);
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    50
(* assign *)
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    51
by (asm_full_simp_tac (simpset() addsimps 
6047
f2e0938ba38d converted to use new primrec section and update operator
paulson
parents: 5268
diff changeset
    52
		       [aexp1, update_type] @ op_type_intrs) 1);
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    53
(* comp *)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1742
diff changeset
    54
by (Fast_tac 1);
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    55
(* while *)
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    56
by (etac (Gamma_bnd_mono RS lfp_Tarski RS ssubst) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    57
by (asm_simp_tac (simpset() addsimps [Gamma_def, bexp1]) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    58
by (blast_tac (claset() addSIs [bexp1]@evalb_type_intrs) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    59
(* recursive case of while *)
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    60
by (etac (Gamma_bnd_mono RS lfp_Tarski RS ssubst) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    61
by (asm_full_simp_tac (simpset() addsimps [Gamma_def, bexp1]) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    62
by (blast_tac (claset() addSIs [bexp1]@evalb_type_intrs) 1);
500
0842a38074e7 some small simplifications
nipkow
parents: 482
diff changeset
    63
val com1 = result();
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    64
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    65
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1742
diff changeset
    66
AddSIs [aexp2,bexp2,B_type,A_type];
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    67
AddIs  evalc.intrs;
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    68
AddEs  [C_type,C_type_fst];
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    69
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    70
5137
60205b0de9b9 Huge tidy-up: removal of leading \!\!
paulson
parents: 5068
diff changeset
    71
Goal "c : com ==> ALL x:C(c). <c,fst(x)> -c-> snd(x)";
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    72
by (etac com.induct 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    73
(* skip *)
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    74
by (fast_tac (claset() addss (simpset())) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    75
(* assign *)
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    76
by (fast_tac (claset() addss (simpset())) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    77
(* comp *)
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    78
by (best_tac (claset() addss (simpset())) 1);
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    79
(* while *)
4152
451104c223e2 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4091
diff changeset
    80
by Safe_tac;
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1742
diff changeset
    81
by (ALLGOALS Asm_full_simp_tac);
518
4530c45370b4 Proof beautification
nipkow
parents: 511
diff changeset
    82
by (EVERY1 [forward_tac [Gamma_bnd_mono], etac induct, atac]);
808
c51c1f59e59e ran expandshort script
lcp
parents: 760
diff changeset
    83
by (rewtac Gamma_def);  
4152
451104c223e2 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4091
diff changeset
    84
by Safe_tac;
518
4530c45370b4 Proof beautification
nipkow
parents: 511
diff changeset
    85
by (EVERY1 [dtac bspec, atac]);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1742
diff changeset
    86
by (ALLGOALS Asm_full_simp_tac);
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    87
(* while, if *)
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    88
by (ALLGOALS Blast_tac);
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    89
val com2 = result();
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    90
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    91
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    92
(**** Proof of Equivalence ****)
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
    93
5268
59ef39008514 even more tidying of Goal commands
paulson
parents: 5137
diff changeset
    94
Goal "ALL c:com. C(c) = {io:(loc->nat)*(loc->nat). <c,fst(io)> -c-> snd(io)}";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2496
diff changeset
    95
by (fast_tac (claset() addIs [C_subset RS subsetD]
4298
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    96
		       addEs [com2 RS bspec]
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    97
		       addDs [com1]
b69eedd3aa6c Tidying and modification to cope with iffCE
paulson
parents: 4152
diff changeset
    98
		       addss (simpset())) 1);
511
b2be4790da7a re-organized using new theory sections
lcp
parents: 510
diff changeset
    99
val com_equivalence = result();