src/HOL/BCV/DFAandWTI.ML
author wenzelm
Mon, 28 Aug 2000 14:09:33 +0200
changeset 9697 c5fc121c2067
parent 7961 422ac6888c7f
permissions -rw-r--r--
restart_loader: reset_path;
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";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    11
by (Asm_simp_tac 1);
7626
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))";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    18
by (Asm_simp_tac 1);
7626
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)";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    25
by (dtac is_dfaD 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    26
by (assume_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    27
by (Asm_full_simp_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    28
by (blast_tac (claset() addDs [wti_is_fix_stepD]) 1);
7626
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";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    33
by (induct_tac "n" 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    34
by (Simp_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    35
by (asm_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
7626
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))";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    40
by (induct_tac "n" 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    41
 by (Force_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    42
by (asm_full_simp_tac (simpset() addsimps [Cons_le_iff,length_Suc_conv]) 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    43
by (Force_tac 1);
7626
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)";
7961
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    52
by (subgoal_tac "? m. n = m+1" 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    53
 by (res_inst_tac [("x","n-1")] exI 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    54
 by (arith_tac 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    55
by (Clarify_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    56
by (Asm_full_simp_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    57
by (dtac dfa_iff_welltyping 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    58
  by (assume_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    59
 by (etac trans 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    60
 by (asm_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    61
by (asm_full_simp_tac (simpset() addsimps [Cons_le_iff]) 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    62
by (rtac iffI 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    63
 by (Clarify_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    64
 by (rtac bexI 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    65
  by (rtac conjI 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    66
   by (assume_tac 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    67
  by (assume_tac 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    68
 by (Asm_simp_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    69
by (Clarify_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    70
by (asm_full_simp_tac (simpset() addsimps [in_listsn_Suc_iff,Bex_def]) 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    71
by (Clarify_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    72
by (asm_full_simp_tac (simpset() addsimps []) 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    73
by (rtac exI 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    74
by (rtac conjI 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    75
 by (rtac conjI 2);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    76
  by (assume_tac 3);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    77
 by (Blast_tac 1);
422ac6888c7f expandshort
paulson
parents: 7626
diff changeset
    78
by (Force_tac 1);
7626
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    79
qed "dfa_iff_welltyping0";