src/ZF/ex/CoUnit.ML
author wenzelm
Fri, 06 Oct 2000 17:35:58 +0200
changeset 10168 50be659d4222
parent 6141 a6922171b396
child 10216 e928bdf62014
permissions -rw-r--r--
final tuning;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     1
(*  Title:      ZF/ex/CoUnit.ML
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
     4
    Copyright   1994  University of Cambridge
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
     5
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
     6
Trivial codatatype definitions, one of which goes wrong!
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
     7
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
     8
See discussion in 
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
     9
  L C Paulson.  A Concrete Final Coalgebra Theorem for ZF Set Theory.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    10
  Report 334,  Cambridge University Computer Laboratory.  1994.
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    11
*)
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    12
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    13
(*USELESS because folding on Con(?xa) == ?xa fails*)
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5147
diff changeset
    14
val ConE = counit.mk_cases "Con(x) : counit";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    15
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    16
(*Proving freeness results*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    17
val Con_iff = counit.mk_free "Con(x)=Con(y) <-> x=y";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    18
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    19
(*Should be a singleton, not everything!*)
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    20
Goal "counit = quniv(0)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    21
by (rtac (counit.dom_subset RS equalityI) 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    22
by (rtac subsetI 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    23
by (etac counit.coinduct 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    24
by (rtac subset_refl 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    25
by (rewrite_goals_tac counit.con_defs);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    26
by (Fast_tac 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    27
qed "counit_eq_univ";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    28
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    29
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    30
(*A similar example, but the constructor is non-degenerate and it works!
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    31
  The resulting set is a singleton.
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    32
*)
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    33
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 5147
diff changeset
    34
val Con2E = counit2.mk_cases "Con2(x,y) : counit2";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    35
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    36
(*Proving freeness results*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    37
val Con2_iff = counit2.mk_free "Con2(x,y)=Con2(x',y') <-> x=x' & y=y'";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    38
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    39
Goalw counit2.con_defs "bnd_mono(univ(0), %x. Con2(x,x))";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    40
by (rtac bnd_monoI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    41
by (REPEAT (ares_tac [subset_refl, QPair_subset_univ, QPair_mono] 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    42
qed "Con2_bnd_mono";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    43
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    44
Goal "lfp(univ(0), %x. Con2(x,x)) : counit2";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    45
by (rtac (singletonI RS counit2.coinduct) 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    46
by (rtac (qunivI RS singleton_subsetI) 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    47
by (rtac ([lfp_subset, empty_subsetI RS univ_mono] MRS subset_trans) 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2469
diff changeset
    48
by (fast_tac (claset() addSIs [Con2_bnd_mono RS lfp_Tarski]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 527
diff changeset
    49
qed "lfp_Con2_in_counit2";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    50
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    51
(*Lemma for proving finality.  Borrowed from ex/llist_eq.ML!*)
5147
825877190618 More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5137
diff changeset
    52
Goal "Ord(i) ==> ALL x y. x: counit2 & y: counit2 --> x Int Vset(i) <= y";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    53
by (etac trans_induct 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    54
by (safe_tac subset_cs);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    55
by (etac counit2.elim 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    56
by (etac counit2.elim 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    57
by (rewrite_goals_tac counit2.con_defs);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    58
by (fast_tac (subset_cs
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    59
	      addSIs [QPair_Int_Vset_subset_UN RS subset_trans, QPair_mono]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    60
	      addSEs [Ord_in_Ord, Pair_inject]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    61
qed "counit2_Int_Vset_subset_lemma";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    62
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    63
val counit2_Int_Vset_subset = standard
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    64
        (counit2_Int_Vset_subset_lemma RS spec RS spec RS mp);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    65
5137
60205b0de9b9 Huge tidy-up: removal of leading \!\!
paulson
parents: 5068
diff changeset
    66
Goal "[| x: counit2;  y: counit2 |] ==> x=y";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    67
by (rtac equalityI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    68
by (REPEAT (ares_tac [conjI, counit2_Int_Vset_subset RS Int_Vset_subset] 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    69
qed "counit2_implies_equal";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    70
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    71
Goal "counit2 = {lfp(univ(0), %x. Con2(x,x))}";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    72
by (rtac equalityI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    73
by (rtac (lfp_Con2_in_counit2 RS singleton_subsetI) 2);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    74
by (rtac subsetI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    75
by (dtac (lfp_Con2_in_counit2 RS counit2_implies_equal) 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    76
by (etac subst 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    77
by (rtac singletonI 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    78
qed "counit2_eq_univ";