src/ZF/ex/Brouwer.ML
author wenzelm
Wed, 14 Sep 1994 16:11:19 +0200
changeset 613 f9eb0f819642
parent 525 e62519a8497d
child 782 200a16083201
permissions -rw-r--r--
removed lookup_const (use Sign.const_type instead);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     1
(*  Title: 	ZF/ex/Brouwer.ML
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     2
    ID:         $ $
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     5
525
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
     6
Infinite branching datatype definitions
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
     7
  (1) the Brouwer ordinals
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
     8
  (2) the Martin-Löf wellordering type
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
     9
*)
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    10
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 489
diff changeset
    11
open Brouwer;
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    12
525
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    13
(** The Brouwer ordinals **)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    14
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    15
goal Brouwer.thy "brouwer = {0} + brouwer + (nat -> brouwer)";
525
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    16
let open brouwer;  val rew = rewrite_rule con_defs in  
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    17
by (fast_tac (sum_cs addSIs (equalityI :: map rew intrs)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    18
                     addEs [rew elim]) 1)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    19
end;
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    20
val brouwer_unfold = result();
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    21
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    22
(*A nicer induction rule than the standard one*)
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    23
val major::prems = goal Brouwer.thy
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    24
    "[| b: brouwer;  					\
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    25
\       P(Zero);					\
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    26
\	!!b. [| b: brouwer;  P(b) |] ==> P(Suc(b));	\
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    27
\	!!h. [| h: nat -> brouwer;  ALL i:nat. P(h`i)	\
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    28
\            |] ==> P(Lim(h))				\
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    29
\    |] ==> P(b)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 489
diff changeset
    30
by (rtac (major RS brouwer.induct) 1);
489
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    31
by (REPEAT_SOME (ares_tac prems));
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    32
by (fast_tac (ZF_cs addEs [fun_weaken_type]) 1);
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    33
by (fast_tac (ZF_cs addDs [apply_type]) 1);
0449a7f1add3 Addition of infinite branching datatypes
lcp
parents:
diff changeset
    34
val brouwer_induct2 = result();
525
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    35
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    36
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    37
(** The Martin-Löf wellordering type **)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    38
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    39
goal Brouwer.thy "Well(A,B) = (SUM x:A. B(x) -> Well(A,B))";
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    40
let open Well;  val rew = rewrite_rule con_defs in  
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    41
by (fast_tac (sum_cs addSIs (equalityI :: map rew intrs)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    42
                     addEs [rew elim]) 1)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    43
end;
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    44
val Well_unfold = result();
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    45
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    46
(*A nicer induction rule than the standard one*)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    47
val major::prems = goal Brouwer.thy
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    48
    "[| w: Well(A,B);  							\
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    49
\	!!a f. [| a: A;  f: B(a) -> Well(A,B);  ALL y: B(a). P(f`y)	\
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    50
\            |] ==> P(Sup(a,f))						\
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    51
\    |] ==> P(w)";
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    52
by (rtac (major RS Well.induct) 1);
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    53
by (REPEAT_SOME (ares_tac prems));
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    54
by (fast_tac (ZF_cs addEs [fun_weaken_type]) 1);
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    55
by (fast_tac (ZF_cs addDs [apply_type]) 1);
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    56
val Well_induct2 = result();
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    57
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    58
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    59
(*In fact it's isomorphic to nat, but we need a recursion operator for
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    60
  Well to prove this.*)
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    61
goal Brouwer.thy "Well(bool, %x.x) = 1 + (1 -> Well(bool, %x.x))";
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    62
by (resolve_tac [Well_unfold RS trans] 1);
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    63
by (simp_tac (ZF_ss addsimps [Sigma_bool, Pi_empty1, succ_def]) 1);
e62519a8497d ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    64
val Well_bool_unfold = result();