src/ZF/QPair.ML
author wenzelm
Mon, 22 Jun 1998 17:12:27 +0200
changeset 5067 62b6288e6005
parent 4477 b3e5857d8d99
child 5137 60205b0de9b9
permissions -rw-r--r--
isatool fixgoal;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1096
diff changeset
     1
(*  Title:      ZF/QPair.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1096
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
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
open QPair;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
(**** Quine ordered pairing ****)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
(** Lemmas for showing that <a;b> uniquely determines a and b **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    27
qed_goalw "QPair_empty" thy [QPair_def]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    28
    "<0;0> = 0"
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    29
 (fn _=> [Simp_tac 1]);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    30
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    31
qed_goalw "QPair_iff" thy [QPair_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
    "<a;b> = <c;d> <-> a=c & b=d"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
 (fn _=> [rtac sum_equal_iff 1]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    35
bind_thm ("QPair_inject", (QPair_iff RS iffD1 RS conjE));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    37
Addsimps [QPair_empty, QPair_iff];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    38
AddSEs   [QPair_inject];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    39
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    40
qed_goal "QPair_inject1" thy "<a;b> = <c;d> ==> a=c"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
  [ (rtac (major RS QPair_inject) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    44
qed_goal "QPair_inject2" thy "<a;b> = <c;d> ==> b=d"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
  [ (rtac (major RS QPair_inject) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
(*** QSigma: Disjoint union of a family of sets
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
     Generalizes Cartesian product ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    52
qed_goalw "QSigmaI" thy [QSigma_def]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    53
    "!!A B. [| a:A;  b:B(a) |] ==> <a;b> : QSigma(A,B)"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
    54
 (fn _ => [ Blast_tac 1 ]);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    55
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    56
AddSIs [QSigmaI];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
(*The general elimination rule*)
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    59
qed_goalw "QSigmaE" thy [QSigma_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
    "[| c: QSigma(A,B);  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
\       !!x y.[| x:A;  y:B(x);  c=<x;y> |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
\    |] ==> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
  [ (cut_facts_tac [major] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
    (REPEAT (eresolve_tac [UN_E, singletonE] 1 ORELSE ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
(** Elimination rules for <a;b>:A*B -- introducing no eigenvariables **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
val QSigmaE2 = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
  rule_by_tactic (REPEAT_FIRST (etac QPair_inject ORELSE' bound_hyp_subst_tac)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1096
diff changeset
    71
                  THEN prune_params_tac)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
      (read_instantiate [("c","<a;b>")] QSigmaE);  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    74
qed_goal "QSigmaD1" thy "<a;b> : QSigma(A,B) ==> a : A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
  [ (rtac (major RS QSigmaE2) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    78
qed_goal "QSigmaD2" thy "<a;b> : QSigma(A,B) ==> b : B(a)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
  [ (rtac (major RS QSigmaE2) 1), (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    82
AddSEs [QSigmaE2, QSigmaE];
744
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    83
2054fa3c8d76 tidied proofs, using fast_tac etc. as much as possible
lcp
parents: 516
diff changeset
    84
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    85
qed_goalw "QSigma_cong" thy [QSigma_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
    "[| A=A';  !!x. x:A' ==> B(x)=B'(x) |] ==> \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
\    QSigma(A,B) = QSigma(A',B')"
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
    88
 (fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    90
qed_goal "QSigma_empty1" thy "QSigma(0,B) = 0"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
    91
 (fn _ => [ (Blast_tac 1) ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    92
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    93
qed_goal "QSigma_empty2" thy "A <*> 0 = 0"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
    94
 (fn _ => [ (Blast_tac 1) ]);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    95
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    96
Addsimps [QSigma_empty1, QSigma_empty2];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    98
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
    99
(*** Projections: qfst, qsnd ***)
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   100
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   101
qed_goalw "qfst_conv" thy [qfst_def] "qfst(<a;b>) = a"
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   102
 (fn _=> 
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   103
  [ (blast_tac (claset() addIs [the_equality]) 1) ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   104
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   105
qed_goalw "qsnd_conv" thy [qsnd_def] "qsnd(<a;b>) = b"
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   106
 (fn _=> 
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   107
  [ (blast_tac (claset() addIs [the_equality]) 1) ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   108
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   109
Addsimps [qfst_conv, qsnd_conv];
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   110
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   111
qed_goal "qfst_type" thy
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   112
    "!!p. p:QSigma(A,B) ==> qfst(p) : A"
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4091
diff changeset
   113
 (fn _=> [ Auto_tac ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   114
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   115
qed_goal "qsnd_type" thy
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   116
    "!!p. p:QSigma(A,B) ==> qsnd(p) : B(qfst(p))"
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4091
diff changeset
   117
 (fn _=> [ Auto_tac ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   118
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   119
Goal "!!a A B. a: QSigma(A,B) ==> <qfst(a); qsnd(a)> = a";
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4091
diff changeset
   120
by Auto_tac;
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   121
qed "QPair_qfst_qsnd_eq";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
(*** Eliminator - qsplit ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   126
(*A META-equality, so that it applies to higher types as well...*)
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   127
qed_goalw "qsplit" thy [qsplit_def]
3840
e0baea4d485a fixed dots;
wenzelm
parents: 3016
diff changeset
   128
    "qsplit(%x y. c(x,y), <a;b>) == c(a,b)"
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   129
 (fn _ => [ (Simp_tac 1),
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   130
            (rtac reflexive_thm 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   132
Addsimps [qsplit];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   133
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   134
qed_goal "qsplit_type" thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
    "[|  p:QSigma(A,B);   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
\        !!x y.[| x:A; y:B(x) |] ==> c(x,y):C(<x;y>) \
3840
e0baea4d485a fixed dots;
wenzelm
parents: 3016
diff changeset
   137
\    |] ==> qsplit(%x y. c(x,y), p) : C(p)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   139
  [ (rtac (major RS QSigmaE) 1),
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   140
    (asm_simp_tac (simpset() addsimps prems) 1) ]);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   141
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   142
Goalw [qsplit_def]
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   143
  "!!u. u: A<*>B ==>   \
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   144
\       R(qsplit(c,u)) <-> (ALL x:A. ALL y:B. u = <x;y> --> R(c(x,y)))";
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4091
diff changeset
   145
by Auto_tac;
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   146
qed "expand_qsplit";
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   147
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   148
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   149
(*** qsplit for predicates: result type o ***)
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   150
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   151
Goalw [qsplit_def] "!!R a b. R(a,b) ==> qsplit(R, <a;b>)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   152
by (Asm_simp_tac 1);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   153
qed "qsplitI";
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   154
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   155
val major::sigma::prems = goalw thy [qsplit_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1096
diff changeset
   156
    "[| qsplit(R,z);  z:QSigma(A,B);                    \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1096
diff changeset
   157
\       !!x y. [| z = <x;y>;  R(x,y) |] ==> P           \
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   158
\   |] ==> P";
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   159
by (rtac (sigma RS QSigmaE) 1);
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   160
by (cut_facts_tac [major] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   161
by (REPEAT (ares_tac prems 1));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   162
by (Asm_full_simp_tac 1);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   163
qed "qsplitE";
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   164
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   165
Goalw [qsplit_def] "!!R a b. qsplit(R,<a;b>) ==> R(a,b)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   166
by (Asm_full_simp_tac 1);
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   167
qed "qsplitD";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   168
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
(*** qconverse ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   172
qed_goalw "qconverseI" thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
    "!!a b r. <a;b>:r ==> <b;a>:qconverse(r)"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   174
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   176
qed_goalw "qconverseD" thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
    "!!a b r. <a;b> : qconverse(r) ==> <b;a> : r"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   178
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   180
qed_goalw "qconverseE" thy [qconverse_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
    "[| yx : qconverse(r);  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
\       !!x y. [| yx=<y;x>;  <x;y>:r |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
\    |] ==> P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   184
 (fn [major,minor]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
  [ (rtac (major RS ReplaceE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
    (REPEAT (eresolve_tac [exE, conjE, minor] 1)),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
    (hyp_subst_tac 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   188
    (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   189
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   190
AddSIs [qconverseI];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   191
AddSEs [qconverseD, qconverseE];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   193
qed_goal "qconverse_qconverse" thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
    "!!A B r. r<=QSigma(A,B) ==> qconverse(qconverse(r)) = r"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   195
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   196
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   197
qed_goal "qconverse_type" thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   198
    "!!A B r. r <= A <*> B ==> qconverse(r) <= B <*> A"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   199
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   200
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   201
qed_goal "qconverse_prod" thy "qconverse(A <*> B) = B <*> A"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   202
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   204
qed_goal "qconverse_empty" thy "qconverse(0) = 0"
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   205
 (fn _ => [ (Blast_tac 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   207
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   208
(**** The Quine-inspired notion of disjoint sum ****)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
val qsum_defs = [qsum_def,QInl_def,QInr_def,qcase_def];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   212
(** Introduction rules for the injections **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   214
Goalw qsum_defs "!!a A B. a : A ==> QInl(a) : A <+> B";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   215
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   216
qed "QInlI";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   217
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   218
Goalw qsum_defs "!!b A B. b : B ==> QInr(b) : A <+> B";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   219
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   220
qed "QInrI";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
(** Elimination rules **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   223
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   224
val major::prems = goalw thy qsum_defs
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
    "[| u: A <+> B;  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
\       !!x. [| x:A;  u=QInl(x) |] ==> P; \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
\       !!y. [| y:B;  u=QInr(y) |] ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   228
\    |] ==> P";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
by (rtac (major RS UnE) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
by (REPEAT (rtac refl 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
     ORELSE eresolve_tac (prems@[QSigmaE,singletonE,ssubst]) 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   232
qed "qsumE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   234
AddSIs [QInlI, QInrI];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   235
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   236
(** Injection and freeness equivalences, for rewriting **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   237
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   238
Goalw qsum_defs "QInl(a)=QInl(b) <-> a=b";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   239
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   240
qed "QInl_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   241
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   242
Goalw qsum_defs "QInr(a)=QInr(b) <-> a=b";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   243
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   244
qed "QInr_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   246
Goalw qsum_defs "QInl(a)=QInr(b) <-> False";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   247
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   248
qed "QInl_QInr_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   250
Goalw qsum_defs "QInr(b)=QInl(a) <-> False";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   251
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   252
qed "QInr_QInl_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   253
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   254
Goalw qsum_defs "0<+>0 = 0";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   255
by (Simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   256
qed "qsum_empty";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   257
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   258
(*Injection and freeness rules*)
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   259
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   260
bind_thm ("QInl_inject", (QInl_iff RS iffD1));
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   261
bind_thm ("QInr_inject", (QInr_iff RS iffD1));
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   262
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
   263
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
   264
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   265
AddSEs [qsumE, QInl_neq_QInr, QInr_neq_QInl];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   266
AddSDs [QInl_inject, QInr_inject];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   267
Addsimps [QInl_iff, QInr_iff, QInl_QInr_iff, QInr_QInl_iff, qsum_empty];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   269
Goal "!!A B. QInl(a): A<+>B ==> a: A";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   270
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   271
qed "QInlD";
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   272
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   273
Goal "!!A B. QInr(b): A<+>B ==> b: B";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   274
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   275
qed "QInrD";
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 6
diff changeset
   276
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
(** <+> is itself injective... who cares?? **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   279
Goal
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
    "u: A <+> B <-> (EX x. x:A & u=QInl(x)) | (EX y. y:B & u=QInr(y))";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   281
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   282
qed "qsum_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   284
Goal "A <+> B <= C <+> D <-> A<=C & B<=D";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   285
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   286
qed "qsum_subset_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   287
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   288
Goal "A <+> B = C <+> D <-> A=C & B=D";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   289
by (simp_tac (simpset() addsimps [extension,qsum_subset_iff]) 1);
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   290
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   291
qed "qsum_equal_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
(*** Eliminator -- qcase ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   295
Goalw qsum_defs "qcase(c, d, QInl(a)) = c(a)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   296
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   297
qed "qcase_QInl";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   299
Goalw qsum_defs "qcase(c, d, QInr(b)) = d(b)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   300
by (Simp_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   301
qed "qcase_QInr";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   302
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   303
Addsimps [qcase_QInl, qcase_QInr];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   304
1096
6c177c4c2127 Modified proofs for (q)split, fst, snd for new
lcp
parents: 790
diff changeset
   305
val major::prems = goal thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   306
    "[| u: A <+> B; \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
\       !!x. x: A ==> c(x): C(QInl(x));   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
\       !!y. y: B ==> d(y): C(QInr(y)) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
\    |] ==> qcase(c,d,u) : C(u)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
by (rtac (major RS qsumE) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
by (ALLGOALS (etac ssubst));
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   312
by (ALLGOALS (asm_simp_tac (simpset() addsimps prems)));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   313
qed "qcase_type";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
(** Rules for the Part primitive **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   317
Goal "Part(A <+> B,QInl) = {QInl(x). x: A}";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   318
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   319
qed "Part_QInl";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   321
Goal "Part(A <+> B,QInr) = {QInr(y). y: B}";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   322
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   323
qed "Part_QInr";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   325
Goal "Part(A <+> B, %x. QInr(h(x))) = {QInr(y). y: Part(B,h)}";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   326
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   327
qed "Part_QInr2";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   328
5067
62b6288e6005 isatool fixgoal;
wenzelm
parents: 4477
diff changeset
   329
Goal "!!A B C. C <= A <+> B ==> Part(C,QInl) Un Part(C,QInr) = C";
3016
15763781afb0 Conversion to use blast_tac
paulson
parents: 2493
diff changeset
   330
by (Blast_tac 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 744
diff changeset
   331
qed "Part_qsum_equality";