src/HOL/ex/Unification.thy
 changeset 44367 74c08021ab2e parent 42463 f270e3e18be5 child 44368 91e8062605d5
```     1.1 --- a/src/HOL/ex/Unification.thy	Sun Aug 21 11:03:15 2011 -0700
1.2 +++ b/src/HOL/ex/Unification.thy	Sun Aug 21 22:13:04 2011 +0200
1.3 @@ -29,7 +29,7 @@
1.4  datatype 'a trm =
1.5    Var 'a
1.6    | Const 'a
1.7 -  | App "'a trm" "'a trm" (infix "\<cdot>" 60)
1.8 +  | Comb "'a trm" "'a trm" (infix "\<cdot>" 60)
1.9
1.10  type_synonym 'a subst = "('a \<times> 'a trm) list"
1.11
1.12 @@ -42,38 +42,38 @@
1.13
1.14  text {* Applying a substitution to a term: *}
1.15
1.16 -fun apply_subst :: "'a trm \<Rightarrow> 'a subst \<Rightarrow> 'a trm" (infixl "\<triangleleft>" 60)
1.17 +primrec subst :: "'a trm \<Rightarrow> 'a subst \<Rightarrow> 'a trm" (infixl "\<lhd>" 55)
1.18  where
1.19 -  "(Var v) \<triangleleft> s = assoc v (Var v) s"
1.20 -| "(Const c) \<triangleleft> s = (Const c)"
1.21 -| "(M \<cdot> N) \<triangleleft> s = (M \<triangleleft> s) \<cdot> (N \<triangleleft> s)"
1.22 +  "(Var v) \<lhd> s = assoc v (Var v) s"
1.23 +| "(Const c) \<lhd> s = (Const c)"
1.24 +| "(M \<cdot> N) \<lhd> s = (M \<lhd> s) \<cdot> (N \<lhd> s)"
1.25
1.26  text {* Composition of substitutions: *}
1.27
1.28  fun
1.29 -  "compose" :: "'a subst \<Rightarrow> 'a subst \<Rightarrow> 'a subst" (infixl "\<bullet>" 80)
1.30 +  comp :: "'a subst \<Rightarrow> 'a subst \<Rightarrow> 'a subst" (infixl "\<lozenge>" 56)
1.31  where
1.32 -  "[] \<bullet> bl = bl"
1.33 -| "((a,b) # al) \<bullet> bl = (a, b \<triangleleft> bl) # (al \<bullet> bl)"
1.34 +  "[] \<lozenge> bl = bl"
1.35 +| "((a,b) # al) \<lozenge> bl = (a, b \<lhd> bl) # (al \<lozenge> bl)"
1.36
1.37  text {* Equivalence of substitutions: *}
1.38
1.39 -definition eqv (infix "=\<^sub>s" 50)
1.40 +definition subst_eq (infixr "\<doteq>" 52)
1.41  where
1.42 -  "s1 =\<^sub>s s2 \<equiv> \<forall>t. t \<triangleleft> s1 = t \<triangleleft> s2"
1.43 +  "s1 \<doteq> s2 \<equiv> \<forall>t. t \<lhd> s1 = t \<lhd> s2"
1.44
1.45
1.46  subsection {* Basic lemmas *}
1.47
1.48 -lemma apply_empty[simp]: "t \<triangleleft> [] = t"
1.49 +lemma apply_empty[simp]: "t \<lhd> [] = t"
1.50  by (induct t) auto
1.51
1.52 -lemma compose_empty[simp]: "\<sigma> \<bullet> [] = \<sigma>"
1.53 +lemma compose_empty[simp]: "\<sigma> \<lozenge> [] = \<sigma>"
1.54  by (induct \<sigma>) auto
1.55
1.56 -lemma apply_compose[simp]: "t \<triangleleft> (s1 \<bullet> s2) = t \<triangleleft> s1 \<triangleleft> s2"
1.57 +lemma apply_compose[simp]: "t \<lhd> (s1 \<lozenge> s2) = t \<lhd> s1 \<lhd> s2"
1.58  proof (induct t)
1.59 -  case App thus ?case by simp
1.60 +  case Comb thus ?case by simp
1.61  next
1.62    case Const thus ?case by simp
1.63  next
1.64 @@ -85,39 +85,39 @@
1.65    qed
1.66  qed
1.67
1.68 -lemma eqv_refl[intro]: "s =\<^sub>s s"
1.69 -  by (auto simp:eqv_def)
1.70 +lemma eqv_refl[intro]: "s \<doteq> s"
1.71 +  by (auto simp:subst_eq_def)
1.72
1.73 -lemma eqv_trans[trans]: "\<lbrakk>s1 =\<^sub>s s2; s2 =\<^sub>s s3\<rbrakk> \<Longrightarrow> s1 =\<^sub>s s3"
1.74 -  by (auto simp:eqv_def)
1.75 +lemma eqv_trans[trans]: "\<lbrakk>s1 \<doteq> s2; s2 \<doteq> s3\<rbrakk> \<Longrightarrow> s1 \<doteq> s3"
1.76 +  by (auto simp:subst_eq_def)
1.77
1.78 -lemma eqv_sym[sym]: "\<lbrakk>s1 =\<^sub>s s2\<rbrakk> \<Longrightarrow> s2 =\<^sub>s s1"
1.79 -  by (auto simp:eqv_def)
1.80 +lemma eqv_sym[sym]: "\<lbrakk>s1 \<doteq> s2\<rbrakk> \<Longrightarrow> s2 \<doteq> s1"
1.81 +  by (auto simp:subst_eq_def)
1.82
1.83 -lemma eqv_intro[intro]: "(\<And>t. t \<triangleleft> \<sigma> = t \<triangleleft> \<theta>) \<Longrightarrow> \<sigma> =\<^sub>s \<theta>"
1.84 -  by (auto simp:eqv_def)
1.85 +lemma eqv_intro[intro]: "(\<And>t. t \<lhd> \<sigma> = t \<lhd> \<theta>) \<Longrightarrow> \<sigma> \<doteq> \<theta>"
1.86 +  by (auto simp:subst_eq_def)
1.87
1.88 -lemma eqv_dest[dest]: "s1 =\<^sub>s s2 \<Longrightarrow> t \<triangleleft> s1 = t \<triangleleft> s2"
1.89 -  by (auto simp:eqv_def)
1.90 +lemma eqv_dest[dest]: "s1 \<doteq> s2 \<Longrightarrow> t \<lhd> s1 = t \<lhd> s2"
1.91 +  by (auto simp:subst_eq_def)
1.92
1.93 -lemma compose_eqv: "\<lbrakk>\<sigma> =\<^sub>s \<sigma>'; \<theta> =\<^sub>s \<theta>'\<rbrakk> \<Longrightarrow> (\<sigma> \<bullet> \<theta>) =\<^sub>s (\<sigma>' \<bullet> \<theta>')"
1.94 -  by (auto simp:eqv_def)
1.95 +lemma compose_eqv: "\<lbrakk>\<sigma> \<doteq> \<sigma>'; \<theta> \<doteq> \<theta>'\<rbrakk> \<Longrightarrow> (\<sigma> \<lozenge> \<theta>) \<doteq> (\<sigma>' \<lozenge> \<theta>')"
1.96 +  by (auto simp:subst_eq_def)
1.97
1.98 -lemma compose_assoc: "(a \<bullet> b) \<bullet> c =\<^sub>s a \<bullet> (b \<bullet> c)"
1.99 +lemma compose_assoc: "(a \<lozenge> b) \<lozenge> c \<doteq> a \<lozenge> (b \<lozenge> c)"
1.100    by auto
1.101
1.102
1.103  subsection {* Specification: Most general unifiers *}
1.104
1.105  definition
1.106 -  "Unifier \<sigma> t u \<equiv> (t\<triangleleft>\<sigma> = u\<triangleleft>\<sigma>)"
1.107 +  "Unifier \<sigma> t u \<equiv> (t\<lhd>\<sigma> = u\<lhd>\<sigma>)"
1.108
1.109  definition
1.110    "MGU \<sigma> t u \<equiv> Unifier \<sigma> t u \<and> (\<forall>\<theta>. Unifier \<theta> t u
1.111 -  \<longrightarrow> (\<exists>\<gamma>. \<theta> =\<^sub>s \<sigma> \<bullet> \<gamma>))"
1.112 +  \<longrightarrow> (\<exists>\<gamma>. \<theta> \<doteq> \<sigma> \<lozenge> \<gamma>))"
1.113
1.114  lemma MGUI[intro]:
1.115 -  "\<lbrakk>t \<triangleleft> \<sigma> = u \<triangleleft> \<sigma>; \<And>\<theta>. t \<triangleleft> \<theta> = u \<triangleleft> \<theta> \<Longrightarrow> \<exists>\<gamma>. \<theta> =\<^sub>s \<sigma> \<bullet> \<gamma>\<rbrakk>
1.116 +  "\<lbrakk>t \<lhd> \<sigma> = u \<lhd> \<sigma>; \<And>\<theta>. t \<lhd> \<theta> = u \<lhd> \<theta> \<Longrightarrow> \<exists>\<gamma>. \<theta> \<doteq> \<sigma> \<lozenge> \<gamma>\<rbrakk>
1.117    \<Longrightarrow> MGU \<sigma> t u"
1.118    by (simp only:Unifier_def MGU_def, auto)
1.119
1.120 @@ -130,11 +130,11 @@
1.121
1.122  text {* Occurs check: Proper subterm relation *}
1.123
1.124 -fun occ :: "'a trm \<Rightarrow> 'a trm \<Rightarrow> bool"
1.125 +fun occs :: "'a trm \<Rightarrow> 'a trm \<Rightarrow> bool" (infixl "<:" 54)
1.126  where
1.127 -  "occ u (Var v) = False"
1.128 -| "occ u (Const c) = False"
1.129 -| "occ u (M \<cdot> N) = (u = M \<or> u = N \<or> occ u M \<or> occ u N)"
1.130 +  "occs u (Var v) = False"
1.131 +| "occs u (Const c) = False"
1.132 +| "occs u (M \<cdot> N) = (u = M \<or> u = N \<or> occs u M \<or> occs u N)"
1.133
1.134  text {* The unification algorithm: *}
1.135
1.136 @@ -143,41 +143,41 @@
1.137    "unify (Const c) (M \<cdot> N)   = None"
1.138  | "unify (M \<cdot> N)   (Const c) = None"
1.139  | "unify (Const c) (Var v)   = Some [(v, Const c)]"
1.140 -| "unify (M \<cdot> N)   (Var v)   = (if (occ (Var v) (M \<cdot> N))
1.141 +| "unify (M \<cdot> N)   (Var v)   = (if (occs (Var v) (M \<cdot> N))
1.142                                          then None
1.143                                          else Some [(v, M \<cdot> N)])"
1.144 -| "unify (Var v)   M         = (if (occ (Var v) M)
1.145 +| "unify (Var v)   M         = (if (occs (Var v) M)
1.146                                          then None
1.147                                          else Some [(v, M)])"
1.148  | "unify (Const c) (Const d) = (if c=d then Some [] else None)"
1.149  | "unify (M \<cdot> N) (M' \<cdot> N') = (case unify M M' of
1.150                                      None \<Rightarrow> None |
1.151 -                                    Some \<theta> \<Rightarrow> (case unify (N \<triangleleft> \<theta>) (N' \<triangleleft> \<theta>)
1.152 +                                    Some \<theta> \<Rightarrow> (case unify (N \<lhd> \<theta>) (N' \<lhd> \<theta>)
1.153                                        of None \<Rightarrow> None |
1.154 -                                         Some \<sigma> \<Rightarrow> Some (\<theta> \<bullet> \<sigma>)))"
1.155 +                                         Some \<sigma> \<Rightarrow> Some (\<theta> \<lozenge> \<sigma>)))"
1.156    by pat_completeness auto
1.157
1.158  declare unify.psimps[simp]
1.159
1.160  subsection {* Partial correctness *}
1.161
1.162 -text {* Some lemmas about occ and MGU: *}
1.163 +text {* Some lemmas about occs and MGU: *}
1.164
1.165 -lemma subst_no_occ: "\<not>occ (Var v) t \<Longrightarrow> Var v \<noteq> t
1.166 -  \<Longrightarrow> t \<triangleleft> [(v,s)] = t"
1.167 +lemma subst_no_occs: "\<not>occs (Var v) t \<Longrightarrow> Var v \<noteq> t
1.168 +  \<Longrightarrow> t \<lhd> [(v,s)] = t"
1.169  by (induct t) auto
1.170
1.171  lemma MGU_Var[intro]:
1.172 -  assumes no_occ: "\<not>occ (Var v) t"
1.173 +  assumes no_occs: "\<not>occs (Var v) t"
1.174    shows "MGU [(v,t)] (Var v) t"
1.175  proof (intro MGUI exI)
1.176 -  show "Var v \<triangleleft> [(v,t)] = t \<triangleleft> [(v,t)]" using no_occ
1.177 -    by (cases "Var v = t", auto simp:subst_no_occ)
1.178 +  show "Var v \<lhd> [(v,t)] = t \<lhd> [(v,t)]" using no_occs
1.179 +    by (cases "Var v = t", auto simp:subst_no_occs)
1.180  next
1.181 -  fix \<theta> assume th: "Var v \<triangleleft> \<theta> = t \<triangleleft> \<theta>"
1.182 -  show "\<theta> =\<^sub>s [(v,t)] \<bullet> \<theta>"
1.183 +  fix \<theta> assume th: "Var v \<lhd> \<theta> = t \<lhd> \<theta>"
1.184 +  show "\<theta> \<doteq> [(v,t)] \<lozenge> \<theta>"
1.185    proof
1.186 -    fix s show "s \<triangleleft> \<theta> = s \<triangleleft> [(v,t)] \<bullet> \<theta>" using th
1.187 +    fix s show "s \<lhd> \<theta> = s \<lhd> [(v,t)] \<lozenge> \<theta>" using th
1.188        by (induct s) auto
1.189    qed
1.190  qed
1.191 @@ -200,42 +200,42 @@
1.192
1.193    then obtain \<theta>1 \<theta>2
1.194      where "unify M M' = Some \<theta>1"
1.195 -    and "unify (N \<triangleleft> \<theta>1) (N' \<triangleleft> \<theta>1) = Some \<theta>2"
1.196 -    and \<sigma>: "\<sigma> = \<theta>1 \<bullet> \<theta>2"
1.197 +    and "unify (N \<lhd> \<theta>1) (N' \<lhd> \<theta>1) = Some \<theta>2"
1.198 +    and \<sigma>: "\<sigma> = \<theta>1 \<lozenge> \<theta>2"
1.199      and MGU_inner: "MGU \<theta>1 M M'"
1.200 -    and MGU_outer: "MGU \<theta>2 (N \<triangleleft> \<theta>1) (N' \<triangleleft> \<theta>1)"
1.201 +    and MGU_outer: "MGU \<theta>2 (N \<lhd> \<theta>1) (N' \<lhd> \<theta>1)"
1.202      by (auto split:option.split_asm)
1.203
1.204    show ?case
1.205    proof
1.206      from MGU_inner and MGU_outer
1.207 -    have "M \<triangleleft> \<theta>1 = M' \<triangleleft> \<theta>1"
1.208 -      and "N \<triangleleft> \<theta>1 \<triangleleft> \<theta>2 = N' \<triangleleft> \<theta>1 \<triangleleft> \<theta>2"
1.209 +    have "M \<lhd> \<theta>1 = M' \<lhd> \<theta>1"
1.210 +      and "N \<lhd> \<theta>1 \<lhd> \<theta>2 = N' \<lhd> \<theta>1 \<lhd> \<theta>2"
1.211        unfolding MGU_def Unifier_def
1.212        by auto
1.213 -    thus "M \<cdot> N \<triangleleft> \<sigma> = M' \<cdot> N' \<triangleleft> \<sigma>" unfolding \<sigma>
1.214 +    thus "M \<cdot> N \<lhd> \<sigma> = M' \<cdot> N' \<lhd> \<sigma>" unfolding \<sigma>
1.215        by simp
1.216    next
1.217 -    fix \<sigma>' assume "M \<cdot> N \<triangleleft> \<sigma>' = M' \<cdot> N' \<triangleleft> \<sigma>'"
1.218 -    hence "M \<triangleleft> \<sigma>' = M' \<triangleleft> \<sigma>'"
1.219 -      and Ns: "N \<triangleleft> \<sigma>' = N' \<triangleleft> \<sigma>'" by auto
1.220 +    fix \<sigma>' assume "M \<cdot> N \<lhd> \<sigma>' = M' \<cdot> N' \<lhd> \<sigma>'"
1.221 +    hence "M \<lhd> \<sigma>' = M' \<lhd> \<sigma>'"
1.222 +      and Ns: "N \<lhd> \<sigma>' = N' \<lhd> \<sigma>'" by auto
1.223
1.224      with MGU_inner obtain \<delta>
1.225 -      where eqv: "\<sigma>' =\<^sub>s \<theta>1 \<bullet> \<delta>"
1.226 +      where eqv: "\<sigma>' \<doteq> \<theta>1 \<lozenge> \<delta>"
1.227        unfolding MGU_def Unifier_def
1.228        by auto
1.229
1.230 -    from Ns have "N \<triangleleft> \<theta>1 \<triangleleft> \<delta> = N' \<triangleleft> \<theta>1 \<triangleleft> \<delta>"
1.231 +    from Ns have "N \<lhd> \<theta>1 \<lhd> \<delta> = N' \<lhd> \<theta>1 \<lhd> \<delta>"
1.233
1.234      with MGU_outer obtain \<rho>
1.235 -      where eqv2: "\<delta> =\<^sub>s \<theta>2 \<bullet> \<rho>"
1.236 +      where eqv2: "\<delta> \<doteq> \<theta>2 \<lozenge> \<rho>"
1.237        unfolding MGU_def Unifier_def
1.238        by auto
1.239
1.240 -    have "\<sigma>' =\<^sub>s \<sigma> \<bullet> \<rho>" unfolding \<sigma>
1.241 +    have "\<sigma>' \<doteq> \<sigma> \<lozenge> \<rho>" unfolding \<sigma>
1.242        by (rule eqv_intro, auto simp:eqv_dest[OF eqv] eqv_dest[OF eqv2])
1.243 -    thus "\<exists>\<gamma>. \<sigma>' =\<^sub>s \<sigma> \<bullet> \<gamma>" ..
1.244 +    thus "\<exists>\<gamma>. \<sigma>' \<doteq> \<sigma> \<lozenge> \<gamma>" ..
1.245    qed
1.246  qed (auto split:split_if_asm) -- "Solve the remaining cases automatically"
1.247
1.248 @@ -256,50 +256,50 @@
1.249  text {* Elimination of variables by a substitution: *}
1.250
1.251  definition
1.252 -  "elim \<sigma> v \<equiv> \<forall>t. v \<notin> vars_of (t \<triangleleft> \<sigma>)"
1.253 +  "elim \<sigma> v \<equiv> \<forall>t. v \<notin> vars_of (t \<lhd> \<sigma>)"
1.254
1.255 -lemma elim_intro[intro]: "(\<And>t. v \<notin> vars_of (t \<triangleleft> \<sigma>)) \<Longrightarrow> elim \<sigma> v"
1.256 +lemma elim_intro[intro]: "(\<And>t. v \<notin> vars_of (t \<lhd> \<sigma>)) \<Longrightarrow> elim \<sigma> v"
1.257    by (auto simp:elim_def)
1.258
1.259 -lemma elim_dest[dest]: "elim \<sigma> v \<Longrightarrow> v \<notin> vars_of (t \<triangleleft> \<sigma>)"
1.260 +lemma elim_dest[dest]: "elim \<sigma> v \<Longrightarrow> v \<notin> vars_of (t \<lhd> \<sigma>)"
1.261    by (auto simp:elim_def)
1.262
1.263 -lemma elim_eqv: "\<sigma> =\<^sub>s \<theta> \<Longrightarrow> elim \<sigma> x = elim \<theta> x"
1.264 -  by (auto simp:elim_def eqv_def)
1.265 +lemma elim_eqv: "\<sigma> \<doteq> \<theta> \<Longrightarrow> elim \<sigma> x = elim \<theta> x"
1.266 +  by (auto simp:elim_def subst_eq_def)
1.267
1.268
1.269  text {* Replacing a variable by itself yields an identity subtitution: *}
1.270
1.271 -lemma var_self[intro]: "[(v, Var v)] =\<^sub>s []"
1.272 +lemma var_self[intro]: "[(v, Var v)] \<doteq> []"
1.273  proof
1.274 -  fix t show "t \<triangleleft> [(v, Var v)] = t \<triangleleft> []"
1.275 +  fix t show "t \<lhd> [(v, Var v)] = t \<lhd> []"
1.276      by (induct t) simp_all
1.277  qed
1.278
1.279 -lemma var_same: "([(v, t)] =\<^sub>s []) = (t = Var v)"
1.280 +lemma var_same: "([(v, t)] \<doteq> []) = (t = Var v)"
1.281  proof
1.282    assume t_v: "t = Var v"
1.283 -  thus "[(v, t)] =\<^sub>s []"
1.284 +  thus "[(v, t)] \<doteq> []"
1.285      by auto
1.286  next
1.287 -  assume id: "[(v, t)] =\<^sub>s []"
1.288 +  assume id: "[(v, t)] \<doteq> []"
1.289    show "t = Var v"
1.290    proof -
1.291 -    have "t = Var v \<triangleleft> [(v, t)]" by simp
1.292 -    also from id have "\<dots> = Var v \<triangleleft> []" ..
1.293 +    have "t = Var v \<lhd> [(v, t)]" by simp
1.294 +    also from id have "\<dots> = Var v \<lhd> []" ..
1.295      finally show ?thesis by simp
1.296    qed
1.297  qed
1.298
1.299 -text {* A lemma about occ and elim *}
1.300 +text {* A lemma about occs and elim *}
1.301
1.302  lemma remove_var:
1.303    assumes [simp]: "v \<notin> vars_of s"
1.304 -  shows "v \<notin> vars_of (t \<triangleleft> [(v, s)])"
1.305 +  shows "v \<notin> vars_of (t \<lhd> [(v, s)])"
1.306    by (induct t) simp_all
1.307
1.308 -lemma occ_elim: "\<not>occ (Var v) t
1.309 -  \<Longrightarrow> elim [(v,t)] v \<or> [(v,t)] =\<^sub>s []"
1.310 +lemma occs_elim: "\<not>occs (Var v) t
1.311 +  \<Longrightarrow> elim [(v,t)] v \<or> [(v,t)] \<doteq> []"
1.312  proof (induct t)
1.313    case (Var x)
1.314    show ?case
1.315 @@ -319,29 +319,29 @@
1.316      by (auto intro!:remove_var)
1.317    thus ?case ..
1.318  next
1.319 -  case (App M N)
1.320 +  case (Comb M N)
1.321
1.322 -  hence ih1: "elim [(v, M)] v \<or> [(v, M)] =\<^sub>s []"
1.323 -    and ih2: "elim [(v, N)] v \<or> [(v, N)] =\<^sub>s []"
1.324 -    and nonocc: "Var v \<noteq> M" "Var v \<noteq> N"
1.325 +  hence ih1: "elim [(v, M)] v \<or> [(v, M)] \<doteq> []"
1.326 +    and ih2: "elim [(v, N)] v \<or> [(v, N)] \<doteq> []"
1.327 +    and nonoccs: "Var v \<noteq> M" "Var v \<noteq> N"
1.328      by auto
1.329
1.330 -  from nonocc have "\<not> [(v,M)] =\<^sub>s []"
1.331 +  from nonoccs have "\<not> [(v,M)] \<doteq> []"
1.333    with ih1 have "elim [(v, M)] v" by blast
1.334 -  hence "v \<notin> vars_of (Var v \<triangleleft> [(v,M)])" ..
1.335 +  hence "v \<notin> vars_of (Var v \<lhd> [(v,M)])" ..
1.336    hence not_in_M: "v \<notin> vars_of M" by simp
1.337
1.338 -  from nonocc have "\<not> [(v,N)] =\<^sub>s []"
1.339 +  from nonoccs have "\<not> [(v,N)] \<doteq> []"
1.341    with ih2 have "elim [(v, N)] v" by blast
1.342 -  hence "v \<notin> vars_of (Var v \<triangleleft> [(v,N)])" ..
1.343 +  hence "v \<notin> vars_of (Var v \<lhd> [(v,N)])" ..
1.344    hence not_in_N: "v \<notin> vars_of N" by simp
1.345
1.346    have "elim [(v, M \<cdot> N)] v"
1.347    proof
1.348      fix t
1.349 -    show "v \<notin> vars_of (t \<triangleleft> [(v, M \<cdot> N)])"
1.350 +    show "v \<notin> vars_of (t \<lhd> [(v, M \<cdot> N)])"
1.351      proof (induct t)
1.352        case (Var x) thus ?case by (simp add: not_in_M not_in_N)
1.353      qed auto
1.354 @@ -354,7 +354,7 @@
1.355  lemma unify_vars:
1.356    assumes "unify_dom (M, N)"
1.357    assumes "unify M N = Some \<sigma>"
1.358 -  shows "vars_of (t \<triangleleft> \<sigma>) \<subseteq> vars_of M \<union> vars_of N \<union> vars_of t"
1.359 +  shows "vars_of (t \<lhd> \<sigma>) \<subseteq> vars_of M \<union> vars_of N \<union> vars_of t"
1.360    (is "?P M N \<sigma> t")
1.361  using assms
1.362  proof (induct M N arbitrary:\<sigma> t)
1.363 @@ -363,45 +363,45 @@
1.364    thus ?case by (induct t) auto
1.365  next
1.366    case (4 M N v)
1.367 -  hence "\<not>occ (Var v) (M\<cdot>N)" by (cases "occ (Var v) (M\<cdot>N)", auto)
1.368 +  hence "\<not>occs (Var v) (M\<cdot>N)" by (cases "occs (Var v) (M\<cdot>N)", auto)
1.369    with 4 have "\<sigma> = [(v, M\<cdot>N)]" by simp
1.370    thus ?case by (induct t) auto
1.371  next
1.372    case (5 v M)
1.373 -  hence "\<not>occ (Var v) M" by (cases "occ (Var v) M", auto)
1.374 +  hence "\<not>occs (Var v) M" by (cases "occs (Var v) M", auto)
1.375    with 5 have "\<sigma> = [(v, M)]" by simp
1.376    thus ?case by (induct t) auto
1.377  next
1.378    case (7 M N M' N' \<sigma>)
1.379    then obtain \<theta>1 \<theta>2
1.380      where "unify M M' = Some \<theta>1"
1.381 -    and "unify (N \<triangleleft> \<theta>1) (N' \<triangleleft> \<theta>1) = Some \<theta>2"
1.382 -    and \<sigma>: "\<sigma> = \<theta>1 \<bullet> \<theta>2"
1.383 +    and "unify (N \<lhd> \<theta>1) (N' \<lhd> \<theta>1) = Some \<theta>2"
1.384 +    and \<sigma>: "\<sigma> = \<theta>1 \<lozenge> \<theta>2"
1.385      and ih1: "\<And>t. ?P M M' \<theta>1 t"
1.386 -    and ih2: "\<And>t. ?P (N\<triangleleft>\<theta>1) (N'\<triangleleft>\<theta>1) \<theta>2 t"
1.387 +    and ih2: "\<And>t. ?P (N\<lhd>\<theta>1) (N'\<lhd>\<theta>1) \<theta>2 t"
1.388      by (auto split:option.split_asm)
1.389
1.390    show ?case
1.391    proof
1.392 -    fix v assume a: "v \<in> vars_of (t \<triangleleft> \<sigma>)"
1.393 +    fix v assume a: "v \<in> vars_of (t \<lhd> \<sigma>)"
1.394
1.395      show "v \<in> vars_of (M \<cdot> N) \<union> vars_of (M' \<cdot> N') \<union> vars_of t"
1.396      proof (cases "v \<notin> vars_of M \<and> v \<notin> vars_of M'
1.397          \<and> v \<notin> vars_of N \<and> v \<notin> vars_of N'")
1.398        case True
1.399 -      with ih1 have l:"\<And>t. v \<in> vars_of (t \<triangleleft> \<theta>1) \<Longrightarrow> v \<in> vars_of t"
1.400 +      with ih1 have l:"\<And>t. v \<in> vars_of (t \<lhd> \<theta>1) \<Longrightarrow> v \<in> vars_of t"
1.401          by auto
1.402
1.403 -      from a and ih2[where t="t \<triangleleft> \<theta>1"]
1.404 -      have "v \<in> vars_of (N \<triangleleft> \<theta>1) \<union> vars_of (N' \<triangleleft> \<theta>1)
1.405 -        \<or> v \<in> vars_of (t \<triangleleft> \<theta>1)" unfolding \<sigma>
1.406 +      from a and ih2[where t="t \<lhd> \<theta>1"]
1.407 +      have "v \<in> vars_of (N \<lhd> \<theta>1) \<union> vars_of (N' \<lhd> \<theta>1)
1.408 +        \<or> v \<in> vars_of (t \<lhd> \<theta>1)" unfolding \<sigma>
1.409          by auto
1.410        hence "v \<in> vars_of t"
1.411        proof
1.412 -        assume "v \<in> vars_of (N \<triangleleft> \<theta>1) \<union> vars_of (N' \<triangleleft> \<theta>1)"
1.413 +        assume "v \<in> vars_of (N \<lhd> \<theta>1) \<union> vars_of (N' \<lhd> \<theta>1)"
1.414          with True show ?thesis by (auto dest:l)
1.415        next
1.416 -        assume "v \<in> vars_of (t \<triangleleft> \<theta>1)"
1.417 +        assume "v \<in> vars_of (t \<lhd> \<theta>1)"
1.418          thus ?thesis by (rule l)
1.419        qed
1.420
1.421 @@ -417,7 +417,7 @@
1.422  lemma unify_eliminates:
1.423    assumes "unify_dom (M, N)"
1.424    assumes "unify M N = Some \<sigma>"
1.425 -  shows "(\<exists>v\<in>vars_of M \<union> vars_of N. elim \<sigma> v) \<or> \<sigma> =\<^sub>s []"
1.426 +  shows "(\<exists>v\<in>vars_of M \<union> vars_of N. elim \<sigma> v) \<or> \<sigma> \<doteq> []"
1.427    (is "?P M N \<sigma>")
1.428  using assms
1.429  proof (induct M N arbitrary:\<sigma>)
1.430 @@ -426,21 +426,21 @@
1.431    case 2 thus ?case by simp
1.432  next
1.433    case (3 c v)
1.434 -  have no_occ: "\<not> occ (Var v) (Const c)" by simp
1.435 +  have no_occs: "\<not> occs (Var v) (Const c)" by simp
1.436    with 3 have "\<sigma> = [(v, Const c)]" by simp
1.437 -  with occ_elim[OF no_occ]
1.438 +  with occs_elim[OF no_occs]
1.439    show ?case by auto
1.440  next
1.441    case (4 M N v)
1.442 -  hence no_occ: "\<not>occ (Var v) (M\<cdot>N)" by (cases "occ (Var v) (M\<cdot>N)", auto)
1.443 +  hence no_occs: "\<not>occs (Var v) (M\<cdot>N)" by (cases "occs (Var v) (M\<cdot>N)", auto)
1.444    with 4 have "\<sigma> = [(v, M\<cdot>N)]" by simp
1.445 -  with occ_elim[OF no_occ]
1.446 +  with occs_elim[OF no_occs]
1.447    show ?case by auto
1.448  next
1.449    case (5 v M)
1.450 -  hence no_occ: "\<not>occ (Var v) M" by (cases "occ (Var v) M", auto)
1.451 +  hence no_occs: "\<not>occs (Var v) M" by (cases "occs (Var v) M", auto)
1.452    with 5 have "\<sigma> = [(v, M)]" by simp
1.453 -  with occ_elim[OF no_occ]
1.454 +  with occs_elim[OF no_occs]
1.455    show ?case by auto
1.456  next
1.457    case (6 c d) thus ?case
1.458 @@ -449,43 +449,43 @@
1.459    case (7 M N M' N' \<sigma>)
1.460    then obtain \<theta>1 \<theta>2
1.461      where "unify M M' = Some \<theta>1"
1.462 -    and "unify (N \<triangleleft> \<theta>1) (N' \<triangleleft> \<theta>1) = Some \<theta>2"
1.463 -    and \<sigma>: "\<sigma> = \<theta>1 \<bullet> \<theta>2"
1.464 +    and "unify (N \<lhd> \<theta>1) (N' \<lhd> \<theta>1) = Some \<theta>2"
1.465 +    and \<sigma>: "\<sigma> = \<theta>1 \<lozenge> \<theta>2"
1.466      and ih1: "?P M M' \<theta>1"
1.467 -    and ih2: "?P (N\<triangleleft>\<theta>1) (N'\<triangleleft>\<theta>1) \<theta>2"
1.468 +    and ih2: "?P (N\<lhd>\<theta>1) (N'\<lhd>\<theta>1) \<theta>2"
1.469      by (auto split:option.split_asm)
1.470
1.471    from `unify_dom (M \<cdot> N, M' \<cdot> N')`
1.472    have "unify_dom (M, M')"
1.473      by (rule accp_downward) (rule unify_rel.intros)
1.474    hence no_new_vars:
1.475 -    "\<And>t. vars_of (t \<triangleleft> \<theta>1) \<subseteq> vars_of M \<union> vars_of M' \<union> vars_of t"
1.476 +    "\<And>t. vars_of (t \<lhd> \<theta>1) \<subseteq> vars_of M \<union> vars_of M' \<union> vars_of t"
1.477      by (rule unify_vars) (rule `unify M M' = Some \<theta>1`)
1.478
1.479    from ih2 show ?case
1.480    proof
1.481 -    assume "\<exists>v\<in>vars_of (N \<triangleleft> \<theta>1) \<union> vars_of (N' \<triangleleft> \<theta>1). elim \<theta>2 v"
1.482 +    assume "\<exists>v\<in>vars_of (N \<lhd> \<theta>1) \<union> vars_of (N' \<lhd> \<theta>1). elim \<theta>2 v"
1.483      then obtain v
1.484 -      where "v\<in>vars_of (N \<triangleleft> \<theta>1) \<union> vars_of (N' \<triangleleft> \<theta>1)"
1.485 +      where "v\<in>vars_of (N \<lhd> \<theta>1) \<union> vars_of (N' \<lhd> \<theta>1)"
1.486        and el: "elim \<theta>2 v" by auto
1.487      with no_new_vars show ?thesis unfolding \<sigma>
1.488        by (auto simp:elim_def)
1.489    next
1.490 -    assume empty[simp]: "\<theta>2 =\<^sub>s []"
1.491 +    assume empty[simp]: "\<theta>2 \<doteq> []"
1.492
1.493 -    have "\<sigma> =\<^sub>s (\<theta>1 \<bullet> [])" unfolding \<sigma>
1.494 +    have "\<sigma> \<doteq> (\<theta>1 \<lozenge> [])" unfolding \<sigma>
1.495        by (rule compose_eqv) auto
1.496 -    also have "\<dots> =\<^sub>s \<theta>1" by auto
1.497 -    finally have "\<sigma> =\<^sub>s \<theta>1" .
1.498 +    also have "\<dots> \<doteq> \<theta>1" by auto
1.499 +    finally have "\<sigma> \<doteq> \<theta>1" .
1.500
1.501      from ih1 show ?thesis
1.502      proof
1.503        assume "\<exists>v\<in>vars_of M \<union> vars_of M'. elim \<theta>1 v"
1.504 -      with elim_eqv[OF `\<sigma> =\<^sub>s \<theta>1`]
1.505 +      with elim_eqv[OF `\<sigma> \<doteq> \<theta>1`]
1.506        show ?thesis by auto
1.507      next
1.508 -      note `\<sigma> =\<^sub>s \<theta>1`
1.509 -      also assume "\<theta>1 =\<^sub>s []"
1.510 +      note `\<sigma> \<doteq> \<theta>1`
1.511 +      also assume "\<theta>1 \<doteq> []"
1.512        finally show ?thesis ..
1.513      qed
1.514    qed
1.515 @@ -509,7 +509,7 @@
1.516      "unify M M' = Some \<theta>"
1.517
1.518    from unify_eliminates[OF inner]
1.519 -  show "((N \<triangleleft> \<theta>, N' \<triangleleft> \<theta>), (M \<cdot> N, M' \<cdot> N')) \<in>?R"
1.520 +  show "((N \<lhd> \<theta>, N' \<lhd> \<theta>), (M \<cdot> N, M' \<cdot> N')) \<in>?R"
1.521    proof
1.522      -- {* Either a variable is eliminated \ldots *}
1.523      assume "(\<exists>v\<in>vars_of M \<union> vars_of M'. elim \<theta> v)"
1.524 @@ -517,7 +517,7 @@
1.525        where "elim \<theta> v"
1.526        and "v\<in>vars_of M \<union> vars_of M'" by auto
1.527      with unify_vars[OF inner]
1.528 -    have "vars_of (N\<triangleleft>\<theta>) \<union> vars_of (N'\<triangleleft>\<theta>)
1.529 +    have "vars_of (N\<lhd>\<theta>) \<union> vars_of (N'\<lhd>\<theta>)
1.530        \<subset> vars_of (M\<cdot>N) \<union> vars_of (M'\<cdot>N')"
1.531        by auto
1.532
1.533 @@ -525,9 +525,9 @@
1.534        by (auto intro!: measures_less intro: psubset_card_mono)
1.535    next
1.536      -- {* Or the substitution is empty *}
1.537 -    assume "\<theta> =\<^sub>s []"
1.538 -    hence "N \<triangleleft> \<theta> = N"
1.539 -      and "N' \<triangleleft> \<theta> = N'" by auto
1.540 +    assume "\<theta> \<doteq> []"
1.541 +    hence "N \<lhd> \<theta> = N"
1.542 +      and "N' \<lhd> \<theta> = N'" by auto
1.543      thus ?thesis
1.544         by (auto intro!: measures_less intro: psubset_card_mono)
1.545    qed
```