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