Theory Ext_choice_cms

Up to index of Isabelle/HOL/HOL-Complex/CSP-Prover

theory Ext_choice_cms = Ext_choice + Domain_SF_prod_cms:

           (*-------------------------------------------*
            |                CSP-Prover                 |
            |               December 2004               |
            |        Yoshinao Isobe (AIST JAPAN)        |
            *-------------------------------------------*)

theory Ext_choice_cms = Ext_choice + Domain_SF_prod_cms:

(*  The following simplification rules are deleted in this theory file *)
(*  because they unexpectly rewrite UnionT and InterT.                 *)
(*                  disj_not1: (~ P | Q) = (P --> Q)                   *)

declare disj_not1 [simp del]

(*  The following simplification is sometimes unexpected.              *)
(*                                                                     *)
(*             not_None_eq: (x ~= None) = (EX y. x = Some y)           *)

declare not_None_eq [simp del]

(*****************************************************************

         1. [[P [+] Q]]T : non expanding
         2. [[P [+] Q]]F : non expanding
         3. 
         4. 

 *****************************************************************)

(*********************************************************
                   map Ext_choice T
 *********************************************************)

(*** restT (subset) ***)

lemma Ext_choice_restT_sub:
   "[| [[P]]T ev1 rest n <= [[P]]T ev2 rest n ;
       [[Q]]T ev1 rest n <= [[Q]]T ev2 rest n |]
    ==> [[P [+] Q]]T ev1 rest n <= [[P [+] Q]]T ev2 rest n"
apply (simp add: subsetT_iff)
apply (intro allI impI)
apply (simp add: in_restT)
apply (simp add: Ext_choice_memT)
by (auto)

(*** restT (equal) ***)

lemma Ext_choice_restT:
   "[| [[P]]T ev1 rest n = [[P]]T ev2 rest n ;
       [[Q]]T ev1 rest n = [[Q]]T ev2 rest n |]
    ==> [[P [+] Q]]T ev1 rest n = [[P [+] Q]]T ev2 rest n"
apply (rule order_antisym)
by (simp_all add: Ext_choice_restT_sub)

(*** distT lemma ***)

lemma Ext_choice_distT:
"TTs = {([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)}
 ==> (EX TT. TT:TTs & 
             distance([[P [+] Q]]T ev1, [[P [+] Q]]T ev2) 
          <= distance((fst TT), (snd TT)))"
apply (rule rest_to_dist_pair)
by (auto intro: Ext_choice_restT)

(*** map_alpha T lemma ***)

lemma Ext_choice_evalT_map_alpha_lm:
  "[| distance ([[P]]T ev1, [[P]]T ev2) <= alpha * distance (ev1, ev2) ;
      distance ([[Q]]T ev1, [[Q]]T ev2) <= alpha * distance (ev1, ev2) |]
    ==> distance ([[P [+] Q]]T ev1, [[P [+] Q]]T ev2)
     <= alpha * distance (ev1, ev2)"
apply (insert Ext_choice_distT
       [of "{([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)}" P ev1 ev2 Q])
by (auto)

(*** Ext_choice_evalT_map_alpha ***)

lemma Ext_choice_evalT_map_alpha:
 "[| map_alpha [[P]]T alpha ; map_alpha [[Q]]T alpha |]
  ==> map_alpha [[P [+] Q]]T alpha"
apply (simp add: map_alpha_def)
apply (intro allI)
apply (erule conjE)
apply (drule_tac x="x" in spec)
apply (drule_tac x="x" in spec)
apply (drule_tac x="y" in spec)
apply (drule_tac x="y" in spec)
by (simp add: Ext_choice_evalT_map_alpha_lm)

(*** Ext_choice_evalT_non_expanding ***)

lemma Ext_choice_evalT_non_expanding:
 "[| non_expanding [[P]]T ; non_expanding [[Q]]T |]
  ==> non_expanding [[P [+] Q]]T"
by (simp add: non_expanding_def Ext_choice_evalT_map_alpha)

(*** Ext_choice_evalT_contraction_alpha ***)

lemma Ext_choice_evalT_contraction_alpha:
 "[| contraction_alpha [[P]]T alpha; contraction_alpha [[Q]]T alpha|]
  ==> contraction_alpha [[P [+] Q]]T alpha"
by (simp add: contraction_alpha_def Ext_choice_evalT_map_alpha)

(*********************************************************
                   map Ext_choice F
 *********************************************************)

(*** restF (subset) ***)

lemma Ext_choice_restF_sub:
   "[| [[P]]T ev1 rest n <= [[P]]T ev2 rest n ;
       [[Q]]T ev1 rest n <= [[Q]]T ev2 rest n ;
       [[P]]F ev1 rest n <= [[P]]F ev2 rest n ;
       [[Q]]F ev1 rest n <= [[Q]]F ev2 rest n |]
    ==> [[P [+] Q]]F ev1 rest n <= [[P [+] Q]]F ev2 rest n"
