18 |
18 |
19 lemma relation_restrict [simp]: "relation(restrict(r,A))" |
19 lemma relation_restrict [simp]: "relation(restrict(r,A))" |
20 by (simp add: restrict_def relation_def, blast) |
20 by (simp add: restrict_def relation_def, blast) |
21 |
21 |
22 lemma Pi_iff: |
22 lemma Pi_iff: |
23 "f: Pi(A,B) <-> function(f) & f<=Sigma(A,B) & A<=domain(f)" |
23 "f: Pi(A,B) \<longleftrightarrow> function(f) & f<=Sigma(A,B) & A<=domain(f)" |
24 by (unfold Pi_def, blast) |
24 by (unfold Pi_def, blast) |
25 |
25 |
26 (*For upward compatibility with the former definition*) |
26 (*For upward compatibility with the former definition*) |
27 lemma Pi_iff_old: |
27 lemma Pi_iff_old: |
28 "f: Pi(A,B) <-> f<=Sigma(A,B) & (\<forall>x\<in>A. EX! y. <x,y>: f)" |
28 "f: Pi(A,B) \<longleftrightarrow> f<=Sigma(A,B) & (\<forall>x\<in>A. EX! y. <x,y>: f)" |
29 by (unfold Pi_def function_def, blast) |
29 by (unfold Pi_def function_def, blast) |
30 |
30 |
31 lemma fun_is_function: "f: Pi(A,B) ==> function(f)" |
31 lemma fun_is_function: "f: Pi(A,B) ==> function(f)" |
32 by (simp only: Pi_iff) |
32 by (simp only: Pi_iff) |
33 |
33 |
94 |
94 |
95 (*This version is acceptable to the simplifier*) |
95 (*This version is acceptable to the simplifier*) |
96 lemma apply_funtype: "[| f: A->B; a:A |] ==> f`a \<in> B" |
96 lemma apply_funtype: "[| f: A->B; a:A |] ==> f`a \<in> B" |
97 by (blast dest: apply_type) |
97 by (blast dest: apply_type) |
98 |
98 |
99 lemma apply_iff: "f: Pi(A,B) ==> <a,b>: f <-> a:A & f`a = b" |
99 lemma apply_iff: "f: Pi(A,B) ==> <a,b>: f \<longleftrightarrow> a:A & f`a = b" |
100 apply (frule fun_is_rel) |
100 apply (frule fun_is_rel) |
101 apply (blast intro!: apply_Pair apply_equality) |
101 apply (blast intro!: apply_Pair apply_equality) |
102 done |
102 done |
103 |
103 |
104 (*Refining one Pi type to another*) |
104 (*Refining one Pi type to another*) |
108 done |
108 done |
109 |
109 |
110 (*Such functions arise in non-standard datatypes, ZF/ex/Ntree for instance*) |
110 (*Such functions arise in non-standard datatypes, ZF/ex/Ntree for instance*) |
111 lemma Pi_Collect_iff: |
111 lemma Pi_Collect_iff: |
112 "(f \<in> Pi(A, %x. {y:B(x). P(x,y)})) |
112 "(f \<in> Pi(A, %x. {y:B(x). P(x,y)})) |
113 <-> f \<in> Pi(A,B) & (\<forall>x\<in>A. P(x, f`x))" |
113 \<longleftrightarrow> f \<in> Pi(A,B) & (\<forall>x\<in>A. P(x, f`x))" |
114 by (blast intro: Pi_type dest: apply_type) |
114 by (blast intro: Pi_type dest: apply_type) |
115 |
115 |
116 lemma Pi_weaken_type: |
116 lemma Pi_weaken_type: |
117 "[| f \<in> Pi(A,B); !!x. x:A ==> B(x)<=C(x) |] ==> f \<in> Pi(A,C)" |
117 "[| f \<in> Pi(A,B); !!x. x:A ==> B(x)<=C(x) |] ==> f \<in> Pi(A,C)" |
118 by (blast intro: Pi_type dest: apply_type) |
118 by (blast intro: Pi_type dest: apply_type) |
220 apply (rule fun_extension) |
220 apply (rule fun_extension) |
221 apply (auto simp add: lam_type apply_type beta) |
221 apply (auto simp add: lam_type apply_type beta) |
222 done |
222 done |
223 |
223 |
224 lemma fun_extension_iff: |
224 lemma fun_extension_iff: |
225 "[| f:Pi(A,B); g:Pi(A,C) |] ==> (\<forall>a\<in>A. f`a = g`a) <-> f=g" |
225 "[| f:Pi(A,B); g:Pi(A,C) |] ==> (\<forall>a\<in>A. f`a = g`a) \<longleftrightarrow> f=g" |
226 by (blast intro: fun_extension) |
226 by (blast intro: fun_extension) |
227 |
227 |
228 (*thm by Mark Staples, proof by lcp*) |
228 (*thm by Mark Staples, proof by lcp*) |
229 lemma fun_subset_eq: "[| f:Pi(A,B); g:Pi(A,C) |] ==> f \<subseteq> g <-> (f = g)" |
229 lemma fun_subset_eq: "[| f:Pi(A,B); g:Pi(A,C) |] ==> f \<subseteq> g \<longleftrightarrow> (f = g)" |
230 by (blast dest: apply_Pair |
230 by (blast dest: apply_Pair |
231 intro: fun_extension apply_equality [symmetric]) |
231 intro: fun_extension apply_equality [symmetric]) |
232 |
232 |
233 |
233 |
234 (*Every element of Pi(A,B) may be expressed as a lambda abstraction!*) |
234 (*Every element of Pi(A,B) may be expressed as a lambda abstraction!*) |
590 Collect_mono Part_mono in_mono |
590 Collect_mono Part_mono in_mono |
591 |
591 |
592 (* Useful with simp; contributed by Clemens Ballarin. *) |
592 (* Useful with simp; contributed by Clemens Ballarin. *) |
593 |
593 |
594 lemma bex_image_simp: |
594 lemma bex_image_simp: |
595 "[| f \<in> Pi(X, Y); A \<subseteq> X |] ==> (\<exists>x\<in>f``A. P(x)) <-> (\<exists>x\<in>A. P(f`x))" |
595 "[| f \<in> Pi(X, Y); A \<subseteq> X |] ==> (\<exists>x\<in>f``A. P(x)) \<longleftrightarrow> (\<exists>x\<in>A. P(f`x))" |
596 apply safe |
596 apply safe |
597 apply rule |
597 apply rule |
598 prefer 2 apply assumption |
598 prefer 2 apply assumption |
599 apply (simp add: apply_equality) |
599 apply (simp add: apply_equality) |
600 apply (blast intro: apply_Pair) |
600 apply (blast intro: apply_Pair) |
601 done |
601 done |
602 |
602 |
603 lemma ball_image_simp: |
603 lemma ball_image_simp: |
604 "[| f \<in> Pi(X, Y); A \<subseteq> X |] ==> (\<forall>x\<in>f``A. P(x)) <-> (\<forall>x\<in>A. P(f`x))" |
604 "[| f \<in> Pi(X, Y); A \<subseteq> X |] ==> (\<forall>x\<in>f``A. P(x)) \<longleftrightarrow> (\<forall>x\<in>A. P(f`x))" |
605 apply safe |
605 apply safe |
606 apply (blast intro: apply_Pair) |
606 apply (blast intro: apply_Pair) |
607 apply (drule bspec) apply assumption |
607 apply (drule bspec) apply assumption |
608 apply (simp add: apply_equality) |
608 apply (simp add: apply_equality) |
609 done |
609 done |