Theory CSP_T_law_basic

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

theory CSP_T_law_basic
imports CSP_T_law_decompo
begin

           (*-------------------------------------------*
            |        CSP-Prover on Isabelle2004         |
            |               December 2004               |
            |                   June 2005  (modified)   |
            |              September 2005  (modified)   |
            |                                           |
            |        CSP-Prover on Isabelle2005         |
            |                October 2005  (modified)   |
            |                  April 2006  (modified)   |
            |                                           |
            |        Yoshinao Isobe (AIST JAPAN)        |
            *-------------------------------------------*)

theory CSP_T_law_basic = CSP_T_law_decompo:

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

         1. Commutativity
         2. Associativity
         3. Idempotence
         4. Left Commutativity
         5. IF

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

(*********************************************************
                       IF bool
 *********************************************************)

(*------------------*
 |      csp law     |
 *------------------*)

lemma cspT_IF_split: 
  "IF b THEN P ELSE Q =T (if b then P else Q)"
apply (simp add: cspT_semantics)
apply (simp add: traces_def)
done

lemma cspT_IF_True:
  "IF True THEN P ELSE Q =T P"
apply (rule cspT_rw_left)
apply (rule cspT_IF_split)
by (simp)

lemma cspT_IF_False:
  "IF False THEN P ELSE Q =T Q"
apply (rule cspT_rw_left)
apply (rule cspT_IF_split)
by (simp)

lemmas cspT_IF = cspT_IF_True cspT_IF_False

(*-----------------------------------*
 |           Idempotence             |
 *-----------------------------------*)

lemma cspT_Ext_choice_idem: 
  "P [+] P =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)+
done

lemma cspT_Int_choice_idem: 
  "P |~| P =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)+
done

(*------------------*
 |      csp law     |
 *------------------*)

lemmas cspT_idem = cspT_Ext_choice_idem cspT_Int_choice_idem

(*-----------------------------------*
 |          Commutativity            |
 *-----------------------------------*)

(*********************************************************
                      Ext choice
 *********************************************************)

lemma cspT_Ext_choice_commut:
  "P [+] Q =T Q [+] P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces, fast)+
done

(*********************************************************
                      Int choice
 *********************************************************)

lemma cspT_Int_choice_commut:
  "P |~| Q =T Q |~| P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces, fast)+
done

(*********************************************************
                      Parallel
 *********************************************************)

lemma cspT_Parallel_commut:
  "P |[X]| Q =T Q |[X]| P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)

apply (rule, simp add: in_traces)
apply (elim conjE exE)
apply (rule_tac x="ta" in exI)
apply (rule_tac x="s" in exI)
apply (simp add: par_tr_sym)

apply (rule, simp add: in_traces)
apply (elim conjE exE)
apply (rule_tac x="ta" in exI)
apply (rule_tac x="s" in exI)
apply (simp add: par_tr_sym)
done

(*------------------*
 |      csp law     |
 *------------------*)

lemmas cspT_commut = cspT_Ext_choice_commut cspT_Int_choice_commut cspT_Parallel_commut

(*-----------------------------------*
 |          Associativity            |
 *-----------------------------------*)

lemma cspT_Ext_choice_assoc:
  "P [+] (Q [+] R) =T (P [+] Q) [+] R"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces)+
done

lemma cspT_Ext_choice_assoc_sym:
  "(P [+] Q) [+] R =T P [+] (Q [+] R)"
apply (rule cspT_sym)
apply (simp add: cspT_Ext_choice_assoc)
done

lemma cspT_Int_choice_assoc:
  "P |~| (Q |~| R) =T (P |~| Q) |~| R"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces)+
done

lemma cspT_Int_choice_assoc_sym:
  "(P |~| Q) |~| R =T P |~| (Q |~| R)"
apply (rule cspT_sym)
apply (simp add: cspT_Int_choice_assoc)
done

(*------------------*
 |      csp law     |
 *------------------*)

lemmas cspT_assoc = cspT_Ext_choice_assoc cspT_Int_choice_assoc
lemmas cspT_assoc_sym = cspT_Ext_choice_assoc_sym cspT_Int_choice_assoc_sym

