src/HOL/MicroJava/BV/LBVCorrect.thy
author kleing
Thu, 06 Jul 2000 12:15:05 +0200
changeset 9260 678e718a5a86
parent 9054 0e48e7d4d4f9
child 9376 c32c5696ec2a
permissions -rw-r--r--
new ADD instruction
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     1
(*  Title:      HOL/MicroJava/BV/BVLcorrect.thy
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     2
    ID:         $Id$
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     3
    Author:     Gerwin Klein
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     4
    Copyright   1999 Technische Universitaet Muenchen
9054
0e48e7d4d4f9 minor tuning for pdf documents
kleing
parents: 9012
diff changeset
     5
*)
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     6
9054
0e48e7d4d4f9 minor tuning for pdf documents
kleing
parents: 9012
diff changeset
     7
header {* Correctness of the LBV *}
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
     8
9012
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
     9
theory LBVCorrect = LBVSpec:;
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    10
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    11
constdefs
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    12
fits_partial :: "[method_type,nat,instr list,jvm_prog,ty,state_type,state_type,certificate] \\<Rightarrow> bool" 
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    13
"fits_partial phi pc is G rT s0 s2 cert \\<equiv> (\\<forall> a b i s1. (a@(i#b) = is) \\<longrightarrow> 
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    14
                   wtl_inst_list a G rT s0 s1 cert (pc+length is) pc \\<longrightarrow> 
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    15
                   wtl_inst_list (i#b) G rT s1 s2 cert (pc+length is) (pc+length a) \\<longrightarrow> 
8390
e5b618f6824e tuned for completeness of LBV
kleing
parents: 8245
diff changeset
    16
                      ((cert!(pc+length a)      = None   \\<longrightarrow> phi!(pc+length a) = s1) \\<and> 
e5b618f6824e tuned for completeness of LBV
kleing
parents: 8245
diff changeset
    17
                       (\\<forall> t. cert!(pc+length a) = Some t \\<longrightarrow> phi!(pc+length a) = t)))"
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
    18
  
