src/HOL/Subst/Subst.thy
author haftmann
Tue, 10 Jul 2007 09:24:43 +0200
changeset 23693 d92637b15a45
parent 15648 f6da795ee27a
child 24823 bfb619994060
permissions -rw-r--r--
adjusted
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3268
012c43174664 Mostly cosmetic changes: updated headers, ID lines, etc.
paulson
parents: 3192
diff changeset
     1
(*  Title:      Subst/Subst.thy
012c43174664 Mostly cosmetic changes: updated headers, ID lines, etc.
paulson
parents: 3192
diff changeset
     2
    ID:         $Id$
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1266
diff changeset
     3
    Author:     Martin Coen, Cambridge University Computer Laboratory
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     5
*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     6
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     7
header{*Substitutions on uterms*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     8
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     9
theory Subst
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    10
imports AList UTerm
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    11
begin
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    12
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    13
consts
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    14
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    15
  "=$="  ::  "[('a*('a uterm)) list,('a*('a uterm)) list] => bool" (infixr 52)
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    16
  "<|"   ::  "'a uterm => ('a * 'a uterm) list => 'a uterm"        (infixl 55)
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    17
  "<>"   ::  "[('a*('a uterm)) list, ('a*('a uterm)) list] 
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    18
                 => ('a*('a uterm)) list"                          (infixl 56)
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    19
  sdom   ::  "('a*('a uterm)) list => 'a set"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    20
  srange ::  "('a*('a uterm)) list => 'a set"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    21
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    22
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    23
syntax (xsymbols)
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    24
  "op =$=" :: "[('a*('a uterm)) list,('a*('a uterm)) list] => bool" 
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    25
              (infixr "\<doteq>" 52)
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    26
  "op <|" :: "'a uterm => ('a * 'a uterm) list => 'a uterm" (infixl "\<lhd>" 55)
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    27
  "op <>" :: "[('a*('a uterm)) list, ('a*('a uterm)) list] 
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    28
                 => ('a*('a uterm)) list"                   (infixl "\<lozenge>" 56)
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    29
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    30
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3842
diff changeset
    31
