src/ZF/QPair.ML
author lcp
Thu, 15 Dec 1994 11:08:22 +0100
changeset 790 4c10e8532d43
parent 782 200a16083201
child 1096 6c177c4c2127
permissions -rw-r--r--
qconverse_qconverse, qconverse_prod: renamed from qconverse_of_qconverse, qconverse_of_prod
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
     1
(*  Title: 	ZF/QPair.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
     6
For QPair.thy.  
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
Quine-inspired ordered pairs and disjoint sums, for non-well-founded data
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
structures in ZF.  Does not precisely follow Quine's construction.  Thanks
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
to Thomas Forster for suggesting this approach!
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
W. V. Quine, On Ordered Pairs and Relations, in Selected Logic Papers,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
1966.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
Many proofs are borrowed from pair.ML and sum.ML
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
Do we EVER have rank(a) < rank(<a;b>) ?  Perhaps if the latter rank
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
    is not a limit ordinal? 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
open QPair;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
(**** Quine ordered pairing ****)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
(** Lemmas for showing that <a;b> uniquely determines a and b **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    28
qed_goalw "QPair_iff" QPair.thy [QPair_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
    "<a;b> = <c;d> <-> a=c & b=d"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
 (fn _=> [rtac sum_equal_iff 1]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    32
bind_thm ("QPair_inject", (QPair_iff RS iffD1 RS conjE));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    34
qed_goal "QPair_inject1" QPair.thy "<a;b> = <c;d> ==> a=c"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
  [ (rtac (major RS QPair_inject) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    38
qed_goal "QPair_inject2" QPair.thy "<a;b> = <c;d> ==> b=d"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
  [ (rtac (major RS QPair_inject) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
(*** QSigma: Disjoint union of a family of sets
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
     Generalizes Cartesian product ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    46
qed_goalw "QSigmaI" QPair.thy [QSigma_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
    "[| a:A;  b:B(a) |] ==> <a;b> : QSigma(A,B)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
 (fn prems=> [ (REPEAT (resolve_tac (prems@[singletonI,UN_I]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
(*The general elimination rule*)
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    51
qed_goalw "QSigmaE" QPair.thy [QSigma_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
    "[| c: QSigma(A,B);  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
\       !!x y.[| x:A;  y:B(x);  c=<x;y> |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
\    |] ==> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
  [ (cut_facts_tac [major] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
    (REPEAT (eresolve_tac [UN_E, singletonE] 1 ORELSE ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
(** Elimination rules for <a;b>:A*B -- introducing no eigenvariables **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
val QSigmaE2 = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
  rule_by_tactic (REPEAT_FIRST (etac QPair_inject ORELSE' bound_hyp_subst_tac)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
		  THEN prune_params_tac)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
      (read_instantiate [("c","<a;b>")] QSigmaE);  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    66
qed_goal "QSigmaD1" QPair.thy "<a;b> : QSigma(A,B) ==> a : A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
  [ (rtac (major RS QSigmaE2) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    70
qed_goal "QSigmaD2" QPair.thy "<a;b> : QSigma(A,B) ==> b : B(a)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
  [ (rtac (major RS QSigmaE2) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    74
val qpair_cs = ZF_cs addSIs [QSigmaI] addSEs [QSigmaE2, QSigmaE, QPair_inject];
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    75
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    76
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    77
qed_goalw "QSigma_cong" QPair.thy [QSigma_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
    "[| A=A';  !!x. x:A' ==> B(x)=B'(x) |] ==> \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
\    QSigma(A,B) = QSigma(A',B')"
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    80
 (fn prems=> [ (simp_tac (ZF_ss addsimps prems) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    82
qed_goal "QSigma_empty1" QPair.thy "QSigma(0,B) = 0"
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    83
 (fn _ => [ (fast_tac (qpair_cs addIs [equalityI]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    85
qed_goal "QSigma_empty2" QPair.thy "A <*> 0 = 0"
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    86
 (fn _ => [ (fast_tac (qpair_cs addIs [equalityI]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
(*** Eliminator - qsplit ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    91
qed_goalw "qsplit" QPair.thy [qsplit_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
    "qsplit(%x y.c(x,y), <a;b>) = c(a,b)"
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    93
 (fn _ => [ (fast_tac (qpair_cs addIs [the_equality]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
    95
qed_goal "qsplit_type" QPair.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
    "[|  p:QSigma(A,B);   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
\        !!x y.[| x:A; y:B(x) |] ==> c(x,y):C(<x;y>) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
\    |] ==> qsplit(%x y.c(x,y), p) : C(p)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
  [ (rtac (major RS QSigmaE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
    (etac ssubst 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
    (REPEAT (ares_tac (prems @ [qsplit RS ssubst]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
(*** qconverse ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   107
qed_goalw "qconverseI" QPair.thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
    "!!a b r. <a;b>:r ==> <b;a>:qconverse(r)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
 (fn _ => [ (fast_tac qpair_cs 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   111
qed_goalw "qconverseD" QPair.thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
    "!!a b r. <a;b> : qconverse(r) ==> <b;a> : r"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
 (fn _ => [ (fast_tac qpair_cs 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   115
qed_goalw "qconverseE" QPair.thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
    "[| yx : qconverse(r);  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
\       !!x y. [| yx=<y;x>;  <x;y>:r |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
\    |] ==> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
 (fn [major,minor]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
  [ (rtac (major RS ReplaceE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   121
    (REPEAT (eresolve_tac [exE, conjE, minor] 1)),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
    (hyp_subst_tac 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
    (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
val qconverse_cs = qpair_cs addSIs [qconverseI] 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
			    addSEs [qconverseD,qconverseE];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
790
4c10e8532d43 qconverse_qconverse, qconverse_prod: renamed from
lcp
parents: 782
diff changeset
   128
qed_goal "qconverse_qconverse" QPair.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
    "!!A B r. r<=QSigma(A,B) ==> qconverse(qconverse(r)) = r"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
 (fn _ => [ (fast_tac (qconverse_cs addSIs [equalityI]) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   132
qed_goal "qconverse_type" QPair.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
    "!!A B r. r <= A <*> B ==> qconverse(r) <= B <*> A"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
 (fn _ => [ (fast_tac qconverse_cs 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
790
4c10e8532d43 qconverse_qconverse, qconverse_prod: renamed from
lcp
parents: 782
diff changeset
   136
qed_goal "qconverse_prod" QPair.thy "qconverse(A <*> B) = B <*> A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
 (fn _ => [ (fast_tac (qconverse_cs addSIs [equalityI]) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   139
qed_goal "qconverse_empty" QPair.thy "qconverse(0) = 0"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
 (fn _ => [ (fast_tac (qconverse_cs addSIs [equalityI]) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
(*** qsplit for predicates: result type o ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
goalw QPair.thy [qfsplit_def] "!!R a b. R(a,b) ==> qfsplit(R, <a;b>)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
by (REPEAT (ares_tac [refl,exI,conjI] 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   147
qed "qfsplitI";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
val major::prems = goalw QPair.thy [qfsplit_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
    "[| qfsplit(R,z);  !!x y. [| z = <x;y>;  R(x,y) |] ==> P |] ==> P";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
by (cut_facts_tac [major] 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
by (REPEAT (eresolve_tac (prems@[asm_rl,exE,conjE]) 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   153
qed "qfsplitE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
goal QPair.thy "!!R a b. qfsplit(R,<a;b>) ==> R(a,b)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
by (REPEAT (eresolve_tac [asm_rl,qfsplitE,QPair_inject,ssubst] 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   157
qed "qfsplitD";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
(**** The Quine-inspired notion of disjoint sum ****)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
val qsum_defs = [qsum_def,QInl_def,QInr_def,qcase_def];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
(** Introduction rules for the injections **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
goalw QPair.thy qsum_defs "!!a A B. a : A ==> QInl(a) : A <+> B";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   167
by (REPEAT (ares_tac [UnI1,QSigmaI,singletonI] 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   168
qed "QInlI";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
goalw QPair.thy qsum_defs "!!b A B. b : B ==> QInr(b) : A <+> B";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
by (REPEAT (ares_tac [UnI2,QSigmaI,singletonI] 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   172
qed "QInrI";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
(** Elimination rules **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
val major::prems = goalw QPair.thy qsum_defs
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
    "[| u: A <+> B;  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
\       !!x. [| x:A;  u=QInl(x) |] ==> P; \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
\       !!y. [| y:B;  u=QInr(y) |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
\    |] ==> P";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
by (rtac (major RS UnE) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
by (REPEAT (rtac refl 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
     ORELSE eresolve_tac (prems@[QSigmaE,singletonE,ssubst]) 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   184
qed "qsumE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
(** Injection and freeness equivalences, for rewriting **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   188
goalw QPair.thy qsum_defs "QInl(a)=QInl(b) <-> a=b";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   189
by (simp_tac (ZF_ss addsimps [QPair_iff]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   190
qed "QInl_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   192
goalw QPair.thy qsum_defs "QInr(a)=QInr(b) <-> a=b";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   193
by (simp_tac (ZF_ss addsimps [QPair_iff]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   194
qed "QInr_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   195
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   196
goalw QPair.thy qsum_defs "QInl(a)=QInr(b) <-> False";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   197
by (simp_tac (ZF_ss addsimps [QPair_iff, one_not_0 RS not_sym]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   198
qed "QInl_QInr_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   199
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   200
goalw QPair.thy qsum_defs "QInr(b)=QInl(a) <-> False";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   201
by (simp_tac (ZF_ss addsimps [QPair_iff, one_not_0]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   202
qed "QInr_QInl_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   204
(*Injection and freeness rules*)
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   205
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   206
bind_thm ("QInl_inject", (QInl_iff RS iffD1));
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   207
bind_thm ("QInr_inject", (QInr_iff RS iffD1));
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   208
bind_thm ("QInl_neq_QInr", (QInl_QInr_iff RS iffD1 RS FalseE));
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   209
bind_thm ("QInr_neq_QInl", (QInr_QInl_iff RS iffD1 RS FalseE));
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   210
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
val qsum_cs = 
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   212
    qpair_cs addSIs [PartI, QInlI, QInrI] 
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   213
             addSEs [PartE, qsumE, QInl_neq_QInr, QInr_neq_QInl]
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   214
             addSDs [QInl_inject, QInr_inject];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   216
goal QPair.thy "!!A B. QInl(a): A<+>B ==> a: A";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   217
by (fast_tac qsum_cs 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   218
qed "QInlD";
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   219
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   220
goal QPair.thy "!!A B. QInr(b): A<+>B ==> b: B";
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   221
by (fast_tac qsum_cs 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   222
qed "QInrD";
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   223
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   224
(** <+> is itself injective... who cares?? **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
goal QPair.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
    "u: A <+> B <-> (EX x. x:A & u=QInl(x)) | (EX y. y:B & u=QInr(y))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   228
by (fast_tac qsum_cs 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   229
qed "qsum_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
goal QPair.thy "A <+> B <= C <+> D <-> A<=C & B<=D";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   232
by (fast_tac qsum_cs 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   233
qed "qsum_subset_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   234
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
goal QPair.thy "A <+> B = C <+> D <-> A=C & B=D";
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   236
by (simp_tac (ZF_ss addsimps [extension,qsum_subset_iff]) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   237
by (fast_tac ZF_cs 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   238
qed "qsum_equal_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   239
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
(*** Eliminator -- qcase ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   241
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   242
goalw QPair.thy qsum_defs "qcase(c, d, QInl(a)) = c(a)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   243
by (rtac (qsplit RS trans) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
by (rtac cond_0 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   245
qed "qcase_QInl";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
goalw QPair.thy qsum_defs "qcase(c, d, QInr(b)) = d(b)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   248
by (rtac (qsplit RS trans) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
by (rtac cond_1 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   250
qed "qcase_QInr";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   251
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   252
val major::prems = goal QPair.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   253
    "[| u: A <+> B; \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
\       !!x. x: A ==> c(x): C(QInl(x));   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   255
\       !!y. y: B ==> d(y): C(QInr(y)) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
\    |] ==> qcase(c,d,u) : C(u)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
by (rtac (major RS qsumE) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
by (ALLGOALS (etac ssubst));
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   259
by (ALLGOALS (asm_simp_tac (ZF_ss addsimps
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
			    (prems@[qcase_QInl,qcase_QInr]))));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   261
qed "qcase_type";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   262
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
(** Rules for the Part primitive **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   264
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   265
goal QPair.thy "Part(A <+> B,QInl) = {QInl(x). x: A}";
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   266
by (fast_tac (qsum_cs addIs [equalityI]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   267
qed "Part_QInl";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
goal QPair.thy "Part(A <+> B,QInr) = {QInr(y). y: B}";
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   270
by (fast_tac (qsum_cs addIs [equalityI]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   271
qed "Part_QInr";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
goal QPair.thy "Part(A <+> B, %x.QInr(h(x))) = {QInr(y). y: Part(B,h)}";
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   274
by (fast_tac (qsum_cs addIs [equalityI]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   275
qed "Part_QInr2";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
goal QPair.thy "!!A B C. C <= A <+> B ==> Part(C,QInl) Un Part(C,QInr) = C";
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
   278
by (fast_tac (qsum_cs addIs [equalityI]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   279
qed "Part_qsum_equality";