TFL/examples/Subst/Subst.ML
author paulson
Fri, 21 Feb 1997 15:30:41 +0100
changeset 2671 510d94c71dda
parent 2113 21266526ac42
permissions -rw-r--r--
Introduction of rotate_rule
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2113
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Subst/subst.ML
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     2
    ID:         $Id$
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     3
    Author:     Martin Coen, Cambridge University Computer Laboratory
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     5
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     6
For subst.thy.  
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     7
*)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     8
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
     9
open Subst;
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    10
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    11
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    12
(**** Substitutions ****)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    13
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    14
goal Subst.thy "t <| [] = t";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    15
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    16
by (ALLGOALS (asm_simp_tac (!simpset addsimps al_rews)));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    17
qed "subst_Nil";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    18
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    19
goal Subst.thy "t <: u --> t <| s <: u <| s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    20
by (uterm.induct_tac "u" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    21
by (ALLGOALS Asm_simp_tac);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    22
val subst_mono  = store_thm("subst_mono", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    23
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    24
goal Subst.thy  "~ (Var(v) <: t) --> t <| (v,t <| s)#s = t <| s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    25
by (imp_excluded_middle_tac "t = Var(v)" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    26
by (res_inst_tac [("P",
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    27
    "%x.~x=Var(v) --> ~(Var(v) <: x) --> x <| (v,t<|s)#s=x<|s")]
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    28
    uterm.induct 2);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    29
by (ALLGOALS (simp_tac (!simpset addsimps al_rews)));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    30
by (fast_tac HOL_cs 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    31
val Var_not_occs  = store_thm("Var_not_occs", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    32
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    33
goal Subst.thy
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    34
    "(t <|r = t <|s) = (! v.v : vars_of(t) --> Var(v) <|r = Var(v) <|s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    35
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    36
by (REPEAT (etac rev_mp 3));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    37
by (ALLGOALS Asm_simp_tac);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    38
by (ALLGOALS (fast_tac HOL_cs));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    39
qed "agreement";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    40
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    41
goal Subst.thy   "~ v: vars_of(t) --> t <| (v,u)#s = t <| s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    42
by(simp_tac (!simpset addsimps (agreement::al_rews)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    43
                      setloop (split_tac [expand_if])) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    44
val repl_invariance  = store_thm("repl_invariance", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    45
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    46
val asms = goal Subst.thy 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    47
     "v : vars_of(t) --> w : vars_of(t <| (v,Var(w))#s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    48
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    49
by (ALLGOALS (asm_simp_tac (!simpset addsimps al_rews)));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    50
val Var_in_subst  = store_thm("Var_in_subst", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    51
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    52
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    53
(**** Equality between Substitutions ****)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    54
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    55
goalw Subst.thy [subst_eq_def] "r =s= s = (! t.t <| r = t <| s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    56
by (Simp_tac 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    57
qed "subst_eq_iff";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    58
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    59
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    60
local fun mk_thm s = prove_goal Subst.thy s
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    61
                  (fn prems => [cut_facts_tac prems 1,
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    62
                                REPEAT (etac rev_mp 1),
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    63
                                simp_tac (!simpset addsimps [subst_eq_iff]) 1])
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    64
in 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    65
  val subst_refl      = mk_thm "r = s ==> r =s= s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    66
  val subst_sym       = mk_thm "r =s= s ==> s =s= r";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    67
  val subst_trans     = mk_thm "[| q =s= r; r =s= s |] ==> q =s= s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    68
end;
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    69
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    70
val eq::prems = goalw Subst.thy [subst_eq_def] 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    71
    "[| r =s= s; P (t <| r) (u <| r) |] ==> P (t <| s) (u <| s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    72
by (resolve_tac [eq RS spec RS subst] 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    73
by (resolve_tac (prems RL [eq RS spec RS subst]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    74
qed "subst_subst2";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    75
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    76
val ssubst_subst2 = subst_sym RS subst_subst2;
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    77
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    78
(**** Composition of Substitutions ****)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    79
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    80
local fun mk_thm s = 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    81
 prove_goalw Subst.thy [comp_def,sdom_def] s 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    82
   (fn _ => [simp_tac (simpset_of "UTerm" addsimps al_rews) 1])
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    83
in 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    84
val subst_rews = 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    85
 map mk_thm 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    86
 [ "[] <> bl = bl",
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    87
   "((a,b)#al) <> bl = (a,b <| bl) # (al <> bl)",
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    88
   "sdom([]) = {}",
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    89
   "sdom((a,b)#al) = (if Var(a)=b then (sdom al) - {a} else (sdom al) Un {a})"]
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    90
end;
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    91
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    92
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    93
goal Subst.thy "s <> [] = s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    94
by (alist_ind_tac "s" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    95
by (ALLGOALS (asm_simp_tac (!simpset addsimps (subst_Nil::subst_rews))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    96
qed "comp_Nil";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    97
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    98
goal Subst.thy "(t <| r <> s) = (t <| r <| s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
    99
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   100
by (ALLGOALS (asm_simp_tac (!simpset addsimps al_rews)));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   101
by (alist_ind_tac "r" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   102
by (ALLGOALS (asm_simp_tac (!simpset addsimps (subst_Nil::(al_rews@subst_rews))
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   103
                                     setloop (split_tac [expand_if]))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   104
qed "subst_comp";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   105
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   106
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   107
goal Subst.thy "(q <> r) <> s =s= q <> (r <> s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   108
by (simp_tac (!simpset addsimps [subst_eq_iff,subst_comp]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   109
qed "comp_assoc";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   110
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   111
goal Subst.thy "(theta =s= theta1) --> \
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   112
             \    (sigma =s= sigma1) --> \
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   113
             \     ((theta <> sigma) =s= (theta1 <> sigma1))";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   114
by (simp_tac (!simpset addsimps [subst_eq_def,subst_comp]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   115
val subst_cong = result() RS mp RS mp;
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   116
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   117
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   118
goal Subst.thy "(w,Var(w) <| s)#s =s= s"; 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   119
by (rtac (allI RS (subst_eq_iff RS iffD2)) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   120
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   121
by (REPEAT (etac rev_mp 3));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   122
by (ALLGOALS (simp_tac (!simpset addsimps al_rews
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   123
                                 setloop (split_tac [expand_if]))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   124
qed "Cons_trivial";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   125
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   126
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   127
val [prem] = goal Subst.thy "q <> r =s= s ==>  t <| q <| r = t <| s";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   128
by (simp_tac (!simpset addsimps [prem RS (subst_eq_iff RS iffD1),
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   129
                                subst_comp RS sym]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   130
qed "comp_subst_subst";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   131
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   132
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   133
(****  Domain and range of Substitutions ****)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   134
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   135
goal Subst.thy  "(v : sdom(s)) = (~ Var(v) <| s = Var(v))";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   136
by (alist_ind_tac "s" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   137
by (ALLGOALS (asm_simp_tac (!simpset addsimps (al_rews@subst_rews)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   138
                                     setloop (split_tac[expand_if]))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   139
by (fast_tac HOL_cs 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   140
qed "sdom_iff";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   141
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   142
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   143
goalw Subst.thy [srange_def]  
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   144
   "v : srange(s) = (? w.w : sdom(s) & v : vars_of(Var(w) <| s))";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   145
by (fast_tac set_cs 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   146
qed "srange_iff";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   147
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   148
goal Subst.thy  "(t <| s = t) = (sdom(s) Int vars_of(t) = {})";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   149
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   150
by (REPEAT (etac rev_mp 3));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   151
by (ALLGOALS (simp_tac (!simpset addsimps 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   152
                        (sdom_iff::(subst_rews@al_rews@setplus_rews)))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   153
by (ALLGOALS (fast_tac set_cs));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   154
qed "invariance";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   155
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   156
goal Subst.thy  "v : sdom(s) -->  ~v : srange(s) --> ~v : vars_of(t <| s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   157
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   158
by (imp_excluded_middle_tac "a : sdom(s)" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   159
by (ALLGOALS (asm_simp_tac (!simpset addsimps [sdom_iff,srange_iff])));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   160
by (ALLGOALS (fast_tac set_cs));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   161
val Var_elim  = store_thm("Var_elim", result() RS mp RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   162
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   163
val asms = goal Subst.thy 
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   164
     "[| v : sdom(s); v : vars_of(t <| s) |] ==>  v : srange(s)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   165
by (REPEAT (ares_tac (asms @ [Var_elim RS swap RS classical]) 1));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   166
qed "Var_elim2";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   167
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   168
goal Subst.thy  "v : vars_of(t <| s) --> v : srange(s) | v : vars_of(t)";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   169
by (uterm.induct_tac "t" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   170
by (REPEAT_SOME (etac rev_mp ));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   171
by (ALLGOALS (simp_tac (!simpset addsimps [sdom_iff,srange_iff])));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   172
by (REPEAT (step_tac (set_cs addIs [vars_var_iff RS iffD1 RS sym]) 1));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   173
by (etac notE 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   174
by (etac subst 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   175
by (ALLGOALS (fast_tac set_cs));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   176
val Var_intro  = store_thm("Var_intro", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   177
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   178
goal Subst.thy
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   179
    "v : srange(s) --> (? w.w : sdom(s) & v : vars_of(Var(w) <| s))";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   180
by (simp_tac (!simpset addsimps [srange_iff]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   181
val srangeE  = store_thm("srangeE", make_elim (result() RS mp));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   182
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   183
val asms = goal Subst.thy
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   184
   "sdom(s) Int srange(s) = {} = (! t.sdom(s) Int vars_of(t <| s) = {})";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   185
by (simp_tac (!simpset addsimps setplus_rews) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   186
by (fast_tac (set_cs addIs [Var_elim2] addEs [srangeE]) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   187
qed "dom_range_disjoint";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   188
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   189
val asms = goal Subst.thy "~ u <| s = u --> (? x. x : sdom(s))";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   190
by (simp_tac (!simpset addsimps (invariance::setplus_rews)) 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   191
by (fast_tac set_cs 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   192
val subst_not_empty  = store_thm("subst_not_empty", result() RS mp);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   193
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   194
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   195
goal Subst.thy "(M <| [(x, Var x)]) = M";
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   196
by (UTerm.uterm.induct_tac "M" 1);
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   197
by (ALLGOALS (asm_simp_tac (!simpset addsimps (subst_rews@al_rews)
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   198
                                     setloop (split_tac [expand_if]))));
21266526ac42 Subst as modified by Konrad Slind
paulson
parents:
diff changeset
   199
val id_subst_lemma = result();