apply (simp add: subsetF_iff subsetT_iff)
apply (intro allI impI)
apply (simp add: in_restF in_restT)
apply (simp add: Ext_choice_memF)
apply (elim conjE exE disjE, simp_all)

 apply (simp add: memF_IntF)
 apply (simp add: memF_UnF)
 apply (erule disjE, simp_all)
 apply (simp add: memT_UnT)
 apply (erule disjE, simp_all)

 apply (simp add: memF_UnF)
 apply (rotate_tac 2)
 apply (drule_tac x="s' @t [Tick]t" in spec)
 apply (drule_tac x="s' @t [Tick]t" in spec)
 apply (drule_tac x="X" in spec)
 apply (drule_tac x="X" in spec)
 apply (fast)
done

(*** restF (equal) ***)

lemma Ext_choice_restF:
   "[| [[P]]T ev1 rest n = [[P]]T ev2 rest n ;
       [[Q]]T ev1 rest n = [[Q]]T ev2 rest n ;
       [[P]]F ev1 rest n = [[P]]F ev2 rest n ;
       [[Q]]F ev1 rest n = [[Q]]F ev2 rest n |]
    ==> [[P [+] Q]]F ev1 rest n = [[P [+] Q]]F ev2 rest n"
apply (rule order_antisym)
by (simp_all add: Ext_choice_restF_sub)

(*** distF lemma ***)

lemma Ext_choice_distF:
  "[| TTs = {([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)} ;
      FFs = {([[P]]F ev1, [[P]]F ev2), ([[Q]]F ev1, [[Q]]F ev2)} |]
   ==> (EX TT. TT:TTs & 
               distance([[P [+] Q]]F ev1, [[P [+] Q]]F ev2) 
            <= distance((fst TT), (snd TT))) |
       (EX FF. FF:FFs & 
               distance([[P [+] Q]]F ev1, [[P [+] Q]]F ev2) 
            <= distance((fst FF), (snd FF)))"
apply (rule rest_to_dist_pair_two)
apply (simp_all)
by (auto intro: Ext_choice_restF)

(*** map_alpha F lemma ***)

lemma Ext_choice_evalF_map_alpha_lm:
  "[| distance ([[P]]T ev1, [[P]]T ev2) <= alpha * distance (ev1, ev2) ;
      distance ([[Q]]T ev1, [[Q]]T ev2) <= alpha * distance (ev1, ev2) ;
      distance ([[P]]F ev1, [[P]]F ev2) <= alpha * distance (ev1, ev2) ;
      distance ([[Q]]F ev1, [[Q]]F ev2) <= alpha * distance (ev1, ev2) |]
    ==> distance ([[P [+] Q]]F ev1, [[P [+] Q]]F ev2)
     <= alpha * distance (ev1, ev2)"
apply (insert Ext_choice_distF
       [of "{([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)}" P ev1 ev2 Q
           "{([[P]]F ev1, [[P]]F ev2), ([[Q]]F ev1, [[Q]]F ev2)}"])
by (auto)

(*** Ext_choice_evalF_map_alpha ***)

lemma Ext_choice_evalF_map_alpha:
 "[| map_alpha [[P]]T alpha ; map_alpha [[Q]]T alpha ;
     map_alpha [[P]]F alpha ; map_alpha [[Q]]F alpha |]
  ==> map_alpha [[P [+] Q]]F alpha"
apply (simp add: map_alpha_def)
apply (intro allI)
apply (erule conjE)
apply (drule_tac x="x" in spec)
apply (drule_tac x="x" in spec)
apply (drule_tac x="x" in spec)
apply (drule_tac x="x" in spec)
apply (drule_tac x="y" in spec)
apply (drule_tac x="y" in spec)
apply (drule_tac x="y" in spec)
apply (drule_tac x="y" in spec)
by (simp add: Ext_choice_evalF_map_alpha_lm)

lemma Ext_choice_evalF_non_expanding:
 "[| non_expanding [[P]]T ; non_expanding [[Q]]T ;
     non_expanding [[P]]F ; non_expanding [[Q]]F |]
  ==> non_expanding [[P [+] Q]]F"
by (simp add: non_expanding_def Ext_choice_evalF_map_alpha)

(*** Ext_choice_evalF_contraction_alpha ***)

lemma Ext_choice_evalF_contraction_alpha:
 "[| contraction_alpha [[P]]T alpha; contraction_alpha [[Q]]T alpha ;
     contraction_alpha [[P]]F alpha; contraction_alpha [[Q]]F alpha|]
  ==> contraction_alpha [[P [+] Q]]F alpha"
by (simp add: contraction_alpha_def Ext_choice_evalF_map_alpha)

(****************** to add them again ******************)

declare disj_not1   [simp]
declare not_None_eq [simp]

end

