34 lemma "b\<noteq>c \<Longrightarrow> <a,b> \<inter> <a,c> = <a,a>" |
34 lemma "b\<noteq>c \<Longrightarrow> <a,b> \<inter> <a,c> = <a,a>" |
35 by (simp add: Pair_def Int_cons_left Int_cons_right doubleton_eq_iff, blast) |
35 by (simp add: Pair_def Int_cons_left Int_cons_right doubleton_eq_iff, blast) |
36 |
36 |
37 text\<open>These two are cited in Benzmueller and Kohlhase's system description of |
37 text\<open>These two are cited in Benzmueller and Kohlhase's system description of |
38 LEO, CADE-15, 1998 (page 139-143) as theorems LEO could not prove.\<close> |
38 LEO, CADE-15, 1998 (page 139-143) as theorems LEO could not prove.\<close> |
39 lemma "(X = Y \<union> Z) \<longleftrightarrow> (Y \<subseteq> X & Z \<subseteq> X & (\<forall>V. Y \<subseteq> V & Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" |
39 lemma "(X = Y \<union> Z) \<longleftrightarrow> (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" |
40 by (blast intro!: equalityI) |
40 by (blast intro!: equalityI) |
41 |
41 |
42 text\<open>the dual of the previous one\<close> |
42 text\<open>the dual of the previous one\<close> |
43 lemma "(X = Y \<inter> Z) \<longleftrightarrow> (X \<subseteq> Y & X \<subseteq> Z & (\<forall>V. V \<subseteq> Y & V \<subseteq> Z \<longrightarrow> V \<subseteq> X))" |
43 lemma "(X = Y \<inter> Z) \<longleftrightarrow> (X \<subseteq> Y \<and> X \<subseteq> Z \<and> (\<forall>V. V \<subseteq> Y \<and> V \<subseteq> Z \<longrightarrow> V \<subseteq> X))" |
44 by (blast intro!: equalityI) |
44 by (blast intro!: equalityI) |
45 |
45 |
46 text\<open>trivial example of term synthesis: apparently hard for some provers!\<close> |
46 text\<open>trivial example of term synthesis: apparently hard for some provers!\<close> |
47 schematic_goal "a \<noteq> b \<Longrightarrow> a:?X & b \<notin> ?X" |
47 schematic_goal "a \<noteq> b \<Longrightarrow> a:?X \<and> b \<notin> ?X" |
48 by blast |
48 by blast |
49 |
49 |
50 text\<open>Nice blast benchmark. Proved in 0.3s; old tactics can't manage it!\<close> |
50 text\<open>Nice blast benchmark. Proved in 0.3s; old tactics can't manage it!\<close> |
51 lemma "\<forall>x \<in> S. \<forall>y \<in> S. x \<subseteq> y \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
51 lemma "\<forall>x \<in> S. \<forall>y \<in> S. x \<subseteq> y \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
52 by blast |
52 by blast |
61 Ellis Horwood, 53-100 (1979). *) |
61 Ellis Horwood, 53-100 (1979). *) |
62 lemma "(\<forall>F. {x} \<in> F \<longrightarrow> {y} \<in> F) \<longrightarrow> (\<forall>A. x \<in> A \<longrightarrow> y \<in> A)" |
62 lemma "(\<forall>F. {x} \<in> F \<longrightarrow> {y} \<in> F) \<longrightarrow> (\<forall>A. x \<in> A \<longrightarrow> y \<in> A)" |
63 by best |
63 by best |
64 |
64 |
65 text\<open>A characterization of functions suggested by Tobias Nipkow\<close> |
65 text\<open>A characterization of functions suggested by Tobias Nipkow\<close> |
66 lemma "r \<in> domain(r)->B \<longleftrightarrow> r \<subseteq> domain(r)*B & (\<forall>X. r `` (r -`` X) \<subseteq> X)" |
66 lemma "r \<in> domain(r)->B \<longleftrightarrow> r \<subseteq> domain(r)*B \<and> (\<forall>X. r `` (r -`` X) \<subseteq> X)" |
67 by (unfold Pi_def function_def, best) |
67 by (unfold Pi_def function_def, best) |
68 |
68 |
69 |
69 |
70 subsection\<open>Composition of homomorphisms is a Homomorphism\<close> |
70 subsection\<open>Composition of homomorphisms is a Homomorphism\<close> |
71 |
71 |
78 declare comp_fun [simp] SigmaI [simp] apply_funtype [simp] |
78 declare comp_fun [simp] SigmaI [simp] apply_funtype [simp] |
79 |
79 |
80 (*Force helps prove conditions of rewrites such as comp_fun_apply, since |
80 (*Force helps prove conditions of rewrites such as comp_fun_apply, since |
81 rewriting does not instantiate Vars.*) |
81 rewriting does not instantiate Vars.*) |
82 lemma "(\<forall>A f B g. hom(A,f,B,g) = |
82 lemma "(\<forall>A f B g. hom(A,f,B,g) = |
83 {H \<in> A->B. f \<in> A*A->A & g \<in> B*B->B & |
83 {H \<in> A->B. f \<in> A*A->A \<and> g \<in> B*B->B \<and> |
84 (\<forall>x \<in> A. \<forall>y \<in> A. H`(f`<x,y>) = g`<H`x,H`y>)}) \<longrightarrow> |
84 (\<forall>x \<in> A. \<forall>y \<in> A. H`(f`<x,y>) = g`<H`x,H`y>)}) \<longrightarrow> |
85 J \<in> hom(A,f,B,g) & K \<in> hom(B,g,C,h) \<longrightarrow> |
85 J \<in> hom(A,f,B,g) \<and> K \<in> hom(B,g,C,h) \<longrightarrow> |
86 (K O J) \<in> hom(A,f,C,h)" |
86 (K O J) \<in> hom(A,f,C,h)" |
87 by force |
87 by force |
88 |
88 |
89 text\<open>Another version, with meta-level rewriting\<close> |
89 text\<open>Another version, with meta-level rewriting\<close> |
90 lemma "(\<And>A f B g. hom(A,f,B,g) \<equiv> |
90 lemma "(\<And>A f B g. hom(A,f,B,g) \<equiv> |
91 {H \<in> A->B. f \<in> A*A->A & g \<in> B*B->B & |
91 {H \<in> A->B. f \<in> A*A->A \<and> g \<in> B*B->B \<and> |
92 (\<forall>x \<in> A. \<forall>y \<in> A. H`(f`<x,y>) = g`<H`x,H`y>)}) |
92 (\<forall>x \<in> A. \<forall>y \<in> A. H`(f`<x,y>) = g`<H`x,H`y>)}) |
93 \<Longrightarrow> J \<in> hom(A,f,B,g) & K \<in> hom(B,g,C,h) \<longrightarrow> (K O J) \<in> hom(A,f,C,h)" |
93 \<Longrightarrow> J \<in> hom(A,f,B,g) \<and> K \<in> hom(B,g,C,h) \<longrightarrow> (K O J) \<in> hom(A,f,C,h)" |
94 by force |
94 by force |
95 |
95 |
96 |
96 |
97 subsection\<open>Pastre's Examples\<close> |
97 subsection\<open>Pastre's Examples\<close> |
98 |
98 |