QuotScript.thy
changeset 427 5a3965aa4d80
parent 416 3f3927f793d4
child 432 9c33c0809733
equal deleted inserted replaced
426:98936120ab02 427:5a3965aa4d80
   427   shows "(R1 ===> R3) (f1 o g1) (f2 o g2)"
   427   shows "(R1 ===> R3) (f1 o g1) (f2 o g2)"
   428 using a1 a2 unfolding o_def expand_fun_eq
   428 using a1 a2 unfolding o_def expand_fun_eq
   429 by (auto)
   429 by (auto)
   430 
   430 
   431 
   431 
   432 (* TODO: Put the following lemmas in proper places *)
   432 
   433 
   433 (* Set of lemmas for regularisation of ball and bex *)
   434 lemma equiv_res_forall:
   434 lemma ball_reg_eqv:
   435   fixes P :: "'a \<Rightarrow> bool"
   435   fixes P :: "'a \<Rightarrow> bool"
   436   assumes a: "EQUIV E"
   436   assumes a: "EQUIV R"
   437   shows "Ball (Respects E) P = (All P)"
   437   shows "Ball (Respects R) P = (All P)"
   438   using a by (metis EQUIV_def IN_RESPECTS a)
   438   by (metis EQUIV_def IN_RESPECTS a)
   439 
   439 
   440 lemma equiv_res_exists:
   440 lemma bex_reg_eqv:
   441   fixes P :: "'a \<Rightarrow> bool"
   441   fixes P :: "'a \<Rightarrow> bool"
   442   assumes a: "EQUIV E"
   442   assumes a: "EQUIV R"
   443   shows "Bex (Respects E) P = (Ex P)"
   443   shows "Bex (Respects R) P = (Ex P)"
   444   using a by (metis EQUIV_def IN_RESPECTS a)
   444   by (metis EQUIV_def IN_RESPECTS a)
   445 
   445 
   446 lemma FORALL_REGULAR:
   446 lemma ball_reg_right:
       
   447   assumes a: "\<And>x. R x \<Longrightarrow> P x \<longrightarrow> Q x"
       
   448   shows "All P \<longrightarrow> Ball R Q"
       
   449   by (metis COMBC_def Collect_def Collect_mem_eq a)
       
   450 
       
   451 lemma bex_reg_left:
       
   452   assumes a: "\<And>x. R x \<Longrightarrow> Q x \<longrightarrow> P x"
       
   453   shows "Bex R Q \<longrightarrow> Ex P"
       
   454   by (metis COMBC_def Collect_def Collect_mem_eq a)
       
   455 
       
   456 lemma ball_reg_left:
       
   457   assumes a: "EQUIV R"
       
   458   shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P"
       
   459   by (metis EQUIV_REFL IN_RESPECTS a)
       
   460 
       
   461 lemma bex_reg_right:
       
   462   assumes a: "EQUIV R"
       
   463   shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P"
       
   464   by (metis EQUIV_REFL IN_RESPECTS a)
       
   465 
       
   466 lemma ball_reg_eqv_range:
       
   467   fixes P::"'a \<Rightarrow> bool"
       
   468   and x::"'a"
       
   469   assumes a: "EQUIV R2"
       
   470   shows   "(Ball (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = All (\<lambda>f. P (f x)))"
       
   471   apply(rule iffI)
       
   472   apply(rule allI)
       
   473   apply(drule_tac x="\<lambda>y. f x" in bspec)
       
   474   apply(simp add: Respects_def IN_RESPECTS)
       
   475   apply(rule impI)
       
   476   using a EQUIV_REFL_SYM_TRANS[of "R2"]
       
   477   apply(simp add: REFL_def)
       
   478   apply(simp)
       
   479   apply(simp)
       
   480   done
       
   481 
       
   482 lemma bex_reg_eqv_range:
       
   483   fixes P::"'a \<Rightarrow> bool"
       
   484   and x::"'a"
       
   485   assumes a: "EQUIV R2"
       
   486   shows   "(Bex (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = Ex (\<lambda>f. P (f x)))"
       
   487   apply(auto)
       
   488   apply(rule_tac x="\<lambda>y. f x" in bexI)
       
   489   apply(simp)
       
   490   apply(simp add: Respects_def IN_RESPECTS)
       
   491   apply(rule impI)
       
   492   using a EQUIV_REFL_SYM_TRANS[of "R2"]
       
   493   apply(simp add: REFL_def)
       
   494   done
       
   495 
       
   496 lemma all_reg:
   447   assumes a: "!x :: 'a. (P x --> Q x)"
   497   assumes a: "!x :: 'a. (P x --> Q x)"
   448   and     b: "All P"
   498   and     b: "All P"
   449   shows "All Q"
   499   shows "All Q"
   450   using a b by (metis)
   500   using a b by (metis)
   451 
   501 
   452 lemma EXISTS_REGULAR:
   502 lemma ex_reg:
   453   assumes a: "!x :: 'a. (P x --> Q x)"
   503   assumes a: "!x :: 'a. (P x --> Q x)"
   454   and     b: "Ex P"
   504   and     b: "Ex P"
   455   shows "Ex Q"
   505   shows "Ex Q"
   456   using a b by (metis)
   506   using a b by (metis)
   457 
   507 
   458 lemma RES_FORALL_REGULAR:
   508 lemma ball_reg:
   459   assumes a: "!x :: 'a. (R x --> P x --> Q x)"
   509   assumes a: "!x :: 'a. (R x --> P x --> Q x)"
   460   and     b: "Ball R P"
   510   and     b: "Ball R P"
   461   shows "Ball R Q"
   511   shows "Ball R Q"
   462   using a b by (metis COMBC_def Collect_def Collect_mem_eq)
   512   using a b by (metis COMBC_def Collect_def Collect_mem_eq)
   463 
   513 
   464 lemma RES_EXISTS_REGULAR:
   514 lemma bex_reg:
   465   assumes a: "!x :: 'a. (R x --> P x --> Q x)"
   515   assumes a: "!x :: 'a. (R x --> P x --> Q x)"
   466   and     b: "Bex R P"
   516   and     b: "Bex R P"
   467   shows "Bex R Q"
   517   shows "Bex R Q"
   468   using a b by (metis COMBC_def Collect_def Collect_mem_eq)
   518   using a b by (metis COMBC_def Collect_def Collect_mem_eq)
   469 
   519 
   470 lemma LEFT_RES_FORALL_REGULAR:
   520 
   471   assumes a: "\<And>x. (R x \<and> (Q x \<longrightarrow> P x))"
   521 
   472   shows "Ball R Q \<longrightarrow> All P"
       
   473   using a
       
   474   apply (metis COMBC_def Collect_def Collect_mem_eq a)
       
   475   done
       
   476 
       
   477 lemma RIGHT_RES_FORALL_REGULAR:
       
   478   assumes a: "\<And>x. R x \<Longrightarrow> P x \<longrightarrow> Q x"
       
   479   shows "All P \<longrightarrow> Ball R Q"
       
   480   using a
       
   481   apply (metis COMBC_def Collect_def Collect_mem_eq a)
       
   482   done
       
   483 
       
   484 lemma LEFT_RES_EXISTS_REGULAR:
       
   485   assumes a: "\<And>x. R x \<Longrightarrow> Q x \<longrightarrow> P x"
       
   486   shows "Bex R Q \<longrightarrow> Ex P"
       
   487   using a by (metis COMBC_def Collect_def Collect_mem_eq)
       
   488 
       
   489 lemma RIGHT_RES_EXISTS_REGULAR:
       
   490   assumes a: "\<And>x. (R x \<and> (P x \<longrightarrow> Q x))"
       
   491   shows "Ex P \<longrightarrow> Bex R Q"
       
   492   using a by (metis COMBC_def Collect_def Collect_mem_eq)
       
   493 
   522 
   494 (* TODO: Add similar *)
   523 (* TODO: Add similar *)
   495 lemma RES_FORALL_RSP:
   524 lemma RES_FORALL_RSP:
   496   shows "\<And>f g. (R ===> (op =)) f g ==>
   525   shows "\<And>f g. (R ===> (op =)) f g ==>
   497         (Ball (Respects R) f = Ball (Respects R) g)"
   526         (Ball (Respects R) f = Ball (Respects R) g)"