src/HOL/ex/Acc.ML
author paulson
Thu, 04 Apr 1996 11:45:01 +0200
changeset 1642 21db0cf9a1a4
parent 1465 5d7a7e439cec
child 1820 e381e1c51689
permissions -rw-r--r--
Using new "Times" infix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
     1
(*  Title:      HOL/ex/Acc
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     5
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     6
Inductive definition of acc(r)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     7
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     8
See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     9
Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    11
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
open Acc;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    13
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
(*The intended introduction rule*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
val prems = goal Acc.thy
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
    16
    "[| !!b. (b,a):r ==> b: acc(r) |] ==> a: acc(r)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
by (fast_tac (set_cs addIs (prems @ 
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
    18
                            map (rewrite_rule [pred_def]) acc.intrs)) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
qed "accI";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
    21
goal Acc.thy "!!a b r. [| b: acc(r);  (a,b): r |] ==> a: acc(r)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    22
by (etac acc.elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    23
by (rewtac pred_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    24
by (fast_tac set_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    25
qed "acc_downward";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    26
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    27
val [major,indhyp] = goal Acc.thy
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
    28
    "[| a : acc(r);                                             \
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
    29
\       !!x. [| x: acc(r);  ALL y. (y,x):r --> P(y) |] ==> P(x) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    30
\    |] ==> P(a)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
by (rtac (major RS acc.induct) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
by (rtac indhyp 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
by (resolve_tac acc.intrs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    34
by (rewtac pred_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
by (fast_tac set_cs 2);
1046
9d2261a3e682 expandshort
lcp
parents: 972
diff changeset
    36
by (etac (Int_lower1 RS Pow_mono RS subsetD) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    37
qed "acc_induct";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    38
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    39
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1465
diff changeset
    40
val [major] = goal Acc.thy "r <= (acc r) Times (acc r) ==> wf(r)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    41
by (rtac (major RS wfI) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    42
by (etac acc.induct 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
by (rewtac pred_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    44
by (fast_tac set_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    45
qed "acc_wfI";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    46
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
    47
val [major] = goal Acc.thy "wf(r) ==> ALL x. (x,y): r | (y,x):r --> y: acc(r)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
by (rtac (major RS wf_induct) 1);
1046
9d2261a3e682 expandshort
lcp
parents: 972
diff changeset
    49
by (rtac (impI RS allI) 1);
9d2261a3e682 expandshort
lcp
parents: 972
diff changeset
    50
by (rtac accI 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    51
by (fast_tac set_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    52
qed "acc_wfD_lemma";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    53
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1465
diff changeset
    54
val [major] = goal Acc.thy "wf(r) ==> r <= (acc r) Times (acc r)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    55
by (rtac subsetI 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
by (res_inst_tac [("p", "x")] PairE 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
by (fast_tac (set_cs addSIs [SigmaI,
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1046
diff changeset
    58
                             major RS acc_wfD_lemma RS spec RS mp]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
qed "acc_wfD";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    60
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1465
diff changeset
    61
goal Acc.thy "wf(r)  =  (r <= (acc r) Times (acc r))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    62
by (EVERY1 [rtac iffI, etac acc_wfD, etac acc_wfI]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    63
qed "wf_acc_iff";