src/ZF/ex/CoUnit.ML
author wenzelm
Mon, 22 Jun 1998 17:13:09 +0200
changeset 5068 fb28eaa07e01
parent 4091 771b1f6422a8
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: 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
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    13
open CoUnit;
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    14
  
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    15
(*USELESS because folding on Con(?xa) == ?xa fails*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    16
val ConE = counit.mk_cases counit.con_defs "Con(x) : counit";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    17
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    18
(*Proving freeness results*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    19
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
    20
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    21
(*Should be a singleton, not everything!*)
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    22
Goal "counit = quniv(0)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    23
by (rtac (counit.dom_subset RS equalityI) 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    24
by (rtac subsetI 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    25
by (etac counit.coinduct 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    26
by (rtac subset_refl 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    27
by (rewrite_goals_tac counit.con_defs);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    28
by (Fast_tac 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    29
qed "counit_eq_univ";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    30
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    31
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    32
(*A similar example, but the constructor is non-degenerate and it works!
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    33
  The resulting set is a singleton.
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    34
*)
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    35
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    36
val Con2E = counit2.mk_cases counit2.con_defs "Con2(x,y) : counit2";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    37
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    38
(*Proving freeness results*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    39
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
    40
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    41
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
    42
by (rtac bnd_monoI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    43
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
    44
qed "Con2_bnd_mono";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    45
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    46
Goal "lfp(univ(0), %x. Con2(x,x)) : counit2";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    47
by (rtac (singletonI RS counit2.coinduct) 1);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    48
by (rtac (qunivI RS singleton_subsetI) 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    49
by (rtac ([lfp_subset, empty_subsetI RS univ_mono] MRS subset_trans) 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2469
diff changeset
    50
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
    51
qed "lfp_Con2_in_counit2";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    52
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    53
(*Lemma for proving finality.  Borrowed from ex/llist_eq.ML!*)
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    54
Goal
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    55
    "!!i. Ord(i) ==> ALL x y. x: counit2 & y: counit2 --> x Int Vset(i) <= y";
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    56
by (etac trans_induct 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    57
by (safe_tac subset_cs);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    58
by (etac counit2.elim 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    59
by (etac counit2.elim 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    60
by (rewrite_goals_tac counit2.con_defs);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    61
by (fast_tac (subset_cs
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    62
	      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
    63
	      addSEs [Ord_in_Ord, Pair_inject]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    64
qed "counit2_Int_Vset_subset_lemma";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    65
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    66
val counit2_Int_Vset_subset = standard
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    67
        (counit2_Int_Vset_subset_lemma RS spec RS spec RS mp);
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    68
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    69
Goal "!!x y. [| x: counit2;  y: counit2 |] ==> x=y";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    70
by (rtac equalityI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    71
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
    72
qed "counit2_implies_equal";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    73
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    74
Goal "counit2 = {lfp(univ(0), %x. Con2(x,x))}";
365
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    75
by (rtac equalityI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    76
by (rtac (lfp_Con2_in_counit2 RS singleton_subsetI) 2);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    77
by (rtac subsetI 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    78
by (dtac (lfp_Con2_in_counit2 RS counit2_implies_equal) 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    79
by (etac subst 1);
796c5e305b31 renaming/removal of filenames to correct case
lcp
parents:
diff changeset
    80
by (rtac singletonI 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    81
qed "counit2_eq_univ";