src/HOL/BNF_Util.thy
author blanchet
Wed Feb 12 08:35:57 2014 +0100 (2014-02-12)
changeset 55415 05f5fdb8d093
parent 55084 8ee9aabb2bca
child 55803 74d3fe9031d8
permissions -rw-r--r--
renamed 'nat_{case,rec}' to '{case,rec}_nat'
     1 (*  Title:      HOL/BNF_Util.thy
     2     Author:     Dmitriy Traytel, TU Muenchen
     3     Author:     Jasmin Blanchette, TU Muenchen
     4     Copyright   2012
     5 
     6 Library for bounded natural functors.
     7 *)
     8 
     9 header {* Library for Bounded Natural Functors *}
    10 
    11 theory BNF_Util
    12 imports BNF_Cardinal_Arithmetic
    13 begin
    14 
    15 definition
    16   fun_rel :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
    17 where
    18   "fun_rel A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))"
    19 
    20 lemma fun_relI [intro]:
    21   assumes "\<And>x y. A x y \<Longrightarrow> B (f x) (g y)"
    22   shows "fun_rel A B f g"
    23   using assms by (simp add: fun_rel_def)
    24 
    25 lemma fun_relD:
    26   assumes "fun_rel A B f g" and "A x y"
    27   shows "B (f x) (g y)"
    28   using assms by (simp add: fun_rel_def)
    29 
    30 definition collect where
    31 "collect F x = (\<Union>f \<in> F. f x)"
    32 
    33 lemma fstI: "x = (y, z) \<Longrightarrow> fst x = y"
    34 by simp
    35 
    36 lemma sndI: "x = (y, z) \<Longrightarrow> snd x = z"
    37 by simp
    38 
    39 lemma bijI': "\<lbrakk>\<And>x y. (f x = f y) = (x = y); \<And>y. \<exists>x. y = f x\<rbrakk> \<Longrightarrow> bij f"
    40 unfolding bij_def inj_on_def by auto blast
    41 
    42 (* Operator: *)
    43 definition "Gr A f = {(a, f a) | a. a \<in> A}"
    44 
    45 definition "Grp A f = (\<lambda>a b. b = f a \<and> a \<in> A)"
    46 
    47 ML_file "Tools/BNF/bnf_util.ML"
    48 ML_file "Tools/BNF/bnf_tactics.ML"
    49 
    50 end