Unification/Disagreement.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 12 Sep 2013 17:21:37 +0100
changeset 218 ff8f9b596281
parent 107 5c816239deaa
permissions -rw-r--r--
added
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
theory Disagreement = Main + Swap + Atoms:
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
consts 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
  ds :: "(string \<times> string) list \<Rightarrow> (string \<times> string) list \<Rightarrow> string set"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
defs   
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
  ds_def: "ds xs ys  \<equiv>  { a . a \<in> (atms xs \<union> atms ys) \<and> (swapas xs a \<noteq> swapas ys a) }"
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
lemma 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  ds_elem: "\<lbrakk>swapas pi a\<noteq>a\<rbrakk>\<Longrightarrow>a\<in>ds [] pi"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
apply(simp add: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
apply(auto simp add: swapas_pi_ineq_a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
done
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
lemma 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  elem_ds: "\<lbrakk>a\<in>ds [] pi\<rbrakk>\<Longrightarrow>a\<noteq>swapas pi a"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
apply(simp add: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
lemma 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  ds_sym: "ds pi1 pi2 = ds pi2 pi1"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
apply(simp only: ds_def)
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
lemma 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  ds_trans: "c\<in>ds pi1 pi3\<longrightarrow>(c\<in>ds pi1 pi2 \<or> c\<in>ds pi2 pi3)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
apply(drule a_not_in_atms[THEN mp])+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
apply(drule a_not_in_atms[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
apply(drule swapas_pi_ineq_a[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
lemma ds_cancel_pi_left: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  "(c\<in> ds (pi1@pi) (pi2@pi)) \<longrightarrow> (swapas pi c\<in> ds pi1 pi2)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
apply(simp_all add: swapas_append)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
apply(rule a_ineq_swapas_pi[THEN mp], clarify, drule a_not_in_atms[THEN mp], simp)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
lemma ds_cancel_pi_right: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  "(swapas pi c\<in> ds pi1 pi2) \<longrightarrow> (c\<in> ds (pi1@pi) (pi2@pi))"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
apply(simp_all add: swapas_append)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
apply(rule a_ineq_swapas_pi[THEN mp],clarify,
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
      drule a_not_in_atms[THEN mp],drule a_not_in_atms[THEN mp],simp)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
lemma ds_equality: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  "(ds [] pi)-{a,swapas pi a} = (ds [] ((a,swapas pi a)#pi))-{swapas pi a}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
lemma ds_7: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  "\<lbrakk>b\<noteq> swapas pi b;a\<in>ds [] ((b,swapas pi b)#pi)\<rbrakk>\<Longrightarrow>a\<in>ds [] pi"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
apply(case_tac "b=a")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
apply(rule swapas_pi_in_atms)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
apply(drule a_ineq_swapas_pi[THEN mp])
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
apply(assumption)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
apply(drule sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
apply(drule swapas_rev_pi_a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
apply(simp)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
apply(case_tac "swapas pi b = a")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
apply(drule sym)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
apply(drule swapas_rev_pi_a)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
apply(simp)
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 ds_cancel_pi_front: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  "ds (pi@pi1) (pi@pi2) = ds pi1 pi2"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
apply(simp only: ds_def)
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
apply(simp_all add: swapas_append)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
apply(rule swapas_pi_ineq_a[THEN mp], clarify, drule a_not_in_atms[THEN mp], simp)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
apply(drule swapas_rev_pi_a, simp)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
lemma ds_rev_pi_pi: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  "ds ((rev pi1)@pi1) pi2 = ds [] pi2"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
apply(simp_all add: swapas_append)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
apply(drule a_ineq_swapas_pi[THEN mp], assumption)+
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
lemma ds_rev: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  "ds [] ((rev pi1)@pi2) = ds pi1 pi2"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
apply(subgoal_tac "ds pi1 pi2 = ds ((rev pi1)@pi1) ((rev pi1)@pi2)")
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
apply(simp add: ds_rev_pi_pi)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
apply(simp only: ds_cancel_pi_front)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
lemma ds_acabbc: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  "\<lbrakk>a\<noteq>b;b\<noteq>c;c\<noteq>a\<rbrakk>\<Longrightarrow>ds [] [(a, c), (a, b), (b, c)] = {a, b}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
lemma ds_baab: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
  "\<lbrakk>a\<noteq>b\<rbrakk>\<Longrightarrow>ds [] [(b, a), (a, b)] = {}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
lemma ds_abab: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
  "\<lbrakk>a\<noteq>b\<rbrakk>\<Longrightarrow>ds [] [(a, b), (a, b)] = {}"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
apply(simp only: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
(* disagreement set as list *)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
consts flatten :: "(string \<times> string)list \<Rightarrow> string list"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
primrec 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
"flatten []     = []"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
"flatten (x#xs) = (fst x)#(snd x)#(flatten xs)"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
consts ds_list :: "(string \<times> string)list \<Rightarrow> (string \<times> string)list \<Rightarrow> string list"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
defs ds_list_def: "ds_list pi1 pi2 \<equiv> remdups ([x:(flatten (pi1@pi2)). x\<in>ds pi1 pi2])"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
lemma set_flatten_eq_atms: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  "set (flatten pi) = atms pi"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
apply(induct_tac pi)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
lemma ds_list_equ_ds: 
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
  "set (ds_list pi1 pi2) = ds pi1 pi2"
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
apply(auto)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
apply(simp add: ds_list_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
apply(simp add: ds_list_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
apply(simp add: set_flatten_eq_atms)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
apply(simp add: ds_def)
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
done
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
5c816239deaa added Unification subdirectory
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
end