src/ZF/IMP/Equiv.thy
author paulson
Fri, 28 Dec 2001 10:11:14 +0100
changeset 12606 cf1715a5f5ec
parent 1478 2b8c2a7547ab
child 12610 8b9845807f77
permissions -rw-r--r--
conversion to Isar/ZF
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 511
diff changeset
     1
(*  Title:      ZF/IMP/Equiv.thy
482
3a4e092ba69c Initial revision
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 511
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
12606
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
     7
theory Equiv = Denotation + Com:
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
     8
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
     9
lemma aexp_iff [rule_format]:
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    10
     "[| a \<in> aexp; sigma: loc -> nat |] 
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    11
      ==> ALL n. <a,sigma> -a-> n <-> A(a,sigma) = n"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    12
apply (erule aexp.induct) 
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    13
apply (force intro!: evala.intros)+
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    14
done
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    15
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    16
declare aexp_iff [THEN iffD1, simp]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    17
        aexp_iff [THEN iffD2, intro!]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    18
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    19
inductive_cases [elim!]: "<true,sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    20
inductive_cases [elim!]: "<false,sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    21
inductive_cases [elim!]: "<ROp(f,a0,a1),sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    22
inductive_cases [elim!]: "<noti(b),sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    23
inductive_cases [elim!]: "<b0 andi b1,sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    24
inductive_cases [elim!]: "<b0 ori b1,sigma> -b-> x"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    25
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    26
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    27
lemma bexp_iff [rule_format]:
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    28
     "[| b \<in> bexp; sigma: loc -> nat |] 
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    29
      ==> ALL w. <b,sigma> -b-> w <-> B(b,sigma) = w"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    30
apply (erule bexp.induct) 
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    31
apply (auto intro!: evalb.intros)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    32
done
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    33
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    34
declare bexp_iff [THEN iffD1, simp]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    35
        bexp_iff [THEN iffD2, intro!]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    36
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    37
lemma com1: "<c,sigma> -c-> sigma' ==> <sigma,sigma'> \<in> C(c)"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    38
apply (erule evalc.induct)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    39
apply simp_all
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    40
(* skip *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    41
apply fast
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    42
(* assign *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    43
apply (simp add: update_type)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    44
(* comp *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    45
apply fast
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    46
(* while *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    47
apply (erule Gamma_bnd_mono [THEN lfp_unfold, THEN ssubst, OF C_subset])
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    48
apply (simp add: Gamma_def)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    49
apply (force ) 
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    50
(* recursive case of while *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    51
apply (erule Gamma_bnd_mono [THEN lfp_unfold, THEN ssubst, OF C_subset])
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    52
apply (simp add: Gamma_def)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    53
apply auto
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    54
done
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    55
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    56
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    57
declare B_type [intro!] A_type [intro!]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    58
declare evalc.intros [intro]
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    59
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    60
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    61
lemma com2 [rule_format]: "c \<in> com ==> \<forall>x \<in> C(c). <c,fst(x)> -c-> snd(x)"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    62
apply (erule com.induct)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    63
(* skip *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    64
apply force
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    65
(* assign *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    66
apply force
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    67
(* comp *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    68
apply force
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    69
(* while *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    70
apply safe
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    71
apply simp_all
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    72
apply (frule Gamma_bnd_mono [OF C_subset], erule Fixedpt.induct, assumption)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    73
apply (unfold Gamma_def)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    74
apply force
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    75
(* if *)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    76
apply auto
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    77
done
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    78
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    79
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    80
(**** Proof of Equivalence ****)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    81
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    82
lemma com_equivalence:
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    83
     "\<forall>c \<in> com. C(c) = {io:(loc->nat)*(loc->nat). <c,fst(io)> -c-> snd(io)}"
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    84
by (force intro: C_subset [THEN subsetD] elim: com2 dest: com1)
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    85
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    86
end
cf1715a5f5ec conversion to Isar/ZF
paulson
parents: 1478
diff changeset
    87