(*-----------------------------------*
 |        Left Commutativity         |
 *-----------------------------------*)

lemma cspT_Ext_choice_left_commut:
  "P [+] (Q [+] R) =T Q [+] (P [+] R)"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces)+
done

lemma cspT_Int_choice_left_commut:
  "P |~| (Q |~| R) =T Q |~| (P |~| R)"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
apply (rule, simp add: in_traces)+
done

lemmas cspT_left_commut = 
       cspT_Ext_choice_left_commut cspT_Int_choice_left_commut

(*-----------------------------------*
 |              Unit                 |
 *-----------------------------------*)

(*** STOP [+] P ***)

lemma cspT_Ext_choice_unit_l: 
  "STOP [+] P =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)
 apply (force)
 apply (rule, simp add: in_traces)
done

lemma cspT_Ext_choice_unit_r: 
  "P [+] STOP =T P"
apply (rule cspT_rw_left)
apply (rule cspT_Ext_choice_commut)
apply (simp add: cspT_Ext_choice_unit_l)
done

lemmas cspT_Ext_choice_unit = 
       cspT_Ext_choice_unit_l cspT_Ext_choice_unit_r

lemma cspT_Int_choice_unit_l: 
  "DIV |~| P =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)
 apply (force)
 apply (rule, simp add: in_traces)
done

lemma cspT_Int_choice_unit_r: 
  "P |~| DIV =T P"
apply (rule cspT_rw_left)
apply (rule cspT_Int_choice_commut)
apply (simp add: cspT_Int_choice_unit_l)
done

lemmas cspT_Int_choice_unit = 
       cspT_Int_choice_unit_l cspT_Int_choice_unit_r

lemmas cspT_unit = cspT_Ext_choice_unit cspT_Int_choice_unit

(*-----------------------------------*
 |             !!-empty              |
 *-----------------------------------*)

lemma cspT_Rep_int_choice0_DIV:
   "!! :{} .. Pf =T DIV"
apply (simp add: cspT_semantics)
apply (simp add: traces_def)
done

lemma cspT_Rep_int_choice_fun_DIV:
   "inj f ==> !!<f> :{} .. Pf =T DIV"
apply (simp add: cspT_semantics)
apply (simp add: traces_def)
done

lemma cspT_Rep_int_choice2_DIV:
   "!set :{} .. Pf =T DIV"
by (simp add: cspT_Rep_int_choice_fun_DIV)

lemma cspT_Rep_int_choice3_DIV:
   "!nat :{} .. Pf =T DIV"
by (simp add: cspT_Rep_int_choice_fun_DIV)

lemma cspT_Rep_int_choice1_DIV:
   "! :{} .. Pf =T DIV"
apply (simp add: Rep_int_choice_com_def)
apply (simp add: cspT_Rep_int_choice2_DIV)
done

lemmas cspT_Rep_int_choice_DIV = cspT_Rep_int_choice0_DIV
                                 cspT_Rep_int_choice1_DIV
                                 cspT_Rep_int_choice2_DIV
                                 cspT_Rep_int_choice3_DIV

lemmas cspT_Rep_int_choice_DIV_sym = cspT_Rep_int_choice0_DIV[THEN cspT_sym]

lemmas cspT_Rep_int_choice_empty = cspT_Rep_int_choice_DIV

(*-----------------------------------*
 |             !!-unit               |
 *-----------------------------------*)

lemma cspT_Rep_int_choice_unit0:
  "C ~= {} ==> !! c:C .. P =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)
 apply (force)
 apply (rule, simp add: in_traces)
 apply (force)
done

lemma cspT_Rep_int_choice_unit_fun:
  "X ~= {} ==> !!<f> x:X .. P =T P"
apply (simp add: Rep_int_choice_fun_def)
apply (simp add: cspT_Rep_int_choice_unit0)
done

lemma cspT_Rep_int_choice_unit_com:
  "X ~= {} ==> ! x:X .. P =T P"
apply (simp add: Rep_int_choice_com_def)
apply (simp add: cspT_Rep_int_choice_unit_fun)
done

lemmas cspT_Rep_int_choice_unit = 
       cspT_Rep_int_choice_unit0
       cspT_Rep_int_choice_unit_fun
       cspT_Rep_int_choice_unit_com

