Unification/Substs.thy
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 19 May 2023 23:34:26 +0100
changeset 632 35a6b918b784
parent 107 5c816239deaa
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
107
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
theory Substs = Main + Terms + PreEqu + Equ:
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
(* substitutions *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
types substs = "(string \<times> trm)list"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  look_up :: "string \<Rightarrow> substs \<Rightarrow> trm"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
primrec 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  "look_up X []     = Susp [] X"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  "look_up X (x#xs) = (if (X = fst x) then (snd x) else look_up X xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  subst :: "substs \<Rightarrow> trm \<Rightarrow> trm"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  subst_unit: "subst s (Unit)          = Unit"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  subst_susp: "subst s (Susp pi X)     = swap pi (look_up X s)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  subst_atom: "subst s (Atom a)        = Atom a" 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  subst_abst: "subst s (Abst a t)      = Abst a (subst s t)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  subst_paar: "subst s (Paar t1 t2)    = Paar (subst s t1) (subst s t2)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  subst_func: "subst s (Func F t)      = Func F (subst s t)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
declare subst_susp [simp del]
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
(* composition of substitutions (adapted from Martin Coen) *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
consts
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  alist_rec :: "substs \<Rightarrow> substs \<Rightarrow> (string\<Rightarrow>trm\<Rightarrow>substs\<Rightarrow>substs\<Rightarrow>substs) \<Rightarrow> substs"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  "alist_rec [] c d = c"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  "alist_rec (p#al) c d = d (fst p) (snd p) al (alist_rec al c d)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  "\<bullet>"   ::  "substs \<Rightarrow> substs \<Rightarrow> substs" (infixl 81)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
defs
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  comp_def: "s1 \<bullet> s2 \<equiv> alist_rec s2 s1 (\<lambda> x y xs g. (x,subst s1 y)#g)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
(* domain of substitutions *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
consts  
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  domn :: "(trm \<Rightarrow> trm) \<Rightarrow> string set"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
defs 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  domn_def: "domn s \<equiv> {X. (s (Susp [] X)) \<noteq> (Susp [] X)}" 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
(* substitutions extending freshness environments *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  ext_subst :: "fresh_envs \<Rightarrow> (trm \<Rightarrow> trm) \<Rightarrow> fresh_envs \<Rightarrow> bool" (" _ \<Turnstile> _ _ " [80,80,80] 80)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
defs 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  ext_subst_def: "nabla1 \<Turnstile> s (nabla2) \<equiv> (\<forall>(a,X)\<in>nabla2. nabla1\<turnstile>a\<sharp> s (Susp [] X))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
(* alpah-equality for substitutions *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  subst_equ :: "fresh_envs \<Rightarrow> (trm\<Rightarrow>trm) \<Rightarrow> (trm\<Rightarrow>trm) \<Rightarrow> bool" (" _ \<Turnstile> _ \<approx> _" [80,80,80] 80)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
defs 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  subst_equ_def: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
  "nabla\<Turnstile> s1 \<approx> s2 \<equiv>  \<forall>X\<in>(domn s1\<union>domn s2). (nabla \<turnstile> s1 (Susp [] X) \<approx> s2 (Susp [] X))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
lemma not_in_domn: "X\<notin>(domn s)\<Longrightarrow> (s (Susp [] X)) = (Susp [] X)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
apply(auto simp only: domn_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
lemma subst_swap_comm: "subst s (swap pi t) = swap pi (subst s t)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
apply(auto simp add: swap_append subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
lemma subst_not_occurs: "\<not>(occurs X t) \<longrightarrow> subst [(X,t2)] t = t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
apply(induct t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
apply(auto simp add: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
lemma [simp]: "subst [] t = t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
apply(induct_tac t, auto simp add: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
lemma [simp]: "subst (s\<bullet>[]) = subst s"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
apply(auto simp add: comp_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
lemma [simp]: "subst ([]\<bullet>s) = subst s"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
apply(rule ext)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
apply(induct_tac x)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
apply(induct_tac s rule: alist_rec.induct)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
apply(auto simp add: comp_def subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
lemma subst_comp_expand: "subst (s1\<bullet>s2) t = subst s1 (subst s2 t)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
apply(induct_tac s2 rule: alist_rec.induct)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
apply(auto simp add: comp_def subst_susp subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
lemma subst_assoc: "subst (s1\<bullet>(s2\<bullet>s3))=subst ((s1\<bullet>s2)\<bullet>s3)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
apply(rule ext)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
apply(induct_tac x)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
apply(simp add: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
lemma fresh_subst: "nabla1\<turnstile>a\<sharp>t\<Longrightarrow> nabla2\<Turnstile>(subst s) nabla1 \<longrightarrow> nabla2\<turnstile>a\<sharp>subst s t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
apply(erule fresh.induct)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
--Susp
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
apply(simp add: ext_subst_def subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
apply(drule_tac x="(swapas (rev pi) a, X)" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
apply(rule fresh_swap_right[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
lemma equ_subst: "nabla1\<turnstile>t1\<approx>t2\<Longrightarrow> nabla2\<Turnstile> (subst s) nabla1 \<longrightarrow> nabla2\<turnstile>(subst s t1)\<approx>(subst s t2)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
apply(erule equ.induct)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
apply(rule_tac "nabla1.1"="nabla" in fresh_subst[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
apply(assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
apply(simp add: subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
-- Susp
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
apply(simp only: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
apply(rule equ_pi1_pi2_add[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
apply(simp only: ext_subst_def subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
lemma unif_1: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
  "\<lbrakk>nabla\<turnstile>subst s (Susp pi X)\<approx>subst s t\<rbrakk>\<Longrightarrow> nabla\<Turnstile> subst (s\<bullet>[(X,swap (rev pi) t)])\<approx>subst s"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
apply(simp only: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
apply(case_tac "pi=[]")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
apply(simp add: subst_susp comp_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
apply(force intro: equ_sym equ_refl)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
apply(subgoal_tac "domn (subst (s\<bullet>[(X,swap (rev pi) t)]))=domn(subst s)\<union>{X}")--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
apply(rule conjI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
apply(simp add: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
apply(simp add: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
apply(simp only: subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
apply(simp only: equ_pi_to_left)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
apply(rule equ_sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
apply(rule ballI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
apply(simp only: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
apply(simp add: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
apply(force intro: equ_sym equ_refl simp add: subst_swap_comm equ_pi_to_left)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
apply(simp only: domn_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
apply(simp add: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
apply(simp add: subst_susp subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
apply(simp only: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
apply(simp add: subst_susp subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
apply(drule swap_empty[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
apply(simp only: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
apply(simp only: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
apply(case_tac "x=X")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
apply(simp add: subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
apply(drule swap_empty[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
apply(simp add: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
lemma subst_equ_a:
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
"\<lbrakk>nabla\<Turnstile>(subst s1) \<approx> (subst s2)\<rbrakk>\<Longrightarrow> \<forall>t2. nabla\<turnstile>(subst s2 t1)\<approx>t2 \<longrightarrow> nabla\<turnstile>(subst s1 t1)\<approx>t2"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
apply(rule allI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
apply(induct t1)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
--Abst.ab
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
apply(ind_cases "nabla \<turnstile> Abst list (subst s1 trm) \<approx> t2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
apply(best)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
--Abst.aa
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
--Susp
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
apply(simp only: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
apply(case_tac "list2\<in>domn (subst s1) \<union> domn (subst s2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
apply(drule_tac x="list2" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
apply(subgoal_tac "nabla \<turnstile> subst s2 (Susp [] list2) \<approx> swap (rev list1) t2")--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
apply(drule_tac "t1.0"="subst s1 (Susp [] list2)" and
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
                "t2.0"="subst s2 (Susp [] list2)" and 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
                "t3.0"="swap (rev list1) t2" in equ_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
apply(simp only: equ_pi_to_right)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
apply(simp add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
apply(simp only: equ_pi_to_right)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
apply(simp add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
apply(erule conjE)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
apply(drule not_in_domn)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
apply(subgoal_tac "subst s1 (Susp list1 list2)=swap list1 (subst s1 (Susp [] list2))")--B
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
apply(subgoal_tac "subst s2 (Susp list1 list2)=swap list1 (subst s2 (Susp [] list2))")--C
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
--BC
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
apply(simp (no_asm) add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
apply(simp (no_asm) add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
--Unit
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
--Atom
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
--Paar
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
apply(ind_cases "nabla \<turnstile> Paar (subst sigma1 trm1) (subst sigma1 trm2) \<approx> t2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
apply(best)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
--Func
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
apply(ind_cases "nabla \<turnstile> Func list (subst sigma1 trm) \<approx> t2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
apply(best)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
lemma unif_2a: "\<lbrakk>nabla\<Turnstile>subst s1\<approx>subst s2\<rbrakk>\<Longrightarrow> 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
                (nabla\<turnstile>subst s2 t1 \<approx> subst s2 t2)\<longrightarrow>(nabla\<turnstile>subst s1 t1 \<approx> subst s1 t2)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
apply(frule_tac "t1.0"="t1" in subst_equ_a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
apply(drule_tac x="subst s2 t2" in spec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
apply(drule equ_sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
apply(drule equ_sym) 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
apply(frule_tac "t1.0"="t2" in subst_equ_a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
apply(drule_tac x="subst s1 t1" in spec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
apply(rule equ_sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
lemma unif_2b: "\<lbrakk>nabla\<Turnstile>subst s1\<approx> subst s2\<rbrakk>\<Longrightarrow>nabla\<turnstile>a\<sharp> subst s2 t\<longrightarrow>nabla\<turnstile>a\<sharp>subst s1 t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
apply(induct t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
--Abst
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
apply(case_tac "a=list")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
apply(force dest!: fresh_abst_ab_elim)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
--Susp
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
apply(subgoal_tac "subst s1 (Susp list1 list2)= swap list1 (subst s1 (Susp [] list2))")--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
apply(subgoal_tac "subst s2 (Susp list1 list2)= swap list1 (subst s2 (Susp [] list2))")--B
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
apply(simp add: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
apply(case_tac "list2\<in>domn (subst s1) \<union> domn (subst s2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
apply(drule_tac x="list2" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
apply(rule fresh_swap_right[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
apply(rule_tac "t1.1"=" subst s2 (Susp [] list2)" in l3_jud[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
apply(rule equ_sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
apply(rule fresh_swap_left[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
apply(erule conjE)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
apply(drule not_in_domn)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
apply(simp add: subst_swap_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
--AB
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
apply(simp (no_asm) add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
apply(simp (no_asm) add: subst_swap_comm[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
--Unit
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
--Atom
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
--Paar
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
apply(force dest!: fresh_paar_elim)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
--Func
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
apply(force dest!:  fresh_func_elim)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
lemma subst_equ_to_trm: "nabla\<Turnstile>subst s1 \<approx> subst s2\<Longrightarrow> nabla\<turnstile>subst s1 t\<approx>subst s2 t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
apply(auto simp add: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
apply(case_tac "list2\<in>domn (subst s1) \<union> domn (subst s2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
apply(simp only: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
apply(simp only: equ_pi_to_left[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
apply(simp only: equ_involutive_left)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
apply(erule conjE)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
apply(drule not_in_domn)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
apply(subgoal_tac "subst s1 (Susp list1 list2)=swap list1 (subst s1 (Susp [] list2))")--A
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
apply(subgoal_tac "subst s2 (Susp list1 list2)=swap list1 (subst s2 (Susp [] list2))")--B
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
apply(rule equ_refl)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
apply(simp (no_asm_use) add: subst_swap_comm[THEN sym])+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
lemma subst_cancel_right: "\<lbrakk>nabla\<Turnstile>(subst s1)\<approx>(subst s2)\<rbrakk>\<Longrightarrow>nabla\<Turnstile>(subst (s1\<bullet>s))\<approx>(subst (s2\<bullet>s))" 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
apply(simp (no_asm) only: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
apply(rule ballI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
apply(simp only: subst_comp_expand)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
apply(rule subst_equ_to_trm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
lemma subst_trans: "\<lbrakk>nabla\<Turnstile>subst s1\<approx>subst s2; nabla\<Turnstile>subst s2\<approx>subst s3\<rbrakk>\<Longrightarrow>nabla\<Turnstile>subst s1\<approx>subst s3"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
apply(simp add: subst_equ_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
apply(case_tac "X \<in>domn (subst s2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
apply(rule_tac "t2.0"="subst s2 (Susp [] X)" in equ_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
apply(assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
apply(case_tac "X \<in>domn (subst s3)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
apply(rule_tac "t2.0"="subst s2 (Susp [] X)" in equ_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
apply(assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
apply(drule not_in_domn)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
apply(case_tac "X \<in>domn (subst s1)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
apply(rule_tac "t2.0"="subst s2 (Susp [] X)" in equ_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
apply(assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
apply(case_tac "X \<in>domn (subst s2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
apply(rule_tac "t2.0"="subst s2 (Susp [] X)" in equ_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
apply(assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
apply(drule not_in_domn)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
apply(rotate_tac 1)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
apply(drule_tac x="X" in bspec)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
(* if occurs holds, then one subterm is equal to (subst s (Susp pi X)) *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
lemma occurs_sub_trm_equ: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
  "occurs X t1 \<longrightarrow> (\<exists>t2\<in>sub_trms (subst s t1). (\<exists>pi.(nabla\<turnstile>subst s (Susp pi1 X)\<approx>(swap pi t2))))" 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
apply(induct_tac t1)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
apply(simp only: subst_susp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
apply(rule_tac x="swap list1 (look_up X s)" in bexI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
apply(rule_tac x="pi1@(rev list1)" in exI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
apply(simp add: swap_append)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
apply(simp add: equ_pi_to_left[THEN sym])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
apply(simp only: equ_involutive_left)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
apply(rule equ_refl)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
apply(rule t_sub_trms_t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
end