primrec
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    32
  subst_Var:      "(Var v \<lhd> s) = assoc v (Var v) s"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    33
  subst_Const:  "(Const c \<lhd> s) = Const c"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    34
  subst_Comb:  "(Comb M N \<lhd> s) = Comb (M \<lhd> s) (N \<lhd> s)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    35
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    36
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    37
defs 
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    38
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    39
  subst_eq_def:  "r =$= s == ALL t. t \<lhd> r = t \<lhd> s"
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    40
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    41
  comp_def:    "al \<lozenge> bl == alist_rec al bl (%x y xs g. (x,y \<lhd> bl)#g)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    42
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    43
  sdom_def:
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    44
  "sdom(al) == alist_rec al {}  
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    45
                (%x y xs g. if Var(x)=y then g - {x} else g Un {x})"
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    46
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    47
  srange_def:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    48
   "srange(al) == Union({y. \<exists>x \<in> sdom(al). y = vars_of(Var(x) \<lhd> al)})"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    49
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    50
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    51
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    52
subsection{*Basic Laws*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    53
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    54
lemma subst_Nil [simp]: "t \<lhd> [] = t"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    55
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    56
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    57
lemma subst_mono [rule_format]: "t \<prec> u --> t \<lhd> s \<prec> u \<lhd> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    58
by (induct_tac "u", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    59
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    60
lemma Var_not_occs [rule_format]:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    61
     "~ (Var(v) \<prec> t) --> t \<lhd> (v,t \<lhd> s) # s = t \<lhd> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    62
apply (case_tac "t = Var v")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    63
apply (erule_tac [2] rev_mp)
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    64
apply (rule_tac [2] P = 
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    65
         "%x. x \<noteq> Var v --> ~(Var v \<prec> x) --> x \<lhd> (v,t\<lhd>s) #s = x\<lhd>s" 
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    66
       in uterm.induct)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    67
apply auto 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    68
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    69
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    70
lemma agreement: "(t\<lhd>r = t\<lhd>s) = (\<forall>v \<in> vars_of t. Var v \<lhd> r = Var v \<lhd> s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    71
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    72
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    73
lemma repl_invariance: "~ v: vars_of(t) ==> t \<lhd> (v,u)#s = t \<lhd> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    74
by (simp add: agreement)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    75
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    76
lemma Var_in_subst [rule_format]:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    77
     "v \<in> vars_of(t) --> w \<in> vars_of(t \<lhd> (v,Var(w))#s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    78
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    79
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    80
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    81
subsection{*Equality between Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    82
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    83
lemma subst_eq_iff: "r \<doteq> s = (\<forall>t. t \<lhd> r = t \<lhd> s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    84
by (simp add: subst_eq_def)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    85
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    86
lemma subst_refl [iff]: "r \<doteq> r"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    87
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    88
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    89
lemma subst_sym: "r \<doteq> s ==> s \<doteq> r"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    90
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    91
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    92
lemma subst_trans: "[| q \<doteq> r; r \<doteq> s |] ==> q \<doteq> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    93
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    94
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    95
lemma subst_subst2:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    96
    "[| r \<doteq> s; P (t \<lhd> r) (u \<lhd> r) |] ==> P (t \<lhd> s) (u \<lhd> s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    97
by (simp add: subst_eq_def)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    98
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    99
lemmas ssubst_subst2 = subst_sym [THEN subst_subst2]
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   100
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   101
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   102
subsection{*Composition of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   103
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   104
lemma [simp]: 
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   105
     "[] \<lozenge> bl = bl"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   106
     "((a,b)#al) \<lozenge> bl = (a,b \<lhd> bl) # (al \<lozenge> bl)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   107
     "sdom([]) = {}"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   108
     "sdom((a,b)#al) = (if Var(a)=b then (sdom al) - {a} else sdom al Un {a})"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   109
by (simp_all add: comp_def sdom_def) 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   110
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   111
lemma comp_Nil [simp]: "s \<lozenge> [] = s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   112
by (induct "s", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   113
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   114
lemma subst_comp_Nil: "s \<doteq> s \<lozenge> []"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   115
by simp
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   116
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   117
lemma subst_comp [simp]: "(t \<lhd> r \<lozenge> s) = (t \<lhd> r \<lhd> s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   118
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   119
apply (simp_all (no_asm_simp))
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   120
apply (induct "r", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   121
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   122
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   123
lemma comp_assoc: "(q \<lozenge> r) \<lozenge> s \<doteq> q \<lozenge> (r \<lozenge> s)"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   124
by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   125
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   126
lemma subst_cong:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   127
     "[| theta \<doteq> theta1; sigma \<doteq> sigma1|] 
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   128
      ==> (theta \<lozenge> sigma) \<doteq> (theta1 \<lozenge> sigma1)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   129
by (simp add: subst_eq_def)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   130
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   131
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   132
lemma Cons_trivial: "(w, Var(w) \<lhd> s) # s \<doteq> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   133
apply (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   134
apply (rule allI)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   135
apply (induct_tac "t", simp_all)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   136
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   137
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   138
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   139
lemma comp_subst_subst: "q \<lozenge> r \<doteq> s ==>  t \<lhd> q \<lhd> r = t \<lhd> s"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   140
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   141
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   142
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   143
subsection{*Domain and range of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   144
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   145
lemma sdom_iff: "(v \<in> sdom(s)) = (Var(v) \<lhd> s ~= Var(v))"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   146
apply (induct "s")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   147
apply (case_tac [2] a, auto)  
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   148
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   149
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   150
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   151
lemma srange_iff: 
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   152
   "v \<in> srange(s) = (\<exists>w. w \<in> sdom(s) & v \<in> vars_of(Var(w) \<lhd> s))"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   153
by (auto simp add: srange_def)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   154
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   155
lemma empty_iff_all_not: "(A = {}) = (ALL a.~ a:A)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   156
by (unfold empty_def, blast)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   157
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   158
lemma invariance: "(t \<lhd> s = t) = (sdom(s) Int vars_of(t) = {})"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   159
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   160
apply (auto simp add: empty_iff_all_not sdom_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   161
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   162
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   163
lemma Var_in_srange [rule_format]:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   164
     "v \<in> sdom(s) -->  v \<in> vars_of(t \<lhd> s) --> v \<in> srange(s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   165
apply (induct_tac "t")
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   166
apply (case_tac "a \<in> sdom s")
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   167
apply (auto simp add: sdom_iff srange_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   168
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   169
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   170
lemma Var_elim: "[| v \<in> sdom(s); v \<notin> srange(s) |] ==>  v \<notin> vars_of(t \<lhd> s)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   171
by (blast intro: Var_in_srange)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   172
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   173
lemma Var_intro [rule_format]:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   174
     "v \<in> vars_of(t \<lhd> s) --> v \<in> srange(s) | v \<in> vars_of(t)"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   175
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   176
apply (auto simp add: sdom_iff srange_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   177
apply (rule_tac x=a in exI, auto) 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   178
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   179
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   180
lemma srangeD: "v \<in> srange(s) ==> \<exists>w. w \<in> sdom(s) & v \<in> vars_of(Var(w) \<lhd> s)"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   181
by (simp add: srange_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   182
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   183
lemma dom_range_disjoint:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   184
     "sdom(s) Int srange(s) = {} = (\<forall>t. sdom(s) Int vars_of(t \<lhd> s) = {})"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   185
apply (simp add: empty_iff_all_not)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   186
apply (force intro: Var_in_srange dest: srangeD)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   187
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   188
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   189
lemma subst_not_empty: "~ u \<lhd> s = u ==> (\<exists>x. x \<in> sdom(s))"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   190
by (auto simp add: empty_iff_all_not invariance)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   191
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   192
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   193
lemma id_subst_lemma [simp]: "(M \<lhd> [(x, Var x)]) = M"
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   194
by (induct_tac "M", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   195
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   196
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
   197
end