(*-----------------------------------*
 |             !!-const              |
 *-----------------------------------*)

(* const *)

lemma cspT_Rep_int_choice_const0:
  "[| C ~= {} ; ALL c:C. Pf c = P |] ==> !! :C .. Pf =T P"
apply (simp add: cspT_semantics)
apply (rule order_antisym)
 apply (rule, simp add: in_traces)
 apply (force)
 apply (rule, simp add: in_traces)
 apply (force)
done

lemma cspT_Rep_int_choice_const_fun:
  "[| inj f ; X ~= {} ; ALL x:X. Pf x = P |] ==> !!<f> :X .. Pf =T P"
apply (simp add: Rep_int_choice_fun_def)
apply (rule cspT_Rep_int_choice_const0)
apply (simp)
apply (intro ballI)
apply (simp add: image_iff)
apply (erule bexE)
apply (simp)
done

lemma cspT_Rep_int_choice_const_com:
  "[| X ~= {} ; ALL x:X. Pf x = P |] ==> ! :X .. Pf =T P"
apply (simp add: Rep_int_choice_com_def)
apply (rule cspT_Rep_int_choice_const_fun)
apply (auto)
done

lemmas cspT_Rep_int_choice_const =
       cspT_Rep_int_choice_const0
       cspT_Rep_int_choice_const_fun
       cspT_Rep_int_choice_const_com

(*-----------------------------------*
 |           |~|-!!-union            |
 *-----------------------------------*)

lemma cspT_Int_Rep_int_choice_union:
  "(!! :C1 .. P1f) |~| (!! :C2 .. P2f)
   =T (!! c:(C1 Un C2) ..
          IF (c : C1 & c : C2) THEN (P1f c |~| P2f c)
          ELSE IF (c : C1) THEN P1f c ELSE P2f c)"
apply (simp add: cspT_semantics)
apply (rule order_antisym)

 apply (rule)
 apply (simp add: in_traces)
 apply (elim conjE bexE disjE)
 apply (simp_all)
  apply (rule disjI2)
  apply (rule_tac x="c" in bexI)
  apply (simp)
  apply (simp)
  apply (rule disjI2)
  apply (rule_tac x="c" in bexI)
  apply (simp)
  apply (simp)

(* => *)
 apply (rule)
 apply (simp add: in_traces)
 apply (elim conjE exE bexE disjE)
 apply (simp_all)
 apply (elim conjE exE bexE disjE)
 apply (simp_all)
 apply (case_tac "c : C2")
 apply (simp add: in_traces)
 apply (force)
 apply (simp add: in_traces)
 apply (force)
 apply (case_tac "c : C1")
 apply (simp add: in_traces)
 apply (force)
 apply (simp add: in_traces)
 apply (force)
done

(*-----------------------------------*
 |           !!-union-|~|            |
 *-----------------------------------*)

lemma cspT_Rep_int_choice_union_Int0:
  "(!! :(C1 Un C2) .. Pf)
   =T (!! c:C1 .. Pf c) |~| (!! c:C2 .. Pf c)"
apply (rule cspT_rw_right)
apply (rule cspT_Int_Rep_int_choice_union)
apply (rule cspT_decompo)
apply (simp)
apply (rule cspT_rw_right)
apply (rule cspT_IF_split)
apply (simp)
apply (simp add: cspT_idem[THEN cspT_sym])
apply (intro impI)
apply (rule cspT_rw_right)
apply (rule cspT_IF_split)
apply (simp)
done

lemma cspT_Rep_int_choice_union_Int_fun:
  "(!!<f> :(X1 Un X2) .. Pf)
   =T (!!<f> x:X1 .. Pf x) |~| (!!<f> x:X2 .. Pf x)"
apply (simp add: Rep_int_choice_fun_def)
apply (rule cspT_rw_right)
apply (rule cspT_Rep_int_choice_union_Int0[THEN cspT_sym])
apply (rule cspT_decompo)
apply (auto)
done

lemma cspT_Rep_int_choice_union_Int_com:
  "(! :(X1 Un X2) .. Pf)
   =T (! x:X1 .. Pf x) |~| (! x:X2 .. Pf x)"