lemma Ext_choice_restT_sub:

  [| [[P]]T ev1 rest n ≤ [[P]]T ev2 rest n;
     [[Q]]T ev1 rest n ≤ [[Q]]T ev2 rest n |]
  ==> [[P [+] Q]]T ev1 rest n ≤ [[P [+] Q]]T ev2 rest n

lemma Ext_choice_restT:

  [| [[P]]T ev1 rest n = [[P]]T ev2 rest n;
     [[Q]]T ev1 rest n = [[Q]]T ev2 rest n |]
  ==> [[P [+] Q]]T ev1 rest n = [[P [+] Q]]T ev2 rest n

lemma Ext_choice_distT:

  TTs = {([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)}
  ==> ∃TT. TTTTs ∧
           distance ([[P [+] Q]]T ev1, [[P [+] Q]]T ev2)
           ≤ distance (fst TT, snd TT)

lemma Ext_choice_evalT_map_alpha_lm:

  [| distance ([[P]]T ev1, [[P]]T ev2) ≤ alpha * distance (ev1, ev2);
     distance ([[Q]]T ev1, [[Q]]T ev2) ≤ alpha * distance (ev1, ev2) |]
  ==> distance ([[P [+] Q]]T ev1, [[P [+] Q]]T ev2) ≤ alpha * distance (ev1, ev2)

lemma Ext_choice_evalT_map_alpha:

  [| map_alpha [[P]]T alpha; map_alpha [[Q]]T alpha |]
  ==> map_alpha [[P [+] Q]]T alpha

lemma Ext_choice_evalT_non_expanding:

  [| non_expanding [[P]]T; non_expanding [[Q]]T |] ==> non_expanding [[P [+] Q]]T

lemma Ext_choice_evalT_contraction_alpha:

  [| contraction_alpha [[P]]T alpha; contraction_alpha [[Q]]T alpha |]
  ==> contraction_alpha [[P [+] Q]]T alpha

lemma Ext_choice_restF_sub:

  [| [[P]]T ev1 rest n ≤ [[P]]T ev2 rest n; [[Q]]T ev1 rest n ≤ [[Q]]T ev2 rest n;
     [[P]]F ev1 rest n ≤ [[P]]F ev2 rest n;
     [[Q]]F ev1 rest n ≤ [[Q]]F ev2 rest n |]
  ==> [[P [+] Q]]F ev1 rest n ≤ [[P [+] Q]]F ev2 rest n

lemma Ext_choice_restF:

  [| [[P]]T ev1 rest n = [[P]]T ev2 rest n; [[Q]]T ev1 rest n = [[Q]]T ev2 rest n;
     [[P]]F ev1 rest n = [[P]]F ev2 rest n;
     [[Q]]F ev1 rest n = [[Q]]F ev2 rest n |]
  ==> [[P [+] Q]]F ev1 rest n = [[P [+] Q]]F ev2 rest n

lemma Ext_choice_distF:

  [| TTs = {([[P]]T ev1, [[P]]T ev2), ([[Q]]T ev1, [[Q]]T ev2)};
     FFs = {([[P]]F ev1, [[P]]F ev2), ([[Q]]F ev1, [[Q]]F ev2)} |]
  ==> (∃TT. TTTTs ∧
            distance ([[P [+] Q]]F ev1, [[P [+] Q]]F ev2)
            ≤ distance (fst TT, snd TT)) ∨
      (∃FF. FFFFs ∧
            distance ([[P [+] Q]]F ev1, [[P [+] Q]]F ev2)
            ≤ distance (fst FF, snd FF))

lemma Ext_choice_evalF_map_alpha_lm:

  [| distance ([[P]]T ev1, [[P]]T ev2) ≤ alpha * distance (ev1, ev2);
     distance ([[Q]]T ev1, [[Q]]T ev2) ≤ alpha * distance (ev1, ev2);
     distance ([[P]]F ev1, [[P]]F ev2) ≤ alpha * distance (ev1, ev2);
     distance ([[Q]]F ev1, [[Q]]F ev2) ≤ alpha * distance (ev1, ev2) |]
  ==> distance ([[P [+] Q]]F ev1, [[P [+] Q]]F ev2) ≤ alpha * distance (ev1, ev2)

lemma Ext_choice_evalF_map_alpha:

  [| map_alpha [[P]]T alpha; map_alpha [[Q]]T alpha; map_alpha [[P]]F alpha;
     map_alpha [[Q]]F alpha |]
  ==> map_alpha [[P [+] Q]]F alpha

lemma Ext_choice_evalF_non_expanding:

  [| non_expanding [[P]]T; non_expanding [[Q]]T; non_expanding [[P]]F;
     non_expanding [[Q]]F |]
  ==> non_expanding [[P [+] Q]]F

lemma Ext_choice_evalF_contraction_alpha:

  [| contraction_alpha [[P]]T alpha; contraction_alpha [[Q]]T alpha;
     contraction_alpha [[P]]F alpha; contraction_alpha [[Q]]F alpha |]
  ==> contraction_alpha [[P [+] Q]]F alpha