src/HOL/Subst/Subst.thy
author bulwahn
Fri, 11 Mar 2011 15:21:13 +0100
changeset 41919 e180c2a9873b
parent 38140 05691ad74079
permissions -rw-r--r--
correcting dependencies after renaming
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
     1
(*  Title:      HOL/Subst/Subst.thy
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1266
diff changeset
     2
    Author:     Martin Coen, Cambridge University Computer Laboratory
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     3
    Copyright   1993  University of Cambridge
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     4
*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     5
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
     6
header {* Substitutions on uterms *}
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     7
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     8
theory Subst
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
     9
imports AList UTerm
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    10
begin
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    11
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    12
primrec
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    13
  subst :: "'a uterm => ('a * 'a uterm) list => 'a uterm"  (infixl "<|" 55)
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    14
where
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    15
  subst_Var: "(Var v <| s) = assoc v (Var v) s"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    16
| subst_Const: "(Const c <| s) = Const c"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    17
| subst_Comb: "(Comb M N <| s) = Comb (M <| s) (N <| s)"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    18
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    19
notation (xsymbols)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    20
  subst  (infixl "\<lhd>" 55)
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    21
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    22
definition
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    23
  subst_eq :: "[('a*('a uterm)) list,('a*('a uterm)) list] => bool"  (infixr "=$=" 52)
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    24
  where "r =$= s \<longleftrightarrow> (\<forall>t. t \<lhd> r = t \<lhd> s)"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    25
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 24823
diff changeset
    26
notation (xsymbols)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    27
  subst_eq  (infixr "\<doteq>" 52)
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    28
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    29
definition
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    30
  comp :: "('a * 'a uterm) list \<Rightarrow> ('a * 'a uterm) list \<Rightarrow> ('a* 'a uterm) list"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    31
    (infixl "<>" 56)
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    32
  where "al <> bl = alist_rec al bl (%x y xs g. (x,y \<lhd> bl) # g)"
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    33
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 24823
diff changeset
    34
notation (xsymbols)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    35
  comp  (infixl "\<lozenge>" 56)
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    36
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    37
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    38
  sdom :: "('a*('a uterm)) list => 'a set" where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    39
  "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
    40
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    41
definition
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    42
  srange :: "('a*('a uterm)) list => 'a set" where
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    43
  "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
    44
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    45
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    46
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    47
subsection {* Basic Laws *}
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    48
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    49
lemma subst_Nil [simp]: "t \<lhd> [] = t"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    50
  by (induct t) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    51
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    52
lemma subst_mono: "t \<prec> u \<Longrightarrow> t \<lhd> s \<prec> u \<lhd> s"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    53
  by (induct u) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    54
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    55
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
    56
  apply (case_tac "t = Var v")
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    57
   prefer 2
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    58
   apply (erule rev_mp)+
38140
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    59
   apply (rule_tac P = "%x. x \<noteq> Var v \<longrightarrow> ~(Var v \<prec> x) \<longrightarrow> x \<lhd> (v,t\<lhd>s) #s = x\<lhd>s" 
05691ad74079 modernized specifications;
wenzelm
parents: 25382
diff changeset
    60
     in uterm.induct)
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    61
     apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    62
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    63
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    64
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
    65
  by (induct t) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    66
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    67
lemma repl_invariance: "~ v: vars_of t ==> t \<lhd> (v,u)#s = t \<lhd> s"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    68
  by (simp add: agreement)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    69
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    70
lemma Var_in_subst:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    71
    "v \<in> vars_of(t) --> w \<in> vars_of(t \<lhd> (v,Var(w))#s)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    72
  by (induct t) auto
15635
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    75
subsection{*Equality between Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    76
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    77
lemma subst_eq_iff: "r \<doteq> s = (\<forall>t. t \<lhd> r = t \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    78
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    79
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    80
lemma subst_refl [iff]: "r \<doteq> r"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    81
  by (simp add: subst_eq_iff)
15635
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_sym: "r \<doteq> s ==> s \<doteq> r"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    84
  by (simp add: subst_eq_iff)
15635
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_trans: "[| q \<doteq> r; r \<doteq> s |] ==> q \<doteq> s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    87
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    88
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    89
lemma subst_subst2:
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
    90
    "[| 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
    91
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    92
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    93
lemma ssubst_subst2:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
    94
    "[| 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
    95
  by (simp add: subst_eq_def)
15635
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    98
subsection{*Composition of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    99
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   100
lemma [simp]: 
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   101
     "[] \<lozenge> bl = bl"
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   102
     "((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
   103
     "sdom([]) = {}"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   104
     "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
   105
  by (simp_all add: comp_def sdom_def) 
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   106
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   107
lemma comp_Nil [simp]: "s \<lozenge> [] = s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   108
  by (induct s) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   109
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   110
lemma subst_comp_Nil: "s \<doteq> s \<lozenge> []"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   111
  by simp
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   112
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   113
lemma subst_comp [simp]: "(t \<lhd> r \<lozenge> s) = (t \<lhd> r \<lhd> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   114
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   115
  apply simp_all
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   116
  apply (induct r)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   117
   apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   118
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   119
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   120
lemma comp_assoc: "(q \<lozenge> r) \<lozenge> s \<doteq> q \<lozenge> (r \<lozenge> s)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   121
  by (simp add: subst_eq_iff)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   122
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   123
lemma subst_cong:
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   124
  "[| theta \<doteq> theta1; sigma \<doteq> sigma1|] 
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   125
    ==> (theta \<lozenge> sigma) \<doteq> (theta1 \<lozenge> sigma1)"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   126
  by (simp add: subst_eq_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   127
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   128
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   129
lemma Cons_trivial: "(w, Var(w) \<lhd> s) # s \<doteq> s"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   130
  apply (simp add: subst_eq_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   131
  apply (rule allI)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   132
  apply (induct_tac t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   133
    apply simp_all
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   134
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   135
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   136
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   137
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
   138
  by (simp add: subst_eq_iff)
15635
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   141
subsection{*Domain and range of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   142
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   143
lemma sdom_iff: "(v \<in> sdom(s)) = (Var(v) \<lhd> s ~= Var(v))"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   144
  apply (induct s)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   145
   apply (case_tac [2] a)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   146
   apply auto
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   147
  done
15635
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   150
lemma srange_iff: 
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   151
    "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
   152
  by (auto simp add: srange_def)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   153
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   154
lemma empty_iff_all_not: "(A = {}) = (ALL a.~ a:A)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   155
  unfolding empty_def by blast
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   156
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   157
lemma invariance: "(t \<lhd> s = t) = (sdom(s) Int vars_of(t) = {})"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   158
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   159
    apply (auto simp add: empty_iff_all_not sdom_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   160
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   161
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   162
lemma Var_in_srange:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   163
    "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
   164
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   165
    apply (case_tac "a \<in> sdom s")
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   166
  apply (auto simp add: sdom_iff srange_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   167
  done
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   168
15648
f6da795ee27a x-symbols and other tidying
paulson
parents: 15635
diff changeset
   169
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
   170
  by (blast intro: Var_in_srange)
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   171
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   172
lemma Var_intro:
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   173
    "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
   174
  apply (induct t)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   175
    apply (auto simp add: sdom_iff srange_iff)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   176
  apply (rule_tac x=a in exI)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   177
  apply auto 
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   178
  done
15635
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)"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
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:
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   184
    "sdom(s) Int srange(s) = {} = (\<forall>t. sdom(s) Int vars_of(t \<lhd> s) = {})"
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   185
  apply (simp add: empty_iff_all_not)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   186
  apply (force intro: Var_in_srange dest: srangeD)
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   187
  done
15635
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))"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   190
  by (auto simp add: empty_iff_all_not invariance)
15635
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"
24823
bfb619994060 modernized specifications;
wenzelm
parents: 15648
diff changeset
   194
  by (induct M) auto
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   195
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
   196
end