apply (simp add: Rep_int_choice_com_def)
apply (rule cspT_rw_right)
apply (rule cspT_Rep_int_choice_union_Int_fun[THEN cspT_sym])
apply (rule cspT_decompo)
apply (auto)
done

lemmas cspT_Rep_int_choice_union_Int
     = cspT_Rep_int_choice_union_Int0
       cspT_Rep_int_choice_union_Int_fun
       cspT_Rep_int_choice_union_Int_com

(*********************************************************
                     Depth_rest
 *********************************************************)

(*------------------*
 |      csp law     |
 *------------------*)

lemma cspT_Depth_rest_Zero:
  "P |. 0 =T DIV"
apply (simp add: cspT_semantics)
apply (rule order_antisym)

(* => *)
 apply (rule)
 apply (simp add: in_traces)
 apply (simp add: lengtht_zero)

(* <= *)
 apply (rule)
 apply (simp add: in_traces)
done

lemma cspT_Depth_rest_min:
  "P |. n |. m =T P |. min n m"
apply (simp add: cspT_semantics)
apply (simp add: traces.simps)
apply (simp add: min_rs)
done

lemma cspT_Depth_rest_congE:
  "[| P =T Q ; ALL m. P |. m =T Q |. m ==> S |] ==> S"
apply (simp add: cspT_semantics)
apply (simp add: traces.simps)
done

(*------------------*
 |     !nat-rest    |
 *------------------*)

lemma cspT_nat_Depth_rest_UNIV: 
  "P =T !nat n .. (P |. n)"
apply (simp add: cspT_eqT_semantics)
apply (rule order_antisym)

 (* <= *)
 apply (rule)
 apply (simp add: in_traces)
 apply (rule disjI2)
 apply (rule_tac x="lengtht t" in exI)
 apply (simp)

 (* => *)
 apply (rule)
 apply (simp add: in_traces)
 apply (erule disjE)
 apply (simp_all)
done

lemma cspT_nat_Depth_rest_lengthset: "P =T !nat n:(lengthset P) .. (P |. n)"
apply (simp add: cspT_eqT_semantics)
apply (rule order_antisym)

 (* <= *)
 apply (rule)
 apply (simp add: in_traces)
 apply (rule disjI2)
 apply (rule_tac x="lengtht t" in bexI)
 apply (simp)
 apply (simp add: lengthset_def)
 apply (rule_tac x="t" in exI)
 apply (simp)

 (* => *)
 apply (rule)
 apply (simp add: in_traces)
 apply (erule disjE)
 apply (simp_all)
done

lemmas cspT_nat_Depth_rest = cspT_nat_Depth_rest_UNIV
                             cspT_nat_Depth_rest_lengthset

(*------------------*
 |    ?-partial     |
 *------------------*)

lemma cspT_Ext_pre_choice_partial:
  "? :X -> Pf =T ? x:X -> (IF (x:X) THEN Pf x ELSE DIV)"
apply (rule cspT_decompo)
apply (simp_all)
apply (rule cspT_rw_right)
apply (rule cspT_IF)
apply (simp)
done

(*------------------*
 |   !!-partial     |
 *------------------*)

lemma cspT_Rep_int_choice_partial0:
  "!! :C .. Pf =T !! c:C .. (IF (c:C) THEN Pf c ELSE DIV)"
apply (rule cspT_decompo)
apply (simp_all)
apply (rule cspT_rw_right)
apply (rule cspT_IF)
apply (simp)
done

lemma cspT_Rep_int_choice_partial_fun:
  "inj f ==> !!<f> :X .. Pf =T !!<f> x:X .. (IF (x:X) THEN Pf x ELSE DIV)"
apply (simp add: Rep_int_choice_fun_def)
apply (rule cspT_rw_left)
apply (rule cspT_Rep_int_choice_partial0)
apply (rule cspT_decompo)
apply (simp)
apply (rule cspT_decompo)
apply (auto)
done

lemma cspT_Rep_int_choice_partial_com:
  "! :X .. Pf =T ! x:X .. (IF (x:X) THEN Pf x ELSE DIV)"
