src/HOL/BCV/DFAandWTI.ML
author nipkow
Tue, 28 Sep 1999 16:36:12 +0200
changeset 7626 5997f35954d7
child 7961 422ac6888c7f
permissions -rw-r--r--
A new theory: a model of bytecode verification.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7626
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/BCV/DFAandWTI.ML
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     4
    Copyright   1999 TUM
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     5
*)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     6
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     7
Goalw [wti_is_fix_step_def]
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     8
 "[| wti_is_fix_step step wti succs n L; \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     9
\    sos : listsn n (option L); p < n |] ==> \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    10
\ wti p sos = stable step succs p sos";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    11
by(Asm_simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    12
qed "wti_is_fix_stepD";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    13
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    14
Goalw [is_dfa_def]
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    15
 "[| is_dfa dfa step succs n L; sos : listsn n (option L) |] ==> \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    16
\ dfa sos = (? tos : listsn (size sos) (option L). \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    17
\             sos <= tos & (!p < size tos. stable step succs p tos))";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    18
by(Asm_simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    19
qed "is_dfaD";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    20
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    21
Goalw [welltyping_def]
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    22
 "[| wti_is_fix_step step wti succs n L; is_dfa dfa step succs n L; \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    23
\    sos : listsn n (option L) |] ==> \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    24
\ dfa sos = (? tos : listsn n (option L). sos <= tos & welltyping wti tos)";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    25
bd is_dfaD 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    26
ba 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    27
by(Asm_full_simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    28
by(blast_tac (claset() addDs [wti_is_fix_stepD]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    29
qed "dfa_iff_welltyping";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    30
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    31
Goal
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    32
 "x:M ==> replicate n x : listsn n M";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    33
by(induct_tac "n" 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    34
by(Simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    35
by(asm_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    36
qed "replicate_in_listsn";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    37
Addsimps [replicate_in_listsn];
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    38
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    39
Goal "!ys. replicate n x <= ys = (length ys = n & (!y:set ys. x <= y))";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    40
by(induct_tac "n" 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    41
 by(Force_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    42
by(asm_full_simp_tac (simpset() addsimps [Cons_le_iff,length_Suc_conv]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    43
by(Force_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    44
qed_spec_mp "replicate_le_conv";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    45
AddIffs [replicate_le_conv];
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    46
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    47
Goal
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    48
 "[| wti_is_fix_step step wti succs n L; is_dfa dfa step succs n L; \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    49
\    0 < n; init : (option L) |] ==> \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    50
\ dfa (init # replicate (n-1) None) = \
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    51
\ (? tos : listsn n (option L). init <= tos!0 & welltyping wti tos)";
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    52
by(subgoal_tac "? m. n = m+1" 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    53
 by(res_inst_tac [("x","n-1")] exI 2);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    54
 by(arith_tac 2);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    55
by(Clarify_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    56
by(Asm_full_simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    57
bd dfa_iff_welltyping 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    58
  ba 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    59
 be trans 2;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    60
 by(asm_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    61
by(asm_full_simp_tac (simpset() addsimps [Cons_le_iff]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    62
br iffI 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    63
 by(Clarify_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    64
 br bexI 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    65
  br conjI 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    66
   ba 2;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    67
  ba 2;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    68
 by(Asm_simp_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    69
by(Clarify_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    70
by(asm_full_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    71
by(Clarify_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    72
by(asm_full_simp_tac (simpset() addsimps []) 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    73
br exI 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    74
br conjI 1;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    75
 br conjI 2;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    76
  ba 3;
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    77
 by(Blast_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    78
by(Force_tac 1);
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    79
qed "dfa_iff_welltyping0";