src/HOL/BCV/Machine.ML
changeset 7961 422ac6888c7f
parent 7626 5997f35954d7
child 8423 3c19160b6432
equal deleted inserted replaced
7960:d5c91c131070 7961:422ac6888c7f
    10 
    10 
    11 
    11 
    12 (*** Machine specific ***)
    12 (*** Machine specific ***)
    13 
    13 
    14 Goal "!p. p<size(bs) --> maxreg(bs!p) < maxregs(bs)";
    14 Goal "!p. p<size(bs) --> maxreg(bs!p) < maxregs(bs)";
    15 by(induct_tac "bs" 1);
    15 by (induct_tac "bs" 1);
    16 by(auto_tac (claset(), simpset() addsimps [nth_Cons,less_max_iff_disj]
    16 by (auto_tac (claset(), simpset() addsimps [nth_Cons,less_max_iff_disj]
    17                                  addsplits [nat.split]));
    17                                  addsplits [nat.split]));
    18 qed_spec_mp "maxreg_less_maxregs";
    18 qed_spec_mp "maxreg_less_maxregs";
    19 
    19 
    20 Goalw [le_typ] "(t <= Ctyp) = (t = Ctyp)";
    20 Goalw [le_typ] "(t <= Ctyp) = (t = Ctyp)";
    21 by(Simp_tac 1);
    21 by (Simp_tac 1);
    22 qed "le_Ctyp_conv";
    22 qed "le_Ctyp_conv";
    23 
    23 
    24 Goalw [le_typ] "(t ~= Top) = (t = Atyp | t = Btyp | t = Ctyp)";
    24 Goalw [le_typ] "(t ~= Top) = (t = Atyp | t = Btyp | t = Ctyp)";
    25 by(induct_tac "t" 1);
    25 by (induct_tac "t" 1);
    26 by(ALLGOALS Simp_tac);
    26 by (ALLGOALS Simp_tac);
    27 qed "le_Top_conv";
    27 qed "le_Top_conv";
    28 
    28 
    29 Goalw [step_pres_type_def,listsn_def,exec_def,stype_def]
    29 Goalw [step_pres_type_def,listsn_def,exec_def,stype_def]
    30  "step_pres_type (%p. exec (bs!p)) (length bs) (stype bs)";
    30  "step_pres_type (%p. exec (bs!p)) (length bs) (stype bs)";
    31 by(force_tac (claset(), simpset() addsplits [instr.split_asm,split_if_asm]) 1);
    31 by (force_tac (claset(), simpset() addsplits [instr.split_asm,split_if_asm]) 1);
    32 qed "exec_pres_type";
    32 qed "exec_pres_type";
    33 
    33 
    34 Goalw [wti_is_fix_step_def,stable_def,wt_instr_def,exec_def,succs_def]
    34 Goalw [wti_is_fix_step_def,stable_def,wt_instr_def,exec_def,succs_def]
    35  "wti_is_fix_step (%p. exec (bs!p)) (%u. wt_instr (bs ! u) u) \
    35  "wti_is_fix_step (%p. exec (bs!p)) (%u. wt_instr (bs ! u) u) \
    36 \     (%p. succs (bs ! p) p) (length bs) (stype bs)";
    36 \     (%p. succs (bs ! p) p) (length bs) (stype bs)";
    37 by(force_tac (claset() addDs [maxreg_less_maxregs,
    37 by (force_tac (claset() addDs [maxreg_less_maxregs,
    38                               le_Top_conv RS iffD1,le_Ctyp_conv RS iffD1],
    38                               le_Top_conv RS iffD1,le_Ctyp_conv RS iffD1],
    39               simpset() addsplits [option.split,instr.split]) 1);
    39               simpset() addsplits [option.split,instr.split]) 1);
    40 qed "wt_instr_is_fix_exec";
    40 qed "wt_instr_is_fix_exec";
    41 
    41 
    42 
    42 
    43 Goalw [step_mono_None_def,exec_def,succs_def,le_list]
    43 Goalw [step_mono_None_def,exec_def,succs_def,le_list]
    44  "step_mono_None (%p. exec (bs!p)) (length bs) (stype bs)";
    44  "step_mono_None (%p. exec (bs!p)) (length bs) (stype bs)";
    45 by(Clarify_tac 1);
    45 by (Clarify_tac 1);
    46 by(forward_tac [maxreg_less_maxregs] 1);
    46 by (ftac maxreg_less_maxregs 1);
    47 by(split_asm_tac [instr.split_asm] 1);
    47 by (split_asm_tac [instr.split_asm] 1);
    48 
    48 
    49 by(ALLGOALS (asm_full_simp_tac (simpset() addsplits [split_if_asm])));
    49 by (ALLGOALS (asm_full_simp_tac (simpset() addsplits [split_if_asm])));
    50 
    50 
    51 by(rotate_tac 1 1);
    51 by (rotate_tac 1 1);
    52 by(Asm_full_simp_tac 1);
    52 by (Asm_full_simp_tac 1);
    53 by(blast_tac (claset() addIs [order_trans]) 1);
    53 by (blast_tac (claset() addIs [order_trans]) 1);
    54 
    54 
    55 by(rotate_tac 1 1);
    55 by (rotate_tac 1 1);
    56 by(Asm_full_simp_tac 1);
    56 by (Asm_full_simp_tac 1);
    57 by(blast_tac (claset() addIs [order_trans]) 1);
    57 by (blast_tac (claset() addIs [order_trans]) 1);
    58 
    58 
    59 by(rotate_tac 1 1);
    59 by (rotate_tac 1 1);
    60 by(Asm_full_simp_tac 1);
    60 by (Asm_full_simp_tac 1);
    61 by(blast_tac (claset() addIs [order_trans]) 1);
    61 by (blast_tac (claset() addIs [order_trans]) 1);
    62 
    62 
    63 by(rotate_tac 1 1);
    63 by (rotate_tac 1 1);
    64 by(Asm_full_simp_tac 1);
    64 by (Asm_full_simp_tac 1);
    65 by(subgoal_tac "s!nat1 <= t!nat1" 1);
    65 by (subgoal_tac "s!nat1 <= t!nat1" 1);
    66 by(Blast_tac 2);
    66 by (Blast_tac 2);
    67 by(subgoal_tac "s!nat2 <= t!nat2" 1);
    67 by (subgoal_tac "s!nat2 <= t!nat2" 1);
    68 by(Blast_tac 2);
    68 by (Blast_tac 2);
    69 be thin_rl 1;
    69 by (etac thin_rl 1);
    70 by(asm_full_simp_tac (simpset() addsimps [le_typ])1);
    70 by (asm_full_simp_tac (simpset() addsimps [le_typ])1);
    71 by(exhaust_tac "t!nat1" 1);
    71 by (exhaust_tac "t!nat1" 1);
    72 by(ALLGOALS Asm_full_simp_tac);
    72 by (ALLGOALS Asm_full_simp_tac);
    73 by(exhaust_tac "t!nat2" 1);
    73 by (exhaust_tac "t!nat2" 1);
    74 by(ALLGOALS Asm_full_simp_tac);
    74 by (ALLGOALS Asm_full_simp_tac);
    75 by(exhaust_tac "t!nat2" 1);
    75 by (exhaust_tac "t!nat2" 1);
    76 by(ALLGOALS Asm_full_simp_tac);
    76 by (ALLGOALS Asm_full_simp_tac);
    77 by(exhaust_tac "s!nat1" 1);
    77 by (exhaust_tac "s!nat1" 1);
    78 by(ALLGOALS Asm_full_simp_tac);
    78 by (ALLGOALS Asm_full_simp_tac);
    79 by(exhaust_tac "t!nat2" 1);
    79 by (exhaust_tac "t!nat2" 1);
    80 by(ALLGOALS Asm_full_simp_tac);
    80 by (ALLGOALS Asm_full_simp_tac);
    81 
    81 
    82 qed "exec_mono_None";
    82 qed "exec_mono_None";
    83 
    83 
    84 Goalw [step_mono_def,exec_def,succs_def]
    84 Goalw [step_mono_def,exec_def,succs_def]
    85  "step_mono (%p. exec (bs!p)) (length bs) (stype bs)";
    85  "step_mono (%p. exec (bs!p)) (length bs) (stype bs)";
    86 by(Clarify_tac 1);
    86 by (Clarify_tac 1);
    87 by(forward_tac [maxreg_less_maxregs] 1);
    87 by (ftac maxreg_less_maxregs 1);
    88 by(split_asm_tac [instr.split_asm] 1);
    88 by (split_asm_tac [instr.split_asm] 1);
    89 by(ALLGOALS
    89 by (ALLGOALS
    90    (fast_tac (claset() addIs [list_update_le_cong,le_listD]
    90    (fast_tac (claset() addIs [list_update_le_cong,le_listD]
    91                addss (simpset() addsplits [split_if_asm]))));
    91                addss (simpset() addsplits [split_if_asm]))));
    92 
    92 
    93 qed_spec_mp "exec_mono_Some";
    93 qed_spec_mp "exec_mono_Some";
    94 
    94 
    95 Goalw [stype_def] "semilat(stype bs)";
    95 Goalw [stype_def] "semilat(stype bs)";
    96 by(Blast_tac 1);
    96 by (Blast_tac 1);
    97 qed "lat_stype";
    97 qed "lat_stype";
    98 
    98 
    99 Goalw [stype_def] "acc(stype bs)";
    99 Goalw [stype_def] "acc(stype bs)";
   100 by(Simp_tac 1);
   100 by (Simp_tac 1);
   101 qed "acc_stype";
   101 qed "acc_stype";
   102 
   102 
   103 Delsimps [stype_def];
   103 Delsimps [stype_def];
   104 
   104 
   105 Goal
   105 Goal
   107 \    succs_bounded (%p. succs (bs!p) p) (size bs); \
   107 \    succs_bounded (%p. succs (bs!p) p) (size bs); \
   108 \    sos : listsn (size bs) (option(stype bs)) |] ==> \
   108 \    sos : listsn (size bs) (option(stype bs)) |] ==> \
   109 \ fix(next (%p. exec (bs!p)) (%p. succs (bs!p) p), sos) = \
   109 \ fix(next (%p. exec (bs!p)) (%p. succs (bs!p) p), sos) = \
   110 \ (? tos : listsn (size bs) (option(stype bs)). \
   110 \ (? tos : listsn (size bs) (option(stype bs)). \
   111 \      sos <= tos & welltyping (%p. wt_instr (bs!p) p) tos)";
   111 \      sos <= tos & welltyping (%p. wt_instr (bs!p) p) tos)";
   112 by(simp_tac (simpset() delsimps [not_None_eq]) 1);
   112 by (simp_tac (simpset() delsimps [not_None_eq]) 1);
   113 by(REPEAT(ares_tac [fix_next_iff_welltyping,exec_pres_type,
   113 by (REPEAT(ares_tac [fix_next_iff_welltyping,exec_pres_type,
   114                     exec_mono_None,exec_mono_Some,
   114                     exec_mono_None,exec_mono_Some,
   115                     wt_instr_is_fix_exec,lat_stype,acc_stype] 1));
   115                     wt_instr_is_fix_exec,lat_stype,acc_stype] 1));
   116 
   116 
   117 qed "fix_iff_welltyped";
   117 qed "fix_iff_welltyped";