apply (simp add: Rep_int_choice_com_def)
apply (rule cspT_rw_left)
apply (rule cspT_Rep_int_choice_partial_fun)
apply (simp)
apply (rule cspT_decompo)
apply (simp)
apply (rule cspT_decompo)
apply (auto)
done

lemmas cspT_Rep_int_choice_partial =
       cspT_Rep_int_choice_partial0
       cspT_Rep_int_choice_partial_fun
       cspT_Rep_int_choice_partial_com

end

lemma cspT_IF_split:

  IF b THEN P ELSE Q =T (if b then P else Q)

lemma cspT_IF_True:

  IF True THEN P ELSE Q =T P

lemma cspT_IF_False:

  IF False THEN P ELSE Q =T Q

lemmas cspT_IF:

  IF True THEN P ELSE Q =T P
  IF False THEN P ELSE Q =T Q

lemmas cspT_IF:

  IF True THEN P ELSE Q =T P
  IF False THEN P ELSE Q =T Q

lemma cspT_Ext_choice_idem:

  P [+] P =T P

lemma cspT_Int_choice_idem:

  P |~| P =T P

lemmas cspT_idem:

  P [+] P =T P
  P |~| P =T P

lemmas cspT_idem:

  P [+] P =T P
  P |~| P =T P

lemma cspT_Ext_choice_commut:

  P [+] Q =T Q [+] P

lemma cspT_Int_choice_commut:

  P |~| Q =T Q |~| P

lemma cspT_Parallel_commut:

  P |[X]| Q =T Q |[X]| P

lemmas cspT_commut:

  P [+] Q =T Q [+] P
  P |~| Q =T Q |~| P
  P |[X]| Q =T Q |[X]| P

lemmas cspT_commut:

  P [+] Q =T Q [+] P
  P |~| Q =T Q |~| P
  P |[X]| Q =T Q |[X]| P

lemma cspT_Ext_choice_assoc:

  P [+] (Q [+] R) =T P [+] Q [+] R

lemma cspT_Ext_choice_assoc_sym:

  P [+] Q [+] R =T P [+] (Q [+] R)

lemma cspT_Int_choice_assoc:

  P |~| (Q |~| R) =T P |~| Q |~| R

lemma cspT_Int_choice_assoc_sym:

  P |~| Q |~| R =T P |~| (Q |~| R)

lemmas cspT_assoc:

  P [+] (Q [+] R) =T P [+] Q [+] R
  P |~| (Q |~| R) =T P |~| Q |~| R

lemmas cspT_assoc:

  P [+] (Q [+] R) =T P [+] Q [+] R
  P |~| (Q |~| R) =T P |~| Q |~| R

lemmas cspT_assoc_sym:

  P [+] Q [+] R =T P [+] (Q [+] R)
  P |~| Q |~| R =T P |~| (Q |~| R)

lemmas cspT_assoc_sym:

  P [+] Q [+] R =T P [+] (Q [+] R)
  P |~| Q |~| R =T P |~| (Q |~| R)

lemma cspT_Ext_choice_left_commut:

  P [+] (Q [+] R) =T Q [+] (P [+] R)

lemma cspT_Int_choice_left_commut:

  P |~| (Q |~| R) =T Q |~| (P |~| R)

lemmas cspT_left_commut:

  P [+] (Q [+] R) =T Q [+] (P [+] R)
  P |~| (Q |~| R) =T Q |~| (P |~| R)

lemmas cspT_left_commut:

  P [+] (Q [+] R) =T Q [+] (P [+] R)
  P |~| (Q |~| R) =T Q |~| (P |~| R)

lemma cspT_Ext_choice_unit_l:

  STOP [+] P =T P

lemma cspT_Ext_choice_unit_r:

  P [+] STOP =T P

lemmas cspT_Ext_choice_unit:

  STOP [+] P =T P
  P [+] STOP =T P

lemmas cspT_Ext_choice_unit:

  STOP [+] P =T P
  P [+] STOP =T P

lemma cspT_Int_choice_unit_l:

  DIV |~| P =T P

lemma cspT_Int_choice_unit_r:

  P |~| DIV =T P

