Tidied some examples
authorpaulson
Mon Jul 21 13:02:07 2003 +0200 (2003-07-21 ago)
changeset 141203a73850c6c7d
parent 14119 fb9c392644a1
child 14121 d2a0fd183f5f
Tidied some examples
src/ZF/OrderArith.thy
src/ZF/ex/misc.thy
     1.1 --- a/src/ZF/OrderArith.thy	Mon Jul 21 10:58:16 2003 +0200
     1.2 +++ b/src/ZF/OrderArith.thy	Mon Jul 21 13:02:07 2003 +0200
     1.3 @@ -543,6 +543,27 @@
     1.4  apply (frule ok, assumption+, blast) 
     1.5  done
     1.6  
     1.7 +subsubsection{*Bijections involving Powersets*}
     1.8 +
     1.9 +lemma Pow_sum_bij:
    1.10 +    "(\<lambda>Z \<in> Pow(A+B). <{x \<in> A. Inl(x) \<in> Z}, {y \<in> B. Inr(y) \<in> Z}>)  
    1.11 +     \<in> bij(Pow(A+B), Pow(A)*Pow(B))"
    1.12 +apply (rule_tac d = "%<X,Y>. {Inl (x). x \<in> X} Un {Inr (y). y \<in> Y}" 
    1.13 +       in lam_bijective)
    1.14 +apply force+
    1.15 +done
    1.16 +
    1.17 +text{*As a special case, we have @{term "bij(Pow(A*B), A -> Pow(B))"} *}
    1.18 +lemma Pow_Sigma_bij:
    1.19 +    "(\<lambda>r \<in> Pow(Sigma(A,B)). \<lambda>x \<in> A. r``{x})  
    1.20 +     \<in> bij(Pow(Sigma(A,B)), \<Pi>x \<in> A. Pow(B(x)))"
    1.21 +apply (rule_tac d = "%f. \<Union>x \<in> A. \<Union>y \<in> f`x. {<x,y>}" in lam_bijective)
    1.22 +apply (blast intro: lam_type)
    1.23 +apply (blast dest: apply_type, simp_all)
    1.24 +apply fast (*strange, but blast can't do it*)
    1.25 +apply (rule fun_extension, auto)
    1.26 +by blast
    1.27 +
    1.28  
    1.29  ML {*
    1.30  val measure_def = thm "measure_def";
     2.1 --- a/src/ZF/ex/misc.thy	Mon Jul 21 10:58:16 2003 +0200
     2.2 +++ b/src/ZF/ex/misc.thy	Mon Jul 21 13:02:07 2003 +0200
     2.3 @@ -3,32 +3,37 @@
     2.4      Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     2.5      Copyright   1993  University of Cambridge
     2.6  
     2.7 -Miscellaneous examples for Zermelo-Fraenkel Set Theory 
     2.8  Composition of homomorphisms, Pastre's examples, ...
     2.9  *)
    2.10  
    2.11 +header{*Miscellaneous ZF Examples*}
    2.12 +
    2.13  theory misc = Main:
    2.14  
    2.15 -
    2.16 +subsection{*Various Small Problems*}
    2.17  
    2.18 -(*These two are cited in Benzmueller and Kohlhase's system description of LEO,
    2.19 -  CADE-15, 1998 (page 139-143) as theorems LEO could not prove.*)
    2.20 +text{*A weird property of ordered pairs.*}
    2.21 +lemma "b\<noteq>c ==> <a,b> Int <a,c> = <a,a>"
    2.22 +by (simp add: Pair_def Int_cons_left Int_cons_right doubleton_eq_iff, blast)
    2.23 +
    2.24 +text{*These two are cited in Benzmueller and Kohlhase's system description of
    2.25 + LEO, CADE-15, 1998 (page 139-143) as theorems LEO could not prove.*}
    2.26  lemma "(X = Y Un Z) <-> (Y \<subseteq> X & Z \<subseteq> X & (\<forall>V. Y \<subseteq> V & Z \<subseteq> V --> X \<subseteq> V))"
    2.27  by (blast intro!: equalityI)
    2.28  
    2.29 -(*the dual of the previous one*)
    2.30 +text{*the dual of the previous one}
    2.31  lemma "(X = Y Int Z) <-> (X \<subseteq> Y & X \<subseteq> Z & (\<forall>V. V \<subseteq> Y & V \<subseteq> Z --> V \<subseteq> X))"
    2.32  by (blast intro!: equalityI)
    2.33  
    2.34 -(*trivial example of term synthesis: apparently hard for some provers!*)
    2.35 +text{*trivial example of term synthesis: apparently hard for some provers!}
    2.36  lemma "a \<noteq> b ==> a:?X & b \<notin> ?X"
    2.37  by blast
    2.38  
    2.39 -(*Nice Blast_tac benchmark.  Proved in 0.3s; old tactics can't manage it!*)
    2.40 +text{*Nice Blast_tac benchmark.  Proved in 0.3s; old tactics can't manage it!}
    2.41  lemma "\<forall>x \<in> S. \<forall>y \<in> S. x \<subseteq> y ==> \<exists>z. S \<subseteq> {z}"
    2.42  by blast
    2.43  
    2.44 -(*variant of the benchmark above*)
    2.45 +text{*variant of the benchmark above}
    2.46  lemma "\<forall>x \<in> S. Union(S) \<subseteq> x ==> \<exists>z. S \<subseteq> {z}"
    2.47  by blast
    2.48  
    2.49 @@ -39,16 +44,19 @@
    2.50  lemma "(\<forall>F. {x} \<in> F --> {y} \<in> F) --> (\<forall>A. x \<in> A --> y \<in> A)"
    2.51  by best
    2.52  
    2.53 +text{*A characterization of functions suggested by Tobias Nipkow*}
    2.54 +lemma "r \<in> domain(r)->B  <->  r \<subseteq> domain(r)*B & (\<forall>X. r `` (r -`` X) \<subseteq> X)"
    2.55 +by (unfold Pi_def function_def, best)
    2.56  
    2.57 -(*** Composition of homomorphisms is a homomorphism ***)
    2.58  
    2.59 -(*Given as a challenge problem in
    2.60 +subsection{*Composition of homomorphisms is a Homomorphism*}
    2.61 +
    2.62 +text{*Given as a challenge problem in
    2.63    R. Boyer et al.,
    2.64    Set Theory in First-Order Logic: Clauses for G\"odel's Axioms,
    2.65 -  JAR 2 (1986), 287-327 
    2.66 -*)
    2.67 +  JAR 2 (1986), 287-327 *}
    2.68  
    2.69 -(*collecting the relevant lemmas*)
    2.70 +text{*collecting the relevant lemmas}
    2.71  declare comp_fun [simp] SigmaI [simp] apply_funtype [simp]
    2.72  
    2.73  (*Force helps prove conditions of rewrites such as comp_fun_apply, since
    2.74 @@ -60,7 +68,7 @@
    2.75         (K O J) \<in> hom(A,f,C,h)"
    2.76  by force
    2.77  
    2.78 -(*Another version, with meta-level rewriting*)
    2.79 +text{*Another version, with meta-level rewriting}
    2.80  lemma "(!! A f B g. hom(A,f,B,g) ==  
    2.81             {H \<in> A->B. f \<in> A*A->A & g \<in> B*B->B &  
    2.82                       (\<forall>x \<in> A. \<forall>y \<in> A. H`(f`<x,y>) = g`<H`x,H`y>)}) 
    2.83 @@ -68,17 +76,11 @@
    2.84  by force
    2.85  
    2.86  
    2.87 -
    2.88 -(** A characterization of functions suggested by Tobias Nipkow **)
    2.89 -
    2.90 -lemma "r \<in> domain(r)->B  <->  r \<subseteq> domain(r)*B & (\<forall>X. r `` (r -`` X) \<subseteq> X)"
    2.91 -by (unfold Pi_def function_def, best)
    2.92 +subsection{*Pastre's Examples*}
    2.93  
    2.94 -(**** From D Pastre.  Automatic theorem proving in set theory. 
    2.95 -         Artificial Intelligence, 10:1--27, 1978.
    2.96 -
    2.97 -      Previously, these were done using ML code, but blast manages fine.
    2.98 -****)
    2.99 +text{*D Pastre.  Automatic theorem proving in set theory. 
   2.100 +        Artificial Intelligence, 10:1--27, 1978.
   2.101 +Previously, these were done using ML code, but blast manages fine.*}
   2.102  
   2.103  lemmas compIs [intro] = comp_surj comp_inj comp_fun [intro]
   2.104  lemmas compDs [dest] =  comp_mem_injD1 comp_mem_surjD1 
   2.105 @@ -120,26 +122,5 @@
   2.106  by (unfold bij_def, blast)
   2.107  
   2.108  
   2.109 -(** Yet another example... **)
   2.110 -
   2.111 -lemma Pow_sum_bij:
   2.112 -    "(\<lambda>Z \<in> Pow(A+B). <{x \<in> A. Inl(x) \<in> Z}, {y \<in> B. Inr(y) \<in> Z}>)  
   2.113 -     \<in> bij(Pow(A+B), Pow(A)*Pow(B))"
   2.114 -apply (rule_tac d = "%<X,Y>. {Inl (x). x \<in> X} Un {Inr (y). y \<in> Y}" 
   2.115 -       in lam_bijective)
   2.116 -apply force+
   2.117 -done
   2.118 -
   2.119 -(*As a special case, we have  bij(Pow(A*B), A -> Pow B)  *)
   2.120 -lemma Pow_Sigma_bij:
   2.121 -    "(\<lambda>r \<in> Pow(Sigma(A,B)). \<lambda>x \<in> A. r``{x})  
   2.122 -     \<in> bij(Pow(Sigma(A,B)), \<Pi>x \<in> A. Pow(B(x)))"
   2.123 -apply (rule_tac d = "%f. \<Union>x \<in> A. \<Union>y \<in> f`x. {<x,y>}" in lam_bijective)
   2.124 -apply (blast intro: lam_type)
   2.125 -apply (blast dest: apply_type, simp_all)
   2.126 -apply fast (*strange, but blast can't do it*)
   2.127 -apply (rule fun_extension, auto)
   2.128 -by blast
   2.129 -
   2.130  end
   2.131