src/HOL/Subst/Subst.thy
author paulson
Tue, 29 Mar 2005 12:30:48 +0200
changeset 15635 8408a06590a6
parent 5184 9b8547a9496a
child 15648 f6da795ee27a
permissions -rw-r--r--
converted HOL-Subst to tactic scripts
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
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3842
diff changeset
    23
primrec
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    24
  subst_Var:      "(Var v <| s) = assoc v (Var v) s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    25
  subst_Const:  "(Const c <| s) = Const c"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    26
  subst_Comb:  "(Comb M N <| s) = Comb (M <| s) (N <| s)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    27
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    28
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    29
defs 
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    30
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    31
  subst_eq_def:  "r =$= s == ALL t. t <| r = t <| s"
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    32
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    33
  comp_def:    "al <> bl == alist_rec al bl (%x y xs g. (x,y <| bl)#g)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    34
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    35
  sdom_def:
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    36
  "sdom(al) == alist_rec al {}  
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    37
                (%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
    38
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    39
  srange_def:
3192
a75558a4ed37 New version, modified by Konrad Slind and LCP for TFL
paulson
parents: 1476
diff changeset
    40
   "srange(al) == Union({y. EX x:sdom(al). y=vars_of(Var(x) <| al)})"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    41
15635
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    42
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
subsection{*Basic Laws*}
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
lemma subst_Nil [simp]: "t <| [] = t"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    47
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    48
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    49
lemma subst_mono [rule_format]: "t <: u --> t <| s <: u <| s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    50
by (induct_tac "u", auto)
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
lemma Var_not_occs [rule_format]:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    53
     "~ (Var(v) <: t) --> t <| (v,t <| s) # s = t <| s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    54
apply (case_tac "t = Var v")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    55
apply (erule_tac [2] rev_mp)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    56
apply (rule_tac [2] P = "%x.~x=Var (v) --> ~ (Var (v) <: x) --> x <| (v,t<|s) #s=x<|s" in uterm.induct)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    57
apply auto 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    58
done
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 agreement: "(t <|r = t <|s) = (\<forall>v. v : vars_of(t) --> Var(v) <|r = Var(v) <|s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    61
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    62
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    63
lemma repl_invariance: "~ v: vars_of(t) ==> t <| (v,u)#s = t <| s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    64
by (simp add: agreement)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    65
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    66
lemma Var_in_subst [rule_format]:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    67
     "v : vars_of(t) --> w : vars_of(t <| (v,Var(w))#s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    68
by (induct_tac "t", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    69
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    70
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    71
subsection{*Equality between Substitutions*}
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
lemma subst_eq_iff: "r =$= s = (\<forall>t. t <| r = t <| s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    74
by (simp add: subst_eq_def)
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 subst_refl [iff]: "r =$= r"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    77
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    78
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    79
lemma subst_sym: "r =$= s ==> s =$= r"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    80
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    81
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    82
lemma subst_trans: "[| q =$= r; r =$= s |] ==> q =$= s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    83
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    84
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    85
lemma subst_subst2:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    86
    "[| r =$= s; P (t <| r) (u <| r) |] ==> P (t <| s) (u <| s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    87
by (simp add: subst_eq_def)
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
lemmas ssubst_subst2 = subst_sym [THEN subst_subst2]
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    90
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    91
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    92
subsection{*Composition of Substitutions*}
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    93
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    94
lemma [simp]: 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    95
     "[] <> bl = bl"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    96
     "((a,b)#al) <> bl = (a,b <| bl) # (al <> bl)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    97
     "sdom([]) = {}"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
    98
     "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
    99
by (simp_all add: comp_def sdom_def) 
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
lemma comp_Nil [simp]: "s <> [] = s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   102
by (induct "s", auto)
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 subst_comp_Nil: "s =$= s <> []"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   105
by simp
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   106
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   107
lemma subst_comp [simp]: "(t <| r <> s) = (t <| r <| s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   108
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   109
apply (simp_all (no_asm_simp))
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   110
apply (induct "r", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   111
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   112
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   113
lemma comp_assoc: "(q <> r) <> s =$= q <> (r <> s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   114
apply (simp (no_asm) add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   115
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   116
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   117
lemma subst_cong:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   118
     "[| theta =$= theta1; sigma =$= sigma1|] 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   119
      ==> (theta <> sigma) =$= (theta1 <> sigma1)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   120
by (simp add: subst_eq_def)
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   123
lemma Cons_trivial: "(w, Var(w) <| s) # s =$= s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   124
apply (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   125
apply (rule allI)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   126
apply (induct_tac "t", simp_all)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   127
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   128
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   129
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   130
lemma comp_subst_subst: "q <> r =$= s ==>  t <| q <| r = t <| s"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   131
by (simp add: subst_eq_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   132
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   133
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   134
subsection{*Domain and range of Substitutions*}
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
lemma sdom_iff: "(v : sdom(s)) = (Var(v) <| s ~= Var(v))"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   137
apply (induct "s")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   138
apply (case_tac [2] a, auto)  
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   139
done
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
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   142
lemma srange_iff: 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   143
   "v : srange(s) = (\<exists>w. w : sdom(s) & v : vars_of(Var(w) <| s))"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   144
by (auto simp add: srange_def)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   145
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   146
lemma empty_iff_all_not: "(A = {}) = (ALL a.~ a:A)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   147
by (unfold empty_def, blast)
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 invariance: "(t <| s = t) = (sdom(s) Int vars_of(t) = {})"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   150
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   151
apply (auto simp add: empty_iff_all_not sdom_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   152
done
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 Var_in_srange [rule_format]:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   155
     "v : sdom(s) -->  v : vars_of(t <| s) --> v : srange(s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   156
apply (induct_tac "t")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   157
apply (case_tac "a : sdom (s) ")
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   158
apply (auto simp add: sdom_iff srange_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   159
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   160
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   161
lemma Var_elim: "[| v : sdom(s); v ~: srange(s) |] ==>  v ~: vars_of(t <| s)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   162
by (blast intro: Var_in_srange)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   163
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   164
lemma Var_intro [rule_format]:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   165
     "v : vars_of(t <| s) --> v : srange(s) | v : vars_of(t)"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   166
apply (induct_tac "t")
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
apply (rule_tac x=a in exI, auto) 
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   169
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   170
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   171
lemma srangeD [rule_format]:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   172
     "v : srange(s) --> (\<exists>w. w : sdom(s) & v : vars_of(Var(w) <| s))"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   173
apply (simp (no_asm) add: srange_iff)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   174
done
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   175
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   176
lemma dom_range_disjoint:
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   177
     "sdom(s) Int srange(s) = {} = (\<forall>t. sdom(s) Int vars_of(t <| s) = {})"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   178
apply (simp (no_asm) add: empty_iff_all_not)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   179
apply (force intro: Var_in_srange dest: srangeD)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   180
done
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 subst_not_empty: "~ u <| s = u ==> (\<exists>x. x : sdom(s))"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   183
by (auto simp add: empty_iff_all_not invariance)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   184
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   185
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   186
lemma id_subst_lemma [simp]: "(M <| [(x, Var x)]) = M"
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   187
by (induct_tac "M", auto)
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   188
8408a06590a6 converted HOL-Subst to tactic scripts
paulson
parents: 5184
diff changeset
   189
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
   190
end