lemmas cspT_Int_choice_unit:

  DIV |~| P =T P
  P |~| DIV =T P

lemmas cspT_Int_choice_unit:

  DIV |~| P =T P
  P |~| DIV =T P

lemmas cspT_unit:

  STOP [+] P =T P
  P [+] STOP =T P
  DIV |~| P =T P
  P |~| DIV =T P

lemmas cspT_unit:

  STOP [+] P =T P
  P [+] STOP =T P
  DIV |~| P =T P
  P |~| DIV =T P

lemma cspT_Rep_int_choice0_DIV:

  !! :{} .. Pf =T DIV

lemma cspT_Rep_int_choice_fun_DIV:

  inj f ==> !!<f> :{} .. Pf =T DIV

lemma cspT_Rep_int_choice2_DIV:

  !set :{} .. Pf =T DIV

lemma cspT_Rep_int_choice3_DIV:

  !nat :{} .. Pf =T DIV

lemma cspT_Rep_int_choice1_DIV:

  ! :{} .. Pf =T DIV

lemmas cspT_Rep_int_choice_DIV:

  !! :{} .. Pf =T DIV
  ! :{} .. Pf =T DIV
  !set :{} .. Pf =T DIV
  !nat :{} .. Pf =T DIV

lemmas cspT_Rep_int_choice_DIV:

  !! :{} .. Pf =T DIV
  ! :{} .. Pf =T DIV
  !set :{} .. Pf =T DIV
  !nat :{} .. Pf =T DIV

lemmas cspT_Rep_int_choice_DIV_sym:

  DIV =T !! :{} .. Pf1

lemmas cspT_Rep_int_choice_DIV_sym:

  DIV =T !! :{} .. Pf1

lemmas cspT_Rep_int_choice_empty:

  !! :{} .. Pf =T DIV
  ! :{} .. Pf =T DIV
  !set :{} .. Pf =T DIV
  !nat :{} .. Pf =T DIV

lemmas cspT_Rep_int_choice_empty:

  !! :{} .. Pf =T DIV
  ! :{} .. Pf =T DIV
  !set :{} .. Pf =T DIV
  !nat :{} .. Pf =T DIV

lemma cspT_Rep_int_choice_unit0:

  C ≠ {} ==> !! c:C .. P =T P

lemma cspT_Rep_int_choice_unit_fun:

  X ≠ {} ==> !!<f> x:X .. P =T P

lemma cspT_Rep_int_choice_unit_com:

  X ≠ {} ==> ! x:X .. P =T P

lemmas cspT_Rep_int_choice_unit:

  C ≠ {} ==> !! c:C .. P =T P
  X ≠ {} ==> !!<f> x:X .. P =T P
  X ≠ {} ==> ! x:X .. P =T P

lemmas cspT_Rep_int_choice_unit:

  C ≠ {} ==> !! c:C .. P =T P
  X ≠ {} ==> !!<f> x:X .. P =T P
  X ≠ {} ==> ! x:X .. P =T P

lemma cspT_Rep_int_choice_const0:

  [| C ≠ {}; ∀cC. Pf c = P |] ==> !! :C .. Pf =T P

lemma cspT_Rep_int_choice_const_fun:

  [| inj f; X ≠ {}; ∀xX. Pf x = P |] ==> !!<f> :X .. Pf =T P

lemma cspT_Rep_int_choice_const_com:

  [| X ≠ {}; ∀xX. Pf x = P |] ==> ! :X .. Pf =T P

lemmas cspT_Rep_int_choice_const:

  [| C ≠ {}; ∀cC. Pf c = P |] ==> !! :C .. Pf =T P
  [| inj f; X ≠ {}; ∀xX. Pf x = P |] ==> !!<f> :X .. Pf =T P
  [| X ≠ {}; ∀xX. Pf x = P |] ==> ! :X .. Pf =T P

lemmas cspT_Rep_int_choice_const:

  [| C ≠ {}; ∀cC. Pf c = P |] ==> !! :C .. Pf =T P
  [| inj f; X ≠ {}; ∀xX. Pf x = P |] ==> !!<f> :X .. Pf =T P
  [| X ≠ {}; ∀xX. Pf x = P |] ==> ! :X .. Pf =T P

