Unification/Termination.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 22 Dec 2012 14:15:32 +0000
changeset 172 b82bb37cf1d3
parent 107 5c816239deaa
permissions -rw-r--r--
typo
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 Termination = Main + Terms + Fresh + Equ + Substs + Mgu:
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
(* set of variables *)
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
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  vars_trm    :: "trm \<Rightarrow> string set"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  vars_eprobs :: "eprobs \<Rightarrow> (string set)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  "vars_trm (Unit)       = {}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  "vars_trm (Atom a)     = {}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  "vars_trm (Susp pi X)  = {X}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
  "vars_trm (Paar t1 t2) = (vars_trm t1)\<union>(vars_trm t2)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  "vars_trm (Abst a t)   = vars_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  "vars_trm (Func F t)   = vars_trm t"
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
  "vars_eprobs [] = {}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  "vars_eprobs (x#xs) = (vars_trm (snd x))\<union>(vars_trm (fst x))\<union>(vars_eprobs xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
lemma[simp]: "vars_trm (swap pi t) = vars_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  size_trm    :: "trm \<Rightarrow> nat"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  size_fprobs :: "fprobs \<Rightarrow> nat"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  size_eprobs :: "eprobs \<Rightarrow> nat"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  size_probs  :: "probs \<Rightarrow> nat"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  "size_trm (Unit)      = 1"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  "size_trm (Atom a)    = 1"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  "size_trm (Susp pi X) = 1"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  "size_trm (Abst a t)  = 1 + size_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  "size_trm (Func F t)  = 1 + size_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  "size_trm (Paar t t') = 1 + (size_trm t) + (size_trm t')"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  "size_fprobs [] = 0"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  "size_fprobs (x#xs) = (size_trm (snd x))+(size_fprobs xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  "size_eprobs [] = 0"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  "size_eprobs (x#xs) = (size_trm (fst x))+(size_trm (snd x))+(size_eprobs xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
lemma[simp]: "size_trm (swap pi t) = size_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
done
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
syntax        
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  "_measure_relation" :: "(nat\<times>nat\<times>nat) \<Rightarrow> (nat\<times>nat\<times>nat) \<Rightarrow> bool" ("_ \<lless> _" [80,80] 80)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
translations
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  "n1 \<lless> n2"  \<rightleftharpoons> "(n1,n2) \<in> (less_than<*lex*>less_than<*lex*>less_than)"
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
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  rank :: "probs \<Rightarrow> (nat\<times>nat\<times>nat)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
primrec
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  "rank (eprobs,fprobs) = (card (vars_eprobs eprobs),size_eprobs eprobs,size_fprobs fprobs)" 
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
lemma[simp]: "finite (vars_trm t)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
apply(induct t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
lemma[simp]: "finite (vars_eprobs P)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
apply(induct_tac P)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
lemma union_comm: "A\<union>(B\<union>C)=(A\<union>B)\<union>C"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
lemma card_union: "\<lbrakk>finite A; finite B\<rbrakk>\<Longrightarrow>(card B < card (A\<union>B)) \<or> (card B = card (A\<union>B))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
apply(rule psubset_card_mono)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
lemma card_insert: "\<lbrakk>finite B\<rbrakk>\<Longrightarrow>(card B < card (insert X B)) \<or> (card B = card (insert X B))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
apply(rule psubset_card_mono)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
apply(auto)
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 subseteq_card: "\<lbrakk>A\<subseteq>B; finite B\<rbrakk>\<Longrightarrow>(card A \<le> card B)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
apply(drule_tac A="A" in card_mono)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
apply(auto simp add: le_eq_less_or_eq)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
lemma not_occurs_trm: "\<not>occurs X t \<longrightarrow> X\<notin> vars_trm t"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
apply(induct_tac t)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
lemma not_occurs_subst: "\<not>occurs X t1\<longrightarrow> X\<notin> vars_trm (subst [(X,swap pi2 t1)] t2)" 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
apply(induct_tac t2)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
apply(auto simp add: subst_susp not_occurs_trm)
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 not_occurs_list: "\<not>occurs X t \<longrightarrow>
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  X\<notin> vars_eprobs (apply_subst_eprobs [(X, swap pi t)] xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
apply(induct_tac xs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
apply(case_tac a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
apply(auto simp add: not_occurs_subst)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
lemma vars_equ: "\<not>occurs X t1 \<and> occurs X t2\<longrightarrow> 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  vars_trm (subst [(X, swap pi t1)] t2)=(vars_trm t1\<union>vars_trm t2)-{X}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
apply(induct_tac t2)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
apply(case_tac "X=list2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
apply(simp add: subst_susp not_occurs_trm)
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(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
apply(rule conjI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
apply(case_tac "occurs X trm2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
apply(force dest: not_occurs_trm[THEN mp] simp add: subst_not_occurs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
apply(force dest: not_occurs_trm[THEN mp] simp add: subst_not_occurs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
lemma vars_subseteq: "\<not>occurs X t \<longrightarrow>
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
  vars_eprobs (apply_subst_eprobs [(X, swap pi t)] xs) \<subseteq> (vars_trm t \<union> vars_eprobs xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
apply(induct_tac xs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
apply(case_tac "occurs X (fst a)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
apply(case_tac "occurs X (snd a)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
apply(simp add: vars_equ[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
apply(simp add: subst_not_occurs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
apply(force simp add: vars_equ)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
apply(case_tac "occurs X (snd a)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
apply(simp add: vars_equ[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
apply(force simp add: subst_not_occurs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
apply(force simp add: subst_not_occurs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
lemma vars_decrease: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
  "\<not>occurs X t\<longrightarrow> card (vars_eprobs (apply_subst_eprobs [(X, swap pi t)] xs))
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
                 <card (insert X (vars_trm t \<union> vars_eprobs xs))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
apply(rule impI)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
apply(case_tac "X\<in>(vars_trm t \<union> vars_eprobs xs)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
(* first case *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
apply(subgoal_tac "insert X (vars_trm t \<union> vars_eprobs xs) = (vars_trm t \<union> vars_eprobs xs)") (*A*)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
apply(frule_tac pi1="pi" and xs1="xs" in vars_subseteq[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
apply(frule_tac pi1="pi" and xs1="xs" in not_occurs_list[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
apply(subgoal_tac "vars_eprobs (apply_subst_eprobs [(X, swap pi t)] xs)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
                   \<subset>  vars_trm t \<union> vars_eprobs xs") (* B *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
apply(simp add: psubset_card_mono)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
(* B *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
(* A *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
(* second case *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
apply(subgoal_tac "finite (vars_trm t \<union> vars_eprobs xs)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
apply(drule_tac x="X" in card_insert_disjoint)
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)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
apply(frule_tac pi1="pi" and xs1="xs" in vars_subseteq[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
apply(auto dest: subseteq_card)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
lemma rank_cred: "\<lbrakk>P1\<turnstile>(nabla)\<rightarrow>P2\<rbrakk>\<Longrightarrow>(rank P2) \<lless> (rank P1)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
apply(ind_cases "P1 \<turnstile> nabla \<rightarrow> P2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
apply(simp_all add: lex_prod_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
lemma rank_sred: "\<lbrakk>P1\<turnstile>(s)\<leadsto>P2\<rbrakk>\<Longrightarrow>(rank P2) \<lless> (rank P1)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
apply(ind_cases "P1 \<turnstile> s \<leadsto> P2")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
apply(simp_all add: lex_prod_def union_comm)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
apply(subgoal_tac 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
  "vars_trm s1\<union>vars_trm t1\<union>vars_trm s2\<union>vars_trm t2\<union>vars_eprobs xs = 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
   vars_trm s1\<union>vars_trm s2\<union>vars_trm t1\<union>vars_trm t2\<union>vars_eprobs xs") (*A*)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
(* A *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
apply(force)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
(* Susp-Susp case *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
apply(simp add: card_insert)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
(* variable elimination cases *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
apply(simp_all add: apply_subst_def vars_decrease)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
lemma rank_trans: "\<lbrakk>rank P1 \<lless> rank P2; rank P2 \<lless> rank P3\<rbrakk>\<Longrightarrow>rank P1 \<lless> rank P3"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
apply(simp add: lex_prod_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
(* all reduction are well-founded under \<lless> *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
lemma rank_red_plus: "\<lbrakk>P1\<Turnstile>(s,nabla)\<Rightarrow>P2\<rbrakk>\<Longrightarrow>(rank P2) \<lless> (rank P1)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
apply(erule red_plus.induct)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
apply(auto dest: rank_sred rank_cred rank_trans)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
end
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205