9012
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    19
fits :: "[method_type,instr list,jvm_prog,ty,state_type,state_type,certificate] \\<Rightarrow> bool"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    20
"fits phi is G rT s0 s2 cert \\<equiv> fits_partial phi 0 is G rT s0 s2 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    21
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    22
lemma fitsD: 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    23
"fits phi is G rT s0 s2 cert \\<Longrightarrow>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    24
 (a@(i#b) = is) \\<Longrightarrow>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    25
 wtl_inst_list a G rT s0 s1 cert (0+length is) 0 \\<Longrightarrow>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    26
 wtl_inst_list (i#b) G rT s1 s2 cert (0+length is) (0+length a) \\<Longrightarrow>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    27
 ((cert!(0+length a)     = None   \\<longrightarrow> phi!(0+length a) = s1) \\<and> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    28
 (\\<forall> t. cert!(0+length a) = Some t \\<longrightarrow> phi!(0+length a) = t))";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    29
by (unfold fits_def fits_partial_def) blast;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    30
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    31
lemma exists_list: "\\<exists>l. n < length l" (is "?Q n");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    32
proof (induct "n"); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    33
  fix n;  assume "?Q n";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    34
  thus "?Q (Suc n)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    35
  proof elim; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    36
    fix l; assume "n < length (l::'a list)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    37
    hence "Suc n < length (a#l)"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    38
    thus ?thesis; ..;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    39
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    40
qed auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    41
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    42
lemma exists_phi:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    43
"wtl_inst_list is G rT s0 s2 cert (length is) 0 \\<Longrightarrow> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    44
 \\<exists> phi. fits phi is G rT s0 s2 cert \\<and> length is < length phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    45
proof -;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    46
  assume all: "wtl_inst_list is G rT s0 s2 cert (length is) 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    47
  have "\\<forall> s0 pc. wtl_inst_list is G rT s0 s2 cert (pc+length is) pc 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    48
     \\<longrightarrow> (\\<exists> phi. pc + length is < length phi \\<and> fits_partial phi pc is G rT s0 s2 cert)"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    49
    (is "?P is");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    50
  proof (induct "?P" "is");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    51
    case Nil; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    52
    show "?P []"; by (simp add: fits_partial_def exists_list);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    53
    case Cons;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    54
    show "?P (a#list)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    55
    proof (intro allI impI);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    56
      fix s0 pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    57
      assume wtl: "wtl_inst_list (a # list) G rT s0 s2 cert (pc + length (a # list)) pc";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    58
      thus "\\<exists>phi. pc + length (a # list) < length phi \\<and> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    59
                  fits_partial phi pc (a # list) G rT s0 s2 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    60
        obtain s1 where 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    61
          opt: "wtl_inst_option a G rT s0 s1 cert (Suc pc + length list) pc" and
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    62
          wtlSuc: "wtl_inst_list list G rT s1 s2 cert (Suc pc + length list) (Suc pc)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    63
          by auto; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    64
        with Cons;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    65
        show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    66
          obtain phi where fits:   "fits_partial phi (Suc pc) list G rT s1 s2 cert" 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    67
                       and length: "(Suc pc) + length list < length phi"; by blast;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    68
          let "?A phi pc x s1'" = 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    69
              "(cert ! (pc + length (x::instr list)) = None \\<longrightarrow> phi ! (pc + length x) = s1') \\<and>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    70
               (\\<forall>t. cert ! (pc + length x) = Some t \\<longrightarrow> phi ! (pc + length x) = t)";          
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    71
          show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    72
          proof (cases "cert!pc");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    73
            case None;            
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    74
            have "fits_partial (phi[pc:= s0]) pc (a # list) G rT s0 s2 cert"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    75
            proof (unfold fits_partial_def, intro allI impI);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    76
              fix x i y s1'; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    77
              assume * : 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    78
                "x @ i # y = a # list"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    79
                "wtl_inst_list x G rT s0 s1' cert (pc + length (a # list)) pc"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    80
                "wtl_inst_list (i # y) G rT s1' s2 cert (pc + length (a # list)) (pc + length x)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    81
              show "?A (phi[pc:= s0]) pc x s1'"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    82
              proof (cases "x");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    83
                assume "x = []";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    84
                with * length None;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    85
                show ?thesis; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    86
              next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    87
                fix b l; assume Cons: "x = b#l";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    88
                with fits *;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    89
                have "?A (phi[pc:= s0]) (Suc pc) l s1'"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    90
                proof (unfold fits_partial_def, elim allE impE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    91
                  from * Cons;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    92
                  show "l @ i # y = list"; by simp; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    93
                  from Cons opt *; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    94
                  show "wtl_inst_list l G rT s1 s1' cert (Suc pc + length list) (Suc pc)"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    95
                    by (simp, elim) (drule wtl_inst_option_unique, assumption, simp);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    96
                qed simp+;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    97
                with Cons length;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    98
                show ?thesis; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
    99
              qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   100
            qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   101
            with length;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   102
            show ?thesis; by intro auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   103
          next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   104
            fix c; assume Some: "cert!pc = Some c";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   105
            have "fits_partial (phi[pc:= c]) pc (a # list) G rT s0 s2 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   106
            proof (unfold fits_partial_def, intro allI impI);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   107
              fix x i y s1'; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   108
              assume * : 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   109
                "x @ i # y = a # list"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   110
                "wtl_inst_list x G rT s0 s1' cert (pc + length (a # list)) pc"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   111
                "wtl_inst_list (i # y) G rT s1' s2 cert (pc + length (a # list)) (pc + length x)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   112
              show "?A (phi[pc:= c]) pc x s1'";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   113
              proof (cases "x");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   114
                assume "x = []";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   115
                with length Some;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   116
                show ?thesis; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   117
              next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   118
                fix b l; assume Cons: "x = b#l";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   119
                with fits *;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   120
                have "?A (phi[pc:= c]) (Suc pc) l s1'"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   121
                proof (unfold fits_partial_def, elim allE impE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   122
                  from * Cons;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   123
                  show "l @ i # y = list"; by simp; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   124
                  from Cons opt *; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   125
                  show "wtl_inst_list l G rT s1 s1' cert (Suc pc + length list) (Suc pc)"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   126
                    by (simp, elim) (drule wtl_inst_option_unique, assumption, simp);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   127
                qed simp+;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   128
                with Cons length;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   129
                show ?thesis; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   130
              qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   131
            qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   132
            with length;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   133
            show ?thesis; by intro auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   134
          qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   135
        qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   136
      qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   137
    qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   138
  qed;  
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   139
  with all; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   140
  show ?thesis;  
9260
678e718a5a86 new ADD instruction
kleing
parents: 9054
diff changeset
   141
  proof (elim exE allE impE conjE); 
9012
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   142
    show "wtl_inst_list is G rT s0 s2 cert (0+length is) 0"; by simp; 
9260
678e718a5a86 new ADD instruction
kleing
parents: 9054
diff changeset
   143
  qed (auto simp add: fits_def);  
9012
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   144
qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   145
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   146
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   147
lemma fits_lemma1:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   148
"\\<lbrakk>wtl_inst_list is G rT s0 s3 cert (length is) 0; fits phi is G rT s0 s3 cert\\<rbrakk> \\<Longrightarrow> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   149
  \\<forall> pc t. pc < length is \\<longrightarrow> (cert ! pc) = Some t \\<longrightarrow> (phi ! pc) = t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   150
proof intro;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   151
  fix pc t;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   152
  assume wtl:  "wtl_inst_list is G rT s0 s3 cert (length is) 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   153
  assume fits: "fits phi is G rT s0 s3 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   154
  assume pc:   "pc < length is";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   155
  assume cert: "cert ! pc = Some t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   156
  from pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   157
  have "is \\<noteq> []"; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   158
  hence cons: "\\<exists>i y. is = i#y"; by (simp add: neq_Nil_conv);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   159
  from wtl pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   160
  have "\\<exists>a b s1. a@b = is \\<and> length a = pc \\<and> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   161
                 wtl_inst_list a G rT s0 s1 cert (length is) 0 \\<and> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   162
                 wtl_inst_list b G rT s1 s3 cert (length is) (0+length a)"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   163
    (is "\\<exists>a b s1. ?A a b \\<and> ?L a \\<and> ?W1 a s1 \\<and> ?W2 a b s1");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   164
  by (rule wtl_partial [rulify]);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   165
  with cons;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   166
  show "phi ! pc = t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   167
  proof (elim exE conjE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   168
    fix a b s1 i y;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   169
    assume * :"?A a b" "?L a" "?W1 a s1" "?W2 a b s1" "is = i#y";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   170
    with pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   171
    have "b \\<noteq> []"; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   172
    hence "\\<exists>b' bs. b = b'#bs"; by (simp add: neq_Nil_conv);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   173
    thus ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   174
    proof (elim exE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   175
      fix b' bs; assume Cons: "b=b'#bs";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   176
      with * fits cert;     
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   177
      show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   178
      proof (unfold fits_def fits_partial_def, elim allE impE); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   179
        from * Cons; show "a@b'#bs=is"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   180
      qed simp+;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   181
    qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   182
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   183
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   184
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   185
lemma fits_lemma2:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   186
"\\<lbrakk>wtl_inst_list a G rT s0 s1 cert (length (a@i#b)) 0; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   187
  wtl_inst_option i G rT s1 s2 cert (length (a@i#b)) (length a); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   188
  fits phi (a@i#b) G rT s0 s3 cert; cert!(length a) = None; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   189
  wtl_inst_list b G rT s2 s3 cert (length (a@i#b)) (Suc (length a))\\<rbrakk> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   190
 \\<Longrightarrow>  phi!(length a) = s1";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   191
proof (unfold fits_def fits_partial_def, elim allE impE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   192
qed (auto simp del: split_paired_Ex);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   193
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   194
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   195
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   196
lemma wtl_suc_pc:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   197
"\\<lbrakk>wtl_inst_list a G rT s0 s1 cert (length (a@i#b)) 0; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   198
  wtl_inst_option i G rT s1 s2 cert (length (a@i#b)) (length a); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   199
  wtl_inst_list b G rT s2 s3 cert (length (a@i#b)) (Suc (length a)); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   200
  fits phi (a@i#b) G rT s0 s3 cert \\<rbrakk> \\<Longrightarrow> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   201
  b \\<noteq> [] \\<longrightarrow> G \\<turnstile> s2 <=s (phi ! (Suc (length a)))";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   202
proof;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   203
  assume f: "fits phi (a@i#b) G rT s0 s3 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   204
  assume "wtl_inst_list a G rT s0 s1 cert (length (a@i#b)) 0"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   205
         "wtl_inst_option i G rT s1 s2 cert (length (a@i#b)) (length a)"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   206
  and w: "wtl_inst_list b G rT s2 s3 cert (length (a@i#b)) (Suc (length a))";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   207
  hence a: "wtl_inst_list (a@[i]) G rT s0 s2 cert (length (a@i#b)) 0"; by (rule wtl_append);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   208
  assume "b \\<noteq> []";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   209
  thus "G \\<turnstile> s2 <=s phi ! Suc (length a)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   210
    obtain b' bs where Cons: "b = b' # bs"; by (simp add: neq_Nil_conv) (elim exE, rule that);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   211
    hence "(a@[i]) @ b' # bs = a @ i # b"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   212
    with f;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   213
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   214
    proof (rule fitsD [elimify]); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   215
      from Cons w;       
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   216
      show "wtl_inst_list (b' # bs) G rT s2 s3 cert (0 + length (a @ i # b)) (0 + length (a @ [i]))";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   217
        by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   218
      from a; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   219
      show "wtl_inst_list (a @ [i]) G rT s0 s2 cert (0 + length (a @ i # b)) 0"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   220
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   221
      assume cert:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   222
        "(cert ! (0 + length (a @ [i])) = None \\<longrightarrow> phi ! (0 + length (a @ [i])) = s2) \\<and>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   223
         (\\<forall>t. cert ! (0 + length (a @ [i])) = Some t \\<longrightarrow> phi ! (0 + length (a @ [i])) = t)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   224
      show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   225
      proof (cases "cert ! Suc (length a)");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   226
        assume "cert ! Suc (length a) = None";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   227
        with cert;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   228
        have "s2 = phi ! Suc (length a)"; by simp; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   229
        thus ?thesis; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   230
      next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   231
        fix t; assume "cert ! Suc (length a) = Some t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   232
        with cert;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   233
        have "phi ! Suc (length a) = t"; by (simp del: split_paired_All);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   234
        with cert Cons w;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   235
        show ?thesis;  by (auto simp add: wtl_inst_option_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   236
      qed;            
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   237
    qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   238
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   239
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   240
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   241
lemma wtl_lemma: 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   242
"\\<lbrakk>wtl_inst_list i1 G rT s0 s1 cert (length (i1@i#i2)) 0;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   243
  wtl_inst_option i G rT s1 s2 cert (length (i1@i#i2)) (length i1);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   244
  wtl_inst_list i2 G rT s2 s3 cert (length (i1@i#i2)) (Suc (length i1));
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   245
  fits phi (i1@i#i2) G rT s0 s3 cert\\<rbrakk> \\<Longrightarrow>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   246
  wt_instr i G rT phi (length (i1@i#i2)) (length i1)" (concl is "?P i");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   247
proof -;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   248
  assume w1: "wtl_inst_list i1 G rT s0 s1 cert (length (i1@i#i2)) 0" (is ?w1);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   249
  assume wo: "wtl_inst_option i G rT s1 s2 cert (length (i1@i#i2)) (length i1)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   250
  assume w2: "wtl_inst_list i2 G rT s2 s3 cert (length (i1@i#i2)) (Suc (length i1))";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   251
  assume f:  "fits phi (i1@i#i2) G rT s0 s3 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   252
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   253
  from w1 wo w2;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   254
  have wtl: "wtl_inst_list (i1@i#i2) G rT s0 s3 cert (length (i1@i#i2)) 0"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   255
    by (rule wtl_cons_appendl);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   256
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   257
  with f;  
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   258
  have c1: "\\<forall>t. cert ! (length i1) = Some t \\<longrightarrow> phi ! (length i1) = t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   259
    by intro (rule fits_lemma1 [rulify], auto);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   260
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   261
  from w1 wo w2 f;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   262
  have c2: "cert ! (length i1) = None \\<Longrightarrow> phi ! (length i1) = s1";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   263
    by - (rule fits_lemma2);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   264
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   265
  from wtl f;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   266
  have c3: "\\<forall>pc t. pc < length(i1@i#i2) \\<longrightarrow> cert ! pc = Some t \\<longrightarrow> phi ! pc = t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   267
    by (rule fits_lemma1);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   268
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   269
  from w1 wo w2 f;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   270
  have suc: "i2 \\<noteq> [] \\<Longrightarrow> G \\<turnstile> s2 <=s phi ! Suc (length i1)"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   271
    by (rule wtl_suc_pc [rulify]); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   272
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   273
  show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   274
  proof (cases "i");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   275
    case LS;    
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   276
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   277
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   278
     by - (cases "load_and_store", 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   279
        (cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   280
         clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   281
         clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def)+);      
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   282
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   283
    case CO;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   284
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   285
    show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   286
     by - (cases "create_object" , 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   287
           cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   288
           clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   289
           clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   290
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   291
    case MO;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   292
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   293
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   294
     by - (cases "manipulate_object" , 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   295
           (cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   296
            clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   297
            clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def)+);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   298
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   299
    case CH;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   300
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   301
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   302
     by - (cases "check_object" , cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   303
           clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   304
           clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   305
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   306
    case MI; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   307
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   308
    show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   309
     by - (cases "meth_inv", cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   310
           clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   311
           intro exI conjI, rule refl, simp, force,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   312
           clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   313
           intro exI conjI, rule refl, simp, force);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   314
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   315
    case MR;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   316
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   317
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   318
      by - (cases "meth_ret" , cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   319
            clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   320
            clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   321
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   322
    case OS;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   323
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   324
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   325
     by - (cases "op_stack" , 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   326
           (cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   327
            clarsimp_tac simp add: c2 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   328
            clarsimp_tac simp add: c1 wt_instr_def wtl_inst_option_def)+);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   329
  next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   330
    case BR;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   331
    with wo suc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   332
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   333
      by - (cases "branch", 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   334
            (cases "cert ! (length i1)",
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   335
             clarsimp_tac simp add: c2 c3 wt_instr_def wtl_inst_option_def split_beta,
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   336
             clarsimp_tac simp add: c1 c3 wt_instr_def wtl_inst_option_def)+);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   337
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   338
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   339
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   340
lemma wtl_fits_wt:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   341
"\\<lbrakk>wtl_inst_list is G rT s0 s3 cert (length is) 0; fits phi is G rT s0 s3 cert\\<rbrakk> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   342
 \\<Longrightarrow> \\<forall>pc. pc < length is \\<longrightarrow> wt_instr (is ! pc) G rT phi (length is) pc";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   343
proof intro;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   344
  assume fits: "fits phi is G rT s0 s3 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   345
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   346
  fix pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   347
  assume wtl: "wtl_inst_list is G rT s0 s3 cert (length is) 0"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   348
     and pc:  "pc < length is";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   349
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   350
  thus "wt_instr (is ! pc) G rT phi (length is) pc"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   351
    obtain i1 i2' s1 where l: "i1 @ i2' = is" "length i1 = pc" and
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   352
      w1: "wtl_inst_list i1 G rT s0 s1 cert (length is) 0" and 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   353
      w2: "wtl_inst_list i2' G rT s1 s3 cert (length is) (0 + length i1)"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   354
      by (rule wtl_partial [rulify, elimify]) (elim, rule that);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   355
    from l pc;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   356
    have "i2' \\<noteq> []"; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   357
    thus ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   358
      obtain i i2 where c: "i2' = i#i2"; by (simp add: neq_Nil_conv) (elim, rule that);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   359
      with w2 l;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   360
      show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   361
        obtain s2 where w3:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   362
          "wtl_inst_option i G rT s1 s2 cert (length (i1@i#i2)) (length i1)"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   363
          "wtl_inst_list i2 G rT s2 s3 cert (length (i1@i#i2)) (Suc (length i1))"; by auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   364
      
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   365
        from w1 l c;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   366
        have w4: "wtl_inst_list i1 G rT s0 s1 cert (length (i1 @ i # i2)) 0"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   367
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   368
        from l c fits;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   369
        have "fits phi (i1@i#i2) G rT s0 s3 cert"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   370
        with w4 w3;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   371
        have "wt_instr i G rT phi (length (i1@i#i2)) (length i1)"; by (rule wtl_lemma);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   372
        with l c;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   373
        show ?thesis; by (auto simp add: nth_append);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   374
      qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   375
    qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   376
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   377
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   378
    
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   379
lemma wtl_inst_list_correct:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   380
"wtl_inst_list is G rT s0 s2 cert (length is) 0 \\<Longrightarrow> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   381
 \\<exists> phi. \\<forall>pc. pc < length is \\<longrightarrow> wt_instr (is ! pc) G rT phi (length is) pc";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   382
proof -;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   383
  assume wtl: "wtl_inst_list is G rT s0 s2 cert (length is) 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   384
  thus ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   385
    obtain phi where "fits phi is G rT s0 s2 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   386
      by (rule exists_phi [elimify]) blast;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   387
    with wtl;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   388
    show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   389
     by (rule wtl_fits_wt [elimify]) blast;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   390
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   391
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   392
    
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   393
lemma fits_first:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   394
"\\<lbrakk>is \\<noteq> [];wtl_inst_list is G rT s0 s2 cert (length is) 0; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   395
 fits phi is G rT s0 s2 cert\\<rbrakk> \\<Longrightarrow> G \\<turnstile> s0 <=s phi ! 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   396
proof -;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   397
  assume wtl: "wtl_inst_list is G rT s0 s2 cert (length is) 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   398
  assume fits: "fits phi is G rT s0 s2 cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   399
  assume "is \\<noteq> []";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   400
  thus ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   401
    obtain y ys where cons: "is = y#ys"; by (simp add: neq_Nil_conv) (elim, rule that); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   402
    from fits;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   403
    show ?thesis; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   404
    proof (rule fitsD [elimify]);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   405
      from cons; show "[]@y#ys = is"; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   406
      from cons wtl; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   407
      show "wtl_inst_list (y#ys) G rT s0 s2 cert (0 + length is) (0 + length [])"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   408
        by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   409
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   410
      assume cert:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   411
        "(cert ! (0 + length []) = None \\<longrightarrow> phi ! (0 + length []) = s0) \\<and>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   412
         (\\<forall>t. cert ! (0 + length []) = Some t \\<longrightarrow> phi ! (0 + length []) = t)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   413
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   414
      show ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   415
      proof (cases "cert!0");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   416
        assume "cert!0 = None";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   417
        with cert;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   418
        show ?thesis; by simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   419
      next;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   420
        fix t; assume "cert!0 = Some t";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   421
        with cert; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   422
        have "phi!0 = t"; by (simp del: split_paired_All);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   423
        with cert cons wtl;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   424
        show ?thesis; by (auto simp add: wtl_inst_option_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   425
      qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   426
    qed simp;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   427
  qed; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   428
qed;
8245
6acc80f7f36f lightweight bytecode verifier with correctness proof
kleing
parents:
diff changeset
   429
  
9012
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   430
lemma wtl_method_correct:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   431
"wtl_method G C pTs rT mxl ins cert \\<Longrightarrow> \\<exists> phi. wt_method G C pTs rT mxl ins phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   432
proof (unfold wtl_method_def, simp del: split_paired_Ex, elim exE conjE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   433
  let "?s0" = "([], Some (Class C) # map Some pTs @ replicate mxl None)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   434
  fix s2;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   435
  assume neqNil: "ins \\<noteq> []";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   436
  assume wtl: "wtl_inst_list ins G rT ?s0 s2 cert (length ins) 0";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   437
  thus ?thesis;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   438
    obtain phi where fits: "fits phi ins G rT ?s0 s2 cert \\<and> length ins < length phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   439
      by (rule exists_phi [elimify]) blast; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   440
    with wtl;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   441
    have allpc:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   442
      "\\<forall>pc. pc < length ins \\<longrightarrow> wt_instr (ins ! pc) G rT phi (length ins) pc";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   443
      by elim (rule wtl_fits_wt [elimify]);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   444
    from neqNil wtl fits;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   445
    have "wt_start G C pTs mxl phi"; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   446
     by (elim conjE, unfold wt_start_def) (rule fits_first);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   447
    with neqNil allpc fits;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   448
    show ?thesis; by (auto simp add: wt_method_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   449
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   450
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   451
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   452
lemma unique_set:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   453
"(a,b,c,d)\\<in>set l \\<longrightarrow> unique l \\<longrightarrow> (a',b',c',d') \\<in> set l \\<longrightarrow> a = a' \\<longrightarrow> b=b' \\<and> c=c' \\<and> d=d'";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   454
  by (induct "l") auto;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   455
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   456
lemma unique_epsilon:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   457
"(a,b,c,d)\\<in>set l \\<longrightarrow> unique l \\<longrightarrow> (\\<epsilon> (a',b',c',d'). (a',b',c',d') \\<in> set l \\<and> a'=a) = (a,b,c,d)";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   458
  by (auto simp add: unique_set);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   459
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   460
theorem wtl_correct:
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   461
"wtl_jvm_prog G cert ==> \\<exists> Phi. wt_jvm_prog G Phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   462
proof (clarsimp_tac simp add: wt_jvm_prog_def wf_prog_def, intro conjI);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   463
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   464
  assume wtl_prog: "wtl_jvm_prog G cert";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   465
  thus "ObjectC \\<in> set G"; by (simp add: wtl_jvm_prog_def wf_prog_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   466
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   467
  from wtl_prog; 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   468
  show uniqueG: "unique G"; by (simp add: wtl_jvm_prog_def wf_prog_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   469
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   470
  show "\\<exists>Phi. Ball (set G) (wf_cdecl (\\<lambda>G C (sig,rT,maxl,b). wt_method G C (snd sig) rT maxl b (Phi C sig)) G)"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   471
    (is "\\<exists>Phi. ?Q Phi");
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   472
  proof (intro exI);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   473
    let "?Phi" = 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   474
        "\\<lambda> C sig. let (C,x,y,mdecls) = \\<epsilon> (Cl,x,y,mdecls). (Cl,x,y,mdecls) \\<in> set G \\<and> Cl = C in
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   475
                   let (sig,rT,maxl,b) = \\<epsilon> (sg,rT,maxl,b). (sg,rT,maxl,b) \\<in> set mdecls \\<and> sg = sig in\
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   476
                     \\<epsilon> phi. wt_method G C (snd sig) rT maxl b phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   477
    from wtl_prog;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   478
    show "?Q ?Phi";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   479
    proof (unfold wf_cdecl_def, intro);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   480
      fix x a b aa ba ab bb m;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   481
      assume 1: "x \\<in> set G" "x = (a, b)" "b = (aa, ba)" "ba = (ab, bb)" "m \\<in> set bb";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   482
      with wtl_prog;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   483
      show "wf_mdecl (\\<lambda>G C (sig,rT,maxl,b). wt_method G C (snd sig) rT maxl b (?Phi C sig)) G a m";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   484
      proof (simp add: wf_mdecl_def wtl_jvm_prog_def wf_prog_def wf_cdecl_def, elim conjE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   485
        apply_end (drule bspec, assumption, simp, elim conjE);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   486
        assume "\\<forall>(sig,rT,mb)\\<in>set bb. wf_mhead G sig rT \\<and> 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   487
                 (\\<lambda>(maxl,b). wtl_method G a (snd sig) rT maxl b (cert a sig)) mb"
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   488
               "unique bb";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   489
        with 1 uniqueG;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   490
        show "(\\<lambda>(sig,rT,mb).
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   491
          wf_mhead G sig rT \\<and>
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   492
          (\\<lambda>(maxl,b).
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   493
              wt_method G a (snd sig) rT maxl b 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   494
               ((\\<lambda>(C,x,y,mdecls).
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   495
                    (\\<lambda>(sig,rT,maxl,b). Eps (wt_method G C (snd sig) rT maxl b))
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   496
                     (\\<epsilon>(sg,rT,maxl,b). (sg, rT, maxl, b) \\<in> set mdecls \\<and> sg = sig))
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   497
                 (\\<epsilon>(Cl,x,y,mdecls). (Cl, x, y, mdecls) \\<in> set G \\<and> Cl = a))) mb) m";
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   498
          by - (drule bspec, assumption, 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   499
                clarsimp_tac elim: wtl_method_correct [elimify],
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   500
                clarsimp_tac intro: selectI simp add: unique_epsilon); 
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   501
      qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   502
    qed (auto simp add: wtl_jvm_prog_def wf_prog_def wf_cdecl_def);
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   503
  qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   504
qed;
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   505
    
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   506
d1bd2144ab5d switched to Isar proofs
kleing
parents: 8390
diff changeset
   507
end;