src/HOL/Subst/Subst.thy
author huffman
Tue, 02 Mar 2010 09:54:50 -0800
changeset 35512 d1ef88d7de5a
parent 25382 72cfe89f7b21
child 38140 05691ad74079
permissions -rw-r--r--
remove dead code
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
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    14
  subst :: "'a uterm => ('a * 'a uterm) list => 'a uterm"  (infixl "<|" 55)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    15
notation (xsymbols)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    16
  subst  (infixl "\<lhd>" 55)
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3842
diff changeset
    17
primrec
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    18
  subst_Var:      "(Var v \<lhd> s) = assoc v (Var v) s"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    19
  subst_Const:  "(Const c \<lhd> s) = Const c"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    20
  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
    21
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    22
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    23
  subst_eq :: "[('a*('a uterm)) list,('a*('a uterm)) list] => bool"  (infixr "=$=" 52) where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    24
  "r =$= s \<longleftrightarrow> (\<forall>t. t \<lhd> r = t \<lhd> s)"
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 24823
diff changeset
    25
notation (xsymbols)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    26
  subst_eq  (infixr "\<doteq>" 52)
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    27
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    28
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    29
  comp :: "[('a*('a uterm)) list, ('a*('a uterm)) list] => ('a*('a uterm)) list"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    30
    (infixl "<>" 56) where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    31
  "al <> bl = alist_rec al bl (%x y xs g. (x,y \<lhd> bl)#g)"
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 24823
diff changeset
    32
