src/HOL/MiniML/I.ML
author oheimb
Thu, 25 Apr 1996 14:06:16 +0200
changeset 1687 b7078a395934
parent 1678 8aff580dce44
child 1723 286f9b6370ab
permissions -rw-r--r--
temporarily included settings for unification bounds again
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     1
open I;
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     2
1687
b7078a395934 temporarily included settings for unification bounds again
oheimb
parents: 1678
diff changeset
     3
Unify.trace_bound := 45;
b7078a395934 temporarily included settings for unification bounds again
oheimb
parents: 1678
diff changeset
     4
Unify.search_bound := 50;
b7078a395934 temporarily included settings for unification bounds again
oheimb
parents: 1678
diff changeset
     5
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     6
goal thy
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     7
  "! a m s s' t n.  \
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     8
\    (new_tv m a & new_tv m s) --> I e a m s = Ok(s',t,n) -->   \
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     9
\    ( ? r. W e ($ s a) m = Ok(r, $ s' t, n) & s' = ($ r o s) )";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    10
by (expr.induct_tac "e" 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    11
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    12
  (* case Var n *)
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    13
  by (simp_tac (!simpset addsimps [app_subst_list]
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    14
      setloop (split_tac [expand_if])) 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    15
  by (fast_tac (HOL_cs addss !simpset) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    16
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    17
 (* case Abs e *)
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    18
 by (asm_full_simp_tac (!simpset setloop (split_tac [expand_bind])) 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    19
 by (strip_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    20
 by (rtac conjI 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    21
  by (strip_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    22
  by (REPEAT (etac allE 1));
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    23
  by (etac impE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    24
   by (fast_tac (HOL_cs addss (!simpset addsimps [new_tv_subst])) 2);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    25
  by (fast_tac (HOL_cs addIs [new_tv_Suc_list RS mp,new_tv_subst_le,
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    26
                              less_imp_le,lessI]) 1); 
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    27
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    28
 by (strip_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    29
 by (REPEAT (etac allE 1));
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    30
 by (etac impE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    31
  by (fast_tac (HOL_cs addss (!simpset addsimps [new_tv_subst])) 2);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    32
 by (fast_tac (HOL_cs addIs [new_tv_Suc_list RS mp,new_tv_subst_le,
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    33
                             less_imp_le,lessI]) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    34
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    35
(* case App e1 e2 *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    36
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    37
by (strip_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    38
by (rename_tac "s1' t1 n1 s2' t2 n2 sa" 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    39
by (rtac conjI 1);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    40
 by (fast_tac (HOL_cs addss !simpset) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    41
by (strip_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    42
by (rename_tac "s1 t1' n1'" 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    43
by (eres_inst_tac [("x","a")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    44
by (eres_inst_tac [("x","m")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    45
by (eres_inst_tac [("x","s")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    46
by (eres_inst_tac [("x","s1'")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    47
by (eres_inst_tac [("x","t1")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    48
by (eres_inst_tac [("x","n1")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    49
by (eres_inst_tac [("x","a")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    50
by (eres_inst_tac [("x","n1")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    51
by (eres_inst_tac [("x","s1'")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    52
by (eres_inst_tac [("x","s2'")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    53
by (eres_inst_tac [("x","t2")] allE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    54
by (eres_inst_tac [("x","n2")] allE 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    55
by (rtac conjI 1);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    56
 by (strip_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    57
 by (mp_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    58
 by (mp_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    59
 by (etac exE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    60
 by (etac conjE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    61
 by (etac impE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    62
  by ((forward_tac [new_tv_subst_tel] 1) THEN (atac 1)); 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    63
  by ((dres_inst_tac [("a","$ s a")] new_tv_W 1) THEN (atac 1));
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    64
  by (fast_tac (HOL_cs addDs [sym RS W_var_geD,new_tv_subst_le,new_tv_list_le] 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    65
                       addss !simpset) 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    66
 by (fast_tac (HOL_cs addss (!simpset addsimps [subst_comp_tel])) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    67
by (strip_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    68
by (rename_tac "s2 t2' n2'" 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    69
by (rtac conjI 1);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    70
 by (strip_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    71
 by (mp_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    72
 by (mp_tac 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    73
 by (etac exE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    74
 by (etac conjE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    75
 by (etac impE 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    76
  by ((forward_tac [new_tv_subst_tel] 1) THEN (atac 1)); 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    77
  by ((dres_inst_tac [("a","$ s a")] new_tv_W 1) THEN (atac 1));
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    78
  by (fast_tac (HOL_cs addDs [sym RS W_var_geD,new_tv_subst_le,new_tv_list_le] 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    79
                       addss !simpset) 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    80
 by (fast_tac (HOL_cs addss (!simpset addsimps [subst_comp_tel,subst_comp_te])) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    81
by (strip_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    82
by (mp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    83
by (mp_tac 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    84
by (etac exE 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    85
by (etac conjE 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    86
by (etac impE 1);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    87
 by ((forward_tac [new_tv_subst_tel] 1) THEN (atac 1)); 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    88
 by ((dres_inst_tac [("a","$ s a")] new_tv_W 1) THEN (atac 1));
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    89
 by (fast_tac (HOL_cs addDs [sym RS W_var_geD,new_tv_subst_le,new_tv_list_le] 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    90
                      addss !simpset) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    91
by (mp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    92
by (REPEAT (eresolve_tac [exE,conjE] 1));
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    93
by (REPEAT(EVERY1
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    94
     [asm_full_simp_tac (!simpset addsimps [subst_comp_tel,subst_comp_te]),
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    95
      REPEAT o etac conjE, hyp_subst_tac]));
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    96
by (rtac exI 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    97
by (safe_tac HOL_cs);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    98
  by (fast_tac HOL_cs 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
    99
 by (simp_tac (!simpset addsimps [o_def,subst_comp_te]) 2);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   100
by (subgoal_tac "new_tv n2 s & new_tv n2 r & new_tv n2 ra" 1);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
   101
 by (asm_full_simp_tac (!simpset addsimps [new_tv_subst]) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   102
by ((forward_tac [new_tv_subst_tel] 1) THEN (atac 1));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   103
by ((dres_inst_tac [("a","$ s a")] new_tv_W 1) THEN (atac 1));
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   104
by (safe_tac HOL_cs);
1669
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
   105
  by (fast_tac (HOL_cs addDs[sym RS W_var_geD,new_tv_subst_le,new_tv_list_le] 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
   106
                       addss !simpset) 1);
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
   107
 by (fast_tac (HOL_cs addDs [sym RS W_var_geD,new_tv_subst_le,new_tv_list_le] 
e56cdf711729 inserted Suc_less_eq explictly in a few proofs.
nipkow
parents: 1486
diff changeset
   108
                      addss !simpset) 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   109
by (dres_inst_tac [("e","expr1")] (sym RS W_var_geD) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   110
by ((dtac new_tv_subst_tel 1) THEN (atac 1));
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   111
by ((dres_inst_tac [("ts","$ s a")] new_tv_list_le 1) THEN (atac 1));
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   112
by ((dtac new_tv_subst_tel 1) THEN (atac 1));
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   113
by (fast_tac (HOL_cs addDs [new_tv_W] addss 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   114
    (!simpset addsimps [subst_comp_tel])) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   115
qed_spec_mp "I_correct_wrt_W";