src/ZF/UNITY/Follows.thy
changeset 61392 331be2820f90
parent 60770 240563fbf41d
child 67399 eab6ce8368fa
equal deleted inserted replaced
61391:2332d9be352b 61392:331be2820f90
    13   Follows :: "[i, i, i=>i, i=>i] => i"  where
    13   Follows :: "[i, i, i=>i, i=>i] => i"  where
    14   "Follows(A, r, f, g) ==
    14   "Follows(A, r, f, g) ==
    15             Increasing(A, r, g) Int
    15             Increasing(A, r, g) Int
    16             Increasing(A, r,f) Int
    16             Increasing(A, r,f) Int
    17             Always({s \<in> state. <f(s), g(s)>:r}) Int
    17             Always({s \<in> state. <f(s), g(s)>:r}) Int
    18            (\<Inter>k \<in> A. {s \<in> state. <k, g(s)>:r} LeadsTo {s \<in> state. <k,f(s)>:r})"
    18            (\<Inter>k \<in> A. {s \<in> state. <k, g(s)>:r} \<longmapsto>w {s \<in> state. <k,f(s)>:r})"
    19 
    19 
    20 abbreviation
    20 abbreviation
    21   Incr :: "[i=>i]=>i" where
    21   Incr :: "[i=>i]=>i" where
    22   "Incr(f) == Increasing(list(nat), prefix(nat), f)"
    22   "Incr(f) == Increasing(list(nat), prefix(nat), f)"
    23 
    23 
    77 (* comp LeadsTo *)
    77 (* comp LeadsTo *)
    78 
    78 
    79 lemma subset_LeadsTo_comp:
    79 lemma subset_LeadsTo_comp:
    80 "[| mono1(A, r, B, s, h); refl(A,r); trans[B](s);
    80 "[| mono1(A, r, B, s, h); refl(A,r); trans[B](s);
    81         \<forall>x \<in> state. f(x):A & g(x):A |] ==>
    81         \<forall>x \<in> state. f(x):A & g(x):A |] ==>
    82   (\<Inter>j \<in> A. {s \<in> state. <j, g(s)> \<in> r} LeadsTo {s \<in> state. <j,f(s)> \<in> r}) <=
    82   (\<Inter>j \<in> A. {s \<in> state. <j, g(s)> \<in> r} \<longmapsto>w {s \<in> state. <j,f(s)> \<in> r}) <=
    83  (\<Inter>k \<in> B. {x \<in> state. <k, (h comp g)(x)> \<in> s} LeadsTo {x \<in> state. <k, (h comp f)(x)> \<in> s})"
    83  (\<Inter>k \<in> B. {x \<in> state. <k, (h comp g)(x)> \<in> s} \<longmapsto>w {x \<in> state. <k, (h comp f)(x)> \<in> s})"
    84 
    84 
    85 apply (unfold mono1_def metacomp_def, clarify)
    85 apply (unfold mono1_def metacomp_def, clarify)
    86 apply (simp_all (no_asm_use) add: INT_iff)
    86 apply (simp_all (no_asm_use) add: INT_iff)
    87 apply auto
    87 apply auto
    88 apply (rule single_LeadsTo_I)
    88 apply (rule single_LeadsTo_I)
    95 apply blast
    95 apply blast
    96 apply auto
    96 apply auto
    97 done
    97 done
    98 
    98 
    99 lemma imp_LeadsTo_comp:
    99 lemma imp_LeadsTo_comp:
   100 "[| F:(\<Inter>j \<in> A. {s \<in> state. <j, g(s)> \<in> r} LeadsTo {s \<in> state. <j,f(s)> \<in> r});
   100 "[| F:(\<Inter>j \<in> A. {s \<in> state. <j, g(s)> \<in> r} \<longmapsto>w {s \<in> state. <j,f(s)> \<in> r});
   101     mono1(A, r, B, s, h); refl(A,r); trans[B](s);
   101     mono1(A, r, B, s, h); refl(A,r); trans[B](s);
   102     \<forall>x \<in> state. f(x):A & g(x):A |] ==>
   102     \<forall>x \<in> state. f(x):A & g(x):A |] ==>
   103    F:(\<Inter>k \<in> B. {x \<in> state. <k, (h comp g)(x)> \<in> s} LeadsTo {x \<in> state. <k, (h comp f)(x)> \<in> s})"
   103    F:(\<Inter>k \<in> B. {x \<in> state. <k, (h comp g)(x)> \<in> s} \<longmapsto>w {x \<in> state. <k, (h comp f)(x)> \<in> s})"
   104 apply (rule subset_LeadsTo_comp [THEN subsetD], auto)
   104 apply (rule subset_LeadsTo_comp [THEN subsetD], auto)
   105 done
   105 done
   106 
   106 
   107 lemma imp_LeadsTo_comp_right:
   107 lemma imp_LeadsTo_comp_right:
   108 "[| F \<in> Increasing(B, s, g);
   108 "[| F \<in> Increasing(B, s, g);
   109   \<forall>j \<in> A. F: {s \<in> state. <j, f(s)> \<in> r} LeadsTo {s \<in> state. <j,f1(s)> \<in> r};
   109   \<forall>j \<in> A. F: {s \<in> state. <j, f(s)> \<in> r} \<longmapsto>w {s \<in> state. <j,f1(s)> \<in> r};
   110   mono2(A, r, B, s, C, t, h); refl(A, r); refl(B, s); trans[C](t);
   110   mono2(A, r, B, s, C, t, h); refl(A, r); refl(B, s); trans[C](t);
   111   \<forall>x \<in> state. f1(x):A & f(x):A & g(x):B; k \<in> C |] ==>
   111   \<forall>x \<in> state. f1(x):A & f(x):A & g(x):B; k \<in> C |] ==>
   112   F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} LeadsTo {x \<in> state. <k, h(f1(x), g(x))> \<in> t}"
   112   F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} \<longmapsto>w {x \<in> state. <k, h(f1(x), g(x))> \<in> t}"
   113 apply (unfold mono2_def Increasing_def)
   113 apply (unfold mono2_def Increasing_def)
   114 apply (rule single_LeadsTo_I, auto)
   114 apply (rule single_LeadsTo_I, auto)
   115 apply (drule_tac x = "g (sa) " and A = B in bspec)
   115 apply (drule_tac x = "g (sa) " and A = B in bspec)
   116 apply auto
   116 apply auto
   117 apply (drule_tac x = "f (sa) " and P = "%j. F \<in> X(j) \<longmapsto>w Y(j)" for X Y in bspec)
   117 apply (drule_tac x = "f (sa) " and P = "%j. F \<in> X(j) \<longmapsto>w Y(j)" for X Y in bspec)
   127 apply (auto simp add: part_order_def)
   127 apply (auto simp add: part_order_def)
   128 done
   128 done
   129 
   129 
   130 lemma imp_LeadsTo_comp_left:
   130 lemma imp_LeadsTo_comp_left:
   131 "[| F \<in> Increasing(A, r, f);
   131 "[| F \<in> Increasing(A, r, f);
   132   \<forall>j \<in> B. F: {x \<in> state. <j, g(x)> \<in> s} LeadsTo {x \<in> state. <j,g1(x)> \<in> s};
   132   \<forall>j \<in> B. F: {x \<in> state. <j, g(x)> \<in> s} \<longmapsto>w {x \<in> state. <j,g1(x)> \<in> s};
   133   mono2(A, r, B, s, C, t, h); refl(A,r); refl(B, s); trans[C](t);
   133   mono2(A, r, B, s, C, t, h); refl(A,r); refl(B, s); trans[C](t);
   134   \<forall>x \<in> state. f(x):A & g1(x):B & g(x):B; k \<in> C |] ==>
   134   \<forall>x \<in> state. f(x):A & g1(x):B & g(x):B; k \<in> C |] ==>
   135   F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} LeadsTo {x \<in> state. <k, h(f(x), g1(x))> \<in> t}"
   135   F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} \<longmapsto>w {x \<in> state. <k, h(f(x), g1(x))> \<in> t}"
   136 apply (unfold mono2_def Increasing_def)
   136 apply (unfold mono2_def Increasing_def)
   137 apply (rule single_LeadsTo_I, auto)
   137 apply (rule single_LeadsTo_I, auto)
   138 apply (drule_tac x = "f (sa) " and P = "%k. F \<in> Stable (X (k))" for X in bspec)
   138 apply (drule_tac x = "f (sa) " and P = "%k. F \<in> Stable (X (k))" for X in bspec)
   139 apply auto
   139 apply auto
   140 apply (drule_tac x = "g (sa) " in bspec)
   140 apply (drule_tac x = "g (sa) " in bspec)
   151 done
   151 done
   152 
   152 
   153 (**  This general result is used to prove Follows Un, munion, etc. **)
   153 (**  This general result is used to prove Follows Un, munion, etc. **)
   154 lemma imp_LeadsTo_comp2:
   154 lemma imp_LeadsTo_comp2:
   155 "[| F \<in> Increasing(A, r, f1) \<inter>  Increasing(B, s, g);
   155 "[| F \<in> Increasing(A, r, f1) \<inter>  Increasing(B, s, g);
   156   \<forall>j \<in> A. F: {s \<in> state. <j, f(s)> \<in> r} LeadsTo {s \<in> state. <j,f1(s)> \<in> r};
   156   \<forall>j \<in> A. F: {s \<in> state. <j, f(s)> \<in> r} \<longmapsto>w {s \<in> state. <j,f1(s)> \<in> r};
   157   \<forall>j \<in> B. F: {x \<in> state. <j, g(x)> \<in> s} LeadsTo {x \<in> state. <j,g1(x)> \<in> s};
   157   \<forall>j \<in> B. F: {x \<in> state. <j, g(x)> \<in> s} \<longmapsto>w {x \<in> state. <j,g1(x)> \<in> s};
   158   mono2(A, r, B, s, C, t, h); refl(A,r); refl(B, s); trans[C](t);
   158   mono2(A, r, B, s, C, t, h); refl(A,r); refl(B, s); trans[C](t);
   159   \<forall>x \<in> state. f(x):A & g1(x):B & f1(x):A &g(x):B; k \<in> C |]
   159   \<forall>x \<in> state. f(x):A & g1(x):B & f1(x):A &g(x):B; k \<in> C |]
   160   ==> F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} LeadsTo {x \<in> state. <k, h(f1(x), g1(x))> \<in> t}"
   160   ==> F:{x \<in> state. <k, h(f(x), g(x))> \<in> t} \<longmapsto>w {x \<in> state. <k, h(f1(x), g1(x))> \<in> t}"
   161 apply (rule_tac B = "{x \<in> state. <k, h (f1 (x), g (x))> \<in> t}" in LeadsTo_Trans)
   161 apply (rule_tac B = "{x \<in> state. <k, h (f1 (x), g (x))> \<in> t}" in LeadsTo_Trans)
   162 apply (blast intro: imp_LeadsTo_comp_right)
   162 apply (blast intro: imp_LeadsTo_comp_right)
   163 apply (blast intro: imp_LeadsTo_comp_left)
   163 apply (blast intro: imp_LeadsTo_comp_left)
   164 done
   164 done
   165 
   165 
   257  "F :Follows(A, r, f, g) ==> F \<in> Always({s \<in> state. <f(s),g(s)> \<in> r})"
   257  "F :Follows(A, r, f, g) ==> F \<in> Always({s \<in> state. <f(s),g(s)> \<in> r})"
   258 by (unfold Follows_def, blast)
   258 by (unfold Follows_def, blast)
   259 
   259 
   260 lemma Follows_imp_LeadsTo:
   260 lemma Follows_imp_LeadsTo:
   261  "[| F \<in> Follows(A, r, f, g); k \<in> A |]  ==>
   261  "[| F \<in> Follows(A, r, f, g); k \<in> A |]  ==>
   262   F: {s \<in> state. <k,g(s)> \<in> r } LeadsTo {s \<in> state. <k,f(s)> \<in> r}"
   262   F: {s \<in> state. <k,g(s)> \<in> r } \<longmapsto>w {s \<in> state. <k,f(s)> \<in> r}"
   263 by (unfold Follows_def, blast)
   263 by (unfold Follows_def, blast)
   264 
   264 
   265 lemma Follows_LeadsTo_pfixLe:
   265 lemma Follows_LeadsTo_pfixLe:
   266      "[| F \<in> Follows(list(nat), gen_prefix(nat, Le), f, g); k \<in> list(nat) |]
   266      "[| F \<in> Follows(list(nat), gen_prefix(nat, Le), f, g); k \<in> list(nat) |]
   267    ==> F \<in> {s \<in> state. k pfixLe g(s)} LeadsTo {s \<in> state. k pfixLe f(s)}"
   267    ==> F \<in> {s \<in> state. k pfixLe g(s)} \<longmapsto>w {s \<in> state. k pfixLe f(s)}"
   268 by (blast intro: Follows_imp_LeadsTo)
   268 by (blast intro: Follows_imp_LeadsTo)
   269 
   269 
   270 lemma Follows_LeadsTo_pfixGe:
   270 lemma Follows_LeadsTo_pfixGe:
   271      "[| F \<in> Follows(list(nat), gen_prefix(nat, Ge), f, g); k \<in> list(nat) |]
   271      "[| F \<in> Follows(list(nat), gen_prefix(nat, Ge), f, g); k \<in> list(nat) |]
   272    ==> F \<in> {s \<in> state. k pfixGe g(s)} LeadsTo {s \<in> state. k pfixGe f(s)}"
   272    ==> F \<in> {s \<in> state. k pfixGe g(s)} \<longmapsto>w {s \<in> state. k pfixGe f(s)}"
   273 by (blast intro: Follows_imp_LeadsTo)
   273 by (blast intro: Follows_imp_LeadsTo)
   274 
   274 
   275 lemma Always_Follows1:
   275 lemma Always_Follows1:
   276 "[| F \<in> Always({s \<in> state. f(s) = g(s)}); F \<in> Follows(A, r, f, h);
   276 "[| F \<in> Always({s \<in> state. f(s) = g(s)}); F \<in> Follows(A, r, f, h);
   277     \<forall>x \<in> state. g(x):A |] ==> F \<in> Follows(A, r, g, h)"
   277     \<forall>x \<in> state. g(x):A |] ==> F \<in> Follows(A, r, g, h)"