lemma cspT_Int_Rep_int_choice_union:

  !! :C1.0 .. P1f |~| !! :C2.0 .. P2f =T 
  !! c:(C1.0C2.0) .. 
   IF (cC1.0cC2.0) THEN P1f c |~| P2f c 
   ELSE IF (cC1.0) THEN P1f c ELSE P2f c

lemma cspT_Rep_int_choice_union_Int0:

  !! :(C1.0C2.0) .. Pf =T !! :C1.0 .. Pf |~| !! :C2.0 .. Pf

lemma cspT_Rep_int_choice_union_Int_fun:

  !!<f> :(X1.0X2.0) .. Pf =T !!<f> :X1.0 .. Pf |~| !!<f> :X2.0 .. Pf

lemma cspT_Rep_int_choice_union_Int_com:

  ! :(X1.0X2.0) .. Pf =T ! :X1.0 .. Pf |~| ! :X2.0 .. Pf

lemmas cspT_Rep_int_choice_union_Int:

  !! :(C1.0C2.0) .. Pf =T !! :C1.0 .. Pf |~| !! :C2.0 .. Pf
  !!<f> :(X1.0X2.0) .. Pf =T !!<f> :X1.0 .. Pf |~| !!<f> :X2.0 .. Pf
  ! :(X1.0X2.0) .. Pf =T ! :X1.0 .. Pf |~| ! :X2.0 .. Pf

lemmas cspT_Rep_int_choice_union_Int:

  !! :(C1.0C2.0) .. Pf =T !! :C1.0 .. Pf |~| !! :C2.0 .. Pf
  !!<f> :(X1.0X2.0) .. Pf =T !!<f> :X1.0 .. Pf |~| !!<f> :X2.0 .. Pf
  ! :(X1.0X2.0) .. Pf =T ! :X1.0 .. Pf |~| ! :X2.0 .. Pf

lemma cspT_Depth_rest_Zero:

  P |. 0 =T DIV

lemma cspT_Depth_rest_min:

  P |. n |. m =T P |. min n m

lemma cspT_Depth_rest_congE:

  [| P =T Q; ∀m. P |. m =T Q |. m ==> S |] ==> S

lemma cspT_nat_Depth_rest_UNIV:

  P =T !nat :UNIV .. Depth_rest P

lemma cspT_nat_Depth_rest_lengthset:

  P =T !nat :lengthset P .. Depth_rest P

lemmas cspT_nat_Depth_rest:

  P =T !nat :UNIV .. Depth_rest P
  P =T !nat :lengthset P .. Depth_rest P

lemmas cspT_nat_Depth_rest:

  P =T !nat :UNIV .. Depth_rest P
  P =T !nat :lengthset P .. Depth_rest P

lemma cspT_Ext_pre_choice_partial:

  ? :X -> Pf =T ? x:X -> IF (xX) THEN Pf x ELSE DIV

lemma cspT_Rep_int_choice_partial0:

  !! :C .. Pf =T !! c:C .. IF (cC) THEN Pf c ELSE DIV

lemma cspT_Rep_int_choice_partial_fun:

  inj f ==> !!<f> :X .. Pf =T !!<f> x:X .. IF (xX) THEN Pf x ELSE DIV

lemma cspT_Rep_int_choice_partial_com:

  ! :X .. Pf =T ! x:X .. IF (xX) THEN Pf x ELSE DIV

lemmas cspT_Rep_int_choice_partial:

  !! :C .. Pf =T !! c:C .. IF (cC) THEN Pf c ELSE DIV
  inj f ==> !!<f> :X .. Pf =T !!<f> x:X .. IF (xX) THEN Pf x ELSE DIV
  ! :X .. Pf =T ! x:X .. IF (xX) THEN Pf x ELSE DIV

lemmas cspT_Rep_int_choice_partial:

  !! :C .. Pf =T !! c:C .. IF (cC) THEN Pf c ELSE DIV
  inj f ==> !!<f> :X .. Pf =T !!<f> x:X .. IF (xX) THEN Pf x ELSE DIV
  ! :X .. Pf =T ! x:X .. IF (xX) THEN Pf x ELSE DIV