src/HOL/Library/FuncSet.thy
changeset 31754 b5260f5272a4
parent 31731 7ffc1a901eea
child 31759 1e652c39d617
     1.1 --- a/src/HOL/Library/FuncSet.thy	Mon Jun 22 08:17:52 2009 +0200
     1.2 +++ b/src/HOL/Library/FuncSet.thy	Mon Jun 22 20:59:12 2009 +0200
     1.3 @@ -51,7 +51,7 @@
     1.4  
     1.5  subsection{*Basic Properties of @{term Pi}*}
     1.6  
     1.7 -lemma Pi_I: "(!!x. x \<in> A ==> f x \<in> B x) ==> f \<in> Pi A B"
     1.8 +lemma Pi_I[intro!]: "(!!x. x \<in> A ==> f x \<in> B x) ==> f \<in> Pi A B"
     1.9    by (simp add: Pi_def)
    1.10  
    1.11  lemma Pi_I'[simp]: "(!!x. x : A --> f x : B x) ==> f : Pi A B"
    1.12 @@ -63,13 +63,17 @@
    1.13  lemma Pi_mem: "[|f: Pi A B; x \<in> A|] ==> f x \<in> B x"
    1.14    by (simp add: Pi_def)
    1.15  
    1.16 +lemma ballE [elim]:
    1.17 +  "f : Pi A B ==> (f x : B x ==> Q) ==> (x ~: A ==> Q) ==> Q"
    1.18 +by(auto simp: Pi_def)
    1.19 +
    1.20  lemma funcset_mem: "[|f \<in> A -> B; x \<in> A|] ==> f x \<in> B"
    1.21    by (simp add: Pi_def)
    1.22  
    1.23  lemma funcset_image: "f \<in> A\<rightarrow>B ==> f ` A \<subseteq> B"
    1.24 -  by (auto simp add: Pi_def)
    1.25 +by auto
    1.26  
    1.27 -lemma Pi_eq_empty: "((PI x: A. B x) = {}) = (\<exists>x\<in>A. B(x) = {})"
    1.28 +lemma Pi_eq_empty[simp]: "((PI x: A. B x) = {}) = (\<exists>x\<in>A. B(x) = {})"
    1.29  apply (simp add: Pi_def, auto)
    1.30  txt{*Converse direction requires Axiom of Choice to exhibit a function
    1.31  picking an element from each non-empty @{term "B x"}*}
    1.32 @@ -78,36 +82,36 @@
    1.33  done
    1.34  
    1.35  lemma Pi_empty [simp]: "Pi {} B = UNIV"
    1.36 -  by (simp add: Pi_def)
    1.37 +by (simp add: Pi_def)
    1.38  
    1.39  lemma Pi_UNIV [simp]: "A -> UNIV = UNIV"
    1.40 -  by (simp add: Pi_def)
    1.41 +by (simp add: Pi_def)
    1.42  (*
    1.43  lemma funcset_id [simp]: "(%x. x): A -> A"
    1.44    by (simp add: Pi_def)
    1.45  *)
    1.46  text{*Covariance of Pi-sets in their second argument*}
    1.47  lemma Pi_mono: "(!!x. x \<in> A ==> B x <= C x) ==> Pi A B <= Pi A C"
    1.48 -  by (simp add: Pi_def, blast)
    1.49 +by auto
    1.50  
    1.51  text{*Contravariance of Pi-sets in their first argument*}
    1.52  lemma Pi_anti_mono: "A' <= A ==> Pi A B <= Pi A' B"
    1.53 -  by (simp add: Pi_def, blast)
    1.54 +by auto
    1.55  
    1.56  
    1.57  subsection{*Composition With a Restricted Domain: @{term compose}*}
    1.58  
    1.59  lemma funcset_compose:
    1.60 -    "[| f \<in> A -> B; g \<in> B -> C |]==> compose A g f \<in> A -> C"
    1.61 -  by (simp add: Pi_def compose_def restrict_def)
    1.62 +  "[| f \<in> A -> B; g \<in> B -> C |]==> compose A g f \<in> A -> C"
    1.63 +by (simp add: Pi_def compose_def restrict_def)
    1.64  
    1.65  lemma compose_assoc:
    1.66      "[| f \<in> A -> B; g \<in> B -> C; h \<in> C -> D |]
    1.67        ==> compose A h (compose A g f) = compose A (compose B h g) f"
    1.68 -  by (simp add: expand_fun_eq Pi_def compose_def restrict_def)
    1.69 +by (simp add: expand_fun_eq Pi_def compose_def restrict_def)
    1.70  
    1.71  lemma compose_eq: "x \<in> A ==> compose A g f x = g(f(x))"
    1.72 -  by (simp add: compose_def restrict_def)
    1.73 +by (simp add: compose_def restrict_def)
    1.74  
    1.75  lemma surj_compose: "[| f ` A = B; g ` B = C |] ==> compose A g f ` A = C"
    1.76    by (auto simp add: image_def compose_eq)
    1.77 @@ -118,7 +122,7 @@
    1.78  lemma restrict_in_funcset: "(!!x. x \<in> A ==> f x \<in> B) ==> (\<lambda>x\<in>A. f x) \<in> A -> B"
    1.79    by (simp add: Pi_def restrict_def)
    1.80  
    1.81 -lemma restrictI: "(!!x. x \<in> A ==> f x \<in> B x) ==> (\<lambda>x\<in>A. f x) \<in> Pi A B"
    1.82 +lemma restrictI[intro!]: "(!!x. x \<in> A ==> f x \<in> B x) ==> (\<lambda>x\<in>A. f x) \<in> Pi A B"
    1.83    by (simp add: Pi_def restrict_def)
    1.84  
    1.85  lemma restrict_apply [simp]:
    1.86 @@ -127,7 +131,7 @@
    1.87  
    1.88  lemma restrict_ext:
    1.89      "(!!x. x \<in> A ==> f x = g x) ==> (\<lambda>x\<in>A. f x) = (\<lambda>x\<in>A. g x)"
    1.90 -  by (simp add: expand_fun_eq Pi_def Pi_def restrict_def)
    1.91 +  by (simp add: expand_fun_eq Pi_def restrict_def)
    1.92  
    1.93  lemma inj_on_restrict_eq [simp]: "inj_on (restrict f A) A = inj_on f A"
    1.94    by (simp add: inj_on_def restrict_def)
    1.95 @@ -150,68 +154,66 @@
    1.96  the theorems belong here, or need at least @{term Hilbert_Choice}.*}
    1.97  
    1.98  lemma bij_betw_imp_funcset: "bij_betw f A B \<Longrightarrow> f \<in> A \<rightarrow> B"
    1.99 -  by (auto simp add: bij_betw_def inj_on_Inv Pi_def)
   1.100 +by (auto simp add: bij_betw_def inj_on_Inv)
   1.101  
   1.102  lemma inj_on_compose:
   1.103 -    "[| bij_betw f A B; inj_on g B |] ==> inj_on (compose A g f) A"
   1.104 -  by (auto simp add: bij_betw_def inj_on_def compose_eq)
   1.105 +  "[| bij_betw f A B; inj_on g B |] ==> inj_on (compose A g f) A"
   1.106 +by (auto simp add: bij_betw_def inj_on_def compose_eq)
   1.107  
   1.108  lemma bij_betw_compose:
   1.109 -    "[| bij_betw f A B; bij_betw g B C |] ==> bij_betw (compose A g f) A C"
   1.110 -  apply (simp add: bij_betw_def compose_eq inj_on_compose)
   1.111 -  apply (auto simp add: compose_def image_def)
   1.112 -  done
   1.113 +  "[| bij_betw f A B; bij_betw g B C |] ==> bij_betw (compose A g f) A C"
   1.114 +apply (simp add: bij_betw_def compose_eq inj_on_compose)
   1.115 +apply (auto simp add: compose_def image_def)
   1.116 +done
   1.117  
   1.118  lemma bij_betw_restrict_eq [simp]:
   1.119 -     "bij_betw (restrict f A) A B = bij_betw f A B"
   1.120 -  by (simp add: bij_betw_def)
   1.121 +  "bij_betw (restrict f A) A B = bij_betw f A B"
   1.122 +by (simp add: bij_betw_def)
   1.123  
   1.124  
   1.125  subsection{*Extensionality*}
   1.126  
   1.127  lemma extensional_arb: "[|f \<in> extensional A; x\<notin> A|] ==> f x = undefined"
   1.128 -  by (simp add: extensional_def)
   1.129 +by (simp add: extensional_def)
   1.130  
   1.131  lemma restrict_extensional [simp]: "restrict f A \<in> extensional A"
   1.132 -  by (simp add: restrict_def extensional_def)
   1.133 +by (simp add: restrict_def extensional_def)
   1.134  
   1.135  lemma compose_extensional [simp]: "compose A f g \<in> extensional A"
   1.136 -  by (simp add: compose_def)
   1.137 +by (simp add: compose_def)
   1.138  
   1.139  lemma extensionalityI:
   1.140 -    "[| f \<in> extensional A; g \<in> extensional A;
   1.141 +  "[| f \<in> extensional A; g \<in> extensional A;
   1.142        !!x. x\<in>A ==> f x = g x |] ==> f = g"
   1.143 -  by (force simp add: expand_fun_eq extensional_def)
   1.144 +by (force simp add: expand_fun_eq extensional_def)
   1.145  
   1.146  lemma Inv_funcset: "f ` A = B ==> (\<lambda>x\<in>B. Inv A f x) : B -> A"
   1.147 -  by (unfold Inv_def) (fast intro: restrict_in_funcset someI2)
   1.148 +by (unfold Inv_def) (fast intro: someI2)
   1.149  
   1.150  lemma compose_Inv_id:
   1.151 -    "bij_betw f A B ==> compose A (\<lambda>y\<in>B. Inv A f y) f = (\<lambda>x\<in>A. x)"
   1.152 -  apply (simp add: bij_betw_def compose_def)
   1.153 -  apply (rule restrict_ext, auto)
   1.154 -  apply (erule subst)
   1.155 -  apply (simp add: Inv_f_f)
   1.156 -  done
   1.157 +  "bij_betw f A B ==> compose A (\<lambda>y\<in>B. Inv A f y) f = (\<lambda>x\<in>A. x)"
   1.158 +apply (simp add: bij_betw_def compose_def)
   1.159 +apply (rule restrict_ext, auto)
   1.160 +apply (erule subst)
   1.161 +apply (simp add: Inv_f_f)
   1.162 +done
   1.163  
   1.164  lemma compose_id_Inv:
   1.165 -    "f ` A = B ==> compose B f (\<lambda>y\<in>B. Inv A f y) = (\<lambda>x\<in>B. x)"
   1.166 -  apply (simp add: compose_def)
   1.167 -  apply (rule restrict_ext)
   1.168 -  apply (simp add: f_Inv_f)
   1.169 -  done
   1.170 +  "f ` A = B ==> compose B f (\<lambda>y\<in>B. Inv A f y) = (\<lambda>x\<in>B. x)"
   1.171 +apply (simp add: compose_def)
   1.172 +apply (rule restrict_ext)
   1.173 +apply (simp add: f_Inv_f)
   1.174 +done
   1.175  
   1.176  
   1.177  subsection{*Cardinality*}
   1.178  
   1.179  lemma card_inj: "[|f \<in> A\<rightarrow>B; inj_on f A; finite B|] ==> card(A) \<le> card(B)"
   1.180 -  apply (rule card_inj_on_le)
   1.181 -    apply (auto simp add: Pi_def)
   1.182 -  done
   1.183 +by (rule card_inj_on_le) auto
   1.184  
   1.185  lemma card_bij:
   1.186 -     "[|f \<in> A\<rightarrow>B; inj_on f A;
   1.187 -        g \<in> B\<rightarrow>A; inj_on g B; finite A; finite B|] ==> card(A) = card(B)"
   1.188 -  by (blast intro: card_inj order_antisym)
   1.189 +  "[|f \<in> A\<rightarrow>B; inj_on f A;
   1.190 +     g \<in> B\<rightarrow>A; inj_on g B; finite A; finite B|] ==> card(A) = card(B)"
   1.191 +by (blast intro: card_inj order_antisym)
   1.192  
   1.193  end