src/ZF/ex/misc.ML
changeset 9061 144b06e6729e
parent 8266 4bc79ed1233b
child 11233 34c81a796ee3
equal deleted inserted replaced
9060:b0dd884b1848 9061:144b06e6729e
     1 (*  Title:      ZF/ex/misc
     1 (*  Title:      ZF/ex/misc.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1993  University of Cambridge
     4     Copyright   1993  University of Cambridge
     5 
     5 
     6 Miscellaneous examples for Zermelo-Fraenkel Set Theory 
     6 Miscellaneous examples for Zermelo-Fraenkel Set Theory 
     7 Composition of homomorphisms, Pastre's examples, ...
     7 Composition of homomorphisms, Pastre's examples, ...
     8 *)
     8 *)
     9 
     9 
    10 writeln"ZF/ex/misc";
    10 (*These two are cited in Benzmueller and Kohlhase's system description of LEO,
    11 
       
    12 (*These two are cited in Benzmueller and Kohlhash's system description of LEO,
       
    13   CADE-15, 1998 (page 139-143) as theorems LEO could not prove.*)
    11   CADE-15, 1998 (page 139-143) as theorems LEO could not prove.*)
    14 
    12 
    15 Goal "(X = Y Un Z) <-> (Y<=X & Z<=X & (ALL V. Y<=V & Z<=V --> X<=V))";
    13 Goal "(X = Y Un Z) <-> (Y<=X & Z<=X & (ALL V. Y<=V & Z<=V --> X<=V))";
    16 by (blast_tac (claset() addSIs [equalityI]) 1);
    14 by (blast_tac (claset() addSIs [equalityI]) 1);
    17 result();
    15 qed "";
    18 
    16 
    19 (*the dual of the previous one*)
    17 (*the dual of the previous one*)
    20 Goal "(X = Y Int Z) <-> (X<=Y & X<=Z & (ALL V. V<=Y & V<=Z --> V<=X))";
    18 Goal "(X = Y Int Z) <-> (X<=Y & X<=Z & (ALL V. V<=Y & V<=Z --> V<=X))";
    21 by (blast_tac (claset() addSIs [equalityI]) 1);
    19 by (blast_tac (claset() addSIs [equalityI]) 1);
    22 result();
    20 qed "";
    23 
    21 
    24 (*trivial example of term synthesis: apparently hard for some provers!*)
    22 (*trivial example of term synthesis: apparently hard for some provers!*)
    25 Goal "a ~= b ==> a:?X & b ~: ?X";
    23 Goal "a ~= b ==> a:?X & b ~: ?X";
    26 by (Blast_tac 1);
    24 by (Blast_tac 1);
    27 result();
    25 qed "";
    28 
    26 
    29 (*Nice Blast_tac benchmark.  Proved in 0.3s; old tactics can't manage it!*)
    27 (*Nice Blast_tac benchmark.  Proved in 0.3s; old tactics can't manage it!*)
    30 Goal "ALL x:S. ALL y:S. x<=y ==> EX z. S <= {z}";
    28 Goal "ALL x:S. ALL y:S. x<=y ==> EX z. S <= {z}";
    31 by (Blast_tac 1);
    29 by (Blast_tac 1);
    32 result();
    30 qed "";
    33 
    31 
    34 (*variant of the benchmark above*)
    32 (*variant of the benchmark above*)
    35 Goal "ALL x:S. Union(S) <= x ==> EX z. S <= {z}";
    33 Goal "ALL x:S. Union(S) <= x ==> EX z. S <= {z}";
    36 by (Blast_tac 1);
    34 by (Blast_tac 1);
    37 result();
    35 qed "";
    38 
    36 
    39 context Perm.thy;
    37 context Perm.thy;
    40 
    38 
    41 (*Example 12 (credited to Peter Andrews) from
    39 (*Example 12 (credited to Peter Andrews) from
    42  W. Bledsoe.  A Maximal Method for Set Variables in Automatic Theorem-proving.
    40  W. Bledsoe.  A Maximal Method for Set Variables in Automatic Theorem-proving.
    43  In: J. Hayes and D. Michie and L. Mikulich, eds.  Machine Intelligence 9.
    41  In: J. Hayes and D. Michie and L. Mikulich, eds.  Machine Intelligence 9.
    44  Ellis Horwood, 53-100 (1979). *)
    42  Ellis Horwood, 53-100 (1979). *)
    45 Goal "(ALL F. {x}: F --> {y}:F) --> (ALL A. x:A --> y:A)";
    43 Goal "(ALL F. {x}: F --> {y}:F) --> (ALL A. x:A --> y:A)";
    46 by (Best_tac 1);
    44 by (Best_tac 1);
    47 result();
    45 qed "";
    48 
    46 
    49 
    47 
    50 (*** Composition of homomorphisms is a homomorphism ***)
    48 (*** Composition of homomorphisms is a homomorphism ***)
    51 
    49 
    52 (*Given as a challenge problem in
    50 (*Given as a challenge problem in
    66 \          {H: A->B. f:A*A->A & g:B*B->B & \
    64 \          {H: A->B. f:A*A->A & g:B*B->B & \
    67 \                    (ALL x:A. ALL y:A. H`(f`<x,y>) = g`<H`x,H`y>)}) --> \
    65 \                    (ALL x:A. ALL y:A. H`(f`<x,y>) = g`<H`x,H`y>)}) --> \
    68 \    J : hom(A,f,B,g) & K : hom(B,g,C,h) -->  \
    66 \    J : hom(A,f,B,g) & K : hom(B,g,C,h) -->  \
    69 \    (K O J) : hom(A,f,C,h)";
    67 \    (K O J) : hom(A,f,C,h)";
    70 by (asm_simp_tac (simpset() setloop (K Safe_tac)) 1);
    68 by (asm_simp_tac (simpset() setloop (K Safe_tac)) 1);
    71 val comp_homs = result();
    69 qed "";
    72 
    70 
    73 (*This version uses meta-level rewriting, safe_tac and asm_simp_tac*)
    71 (*This version uses meta-level rewriting, safe_tac and asm_simp_tac*)
    74 val [hom_def] = goal Perm.thy
    72 val [hom_def] = goal Perm.thy
    75     "(!! A f B g. hom(A,f,B,g) == \
    73     "(!! A f B g. hom(A,f,B,g) == \
    76 \          {H: A->B. f:A*A->A & g:B*B->B & \
    74 \          {H: A->B. f:A*A->A & g:B*B->B & \
    87 (** A characterization of functions, suggested by Tobias Nipkow **)
    85 (** A characterization of functions, suggested by Tobias Nipkow **)
    88 
    86 
    89 Goalw [Pi_def, function_def]
    87 Goalw [Pi_def, function_def]
    90     "r: domain(r)->B  <->  r <= domain(r)*B & (ALL X. r `` (r -`` X) <= X)";
    88     "r: domain(r)->B  <->  r <= domain(r)*B & (ALL X. r `` (r -`` X) <= X)";
    91 by (Best_tac 1);
    89 by (Best_tac 1);
    92 result();
    90 qed "";
    93 
    91 
    94 
    92 
    95 (**** From D Pastre.  Automatic theorem proving in set theory. 
    93 (**** From D Pastre.  Automatic theorem proving in set theory. 
    96          Artificial Intelligence, 10:1--27, 1978.
    94          Artificial Intelligence, 10:1--27, 1978.
    97              These examples require forward reasoning! ****)
    95              These examples require forward reasoning! ****)
   189 by (assume_tac 2);
   187 by (assume_tac 2);
   190 by (rtac (singletonI RS lam_type) 1);
   188 by (rtac (singletonI RS lam_type) 1);
   191 by (Asm_simp_tac 1);
   189 by (Asm_simp_tac 1);
   192 by (Blast_tac 1);
   190 by (Blast_tac 1);
   193 qed "Pow_Sigma_bij";
   191 qed "Pow_Sigma_bij";
   194 
       
   195 writeln"Reached end of file.";