src/HOL/MiniML/Type.ML
author nipkow
Thu, 22 Feb 1996 18:35:16 +0100
changeset 1519 f999804f11ea
parent 1465 5d7a7e439cec
child 1521 4ed3004ff75e
permissions -rw-r--r--
Added links to documentation
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 Type;
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     2
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     3
Addsimps [app_subst_TVar,app_subst_Fun];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     4
Addsimps [mgu_eq,mgu_mg,mgu_free];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     5
Addsimps [free_tv_TVar,free_tv_Fun,free_tv_Nil,free_tv_Cons];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     6
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     7
(* mgu does not introduce new type variables *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     8
goalw thy [new_tv_def] 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
     9
      "!! n. [|mgu t1 t2 = Ok u; new_tv n t1; new_tv n t2|] ==> \
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    10
\            new_tv n u";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    11
by( fast_tac (set_cs addDs [mgu_free]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    12
qed "mgu_new";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    13
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    14
(* application of id_subst does not change type expression *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    15
goalw thy [id_subst_def]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    16
  "$ id_subst = (%t::typ.t)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    17
by (rtac ext 1);
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    18
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    19
by (ALLGOALS Asm_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    20
qed "app_subst_id_te";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    21
Addsimps [app_subst_id_te];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    22
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    23
(* application of id_subst does not change list of type expressions *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    24
goalw thy [app_subst_list]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    25
  "$ id_subst = (%ts::typ list.ts)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    26
by (rtac ext 1); 
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    27
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    28
by (ALLGOALS Asm_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    29
qed "app_subst_id_tel";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    30
Addsimps [app_subst_id_tel];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    31
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    32
goalw thy [dom_def,id_subst_def,empty_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    33
  "dom id_subst = {}";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    34
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    35
qed "dom_id_subst";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    36
Addsimps [dom_id_subst];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    37
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    38
goalw thy [cod_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    39
  "cod id_subst = {}";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    40
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    41
qed "cod_id_subst";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    42
Addsimps [cod_id_subst];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    43
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    44
goalw thy [free_tv_subst]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    45
  "free_tv id_subst = {}";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    46
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    47
qed "free_tv_id_subst";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    48
Addsimps [free_tv_id_subst];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    49
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    50
goalw thy [dom_def,cod_def,UNION_def,Bex_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    51
  "!!v. [| v : free_tv(s n); v~=n |] ==> v : cod s";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    52
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    53
by (safe_tac (empty_cs addSIs [exI,conjI,notI]));
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
    54
by (assume_tac 2);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    55
by (rotate_tac 1 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    56
by (Asm_full_simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    57
qed "cod_app_subst";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    58
Addsimps [cod_app_subst];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    59
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    60
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    61
(* composition of substitutions *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    62
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    63
  "$ g ($ f t::typ) = $ (%x. $ g (f x) ) t";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    64
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    65
by (ALLGOALS Asm_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    66
qed "subst_comp_te";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    67
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    68
goalw thy [app_subst_list]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    69
  "$ g ($ f ts::typ list) = $ (%x. $ g (f x)) ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    70
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    71
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    72
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    73
(* case x#xl *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    74
by (asm_full_simp_tac (!simpset addsimps [subst_comp_te]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    75
qed "subst_comp_tel";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    76
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    77
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    78
(* constructor laws for app_subst *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    79
goalw thy [app_subst_list]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    80
  "$ s [] = []";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    81
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    82
qed "app_subst_Nil";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    83
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    84
goalw thy [app_subst_list]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    85
  "$ s (t#ts) = ($ s t)#($ s ts)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    86
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    87
qed "app_subst_Cons";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    88
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    89
Addsimps [app_subst_Nil,app_subst_Cons];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    90
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    91
(* constructor laws for new_tv *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    92
goalw thy [new_tv_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    93
  "new_tv n (TVar m) = (m<n)";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    94
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    95
qed "new_tv_TVar";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    96
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    97
goalw thy [new_tv_def]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
    98
  "new_tv n (t1 -> t2) = (new_tv n t1 & new_tv n t2)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
    99
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   100
qed "new_tv_Fun";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   101
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   102
goalw thy [new_tv_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   103
  "new_tv n []";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   104
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   105
qed "new_tv_Nil";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   106
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   107
goalw thy [new_tv_def]
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   108
  "new_tv n (t#ts) = (new_tv n t & new_tv n ts)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   109
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   110
qed "new_tv_Cons";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   111
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   112
Addsimps [new_tv_TVar,new_tv_Fun,new_tv_Nil,new_tv_Cons];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   113
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   114
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   115
goalw thy [new_tv_def]
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   116
  "new_tv n s = ((!m. n <= m --> (s m = TVar m)) & \
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   117
\                (! l. l < n --> new_tv n (s l) ))";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   118
by( safe_tac HOL_cs );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   119
(* ==> *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   120
by( fast_tac (HOL_cs addDs [leD] addss (!simpset addsimps [free_tv_subst,dom_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   121
by( subgoal_tac "m:cod s | s l = TVar l" 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   122
by( safe_tac HOL_cs );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   123
by(fast_tac (HOL_cs addDs [UnI2] addss (!simpset addsimps [free_tv_subst])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   124
by(dres_inst_tac [("P","%x. m:free_tv x")] subst 1 THEN atac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   125
by(Asm_full_simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   126
by(fast_tac (set_cs addss (!simpset addsimps [free_tv_subst,cod_def,dom_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   127
(* <== *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   128
by( rewrite_goals_tac [free_tv_subst,cod_def,dom_def] );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   129
by( safe_tac set_cs );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   130
by( cut_inst_tac [("m","m"),("n","n")] less_linear 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   131
by( fast_tac (HOL_cs addSIs [less_or_eq_imp_le]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   132
by( cut_inst_tac [("m","ma"),("n","n")] less_linear 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   133
by( fast_tac (HOL_cs addSIs [less_or_eq_imp_le]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   134
qed "new_tv_subst";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   135
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   136
goal thy 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   137
  "new_tv n  = list_all (new_tv n)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1400
diff changeset
   138
by (rtac ext 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   139
by(list.induct_tac "x" 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   140
by(ALLGOALS Asm_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   141
qed "new_tv_list";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   142
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   143
(* substitution affects only variables occurring freely *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   144
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   145
  "new_tv n (t::typ) --> $(%x. if x=n then t' else s x) t = $s t";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   146
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   147
by (ALLGOALS(asm_simp_tac (!simpset setloop (split_tac [expand_if]))));
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   148
qed "subst_te_new_tv";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   149
Addsimps [subst_te_new_tv];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   150
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   151
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   152
  "new_tv n (ts::typ list) --> $(%x. if x=n then t else s x) ts = $s ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   153
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   154
by (ALLGOALS Asm_full_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   155
qed "subst_tel_new_tv";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   156
Addsimps [subst_tel_new_tv];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   157
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   158
(* all greater variables are also new *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   159
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   160
  "n<=m --> new_tv n (t::typ) --> new_tv m t";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   161
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   162
(* case TVar n *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   163
by( fast_tac (HOL_cs addIs [less_le_trans] addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   164
(* case Fun t1 t2 *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   165
by (Asm_simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   166
bind_thm ("new_tv_le",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   167
Addsimps [lessI RS less_imp_le RS new_tv_le];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   168
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   169
goal thy 
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   170
  "n<=m --> new_tv n (ts::typ list) --> new_tv m ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   171
by( list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   172
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   173
by(Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   174
(* case a#al *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   175
by (fast_tac (HOL_cs addIs [new_tv_le] addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   176
bind_thm ("new_tv_list_le",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   177
Addsimps [lessI RS less_imp_le RS new_tv_list_le];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   178
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   179
goal thy
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   180
  "!! n. [| n<=m; new_tv n (s::subst) |] ==> new_tv m s";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   181
by (asm_full_simp_tac (!simpset addsimps [new_tv_subst]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   182
by (rtac conjI 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   183
by (slow_tac (HOL_cs addIs [le_trans]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   184
by (safe_tac HOL_cs );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   185
by (res_inst_tac [("P","l < n"),("Q","n <= l")] disjE 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   186
by (fast_tac (HOL_cs addss (HOL_ss addsimps [le_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   187
by (ALLGOALS (asm_full_simp_tac (!simpset addsimps [new_tv_le])) );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   188
qed "new_tv_subst_le";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   189
Addsimps [lessI RS less_imp_le RS new_tv_subst_le];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   190
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   191
(* new_tv property remains if a substitution is applied *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   192
goal thy
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   193
  "!!n. [| n<m; new_tv m (s::subst) |] ==> new_tv m (s n)";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   194
by (asm_full_simp_tac (!simpset addsimps [new_tv_subst]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   195
qed "new_tv_subst_var";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   196
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   197
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   198
  "new_tv n s --> new_tv n (t::typ) --> new_tv n ($ s t)";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   199
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   200
by (ALLGOALS(fast_tac (HOL_cs addss (!simpset addsimps [new_tv_subst]))));
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   201
bind_thm ("new_tv_subst_te",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   202
Addsimps [new_tv_subst_te];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   203
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   204
goal thy
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   205
  "new_tv n s --> new_tv n (ts::typ list) --> new_tv n ($ s ts)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   206
by( simp_tac (!simpset addsimps [new_tv_list]) 1);
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   207
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   208
by (ALLGOALS(fast_tac (HOL_cs addss (!simpset addsimps [new_tv_subst]))));
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   209
bind_thm ("new_tv_subst_tel",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   210
Addsimps [new_tv_subst_tel];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   211
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   212
(* auxilliary lemma *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   213
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   214
  "new_tv n ts --> new_tv (Suc n) ((TVar n)#ts)";
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   215
by( simp_tac (!simpset addsimps [new_tv_list]) 1);
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   216
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   217
by (ALLGOALS Asm_full_simp_tac);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   218
qed "new_tv_Suc_list";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   219
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   220
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   221
(* composition of substitutions preserves new_tv proposition *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   222
goal thy 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   223
     "!! n. [| new_tv n (s::subst); new_tv n r |] ==> \
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   224
\           new_tv n (($ r) o s)";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   225
by (asm_full_simp_tac (!simpset addsimps [new_tv_subst]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   226
qed "new_tv_subst_comp_1";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   227
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   228
goal thy
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   229
     "!! n. [| new_tv n (s::subst); new_tv n r |] ==>  \ 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   230
\     new_tv n (%v.$ r (s v))";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   231
by (asm_full_simp_tac (!simpset addsimps [new_tv_subst]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   232
qed "new_tv_subst_comp_2";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   233
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   234
Addsimps [new_tv_subst_comp_1,new_tv_subst_comp_2];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   235
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   236
(* new type variables do not occur freely in a type structure *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   237
goalw thy [new_tv_def] 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   238
      "!!n. new_tv n ts ==> n~:(free_tv ts)";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   239
by (fast_tac (HOL_cs addEs [less_anti_refl]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   240
qed "new_tv_not_free_tv";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   241
Addsimps [new_tv_not_free_tv];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   242
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   243
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   244
  "(t::typ) mem ts --> free_tv t <= free_tv ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   245
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   246
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   247
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   248
(* case x#xl *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   249
by (fast_tac (set_cs addss (!simpset setloop (split_tac [expand_if]))) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   250
bind_thm ("ftv_mem_sub_ftv_list",result() RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   251
Addsimps [ftv_mem_sub_ftv_list];
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   252
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   253
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   254
(* if two substitutions yield the same result if applied to a type
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   255
   structure the substitutions coincide on the free type variables
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   256
   occurring in the type structure *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   257
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   258
  "$ s1 (t::typ) = $ s2 t --> n:(free_tv t) --> s1 n = s2 n";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   259
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   260
(* case TVar n *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   261
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   262
(* case Fun t1 t2 *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   263
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   264
bind_thm ("eq_subst_te_eq_free",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   265
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   266
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   267
  "(!n. n:(free_tv t) --> s1 n = s2 n) --> $ s1 (t::typ) = $ s2 t";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   268
by (typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   269
(* case TVar n *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   270
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   271
(* case Fun t1 t2 *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   272
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   273
bind_thm ("eq_free_eq_subst_te",result() RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   274
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   275
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   276
  "$s1 (ts::typ list) = $s2 ts --> n:(free_tv ts) --> s1 n = s2 n";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   277
by (list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   278
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   279
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   280
(* case x#xl *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   281
by (fast_tac (HOL_cs addIs [eq_subst_te_eq_free] addss (!simpset)) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   282
bind_thm ("eq_subst_tel_eq_free",result() RS mp RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   283
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   284
goal thy
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   285
  "(!n. n:(free_tv ts) --> s1 n = s2 n) --> $s1 (ts::typ list) = $s2 ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   286
by (list.induct_tac "ts" 1); 
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   287
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   288
by (fast_tac (HOL_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   289
(* case x#xl *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   290
by (fast_tac (HOL_cs addIs [eq_free_eq_subst_te] addss (!simpset)) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   291
bind_thm ("eq_free_eq_subst_tel",result() RS mp);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   292
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   293
(* some useful theorems *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   294
goalw thy [free_tv_subst] 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   295
      "!!v. v : cod s ==> v : free_tv s";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   296
by( fast_tac set_cs 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   297
qed "codD";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   298
 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   299
goalw thy [free_tv_subst,dom_def] 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   300
      "!! x. x ~: free_tv s ==> s x = TVar x";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   301
by( fast_tac set_cs 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   302
qed "not_free_impl_id";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   303
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   304
goalw thy [new_tv_def] 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   305
      "!! n. [| new_tv n t; m:free_tv t |] ==> m<n";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   306
by( fast_tac HOL_cs 1 );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   307
qed "free_tv_le_new_tv";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   308
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   309
goal thy 
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   310
     "free_tv (s (v::nat)) <= cod s Un {v}";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   311
by( cut_inst_tac [("P","v:dom s")] excluded_middle 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   312
by( safe_tac (HOL_cs addSIs [subsetI]) );
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   313
by (fast_tac (set_cs addss (!simpset addsimps [dom_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   314
by (fast_tac (set_cs addss (!simpset addsimps [cod_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   315
qed "free_tv_subst_var";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   316
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   317
goal thy 
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   318
     "free_tv ($ s (t::typ)) <= cod s Un free_tv t";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   319
by( typ.induct_tac "t" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   320
(* case TVar n *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   321
by( simp_tac (!simpset addsimps [free_tv_subst_var]) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   322
(* case Fun t1 t2 *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   323
by( fast_tac (set_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   324
qed "free_tv_app_subst_te";     
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   325
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   326
goal thy 
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   327
     "free_tv ($ s (ts::typ list)) <= cod s Un free_tv ts";
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   328
by( list.induct_tac "ts" 1);
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   329
(* case [] *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   330
by (Simp_tac 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   331
(* case a#al *)
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   332
by( cut_facts_tac [free_tv_app_subst_te] 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   333
by( fast_tac (set_cs addss !simpset) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   334
qed "free_tv_app_subst_tel";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   335
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   336
goalw thy [free_tv_subst,dom_def] 
1400
5d909faf0e04 Introduced Monad syntax Pat := Val; Cont
nipkow
parents: 1300
diff changeset
   337
     "free_tv (%u::nat. $ s1 ($ s2 (s3 u)) :: typ) <=   \ 
1300
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   338
\     free_tv s1 Un free_tv s2 Un free_tv s3";
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   339
by( fast_tac (set_cs addSDs [free_tv_app_subst_te RS subsetD,free_tv_subst_var RS subsetD] addss (!simpset addsimps [cod_def,dom_def])) 1);
c7a8f374339b New theory: type inference for let-free MiniML
nipkow
parents:
diff changeset
   340
qed "free_tv_comp_subst";