src/ZF/OrdQuant.ML
author paulson
Wed, 28 Jun 2000 12:34:08 +0200
changeset 9180 3bda56c0d70d
parent 6112 5e4871c5136b
child 9211 6236c5285bd8
permissions -rw-r--r--
tidying and unbatchifying

(*  Title:      ZF/AC/OrdQuant.thy
    ID:         $Id$
    Authors:    Krzysztof Grabczewski and L C Paulson

Quantifiers and union operator for ordinals. 
*)

(*** universal quantifier for ordinals ***)

qed_goalw "oallI" thy [oall_def]
    "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)"
 (fn prems=> [ (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ]);

qed_goalw "ospec" thy [oall_def]
    "[| ALL x<A. P(x);  x<A |] ==> P(x)"
 (fn major::prems=>
  [ (rtac (major RS spec RS mp) 1),
    (resolve_tac prems 1) ]);

qed_goalw "oallE" thy [oall_def]
    "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q"
 (fn major::prems=>
  [ (rtac (major RS allE) 1),
    (REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ]);

val major::prems= goal thy
    "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q";
by (rtac (major RS oallE) 1);
by (REPEAT (eresolve_tac prems 1)) ;
qed "rev_oallE";

(*Trival rewrite rule;   (ALL x<a.P)<->P holds only if a is not 0!*)
Goal "(ALL x<a. True) <-> True";
by (REPEAT (ares_tac [TrueI,oallI,iffI] 1)) ;
qed "oall_simp";

(*Congruence rule for rewriting*)
qed_goalw "oall_cong" thy [oall_def]
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oall(a,P) <-> oall(a',P')"
 (fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]);


(*** existential quantifier for ordinals ***)

qed_goalw "oexI" thy [oex_def]
    "[| P(x);  x<A |] ==> EX x<A. P(x)"
 (fn prems=> [ (REPEAT (ares_tac (prems @ [exI,conjI]) 1)) ]);

(*Not of the general form for such rules; ~EX has become ALL~ *)
val prems = Goal
   "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)";
by (rtac classical 1);
by (REPEAT (ares_tac (prems@[oexI,oallI,notI,notE]) 1)) ;
qed "oexCI";

qed_goalw "oexE" thy [oex_def]
    "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q \
\    |] ==> Q"
 (fn major::prems=>
  [ (rtac (major RS exE) 1),
    (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ]);

qed_goalw "oex_cong" thy [oex_def]
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) \
\    |] ==> oex(a,P) <-> oex(a',P')"
 (fn prems=> [ (simp_tac (simpset() addsimps prems addcongs [conj_cong]) 1) ]);


(*** Rules for Ordinal-Indexed Unions ***)

qed_goalw "OUN_I" thy [OUnion_def]
        "!!i. [| a<i;  b: B(a) |] ==> b: (UN z<i. B(z))"
 (fn _=> [ fast_tac (claset() addSEs [ltE]) 1 ]);

qed_goalw "OUN_E" thy [OUnion_def]
    "[| b : (UN z<i. B(z));  !!a.[| b: B(a);  a<i |] ==> R |] ==> R"
 (fn major::prems=>
  [ (rtac (major RS CollectE) 1),
    (rtac UN_E 1),
    (REPEAT (ares_tac (ltI::prems) 1)) ]);

qed_goalw "OUN_iff" thy [oex_def]
    "b : (UN x<i. B(x)) <-> (EX x<i. b : B(x))"
 (fn _=> [ (fast_tac (claset() addIs [OUN_I] addSEs [OUN_E]) 1) ]);

val prems = Goal
    "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (UN x<i. C(x)) = (UN x<j. D(x))";
by (rtac equality_iffI 1);
by (simp_tac (simpset() addcongs [oex_cong] addsimps OUN_iff::prems) 1) ;
qed "OUN_cong";

AddSIs [oallI];
AddIs  [oexI, OUN_I];
AddSEs [oexE, OUN_E];
AddEs  [rev_oallE];

val Ord_atomize = atomize (("OrdQuant.oall", [ospec])::ZF_conn_pairs, 
                           ZF_mem_pairs);

simpset_ref() := simpset() setmksimps (map mk_eq o Ord_atomize o gen_all)
                        addsimps [oall_simp, ltD RS beta]
                        addcongs [oall_cong, oex_cong, OUN_cong];

val major::prems = Goalw [lt_def, oall_def]
    "[| i<k;  !!x.[| x<k;  ALL y<x. P(y) |] ==> P(x) \
\    |]  ==>  P(i)";
by (rtac (major RS conjE) 1);
by (etac Ord_induct 1 THEN assume_tac 1);
by (fast_tac (claset() addIs prems) 1);
qed "lt_induct";