src/ZF/Induct/Acc.ML
author berghofe
Mon, 19 Nov 2001 17:40:45 +0100
changeset 12238 09966ccbc84c
parent 12088 6f463d16cbd0
permissions -rw-r--r--
Improved error message.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12088
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     1
(*  Title:      ZF/ex/acc
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     5
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     6
Inductive definition of acc(r)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     7
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     8
See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     9
Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    10
*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    11
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    12
(*The introduction rule must require  a \\<in> field(r)  
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    13
  Otherwise acc(r) would be a proper class!    *)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    14
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    15
(*The intended introduction rule*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    16
val prems = goal Acc.thy
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    17
    "[| !!b. <b,a>:r ==> b \\<in> acc(r);  a \\<in> field(r) |] ==> a \\<in> acc(r)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    18
by (fast_tac (claset() addIs prems@acc.intrs) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    19
qed "accI";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    20
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    21
Goal "[| b \\<in> acc(r);  <a,b>: r |] ==> a \\<in> acc(r)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    22
by (etac acc.elim 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    23
by (Fast_tac 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    24
qed "acc_downward";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    25
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    26
val [major,indhyp] = goal Acc.thy
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    27
    "[| a \\<in> acc(r);                                             \
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    28
\       !!x. [| x \\<in> acc(r);  \\<forall>y. <y,x>:r --> P(y) |] ==> P(x) \
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    29
\    |] ==> P(a)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    30
by (rtac (major RS acc.induct) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    31
by (rtac indhyp 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    32
by (Fast_tac 2);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    33
by (resolve_tac acc.intrs 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    34
by (assume_tac 2);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    35
by (etac (Collect_subset RS Pow_mono RS subsetD) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    36
qed "acc_induct";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    37
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    38
Goal "wf[acc(r)](r)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    39
by (rtac wf_onI2 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    40
by (etac acc_induct 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    41
by (Fast_tac 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    42
qed "wf_on_acc";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    43
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    44
(* field(r) \\<subseteq> acc(r) ==> wf(r) *)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    45
val acc_wfI = wf_on_acc RS wf_on_subset_A RS wf_on_field_imp_wf;
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    46
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    47
val [major] = goal Acc.thy "wf(r) ==> field(r) \\<subseteq> acc(r)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    48
by (rtac subsetI 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    49
by (etac (major RS wf_induct2) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    50
by (rtac subset_refl 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    51
by (rtac accI 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    52
by (assume_tac 2);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    53
by (Fast_tac 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    54
qed "acc_wfD";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    55
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    56
Goal "wf(r) <-> field(r) \\<subseteq> acc(r)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    57
by (EVERY1 [rtac iffI, etac acc_wfD, etac acc_wfI]);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    58
qed "wf_acc_iff";