Theory axioms

(*
Title:  Allen's qualitative temporal calculus
Author:  Fadoua Ghourabi (fadouaghourabi@gmail.com)
Affiliation: Ochanomizu University, Japan
*)



theory axioms

imports
    Main  xor_cal

begin


section ‹Axioms›

text‹We formalize Allen's definition of theory of time in term of intervals (Allen, 1983). 
Two relations, namely meets and equality, are defined between intervals. Two interval meets if they  are adjacent 
A set of 5 axioms ((M1) $\sim$ (M5)) are then defined based on relation meets.›

text‹We define a class interval whose assumptions are (i) properties of relations meets  and, (ii) axioms (M1) $\sim$ (M5).›

class interval =
 fixes
  meets::"'a  'a  bool"  (infixl  60) and
  ::"'a  bool"
 assumes
  meets_atrans:"(pq);(qr)  ¬(pr)" and
  meets_irrefl:" p  ¬(pp)" and
  meets_asym:"(pq)  ¬(qp)" and
  meets_wd:"pq   p   q" and
(**** Time axioms ******)
  M1:"(pq); (ps); (rq)  (rs)" and
  M2:"(pq) ; (rs)  ps  ((t. (pt)(ts))  (t. (rt)(tq)))" and
  M3:" p  (q r. qp  pr)" and
  M4:"pq ; qs ; pr ; rs  q = r"  and
  M5exist:"pq  (r s t. rp  pq  qs  rt  ts)" 
(**********)

lemma  (in interval) trans2:"pt; tr; rq  ¬pq"
  using M1 meets_asym by blast

lemma (in interval) nontrans1: "ur  ¬ (t. ut  tr)"
  using meets_atrans by blast
 
lemma (in interval) nontrans2:"ur  ¬ (t. rt  tu)"
  using M1 M5exist trans2 by blast

lemma (in interval) nonmeets1:"¬ (ur  ru)" 
  using meets_asym by blast

lemma (in interval)  nonmeets2: " u ;  r   ¬ (ur  u = r)" 
  using meets_irrefl by blast

lemma (in interval) nonmeets3: "¬ (ur  (p. up  pr))" 
  using nontrans1 by blast

lemma (in interval) nonmeets4: "¬(ur  (p. rp  pu))" 
  using nontrans2 by blast

lemma (in interval) elimmeets: "(p  s  (t. p  t  t  s)  (t. r  t  t  q)) = False"
  using meets_atrans by blast 

lemma (in interval) M5exist_var:
assumes "xy" "yz" "zw"
shows "t. xt  tw"
proof -
  from assms(1,3) have a:"xw  (t. xt  tw)  (t. zt  ty)" using M2[of x y z w] by auto
  from assms have b1:"¬xw" using trans2 by blast
  from assms(2) have "¬ (t. zt  ty)" by (simp add: nontrans2)
  with b1 a have " (t. xt  tw)" by simp
  thus ?thesis by simp
qed

lemma (in interval) M5exist_var2:
assumes "pq"
shows "r1 r2 r3 s t. r1r2  r2r3  r3p  pq  qs  r1t  ts"
proof -
  from assms obtain r3 k1 s  where r3p:"r3p" and  qs:"qs"  and  r3k1:"r3 k1"  and  k1s:"k1s" using M5exist by blast 
  from r3p obtain r2 where r2r3:"r2r3" using M3[of r3] meets_wd by auto
  from r2r3 obtain r1 where r1r2:"r1r2" using M3[of r2] meets_wd by auto
  with  assms  r2r3 r3p qs obtain t where r1t1:"r1t" and t1q:"ts" using M5exist_var by blast
  with assms r1r2 r2r3 r3p qs show ?thesis by blast
qed
  
lemma (in interval) M5exist_var3:
assumes "kl" and "lq" and "qt" and "tr" 
shows  "lqt. klqt  lqtr"
proof -
  from assms(1-3) obtain lq where "klq" and "lqt" 
  using M5exist_var by blast 
  with assms(4) obtain lqt where "klqt" and "lqtr" 
  using M5exist_var by blast
  thus ?thesis by auto
qed


end