notation (xsymbols)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    33
  comp  (infixl "\<lozenge>" 56)
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    34
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    35
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    36
  sdom :: "('a*('a uterm)) list => 'a set" where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    37
  "sdom al = alist_rec al {} (%x y xs g. if Var(x)=y then g - {x} else g Un {x})"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    38
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    39
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    40
  srange :: "('a*('a uterm)) list => 'a set" where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    41
  "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
    42
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    43
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    44
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    45
subsection{*Basic Laws*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    46
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    47
lemma subst_Nil [simp]: "t \<lhd> [] = t"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    48
  by (induct t) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    49
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    50
lemma subst_mono: "t \<prec> u \<Longrightarrow> t \<lhd> s \<prec> u \<lhd> s"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    51
  by (induct u) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    52
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    53
lemma Var_not_occs: "~ (Var(v) \<prec> t) \<Longrightarrow> t \<lhd> (v,t \<lhd> s) # s = t \<lhd> s"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    54
  apply (case_tac "t = Var v")
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    55
   prefer 2
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    56
   apply (erule rev_mp)+
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    57
   apply (rule_tac P =
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    58
         "%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
    59
       in uterm.induct)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    60
     apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    61
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    62
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    63
lemma agreement: "(t\<lhd>r = t\<lhd>s) = (\<forall>v \<in> vars_of t. Var v \<lhd> r = Var v \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    64
  by (induct t) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    65
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    66
lemma repl_invariance: "~ v: vars_of t ==> t \<lhd> (v,u)#s = t \<lhd> s"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    67
  by (simp add: agreement)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    68
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    69
lemma Var_in_subst:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    70
    "v \<in> vars_of(t) --> w \<in> vars_of(t \<lhd> (v,Var(w))#s)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    71
  by (induct t) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    72
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    73
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    74
subsection{*Equality between Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    75
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    76
lemma subst_eq_iff: "r \<doteq> s = (\<forall>t. t \<lhd> r = t \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    77
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    78
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    79
lemma subst_refl [iff]: "r \<doteq> r"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    80
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    81
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    82
lemma subst_sym: "r \<doteq> s ==> s \<doteq> r"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    83
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    84
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    85
lemma subst_trans: "[| q \<doteq> r; r \<doteq> s |] ==> q \<doteq> s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    86
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    87
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    88
lemma subst_subst2:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    89
    "[| r \<doteq> s; P (t \<lhd> r) (u \<lhd> r) |] ==> P (t \<lhd> s) (u \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    90
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    91
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    92
lemma ssubst_subst2:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    93
    "[| s \<doteq> r; P (t \<lhd> r) (u \<lhd> r) |] ==> P (t \<lhd> s) (u \<lhd> s)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    94
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    95
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    96
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    97
subsection{*Composition of Substitutions*}
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
lemma [simp]: 
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   100
     "[] \<lozenge> bl = bl"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   101
     "((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
   102
     "sdom([]) = {}"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   103
     "sdom((a,b)#al) = (if Var(a)=b then (sdom al) - {a} else sdom al Un {a})"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   104
  by (simp_all add: comp_def sdom_def) 
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   105
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   106
lemma comp_Nil [simp]: "s \<lozenge> [] = s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   107
  by (induct s) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   108
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   109
lemma subst_comp_Nil: "s \<doteq> s \<lozenge> []"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   110
  by simp
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   111
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   112
lemma subst_comp [simp]: "(t \<lhd> r \<lozenge> s) = (t \<lhd> r \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   113
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   114
  apply simp_all
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   115
  apply (induct r)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   116
   apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   117
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   118
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   119
lemma comp_assoc: "(q \<lozenge> r) \<lozenge> s \<doteq> q \<lozenge> (r \<lozenge> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   120
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   121
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   122
lemma subst_cong:
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   123
  "[| theta \<doteq> theta1; sigma \<doteq> sigma1|] 
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   124
    ==> (theta \<lozenge> sigma) \<doteq> (theta1 \<lozenge> sigma1)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   125
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   126
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   127
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   128
lemma Cons_trivial: "(w, Var(w) \<lhd> s) # s \<doteq> s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   129
  apply (simp add: subst_eq_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   130
  apply (rule allI)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   131
  apply (induct_tac t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   132
    apply simp_all
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   133
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   134
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   135
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   136
lemma comp_subst_subst: "q \<lozenge> r \<doteq> s ==>  t \<lhd> q \<lhd> r = t \<lhd> s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   137
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   138
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   139
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   140
subsection{*Domain and range of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   141
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   142
lemma sdom_iff: "(v \<in> sdom(s)) = (Var(v) \<lhd> s ~= Var(v))"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   143
  apply (induct s)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   144
   apply (case_tac [2] a)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   145
   apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   146
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   147
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   148
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   149
lemma srange_iff: 
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   150
    "v \<in> srange(s) = (\<exists>w. w \<in> sdom(s) & v \<in> vars_of(Var(w) \<lhd> s))"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   151
  by (auto simp add: srange_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   152
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   153
lemma empty_iff_all_not: "(A = {}) = (ALL a.~ a:A)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   154
  unfolding empty_def by blast
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   155
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   156
lemma invariance: "(t \<lhd> s = t) = (sdom(s) Int vars_of(t) = {})"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   157
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   158
    apply (auto simp add: empty_iff_all_not sdom_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   159
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   160
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   161
lemma Var_in_srange:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   162
    "v \<in> sdom(s) \<Longrightarrow>  v \<in> vars_of(t \<lhd> s) \<Longrightarrow> v \<in> srange(s)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   163
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   164
    apply (case_tac "a \<in> sdom s")
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   165
  apply (auto simp add: sdom_iff srange_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   166
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   167
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   168
lemma Var_elim: "[| v \<in> sdom(s); v \<notin> srange(s) |] ==>  v \<notin> vars_of(t \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   169
  by (blast intro: Var_in_srange)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   170
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   171
lemma Var_intro:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   172
    "v \<in> vars_of(t \<lhd> s) \<Longrightarrow> v \<in> srange(s) | v \<in> vars_of(t)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   173
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   174
    apply (auto simp add: sdom_iff srange_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   175
  apply (rule_tac x=a in exI)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   176
  apply auto 
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   177
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   178
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   179
lemma srangeD: "v \<in> srange(s) ==> \<exists>w. w \<in> sdom(s) & v \<in> vars_of(Var(w) \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   180
  by (simp add: srange_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   181
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   182
lemma dom_range_disjoint:
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   183
    "sdom(s) Int srange(s) = {} = (\<forall>t. sdom(s) Int vars_of(t \<lhd> s) = {})"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   184
  apply (simp add: empty_iff_all_not)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   185
  apply (force intro: Var_in_srange dest: srangeD)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   186
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   187
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   188
lemma subst_not_empty: "~ u \<lhd> s = u ==> (\<exists>x. x \<in> sdom(s))"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   189
  by (auto simp add: empty_iff_all_not invariance)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   190
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   191
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   192
lemma id_subst_lemma [simp]: "(M \<lhd> [(x, Var x)]) = M"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   193
  by (induct M) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   194
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
   195
end