src/ZF/ex/Limit.thy
author paulson
Mon, 15 Apr 2002 10:18:01 +0200
changeset 13085 bfdb0534c8ec
parent 11316 b4e71bd751e4
child 13128 99f6a9f0328a
permissions -rw-r--r--
converted theory ex/Limit to Isar script, but it still needs work!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/ex/Limit
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Sten Agerholm
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     4
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     5
    A formalization of the inverse limit construction of domain theory.
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     6
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     7
    The following paper comments on the formalization:
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     8
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
     9
    "A Comparison of HOL-ST and Isabelle/ZF" by Sten Agerholm
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    10
    In Proceedings of the First Isabelle Users Workshop, Technical 
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    11
    Report No. 379, University of Cambridge Computer Laboratory, 1995.
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    12
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    13
    This is a condensed version of:
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    14
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    15
    "A Comparison of HOL-ST and Isabelle/ZF" by Sten Agerholm
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    16
    Technical Report No. 369, University of Cambridge Computer 
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    17
    Laboratory, 1995.
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    18
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    19
(Proofs converted to Isar and tidied up considerably by lcp)
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    20
*)
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    21
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    22
theory Limit  =  Main:
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    23
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    24
constdefs
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    25
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    26
  rel :: "[i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    27
    "rel(D,x,y) == <x,y>:snd(D)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    28
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    29
  set :: "i=>i"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    30
    "set(D) == fst(D)"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    31
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    32
  po  :: "i=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    33
    "po(D) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    34
     (\<forall>x \<in> set(D). rel(D,x,x)) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    35
     (\<forall>x \<in> set(D). \<forall>y \<in> set(D). \<forall>z \<in> set(D).
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    36
       rel(D,x,y) --> rel(D,y,z) --> rel(D,x,z)) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    37
     (\<forall>x \<in> set(D). \<forall>y \<in> set(D). rel(D,x,y) --> rel(D,y,x) --> x = y)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    38
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    39
  chain :: "[i,i]=>o"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    40
    (* Chains are object level functions nat->set(D) *)
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    41
    "chain(D,X) == X \<in> nat->set(D) & (\<forall>n \<in> nat. rel(D,X`n,X`(succ(n))))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    42
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    43
  isub :: "[i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    44
    "isub(D,X,x) == x \<in> set(D) & (\<forall>n \<in> nat. rel(D,X`n,x))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    45
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    46
  islub :: "[i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    47
    "islub(D,X,x) == isub(D,X,x) & (\<forall>y. isub(D,X,y) --> rel(D,x,y))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    48
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    49
  lub :: "[i,i]=>i"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    50
    "lub(D,X) == THE x. islub(D,X,x)"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    51
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    52
  cpo :: "i=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    53
    "cpo(D) == po(D) & (\<forall>X. chain(D,X) --> (\<exists>x. islub(D,X,x)))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    54
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    55
  pcpo :: "i=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    56
    "pcpo(D) == cpo(D) & (\<exists>x \<in> set(D). \<forall>y \<in> set(D). rel(D,x,y))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    57
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    58
  bot :: "i=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    59
    "bot(D) == THE x. x \<in> set(D) & (\<forall>y \<in> set(D). rel(D,x,y))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    60
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    61
  mono :: "[i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    62
    "mono(D,E) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    63
     {f \<in> set(D)->set(E).
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    64
      \<forall>x \<in> set(D). \<forall>y \<in> set(D). rel(D,x,y) --> rel(E,f`x,f`y)}"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    65
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    66
  cont :: "[i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    67
    "cont(D,E) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    68
     {f \<in> mono(D,E).
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    69
      \<forall>X. chain(D,X) --> f`(lub(D,X)) = lub(E,\<lambda>n \<in> nat. f`(X`n))}"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    70
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    71
  cf :: "[i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    72
    "cf(D,E) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    73
     <cont(D,E),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    74
      {y \<in> cont(D,E)*cont(D,E). \<forall>x \<in> set(D). rel(E,(fst(y))`x,(snd(y))`x)}>"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    75
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    76
  suffix :: "[i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    77
    "suffix(X,n) == \<lambda>m \<in> nat. X`(n #+ m)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    78
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    79
  subchain :: "[i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    80
    "subchain(X,Y) == \<forall>m \<in> nat. \<exists>n \<in> nat. X`m = Y`(m #+ n)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    81
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    82
  dominate :: "[i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    83
    "dominate(D,X,Y) == \<forall>m \<in> nat. \<exists>n \<in> nat. rel(D,X`m,Y`n)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    84
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    85
  matrix :: "[i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    86
    "matrix(D,M) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    87
     M \<in> nat -> (nat -> set(D)) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    88
     (\<forall>n \<in> nat. \<forall>m \<in> nat. rel(D,M`n`m,M`succ(n)`m)) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    89
     (\<forall>n \<in> nat. \<forall>m \<in> nat. rel(D,M`n`m,M`n`succ(m))) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    90
     (\<forall>n \<in> nat. \<forall>m \<in> nat. rel(D,M`n`m,M`succ(n)`succ(m)))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    91
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    92
  projpair  :: "[i,i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    93
    "projpair(D,E,e,p) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    94
     e \<in> cont(D,E) & p \<in> cont(E,D) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    95
     p O e = id(set(D)) & rel(cf(E,E),e O p,id(set(E)))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    96
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    97
  emb       :: "[i,i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
    98
    "emb(D,E,e) == \<exists>p. projpair(D,E,e,p)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
    99
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   100
  Rp        :: "[i,i,i]=>i"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   101
    "Rp(D,E,e) == THE p. projpair(D,E,e,p)"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   102
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   103
  (* Twice, constructions on cpos are more difficult. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   104
  iprod     :: "i=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   105
    "iprod(DD) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   106
     <(\<Pi>n \<in> nat. set(DD`n)),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   107
      {x:(\<Pi>n \<in> nat. set(DD`n))*(\<Pi>n \<in> nat. set(DD`n)).
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   108
       \<forall>n \<in> nat. rel(DD`n,fst(x)`n,snd(x)`n)}>"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   109
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   110
  mkcpo     :: "[i,i=>o]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   111
    (* Cannot use rel(D), is meta fun, need two more args *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   112
    "mkcpo(D,P) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   113
     <{x \<in> set(D). P(x)},{x \<in> set(D)*set(D). rel(D,fst(x),snd(x))}>"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   114
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   115
  subcpo    :: "[i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   116
    "subcpo(D,E) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   117
     set(D) \<subseteq> set(E) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   118
     (\<forall>x \<in> set(D). \<forall>y \<in> set(D). rel(D,x,y) <-> rel(E,x,y)) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   119
     (\<forall>X. chain(D,X) --> lub(E,X):set(D))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   120
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   121
  subpcpo   :: "[i,i]=>o"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   122
    "subpcpo(D,E) == subcpo(D,E) & bot(E):set(D)"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   123
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   124
  emb_chain :: "[i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   125
    "emb_chain(DD,ee) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   126
     (\<forall>n \<in> nat. cpo(DD`n)) & (\<forall>n \<in> nat. emb(DD`n,DD`succ(n),ee`n))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   127
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   128
  Dinf      :: "[i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   129
    "Dinf(DD,ee) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   130
     mkcpo(iprod(DD))
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   131
     (%x. \<forall>n \<in> nat. Rp(DD`n,DD`succ(n),ee`n)`(x`succ(n)) = x`n)"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   132
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   133
consts
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   134
  e_less    :: "[i,i,i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   135
  e_gr      :: "[i,i,i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   136
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   137
defs  (*???NEEDS PRIMREC*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   138
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   139
  e_less_def: (* Valid for m le n only. *)
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   140
    "e_less(DD,ee,m,n) == rec(n#-m,id(set(DD`m)),%x y. ee`(m#+x) O y)"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   141
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   142
  e_gr_def: (* Valid for n le m only. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   143
    "e_gr(DD,ee,m,n) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   144
     rec(m#-n,id(set(DD`n)),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   145
         %x y. y O Rp(DD`(n#+x),DD`(succ(n#+x)),ee`(n#+x)))"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   146
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   147
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   148
constdefs
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   149
  eps       :: "[i,i,i,i]=>i"
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   150
    "eps(DD,ee,m,n) == if(m le n,e_less(DD,ee,m,n),e_gr(DD,ee,m,n))"
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
   151
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   152
  rho_emb   :: "[i,i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   153
    "rho_emb(DD,ee,n) == \<lambda>x \<in> set(DD`n). \<lambda>m \<in> nat. eps(DD,ee,n,m)`x"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   154
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   155
  rho_proj  :: "[i,i,i]=>i"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   156
    "rho_proj(DD,ee,n) == \<lambda>x \<in> set(Dinf(DD,ee)). x`n"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   157
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   158
  commute   :: "[i,i,i,i=>i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   159
    "commute(DD,ee,E,r) ==
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   160
     (\<forall>n \<in> nat. emb(DD`n,E,r(n))) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   161
     (\<forall>m \<in> nat. \<forall>n \<in> nat. m le n --> r(n) O eps(DD,ee,m,n) = r(m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   162
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   163
  mediating :: "[i,i,i=>i,i=>i,i]=>o"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   164
    "mediating(E,G,r,f,t) == emb(E,G,t) & (\<forall>n \<in> nat. f(n) = t O r(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   165
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   166
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   167
lemmas nat_linear_le = Ord_linear_le [OF nat_into_Ord nat_into_Ord]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   168
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   169
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   170
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   171
(* Basic results.                                                       *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   172
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   173
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   174
lemma set_I: "x \<in> fst(D) ==> x \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   175
by (simp add: set_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   176
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   177
lemma rel_I: "<x,y>:snd(D) ==> rel(D,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   178
by (simp add: rel_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   179
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   180
lemma rel_E: "rel(D,x,y) ==> <x,y>:snd(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   181
by (simp add: rel_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   182
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   183
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   184
(* I/E/D rules for po and cpo.                                          *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   185
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   186
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   187
lemma po_refl: "[|po(D); x \<in> set(D)|] ==> rel(D,x,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   188
by (unfold po_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   189
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   190
lemma po_trans: "[|po(D); rel(D,x,y); rel(D,y,z); x \<in> set(D);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   191
                  y \<in> set(D); z \<in> set(D)|] ==> rel(D,x,z)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   192
by (unfold po_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   193
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   194
lemma po_antisym:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   195
    "[|po(D); rel(D,x,y); rel(D,y,x); x \<in> set(D); y \<in> set(D)|] ==> x = y"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   196
by (unfold po_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   197
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   198
lemma poI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   199
  "[| !!x. x \<in> set(D) ==> rel(D,x,x);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   200
      !!x y z. [| rel(D,x,y); rel(D,y,z); x \<in> set(D); y \<in> set(D); z \<in> set(D)|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   201
               ==> rel(D,x,z);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   202
      !!x y. [| rel(D,x,y); rel(D,y,x); x \<in> set(D); y \<in> set(D)|] ==> x=y |] 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   203
   ==> po(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   204
by (unfold po_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   205
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   206
lemma cpoI: "[| po(D); !!X. chain(D,X) ==> islub(D,X,x(D,X))|] ==> cpo(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   207
by (simp add: cpo_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   208
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   209
lemma cpo_po: "cpo(D) ==> po(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   210
by (simp add: cpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   211
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   212
lemma cpo_refl [simp,intro!,TC]: "[|cpo(D); x \<in> set(D)|] ==> rel(D,x,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   213
by (blast intro: po_refl cpo_po)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   214
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   215
lemma cpo_trans: "[|cpo(D); rel(D,x,y); rel(D,y,z); x \<in> set(D);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   216
        y \<in> set(D); z \<in> set(D)|] ==> rel(D,x,z)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   217
by (blast intro: cpo_po po_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   218
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   219
lemma cpo_antisym:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   220
     "[|cpo(D); rel(D,x,y); rel(D,y,x); x \<in> set(D); y \<in> set(D)|] ==> x = y"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   221
by (blast intro: cpo_po po_antisym)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   222
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   223
lemma cpo_islub: "[|cpo(D); chain(D,X);  !!x. islub(D,X,x) ==> R|] ==> R"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   224
by (simp add: cpo_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   225
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   226
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   227
(* Theorems about isub and islub.                                       *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   228
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   229
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   230
lemma islub_isub: "islub(D,X,x) ==> isub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   231
by (simp add: islub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   232
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   233
lemma islub_in: "islub(D,X,x) ==> x \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   234
by (simp add: islub_def isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   235
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   236
lemma islub_ub: "[|islub(D,X,x); n \<in> nat|] ==> rel(D,X`n,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   237
by (simp add: islub_def isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   238
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   239
lemma islub_least: "[|islub(D,X,x); isub(D,X,y)|] ==> rel(D,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   240
by (simp add: islub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   241
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   242
lemma islubI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   243
    "[|isub(D,X,x); !!y. isub(D,X,y) ==> rel(D,x,y)|] ==> islub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   244
by (simp add: islub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   245
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   246
lemma isubI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   247
    "[|x \<in> set(D);  !!n. n \<in> nat ==> rel(D,X`n,x)|] ==> isub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   248
by (simp add: isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   249
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   250
lemma isubE:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   251
    "[|isub(D,X,x); [|x \<in> set(D);  !!n. n \<in> nat==>rel(D,X`n,x)|] ==> P
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   252
     |] ==> P"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   253
by (simp add: isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   254
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   255
lemma isubD1: "isub(D,X,x) ==> x \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   256
by (simp add: isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   257
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   258
lemma isubD2: "[|isub(D,X,x); n \<in> nat|]==>rel(D,X`n,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   259
by (simp add: isub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   260
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   261
lemma islub_unique: "[|islub(D,X,x); islub(D,X,y); cpo(D)|] ==> x = y"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   262
by (blast intro: cpo_antisym islub_least islub_isub islub_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   263
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   264
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   265
(* lub gives the least upper bound of chains.                           *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   266
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   267
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   268
lemma cpo_lub: "[|chain(D,X); cpo(D)|] ==> islub(D,X,lub(D,X))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   269
apply (simp add: lub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   270
apply (best elim: cpo_islub intro: theI islub_unique)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   271
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   272
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   273
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   274
(* Theorems about chains.                                               *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   275
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   276
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   277
lemma chainI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   278
  "[|X \<in> nat->set(D);  !!n. n \<in> nat ==> rel(D,X`n,X`succ(n))|] ==> chain(D,X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   279
by (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   280
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   281
lemma chain_fun: "chain(D,X) ==> X \<in> nat -> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   282
by (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   283
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   284
lemma chain_in [simp,TC]: "[|chain(D,X); n \<in> nat|] ==> X`n \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   285
apply (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   286
apply (blast dest: apply_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   287
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   288
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   289
lemma chain_rel [simp,TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   290
     "[|chain(D,X); n \<in> nat|] ==> rel(D, X ` n, X ` succ(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   291
by (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   292
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   293
lemma chain_rel_gen_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   294
     "[|chain(D,X); cpo(D); n \<in> nat; m \<in> nat|] ==> rel(D,X`n,(X`(m #+ n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   295
apply (induct_tac m)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   296
apply (auto intro: cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   297
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   298
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   299
lemma chain_rel_gen:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   300
    "[|n le m; chain(D,X); cpo(D); m \<in> nat|] ==> rel(D,X`n,X`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   301
apply (frule lt_nat_in_nat, erule nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   302
apply (erule rev_mp) (*prepare the induction*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   303
apply (induct_tac m)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   304
apply (auto intro: cpo_trans simp add: le_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   305
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   306
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   307
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   308
(* Theorems about pcpos and bottom.                                     *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   309
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   310
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   311
lemma pcpoI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   312
    "[|!!y. y \<in> set(D)==>rel(D,x,y); x \<in> set(D); cpo(D)|]==>pcpo(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   313
by (simp add: pcpo_def, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   314
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   315
lemma pcpo_cpo [TC]: "pcpo(D) ==> cpo(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   316
by (simp add: pcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   317
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   318
lemma pcpo_bot_ex1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   319
    "pcpo(D) ==> \<exists>! x. x \<in> set(D) & (\<forall>y \<in> set(D). rel(D,x,y))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   320
apply (simp add: pcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   321
apply (blast intro: cpo_antisym)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   322
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   323
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   324
lemma bot_least [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   325
    "[| pcpo(D); y \<in> set(D)|] ==> rel(D,bot(D),y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   326
apply (simp add: bot_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   327
apply (best intro: pcpo_bot_ex1 [THEN theI2])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   328
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   329
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   330
lemma bot_in [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   331
    "pcpo(D) ==> bot(D):set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   332
apply (simp add: bot_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   333
apply (best intro: pcpo_bot_ex1 [THEN theI2])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   334
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   335
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   336
lemma bot_unique:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   337
    "[| pcpo(D); x \<in> set(D); !!y. y \<in> set(D) ==> rel(D,x,y)|] ==> x = bot(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   338
by (blast intro: cpo_antisym pcpo_cpo bot_in bot_least)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   339
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   340
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   341
(* Constant chains and lubs and cpos.                                   *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   342
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   343
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   344
lemma chain_const: "[|x \<in> set(D); cpo(D)|] ==> chain(D,(\<lambda>n \<in> nat. x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   345
by (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   346
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   347
lemma islub_const:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   348
   "[|x \<in> set(D); cpo(D)|] ==> islub(D,(\<lambda>n \<in> nat. x),x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   349
apply (simp add: islub_def isub_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   350
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   351
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   352
lemma lub_const: "[|x \<in> set(D); cpo(D)|] ==> lub(D,\<lambda>n \<in> nat. x) = x"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   353
by (blast intro: islub_unique cpo_lub chain_const islub_const)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   354
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   355
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   356
(* Taking the suffix of chains has no effect on ub's.                   *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   357
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   358
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   359
lemma isub_suffix:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   360
    "[| chain(D,X); cpo(D) |] ==> isub(D,suffix(X,n),x) <-> isub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   361
apply (simp add: isub_def suffix_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   362
apply (drule_tac x = na in bspec)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   363
apply (auto intro: cpo_trans chain_rel_gen_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   364
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   365
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   366
lemma islub_suffix:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   367
  "[|chain(D,X); cpo(D)|] ==> islub(D,suffix(X,n),x) <-> islub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   368
by (simp add: islub_def isub_suffix)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   369
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   370
lemma lub_suffix:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   371
    "[|chain(D,X); cpo(D)|] ==> lub(D,suffix(X,n)) = lub(D,X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   372
by (simp add: lub_def islub_suffix)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   373
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   374
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   375
(* Dominate and subchain.                                               *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   376
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   377
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   378
lemma dominateI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   379
  "[| !!m. m \<in> nat ==> n(m):nat; !!m. m \<in> nat ==> rel(D,X`m,Y`n(m))|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   380
   dominate(D,X,Y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   381
by (simp add: dominate_def, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   382
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   383
lemma dominate_isub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   384
  "[|dominate(D,X,Y); isub(D,Y,x); cpo(D);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   385
     X \<in> nat->set(D); Y \<in> nat->set(D)|] ==> isub(D,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   386
apply (simp add: isub_def dominate_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   387
apply (blast intro: cpo_trans intro!: apply_funtype)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   388
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   389
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   390
lemma dominate_islub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   391
  "[|dominate(D,X,Y); islub(D,X,x); islub(D,Y,y); cpo(D);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   392
     X \<in> nat->set(D); Y \<in> nat->set(D)|] ==> rel(D,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   393
apply (simp add: islub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   394
apply (blast intro: dominate_isub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   395
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   396
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   397
lemma subchain_isub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   398
     "[|subchain(Y,X); isub(D,X,x)|] ==> isub(D,Y,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   399
by (simp add: isub_def subchain_def, force)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   400
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   401
lemma dominate_islub_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   402
     "[|dominate(D,X,Y); subchain(Y,X); islub(D,X,x); islub(D,Y,y); cpo(D);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   403
        X \<in> nat->set(D); Y \<in> nat->set(D)|] ==> x = y"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   404
by (blast intro: cpo_antisym dominate_islub islub_least subchain_isub 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   405
                 islub_isub islub_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   406
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   407
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   408
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   409
(* Matrix.                                                              *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   410
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   411
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   412
lemma matrix_fun: "matrix(D,M) ==> M \<in> nat -> (nat -> set(D))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   413
by (simp add: matrix_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   414
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   415
lemma matrix_in_fun: "[|matrix(D,M); n \<in> nat|] ==> M`n \<in> nat -> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   416
by (blast intro: apply_funtype matrix_fun)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   417
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   418
lemma matrix_in: "[|matrix(D,M); n \<in> nat; m \<in> nat|] ==> M`n`m \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   419
by (blast intro: apply_funtype matrix_in_fun)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   420
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   421
lemma matrix_rel_1_0:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   422
    "[|matrix(D,M); n \<in> nat; m \<in> nat|] ==> rel(D,M`n`m,M`succ(n)`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   423
by (simp add: matrix_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   424
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   425
lemma matrix_rel_0_1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   426
    "[|matrix(D,M); n \<in> nat; m \<in> nat|] ==> rel(D,M`n`m,M`n`succ(m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   427
by (simp add: matrix_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   428
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   429
lemma matrix_rel_1_1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   430
    "[|matrix(D,M); n \<in> nat; m \<in> nat|] ==> rel(D,M`n`m,M`succ(n)`succ(m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   431
by (simp add: matrix_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   432
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   433
lemma fun_swap: "f \<in> X->Y->Z ==> (\<lambda>y \<in> Y. \<lambda>x \<in> X. f`x`y):Y->X->Z"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   434
by (blast intro: lam_type apply_funtype)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   435
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   436
lemma matrix_sym_axis:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   437
    "matrix(D,M) ==> matrix(D,\<lambda>m \<in> nat. \<lambda>n \<in> nat. M`n`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   438
by (simp add: matrix_def fun_swap)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   439
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   440
lemma matrix_chain_diag:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   441
    "matrix(D,M) ==> chain(D,\<lambda>n \<in> nat. M`n`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   442
apply (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   443
apply (auto intro: lam_type matrix_in matrix_rel_1_1)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   444
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   445
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   446
lemma matrix_chain_left:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   447
    "[|matrix(D,M); n \<in> nat|] ==> chain(D,M`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   448
apply (unfold chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   449
apply (auto intro: matrix_fun [THEN apply_type] matrix_in matrix_rel_0_1)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   450
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   451
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   452
lemma matrix_chain_right:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   453
    "[|matrix(D,M); m \<in> nat|] ==> chain(D,\<lambda>n \<in> nat. M`n`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   454
apply (simp add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   455
apply (auto intro: lam_type matrix_in matrix_rel_1_0)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   456
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   457
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   458
lemma matrix_chainI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   459
  assumes xprem: "!!x. x \<in> nat==>chain(D,M`x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   460
      and yprem: "!!y. y \<in> nat==>chain(D,\<lambda>x \<in> nat. M`x`y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   461
      and Mfun:  "M \<in> nat->nat->set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   462
      and cpoD:  "cpo(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   463
  shows "matrix(D,M)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   464
apply (simp add: matrix_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   465
apply (rule Mfun)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   466
apply (cut_tac y1 = m and n = n in yprem [THEN chain_rel], simp+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   467
apply (simp add: chain_rel xprem)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   468
apply (rule cpo_trans [OF cpoD])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   469
apply (cut_tac y1 = m and n = n in yprem [THEN chain_rel], simp+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   470
apply (simp_all add: chain_fun [THEN apply_type] xprem)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   471
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   472
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   473
lemma lemma_rel_rel:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   474
     "[|m \<in> nat; rel(D, (\<lambda>n \<in> nat. M`n`n)`m, y)|] ==> rel(D,M`m`m, y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   475
by simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   476
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   477
lemma lemma2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   478
     "[|x \<in> nat; m \<in> nat; rel(D,(\<lambda>n \<in> nat. M`n`m1)`x,(\<lambda>n \<in> nat. M`n`m1)`m)|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   479
      ==> rel(D,M`x`m1,M`m`m1)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   480
by simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   481
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   482
lemma isub_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   483
    "[|isub(D, \<lambda>n \<in> nat. M`n`n, y); matrix(D,M); cpo(D)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   484
     isub(D, \<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m), y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   485
apply (unfold isub_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   486
apply (simp (no_asm_simp))
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   487
apply (frule matrix_fun [THEN apply_type], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   488
apply (simp (no_asm_simp))
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   489
apply (rule matrix_chain_left [THEN cpo_lub, THEN islub_least], assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   490
apply (unfold isub_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   491
(*???VERY indirect proof: beta-redexes could be simplified now!*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   492
apply (rename_tac k n)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   493
apply (case_tac "k le n")
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   494
apply (rule cpo_trans, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   495
apply (rule lemma2)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   496
apply (rule_tac [4] lemma_rel_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   497
prefer 5 apply blast
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   498
apply (assumption | rule chain_rel_gen matrix_chain_right matrix_in isubD1)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   499
txt{*opposite case*}
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   500
apply (rule cpo_trans, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   501
apply (rule not_le_iff_lt [THEN iffD1, THEN leI, THEN chain_rel_gen])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   502
prefer 3 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   503
apply (assumption | rule nat_into_Ord matrix_chain_left)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   504
apply (rule lemma_rel_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   505
apply (simp_all add: matrix_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   506
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   507
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   508
lemma matrix_chain_lub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   509
    "[|matrix(D,M); cpo(D)|] ==> chain(D,\<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   510
apply (simp add: chain_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   511
apply (rule lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   512
apply (rule islub_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   513
apply (rule cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   514
prefer 2 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   515
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   516
apply (rule lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   517
apply (simp_all add: matrix_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   518
apply (rule matrix_rel_0_1, assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   519
apply (simp add: matrix_chain_left [THEN chain_fun, THEN eta])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   520
apply (rule dominate_islub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   521
apply (rule_tac [3] cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   522
apply (rule_tac [2] cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   523
apply (simp add: dominate_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   524
apply (blast intro: matrix_rel_1_0)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   525
apply (simp_all add: matrix_chain_left nat_succI chain_fun)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   526
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   527
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   528
lemma isub_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   529
    "[|matrix(D,M); cpo(D)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   530
     isub(D,(\<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m)),y) <->
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   531
     isub(D,(\<lambda>n \<in> nat. M`n`n),y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   532
apply (rule iffI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   533
apply (rule dominate_isub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   534
prefer 2 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   535
apply (simp add: dominate_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   536
apply (rule ballI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   537
apply (rule bexI, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   538
apply (simp add: matrix_chain_left [THEN chain_fun, THEN eta])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   539
apply (rule islub_ub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   540
apply (rule cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   541
apply (simp_all add: matrix_chain_left matrix_chain_diag chain_fun 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   542
                     matrix_chain_lub isub_lemma)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   543
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   544
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   545
lemma lemma1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   546
    "lub(D,(\<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m))) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   547
     (THE x. islub(D, (\<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m)), x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   548
by (simp add: lub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   549
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   550
lemma lemma2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   551
    "lub(D,(\<lambda>n \<in> nat. M`n`n)) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   552
     (THE x. islub(D, (\<lambda>n \<in> nat. M`n`n), x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   553
by (simp add: lub_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   554
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   555
lemma lub_matrix_diag:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   556
    "[|matrix(D,M); cpo(D)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   557
     lub(D,(\<lambda>n \<in> nat. lub(D,\<lambda>m \<in> nat. M`n`m))) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   558
     lub(D,(\<lambda>n \<in> nat. M`n`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   559
apply (simp (no_asm) add: lemma1 lemma2)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   560
apply (simp add: islub_def isub_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   561
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   562
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   563
lemma lub_matrix_diag_sym:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   564
    "[|matrix(D,M); cpo(D)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   565
     lub(D,(\<lambda>m \<in> nat. lub(D,\<lambda>n \<in> nat. M`n`m))) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   566
     lub(D,(\<lambda>n \<in> nat. M`n`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   567
by (drule matrix_sym_axis [THEN lub_matrix_diag], auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   568
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   569
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   570
(* I/E/D rules for mono and cont.                                       *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   571
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   572
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   573
lemma monoI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   574
    "[|f \<in> set(D)->set(E);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   575
       !!x y. [|rel(D,x,y); x \<in> set(D); y \<in> set(D)|] ==> rel(E,f`x,f`y)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   576
      f \<in> mono(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   577
by (simp add: mono_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   578
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   579
lemma mono_fun: "f \<in> mono(D,E) ==> f \<in> set(D)->set(E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   580
by (simp add: mono_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   581
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   582
lemma mono_map: "[|f \<in> mono(D,E); x \<in> set(D)|] ==> f`x \<in> set(E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   583
by (blast intro!: mono_fun [THEN apply_type])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   584
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   585
lemma mono_mono:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   586
    "[|f \<in> mono(D,E); rel(D,x,y); x \<in> set(D); y \<in> set(D)|] ==> rel(E,f`x,f`y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   587
by (simp add: mono_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   588
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   589
lemma contI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   590
    "[|f \<in> set(D)->set(E);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   591
       !!x y. [|rel(D,x,y); x \<in> set(D); y \<in> set(D)|] ==> rel(E,f`x,f`y);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   592
       !!X. chain(D,X) ==> f`lub(D,X) = lub(E,\<lambda>n \<in> nat. f`(X`n))|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   593
      f \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   594
by (simp add: cont_def mono_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   595
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   596
lemma cont2mono: "f \<in> cont(D,E) ==> f \<in> mono(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   597
by (simp add: cont_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   598
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   599
lemma cont_fun [TC] : "f \<in> cont(D,E) ==> f \<in> set(D)->set(E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   600
apply (simp add: cont_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   601
apply (rule mono_fun, blast)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   602
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   603
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   604
lemma cont_map [TC]: "[|f \<in> cont(D,E); x \<in> set(D)|] ==> f`x \<in> set(E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   605
by (blast intro!: cont_fun [THEN apply_type])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   606
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   607
declare comp_fun [TC]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   608
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   609
lemma cont_mono:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   610
    "[|f \<in> cont(D,E); rel(D,x,y); x \<in> set(D); y \<in> set(D)|] ==> rel(E,f`x,f`y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   611
apply (simp add: cont_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   612
apply (blast intro!: mono_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   613
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   614
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   615
lemma cont_lub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   616
   "[|f \<in> cont(D,E); chain(D,X)|] ==> f`(lub(D,X)) = lub(E,\<lambda>n \<in> nat. f`(X`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   617
by (simp add: cont_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   618
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   619
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   620
(* Continuity and chains.                                               *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   621
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   622
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   623
lemma mono_chain:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   624
     "[|f \<in> mono(D,E); chain(D,X)|] ==> chain(E,\<lambda>n \<in> nat. f`(X`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   625
apply (simp (no_asm) add: chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   626
apply (blast intro: lam_type mono_map chain_in mono_mono chain_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   627
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   628
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   629
lemma cont_chain:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   630
     "[|f \<in> cont(D,E); chain(D,X)|] ==> chain(E,\<lambda>n \<in> nat. f`(X`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   631
by (blast intro: mono_chain cont2mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   632
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   633
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   634
(* I/E/D rules about (set+rel) cf, the continuous function space.       *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   635
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   636
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   637
(* The following development more difficult with cpo-as-relation approach. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   638
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   639
lemma cf_cont: "f \<in> set(cf(D,E)) ==> f \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   640
by (simp add: set_def cf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   641
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   642
lemma cont_cf: (* Non-trivial with relation *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   643
    "f \<in> cont(D,E) ==> f \<in> set(cf(D,E))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   644
by (simp add: set_def cf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   645
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   646
(* rel_cf originally an equality. Now stated as two rules. Seemed easiest. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   647
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   648
lemma rel_cfI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   649
    "[|!!x. x \<in> set(D) ==> rel(E,f`x,g`x); f \<in> cont(D,E); g \<in> cont(D,E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   650
     rel(cf(D,E),f,g)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   651
by (simp add: rel_I cf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   652
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   653
lemma rel_cf: "[|rel(cf(D,E),f,g); x \<in> set(D)|] ==> rel(E,f`x,g`x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   654
by (simp add: rel_def cf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   655
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   656
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   657
(* Theorems about the continuous function space.                        *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   658
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   659
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   660
lemma chain_cf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   661
    "[| chain(cf(D,E),X); x \<in> set(D)|] ==> chain(E,\<lambda>n \<in> nat. X`n`x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   662
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   663
apply (blast intro: lam_type apply_funtype cont_fun cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   664
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   665
apply (blast intro: rel_cf chain_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   666
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   667
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   668
lemma matrix_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   669
    "[|chain(cf(D,E),X); chain(D,Xa); cpo(D); cpo(E) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   670
     matrix(E,\<lambda>x \<in> nat. \<lambda>xa \<in> nat. X`x`(Xa`xa))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   671
apply (rule matrix_chainI, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   672
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   673
apply (blast intro: lam_type apply_funtype cont_fun cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   674
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   675
apply (blast intro: cont_mono nat_succI chain_rel cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   676
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   677
apply (blast intro: lam_type apply_funtype cont_fun cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   678
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   679
apply (rule rel_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   680
apply (simp_all add: chain_in chain_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   681
apply (blast intro: lam_type apply_funtype cont_fun cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   682
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   683
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   684
lemma chain_cf_lub_cont:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   685
    "[|chain(cf(D,E),X); cpo(D); cpo(E) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   686
     (\<lambda>x \<in> set(D). lub(E, \<lambda>n \<in> nat. X ` n ` x)) \<in> cont(D, E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   687
apply (rule contI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   688
apply (rule lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   689
apply (assumption | rule chain_cf [THEN cpo_lub, THEN islub_in])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   690
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   691
apply (rule dominate_islub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   692
apply (erule_tac [2] chain_cf [THEN cpo_lub], simp_all)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   693
apply (rule dominateI, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   694
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   695
apply (assumption | rule chain_in [THEN cf_cont, THEN cont_mono])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   696
apply (assumption | rule chain_cf [THEN chain_fun])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   697
apply (simp add: cpo_lub [THEN islub_in] chain_in [THEN cf_cont, THEN cont_lub])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   698
apply (frule matrix_lemma [THEN lub_matrix_diag], assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   699
apply (simp add: chain_in [THEN beta])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   700
apply (drule matrix_lemma [THEN lub_matrix_diag_sym], auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   701
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   702
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   703
lemma islub_cf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   704
    "[| chain(cf(D,E),X); cpo(D); cpo(E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   705
      islub(cf(D,E), X, \<lambda>x \<in> set(D). lub(E,\<lambda>n \<in> nat. X`n`x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   706
apply (rule islubI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   707
apply (rule isubI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   708
apply (rule chain_cf_lub_cont [THEN cont_cf], assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   709
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   710
apply (force dest!: chain_cf [THEN cpo_lub, THEN islub_ub])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   711
apply (blast intro: cf_cont chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   712
apply (blast intro: cont_cf chain_cf_lub_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   713
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   714
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   715
apply (force intro: chain_cf [THEN cpo_lub, THEN islub_least]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   716
                   cf_cont [THEN cont_fun, THEN apply_type] isubI
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   717
            elim: isubD2 [THEN rel_cf] isubD1)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   718
apply (blast intro: chain_cf_lub_cont isubD1 cf_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   719
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   720
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   721
lemma cpo_cf [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   722
    "[| cpo(D); cpo(E)|] ==> cpo(cf(D,E))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   723
apply (rule poI [THEN cpoI])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   724
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   725
apply (assumption | rule cpo_refl cf_cont [THEN cont_fun, THEN apply_type]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   726
                         cf_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   727
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   728
apply (rule cpo_trans, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   729
apply (erule rel_cf, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   730
apply (rule rel_cf, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   731
apply (assumption | rule cf_cont [THEN cont_fun, THEN apply_type] cf_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   732
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   733
apply (assumption | rule cf_cont [THEN cont_fun])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   734
apply (blast intro: cpo_antisym rel_cf cf_cont [THEN cont_fun, THEN apply_type])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   735
apply (fast intro: islub_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   736
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   737
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   738
lemma lub_cf: "[| chain(cf(D,E),X); cpo(D); cpo(E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   739
      lub(cf(D,E), X) = (\<lambda>x \<in> set(D). lub(E,\<lambda>n \<in> nat. X`n`x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   740
by (blast intro: islub_unique cpo_lub islub_cf cpo_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   741
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   742
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   743
lemma const_cont [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   744
     "[|y \<in> set(E); cpo(D); cpo(E)|] ==> (\<lambda>x \<in> set(D).y) \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   745
apply (rule contI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   746
prefer 2 apply simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   747
apply (blast intro: lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   748
apply (simp add: chain_in cpo_lub [THEN islub_in] lub_const)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   749
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   750
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   751
lemma cf_least:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   752
    "[|cpo(D); pcpo(E); y \<in> cont(D,E)|]==>rel(cf(D,E),(\<lambda>x \<in> set(D).bot(E)),y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   753
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   754
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   755
apply typecheck
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   756
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   757
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   758
lemma pcpo_cf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   759
    "[|cpo(D); pcpo(E)|] ==> pcpo(cf(D,E))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   760
apply (rule pcpoI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   761
apply (assumption | rule cf_least bot_in const_cont [THEN cont_cf] cf_cont cpo_cf pcpo_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   762
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   763
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   764
lemma bot_cf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   765
    "[|cpo(D); pcpo(E)|] ==> bot(cf(D,E)) = (\<lambda>x \<in> set(D).bot(E))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   766
by (blast intro: bot_unique [symmetric] pcpo_cf cf_least 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   767
                 bot_in [THEN const_cont, THEN cont_cf] cf_cont pcpo_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   768
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   769
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   770
(* Identity and composition.                                            *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   771
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   772
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   773
lemma id_cont [TC,intro!]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   774
    "cpo(D) ==> id(set(D)) \<in> cont(D,D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   775
by (simp add: id_type contI cpo_lub [THEN islub_in] chain_fun [THEN eta])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   776
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   777
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   778
lemmas comp_cont_apply =  cont_fun [THEN comp_fun_apply, OF _ cont_fun];
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   779
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   780
lemma comp_pres_cont [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   781
    "[| f \<in> cont(D',E); g \<in> cont(D,D'); cpo(D)|] ==> f O g \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   782
apply (rule contI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   783
apply (rule_tac [2] comp_cont_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   784
apply (rule_tac [5] comp_cont_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   785
apply (rule_tac [8] cont_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   786
apply (rule_tac [9] cont_mono) (* 15 subgoals *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   787
apply typecheck (* proves all but the lub case *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   788
apply (subst comp_cont_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   789
apply (rule_tac [4] cont_lub [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   790
apply (rule_tac [6] cont_lub [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   791
prefer 8 apply (simp add: comp_cont_apply chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   792
apply (auto intro: cpo_lub [THEN islub_in] cont_chain)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   793
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   794
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   795
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   796
lemma comp_mono:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   797
    "[| f \<in> cont(D',E); g \<in> cont(D,D'); f':cont(D',E); g':cont(D,D');
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   798
        rel(cf(D',E),f,f'); rel(cf(D,D'),g,g'); cpo(D); cpo(E) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   799
     rel(cf(D,E),f O g,f' O g')"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   800
apply (rule rel_cfI) 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   801
apply (subst comp_cont_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   802
apply (rule_tac [4] comp_cont_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   803
apply (rule_tac [7] cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   804
apply (assumption | rule rel_cf cont_mono cont_map comp_pres_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   805
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   806
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   807
lemma chain_cf_comp:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   808
    "[| chain(cf(D',E),X); chain(cf(D,D'),Y); cpo(D); cpo(E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   809
     chain(cf(D,E),\<lambda>n \<in> nat. X`n O Y`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   810
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   811
defer 1
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   812
apply simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   813
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   814
apply (rule comp_cont_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   815
apply (rule_tac [4] comp_cont_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   816
apply (rule_tac [7] cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   817
apply (rule_tac [8] rel_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   818
apply (rule_tac [10] cont_mono) 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   819
apply (blast intro: lam_type comp_pres_cont cont_cf chain_in [THEN cf_cont] 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   820
                    cont_map chain_rel rel_cf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   821
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   822
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   823
lemma comp_lubs:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   824
    "[| chain(cf(D',E),X); chain(cf(D,D'),Y); cpo(D); cpo(D'); cpo(E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   825
     lub(cf(D',E),X) O lub(cf(D,D'),Y) = lub(cf(D,E),\<lambda>n \<in> nat. X`n O Y`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   826
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   827
apply (rule_tac [3] lub_cf [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   828
apply (assumption | rule comp_fun cf_cont [THEN cont_fun]  cpo_lub [THEN islub_in]  cpo_cf chain_cf_comp)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   829
apply (simp add: chain_in [THEN cf_cont, THEN comp_cont_apply,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   830
                         OF _ _ chain_in [THEN cf_cont]])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   831
apply (subst comp_cont_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   832
apply (assumption | rule cpo_lub [THEN islub_in, THEN cf_cont]  cpo_cf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   833
apply (simp add: lub_cf chain_cf chain_in [THEN cf_cont, THEN cont_lub] chain_cf [THEN cpo_lub, THEN islub_in])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   834
apply (cut_tac M = "\<lambda>xa \<in> nat. \<lambda>xb \<in> nat. X`xa` (Y`xb`x)" in lub_matrix_diag)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   835
prefer 3 apply simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   836
apply (rule matrix_chainI, simp_all)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   837
apply (drule chain_in [THEN cf_cont], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   838
apply (force dest: cont_chain [OF _ chain_cf])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   839
apply (rule chain_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   840
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   841
       rule cont_fun [THEN apply_type] chain_in [THEN cf_cont] lam_type)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   842
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   843
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   844
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   845
(* Theorems about projpair.                                             *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   846
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   847
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   848
lemma projpairI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   849
    "[| e \<in> cont(D,E); p \<in> cont(E,D); p O e = id(set(D));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   850
        rel(cf(E,E))(e O p)(id(set(E)))|] ==> projpair(D,E,e,p)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   851
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   852
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   853
lemma projpair_e_cont: "projpair(D,E,e,p) ==> e \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   854
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   855
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   856
lemma projpair_p_cont: "projpair(D,E,e,p) ==> p \<in> cont(E,D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   857
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   858
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   859
lemma projpair_ep_cont: "projpair(D,E,e,p) ==> e \<in> cont(D,E) & p \<in> cont(E,D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   860
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   861
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   862
lemma projpair_eq: "projpair(D,E,e,p) ==> p O e = id(set(D))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   863
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   864
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   865
lemma projpair_rel: "projpair(D,E,e,p) ==> rel(cf(E,E))(e O p)(id(set(E)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   866
by (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   867
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   868
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   869
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   870
(* NB! projpair_e_cont and projpair_p_cont cannot be used repeatedly    *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   871
(*     at the same time since both match a goal of the form f \<in> cont(X,Y).*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   872
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   873
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   874
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   875
(* Uniqueness of embedding projection pairs.                            *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   876
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   877
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   878
lemmas id_comp = fun_is_rel [THEN left_comp_id]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   879
and    comp_id = fun_is_rel [THEN right_comp_id]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   880
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   881
lemma lemma1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   882
    "[|cpo(D); cpo(E); projpair(D,E,e,p); projpair(D,E,e',p');
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   883
       rel(cf(D,E),e,e')|] ==> rel(cf(E,D),p',p)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   884
apply (rule_tac b=p' in
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   885
       projpair_p_cont [THEN cont_fun, THEN id_comp, THEN subst], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   886
apply (rule projpair_eq [THEN subst], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   887
apply (rule cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   888
apply (assumption | rule cpo_cf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   889
(* The following corresponds to EXISTS_TAC, non-trivial instantiation. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   890
apply (rule_tac [4] f = "p O (e' O p')" in cont_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   891
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   892
apply (blast intro:  cpo_cf cont_cf comp_mono comp_pres_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   893
             dest: projpair_ep_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   894
apply (rule_tac P = "%x. rel (cf (E,D),p O e' O p',x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   895
         in projpair_p_cont [THEN cont_fun, THEN comp_id, THEN subst],
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   896
       assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   897
apply (rule comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   898
apply (blast intro: cpo_cf cont_cf comp_pres_cont projpair_rel
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   899
             dest: projpair_ep_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   900
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   901
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   902
text{*Proof's very like the previous one.  Is there a pattern that
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   903
      could be exploited?*}
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   904
lemma lemma2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   905
    "[|cpo(D); cpo(E); projpair(D,E,e,p); projpair(D,E,e',p');
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   906
       rel(cf(E,D),p',p)|] ==> rel(cf(D,E),e,e')"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   907
apply (rule_tac b=e
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   908
	 in projpair_e_cont [THEN cont_fun, THEN comp_id, THEN subst],
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   909
       assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   910
apply (rule_tac e1=e' in projpair_eq [THEN subst], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   911
apply (rule cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   912
apply (assumption | rule cpo_cf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   913
apply (rule_tac [4] f = "(e O p) O e'" in cont_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   914
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   915
apply (blast intro:  cpo_cf cont_cf comp_mono comp_pres_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   916
             dest: projpair_ep_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   917
apply (rule_tac P = "%x. rel (cf (D,E), (e O p) O e',x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   918
         in projpair_e_cont [THEN cont_fun, THEN id_comp, THEN subst],
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   919
       assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   920
apply (blast intro: cpo_cf cont_cf comp_pres_cont projpair_rel comp_mono
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   921
             dest: projpair_ep_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   922
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   923
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   924
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   925
lemma projpair_unique:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   926
    "[|cpo(D); cpo(E); projpair(D,E,e,p); projpair(D,E,e',p')|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   927
     (e=e')<->(p=p')"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   928
by (blast intro: cpo_antisym lemma1 lemma2 cpo_cf cont_cf
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   929
          dest: projpair_ep_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   930
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   931
(* Slightly different, more asms, since THE chooses the unique element. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   932
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   933
lemma embRp:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   934
    "[|emb(D,E,e); cpo(D); cpo(E)|] ==> projpair(D,E,e,Rp(D,E,e))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   935
apply (simp add: emb_def Rp_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   936
apply (blast intro: theI2 projpair_unique [THEN iffD1])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   937
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   938
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   939
lemma embI: "projpair(D,E,e,p) ==> emb(D,E,e)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   940
by (simp add: emb_def, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   941
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   942
lemma Rp_unique: "[|projpair(D,E,e,p); cpo(D); cpo(E)|] ==> Rp(D,E,e) = p"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   943
by (blast intro: embRp embI projpair_unique [THEN iffD1])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   944
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   945
lemma emb_cont [TC]: "emb(D,E,e) ==> e \<in> cont(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   946
apply (simp add: emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   947
apply (blast intro: projpair_e_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   948
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   949
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   950
(* The following three theorems have cpo asms due to THE (uniqueness). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   951
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   952
lemmas Rp_cont [TC] = embRp [THEN projpair_p_cont, standard]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   953
lemmas embRp_eq = embRp [THEN projpair_eq, standard]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   954
lemmas embRp_rel = embRp [THEN projpair_rel, standard]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   955
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   956
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   957
lemma embRp_eq_thm:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   958
    "[|emb(D,E,e); x \<in> set(D); cpo(D); cpo(E)|] ==> Rp(D,E,e)`(e`x) = x"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   959
apply (rule comp_fun_apply [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   960
apply (assumption | rule Rp_cont emb_cont cont_fun)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   961
apply (subst embRp_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   962
apply (auto intro: id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   963
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   964
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   965
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   966
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   967
(* The identity embedding.                                              *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   968
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   969
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   970
lemma projpair_id:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   971
    "cpo(D) ==> projpair(D,D,id(set(D)),id(set(D)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   972
apply (simp add: projpair_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   973
apply (blast intro: cpo_cf cont_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   974
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   975
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   976
lemma emb_id:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   977
    "cpo(D) ==> emb(D,D,id(set(D)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   978
by (auto intro: embI projpair_id)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   979
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   980
lemma Rp_id:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   981
    "cpo(D) ==> Rp(D,D,id(set(D))) = id(set(D))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   982
by (auto intro: Rp_unique projpair_id)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   983
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   984
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   985
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   986
(* Composition preserves embeddings.                                    *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   987
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   988
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   989
(* Considerably shorter, only partly due to a simpler comp_assoc. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   990
(* Proof in HOL-ST: 70 lines (minus 14 due to comp_assoc complication). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   991
(* Proof in Isa/ZF: 23 lines (compared to 56: 60% reduction). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   992
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   993
lemma comp_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   994
    "[|emb(D,D',e); emb(D',E,e'); cpo(D); cpo(D'); cpo(E)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   995
     projpair(D,E,e' O e,(Rp(D,D',e)) O (Rp(D',E,e')))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   996
apply (simp add: projpair_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   997
apply (assumption | rule comp_pres_cont Rp_cont emb_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   998
apply (rule comp_assoc [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
   999
apply (rule_tac t1 = e' in comp_assoc [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1000
apply (subst embRp_eq) (* Matches everything due to subst/ssubst. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1001
apply assumption+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1002
apply (subst comp_id)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1003
apply (assumption | rule cont_fun Rp_cont embRp_eq)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1004
apply (rule comp_assoc [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1005
apply (rule_tac t1 = "Rp (D,D',e)" in comp_assoc [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1006
apply (rule cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1007
apply (assumption | rule cpo_cf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1008
apply (rule comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1009
apply (rule_tac [6] cpo_refl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1010
apply (erule_tac [7] asm_rl | rule_tac [7] cont_cf Rp_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1011
prefer 6 apply (blast intro: cpo_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1012
apply (rule_tac [5] comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1013
apply (rule_tac [10] embRp_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1014
apply (rule_tac [9] cpo_cf [THEN cpo_refl])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1015
apply (simp_all add: comp_id embRp_rel comp_pres_cont Rp_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1016
                     id_cont emb_cont cont_fun cont_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1017
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1018
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1019
(* The use of THEN is great in places like the following, both ugly in HOL. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1020
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1021
lemmas emb_comp = comp_lemma [THEN embI]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1022
lemmas Rp_comp = comp_lemma [THEN Rp_unique]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1023
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1024
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1025
(* Infinite cartesian product.                                          *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1026
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1027
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1028
lemma iprodI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1029
    "x:(\<Pi>n \<in> nat. set(DD`n)) ==> x \<in> set(iprod(DD))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1030
by (simp add: set_def iprod_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1031
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1032
lemma iprodE:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1033
    "x \<in> set(iprod(DD)) ==> x:(\<Pi>n \<in> nat. set(DD`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1034
by (simp add: set_def iprod_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1035
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1036
(* Contains typing conditions in contrast to HOL-ST *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1037
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1038
lemma rel_iprodI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1039
    "[|!!n. n \<in> nat ==> rel(DD`n,f`n,g`n); f:(\<Pi>n \<in> nat. set(DD`n));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1040
       g:(\<Pi>n \<in> nat. set(DD`n))|] ==> rel(iprod(DD),f,g)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1041
by (simp add: iprod_def rel_I)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1042
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1043
lemma rel_iprodE:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1044
    "[|rel(iprod(DD),f,g); n \<in> nat|] ==> rel(DD`n,f`n,g`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1045
by (simp add: iprod_def rel_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1046
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1047
lemma chain_iprod:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1048
    "[|chain(iprod(DD),X);  !!n. n \<in> nat ==> cpo(DD`n); n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1049
     chain(DD`n,\<lambda>m \<in> nat. X`m`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1050
apply (unfold chain_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1051
apply (rule lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1052
apply (rule apply_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1053
apply (rule iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1054
apply (blast intro: apply_funtype, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1055
apply (simp add: rel_iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1056
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1057
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1058
lemma islub_iprod:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1059
    "[|chain(iprod(DD),X);  !!n. n \<in> nat ==> cpo(DD`n)|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1060
     islub(iprod(DD),X,\<lambda>n \<in> nat. lub(DD`n,\<lambda>m \<in> nat. X`m`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1061
apply (simp add: islub_def isub_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1062
apply (rule iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1063
apply (blast intro: lam_type chain_iprod [THEN cpo_lub, THEN islub_in])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1064
apply (rule rel_iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1065
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1066
(*looks like something should be inserted into the assumptions!*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1067
apply (rule_tac P = "%t. rel (DD`na,t,lub (DD`na,\<lambda>x \<in> nat. X`x`na))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1068
            and b1 = "%n. X`n`na" in beta [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1069
apply (simp del: beta
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1070
	    add: chain_iprod [THEN cpo_lub, THEN islub_ub] iprodE
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1071
                chain_in)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1072
apply (blast intro: iprodI lam_type chain_iprod [THEN cpo_lub, THEN islub_in])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1073
apply (rule rel_iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1074
apply (simp | rule islub_least chain_iprod [THEN cpo_lub])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1075
apply (simp add: isub_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1076
apply (erule iprodE [THEN apply_type])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1077
apply (simp add: rel_iprodE | rule lam_type chain_iprod [THEN cpo_lub, THEN islub_in] iprodE)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1078
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1079
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1080
lemma cpo_iprod [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1081
    "(!!n. n \<in> nat ==> cpo(DD`n)) ==> cpo(iprod(DD))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1082
apply (assumption | rule cpoI poI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1083
apply (rule rel_iprodI) (*not repeated: want to solve 1, leave 2 unchanged *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1084
apply (simp | rule cpo_refl iprodE [THEN apply_type] iprodE)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1085
apply (rule rel_iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1086
apply (drule rel_iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1087
apply (drule_tac [2] rel_iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1088
apply (simp | rule cpo_trans iprodE [THEN apply_type] iprodE)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1089
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1090
apply (blast intro: iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1091
apply (blast intro: iprodE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1092
apply (blast intro: cpo_antisym rel_iprodE iprodE [THEN apply_type])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1093
apply (auto intro: islub_iprod)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1094
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1095
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1096
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1097
lemma lub_iprod:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1098
    "[|chain(iprod(DD),X);  !!n. n \<in> nat ==> cpo(DD`n)|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1099
     ==> lub(iprod(DD),X) = (\<lambda>n \<in> nat. lub(DD`n,\<lambda>m \<in> nat. X`m`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1100
by (blast intro: cpo_lub [THEN islub_unique] islub_iprod cpo_iprod)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1101
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1102
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1103
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1104
(* The notion of subcpo.                                                *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1105
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1106
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1107
lemma subcpoI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1108
    "[|set(D)<=set(E);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1109
       !!x y. [|x \<in> set(D); y \<in> set(D)|] ==> rel(D,x,y)<->rel(E,x,y);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1110
       !!X. chain(D,X) ==> lub(E,X) \<in> set(D)|] ==> subcpo(D,E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1111
by (simp add: subcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1112
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1113
lemma subcpo_subset: "subcpo(D,E) ==> set(D)<=set(E)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1114
by (simp add: subcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1115
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1116
lemma subcpo_rel_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1117
    "[|subcpo(D,E); x \<in> set(D); y \<in> set(D)|] ==> rel(D,x,y)<->rel(E,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1118
by (simp add: subcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1119
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1120
lemmas subcpo_relD1 = subcpo_rel_eq [THEN iffD1]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1121
lemmas subcpo_relD2 = subcpo_rel_eq [THEN iffD2]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1122
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1123
lemma subcpo_lub: "[|subcpo(D,E); chain(D,X)|] ==> lub(E,X) \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1124
by (simp add: subcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1125
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1126
lemma chain_subcpo: "[|subcpo(D,E); chain(D,X)|] ==> chain(E,X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1127
by (blast intro: Pi_type [THEN chainI] chain_fun subcpo_relD1
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1128
                    subcpo_subset [THEN subsetD]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1129
                    chain_in chain_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1130
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1131
lemma ub_subcpo: "[|subcpo(D,E); chain(D,X); isub(D,X,x)|] ==> isub(E,X,x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1132
by (blast intro: isubI subcpo_relD1 subcpo_relD1 chain_in isubD1 isubD2
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1133
                    subcpo_subset [THEN subsetD] chain_in chain_rel)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1134
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1135
lemma islub_subcpo:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1136
     "[|subcpo(D,E); cpo(E); chain(D,X)|] ==> islub(D,X,lub(E,X))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1137
by (blast intro: islubI isubI subcpo_lub subcpo_relD2 chain_in islub_ub
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1138
                 islub_least cpo_lub chain_subcpo isubD1 ub_subcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1139
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1140
lemma subcpo_cpo: "[|subcpo(D,E); cpo(E)|] ==> cpo(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1141
apply (assumption | rule cpoI poI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1142
apply (simp add: subcpo_rel_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1143
apply (assumption | rule cpo_refl subcpo_subset [THEN subsetD])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1144
apply (rotate_tac -3)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1145
apply (simp add: subcpo_rel_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1146
apply (blast intro: subcpo_subset [THEN subsetD] cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1147
(* Changing the order of the assumptions, otherwise simp doesn't work. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1148
apply (rotate_tac -2)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1149
apply (simp add: subcpo_rel_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1150
apply (blast intro: cpo_antisym subcpo_subset [THEN subsetD])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1151
apply (fast intro: islub_subcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1152
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1153
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1154
lemma lub_subcpo: "[|subcpo(D,E); cpo(E); chain(D,X)|] ==> lub(D,X) = lub(E,X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1155
by (blast intro: cpo_lub [THEN islub_unique] islub_subcpo subcpo_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1156
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1157
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1158
(* Making subcpos using mkcpo.                                          *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1159
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1160
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1161
lemma mkcpoI: "[|x \<in> set(D); P(x)|] ==> x \<in> set(mkcpo(D,P))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1162
by (simp add: set_def mkcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1163
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1164
lemma mkcpoD1: "x \<in> set(mkcpo(D,P))==> x \<in> set(D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1165
by (simp add: set_def mkcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1166
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1167
lemma mkcpoD2: "x \<in> set(mkcpo(D,P))==> P(x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1168
by (simp add: set_def mkcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1169
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1170
lemma rel_mkcpoE: "rel(mkcpo(D,P),x,y) ==> rel(D,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1171
by (simp add: rel_def mkcpo_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1172
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1173
lemma rel_mkcpo:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1174
    "[|x \<in> set(D); y \<in> set(D)|] ==> rel(mkcpo(D,P),x,y) <-> rel(D,x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1175
by (simp add: mkcpo_def rel_def set_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1176
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1177
lemma chain_mkcpo:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1178
    "chain(mkcpo(D,P),X) ==> chain(D,X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1179
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1180
apply (blast intro: Pi_type chain_fun chain_in [THEN mkcpoD1])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1181
apply (blast intro: rel_mkcpo [THEN iffD1] chain_rel mkcpoD1 chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1182
done
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
  1183
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1184
lemma subcpo_mkcpo:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1185
    "[|!!X. chain(mkcpo(D,P),X) ==> P(lub(D,X)); cpo(D)|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1186
      ==> subcpo(mkcpo(D,P),D)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1187
apply (intro subcpoI subsetI rel_mkcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1188
apply (erule mkcpoD1)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1189
apply (blast intro: mkcpoI cpo_lub [THEN islub_in] chain_mkcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1190
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1191
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1192
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1193
(* Embedding projection chains of cpos.                                 *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1194
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1195
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1196
lemma emb_chainI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1197
    "[|!!n. n \<in> nat ==> cpo(DD`n);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1198
       !!n. n \<in> nat ==> emb(DD`n,DD`succ(n),ee`n)|] ==> emb_chain(DD,ee)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1199
by (simp add: emb_chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1200
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1201
lemma emb_chain_cpo [TC]: "[|emb_chain(DD,ee); n \<in> nat|] ==> cpo(DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1202
by (simp add: emb_chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1203
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1204
lemma emb_chain_emb:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1205
    "[|emb_chain(DD,ee); n \<in> nat|] ==> emb(DD`n,DD`succ(n),ee`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1206
by (simp add: emb_chain_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1207
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1208
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1209
(* Dinf, the inverse Limit.                                             *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1210
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1211
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1212
lemma DinfI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1213
    "[|x:(\<Pi>n \<in> nat. set(DD`n));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1214
       !!n. n \<in> nat ==> Rp(DD`n,DD`succ(n),ee`n)`(x`succ(n)) = x`n|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1215
     ==> x \<in> set(Dinf(DD,ee))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1216
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1217
apply (blast intro: mkcpoI iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1218
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1219
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1220
lemma Dinf_prod: "x \<in> set(Dinf(DD,ee)) ==> x:(\<Pi>n \<in> nat. set(DD`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1221
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1222
apply (erule mkcpoD1 [THEN iprodE])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1223
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1224
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1225
lemma Dinf_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1226
    "[|x \<in> set(Dinf(DD,ee)); n \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1227
     ==> Rp(DD`n,DD`succ(n),ee`n)`(x`succ(n)) = x`n"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1228
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1229
apply (blast dest: mkcpoD2)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1230
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1231
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1232
lemma rel_DinfI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1233
    "[|!!n. n \<in> nat ==> rel(DD`n,x`n,y`n);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1234
       x:(\<Pi>n \<in> nat. set(DD`n)); y:(\<Pi>n \<in> nat. set(DD`n))|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1235
     rel(Dinf(DD,ee),x,y)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1236
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1237
apply (blast intro: rel_mkcpo [THEN iffD2] rel_iprodI iprodI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1238
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1239
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1240
lemma rel_Dinf: "[|rel(Dinf(DD,ee),x,y); n \<in> nat|] ==> rel(DD`n,x`n,y`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1241
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1242
apply (erule rel_mkcpoE [THEN rel_iprodE], assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1243
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1244
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1245
lemma chain_Dinf: "chain(Dinf(DD,ee),X) ==> chain(iprod(DD),X)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1246
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1247
apply (erule chain_mkcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1248
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1249
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1250
lemma subcpo_Dinf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1251
    "emb_chain(DD,ee) ==> subcpo(Dinf(DD,ee),iprod(DD))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1252
apply (simp add: Dinf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1253
apply (rule subcpo_mkcpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1254
apply (simp add: Dinf_def [symmetric])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1255
apply (rule ballI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1256
apply (subst lub_iprod)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1257
apply (assumption | rule chain_Dinf emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1258
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1259
apply (subst Rp_cont [THEN cont_lub])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1260
apply (assumption | rule emb_chain_cpo emb_chain_emb nat_succI chain_iprod chain_Dinf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1261
(* Useful simplification, ugly in HOL. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1262
apply (simp add: Dinf_eq chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1263
apply (auto intro: cpo_iprod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1264
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1265
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1266
(* Simple example of existential reasoning in Isabelle versus HOL. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1267
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1268
lemma cpo_Dinf: "emb_chain(DD,ee) ==> cpo(Dinf(DD,ee))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1269
apply (rule subcpo_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1270
apply (erule subcpo_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1271
apply (auto intro: cpo_iprod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1272
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1273
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1274
(* Again and again the proofs are much easier to WRITE in Isabelle, but
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1275
  the proof steps are essentially the same (I think). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1276
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1277
lemma lub_Dinf:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1278
    "[|chain(Dinf(DD,ee),X); emb_chain(DD,ee)|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1279
     ==> lub(Dinf(DD,ee),X) = (\<lambda>n \<in> nat. lub(DD`n,\<lambda>m \<in> nat. X`m`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1280
apply (subst subcpo_Dinf [THEN lub_subcpo])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1281
apply (auto intro: cpo_iprod emb_chain_cpo lub_iprod chain_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1282
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1283
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1284
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1285
(* Generalising embedddings D_m -> D_{m+1} to embeddings D_m -> D_n,    *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1286
(* defined as eps(DD,ee,m,n), via e_less and e_gr.                      *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1287
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1288
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1289
lemma e_less_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1290
    "m \<in> nat ==> e_less(DD,ee,m,m) = id(set(DD`m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1291
by (simp add: e_less_def diff_self_eq_0)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1292
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1293
lemma lemma_succ_sub: "succ(m#+n)#-m = succ(natify(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1294
by (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1295
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1296
lemma e_less_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1297
     "e_less(DD,ee,m,succ(m#+k)) = (ee`(m#+k))O(e_less(DD,ee,m,m#+k))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1298
by (simp add: e_less_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1299
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1300
lemma le_exists:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1301
    "[| m le n;  !!x. [|n=m#+x; x \<in> nat|] ==> Q;  n \<in> nat |] ==> Q"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1302
apply (drule less_imp_succ_add, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1303
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1304
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1305
lemma e_less_le: "[| m le n;  n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1306
      e_less(DD,ee,m,succ(n)) = ee`n O e_less(DD,ee,m,n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1307
apply (rule le_exists, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1308
apply (simp add: e_less_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1309
apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1310
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1311
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1312
(* All theorems assume variables m and n are natural numbers. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1313
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1314
lemma e_less_succ:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1315
     "m \<in> nat ==> e_less(DD,ee,m,succ(m)) = ee`m O id(set(DD`m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1316
by (simp add: e_less_le e_less_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1317
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1318
lemma e_less_succ_emb:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1319
    "[|!!n. n \<in> nat ==> emb(DD`n,DD`succ(n),ee`n); m \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1320
     e_less(DD,ee,m,succ(m)) = ee`m"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1321
apply (simp add: e_less_succ)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1322
apply (blast intro: emb_cont cont_fun comp_id)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1323
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1324
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1325
(* Compare this proof with the HOL one, here we do type checking. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1326
(* In any case the one below was very easy to write. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1327
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1328
lemma emb_e_less_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1329
     "[| emb_chain(DD,ee); m \<in> nat |]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1330
      ==> emb(DD`m, DD`(m#+k), e_less(DD,ee,m,m#+k))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1331
apply (subgoal_tac "emb (DD`m, DD` (m#+natify (k)), e_less (DD,ee,m,m#+natify (k))) ")
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1332
apply (rule_tac [2] n = "natify (k) " in nat_induct)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1333
apply (simp_all add: e_less_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1334
apply (assumption | rule emb_id emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1335
apply (simp add: e_less_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1336
apply (auto intro: emb_comp emb_chain_emb emb_chain_cpo add_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1337
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1338
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1339
lemma emb_e_less: "[| m le n;  emb_chain(DD,ee);  n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1340
     emb(DD`m, DD`n, e_less(DD,ee,m,n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1341
apply (frule lt_nat_in_nat)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1342
apply (erule nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1343
(* same proof as e_less_le *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1344
apply (rule le_exists, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1345
apply (simp add: emb_e_less_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1346
apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1347
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1348
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1349
lemma comp_mono_eq: "[|f=f'; g=g'|] ==> f O g = f' O g'"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1350
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1351
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1352
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1353
(* Note the object-level implication for induction on k. This
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1354
   must be removed later to allow the theorems to be used for simp.
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1355
   Therefore this theorem is only a lemma. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1356
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1357
lemma e_less_split_add_lemma [rule_format]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1358
    "[| emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1359
     n le k -->
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1360
     e_less(DD,ee,m,m#+k) = e_less(DD,ee,m#+n,m#+k) O e_less(DD,ee,m,m#+n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1361
apply (induct_tac k)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1362
apply (simp add: e_less_eq id_type [THEN id_comp])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1363
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1364
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1365
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1366
apply (erule impE, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1367
apply (simp add: add_succ_right e_less_add add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1368
apply (subst e_less_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1369
apply (assumption | rule add_le_mono nat_le_refl add_type nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1370
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1371
apply (assumption | rule comp_mono_eq refl)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1372
apply (simp del: add_succ_right add: add_succ_right [symmetric]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1373
	    add: e_less_eq add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1374
apply (subst id_comp) (* simp cannot unify/inst right, use brr below (?) . *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1375
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1376
       rule emb_e_less_add [THEN emb_cont, THEN cont_fun] refl nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1377
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1378
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1379
lemma e_less_split_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1380
     "[| n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1381
      e_less(DD,ee,m,m#+k) = e_less(DD,ee,m#+n,m#+k) O e_less(DD,ee,m,m#+n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1382
by (blast intro: e_less_split_add_lemma)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1383
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1384
lemma e_gr_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1385
    "m \<in> nat ==> e_gr(DD,ee,m,m) = id(set(DD`m))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1386
apply (simp add: e_gr_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1387
apply (simp add: diff_self_eq_0)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1388
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1389
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1390
lemma e_gr_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1391
    "[|n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1392
          e_gr(DD,ee,succ(n#+k),n) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1393
          e_gr(DD,ee,n#+k,n) O Rp(DD`(n#+k),DD`succ(n#+k),ee`(n#+k))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1394
by (simp add: e_gr_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1395
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1396
lemma e_gr_le:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1397
     "[|n le m; m \<in> nat; n \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1398
      ==> e_gr(DD,ee,succ(m),n) = e_gr(DD,ee,m,n) O Rp(DD`m,DD`succ(m),ee`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1399
apply (erule le_exists)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1400
apply (simp add: e_gr_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1401
apply assumption+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1402
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1403
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1404
lemma e_gr_succ:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1405
 "m \<in> nat ==> e_gr(DD,ee,succ(m),m) = id(set(DD`m)) O Rp(DD`m,DD`succ(m),ee`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1406
by (simp add: e_gr_le e_gr_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1407
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1408
(* Cpo asm's due to THE uniqueness. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1409
lemma e_gr_succ_emb: "[|emb_chain(DD,ee); m \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1410
     e_gr(DD,ee,succ(m),m) = Rp(DD`m,DD`succ(m),ee`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1411
apply (simp add: e_gr_succ)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1412
apply (blast intro: id_comp Rp_cont cont_fun emb_chain_cpo emb_chain_emb)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1413
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1414
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1415
lemma e_gr_fun_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1416
    "[|emb_chain(DD,ee); n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1417
     e_gr(DD,ee,n#+k,n): set(DD`(n#+k))->set(DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1418
apply (induct_tac k)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1419
apply (simp add: e_gr_eq id_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1420
apply (simp add: e_gr_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1421
apply (blast intro: comp_fun Rp_cont cont_fun emb_chain_emb emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1422
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1423
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1424
lemma e_gr_fun:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1425
    "[|n le m; emb_chain(DD,ee); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1426
     e_gr(DD,ee,m,n): set(DD`m)->set(DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1427
apply (rule le_exists, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1428
apply (simp add: e_gr_fun_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1429
apply assumption+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1430
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1431
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1432
lemma e_gr_split_add_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1433
    "[| emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1434
     m le k -->
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1435
     e_gr(DD,ee,n#+k,n) = e_gr(DD,ee,n#+m,n) O e_gr(DD,ee,n#+k,n#+m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1436
apply (induct_tac k)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1437
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1438
apply (simp add: le0_iff e_gr_eq id_type [THEN comp_id])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1439
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1440
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1441
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1442
apply (erule impE, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1443
apply (simp add: add_succ_right e_gr_add add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1444
apply (subst e_gr_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1445
apply (assumption | rule add_le_mono nat_le_refl add_type nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1446
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1447
apply (assumption | rule comp_mono_eq refl)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1448
(* New direct subgoal *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1449
apply (simp del: add_succ_right add: add_succ_right [symmetric]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1450
	    add: e_gr_eq add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1451
apply (subst comp_id) (* simp cannot unify/inst right, use brr below (?) . *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1452
apply (assumption | rule e_gr_fun add_type refl add_le_self nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1453
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1454
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1455
lemma e_gr_split_add: "[| m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1456
      e_gr(DD,ee,n#+k,n) = e_gr(DD,ee,n#+m,n) O e_gr(DD,ee,n#+k,n#+m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1457
apply (blast intro: e_gr_split_add_lemma [THEN mp])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1458
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1459
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1460
lemma e_less_cont: "[|m le n; emb_chain(DD,ee); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1461
      e_less(DD,ee,m,n):cont(DD`m,DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1462
apply (blast intro: emb_cont emb_e_less)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1463
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1464
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1465
lemma e_gr_cont:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1466
    "[|n le m; emb_chain(DD,ee); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1467
     e_gr(DD,ee,m,n):cont(DD`m,DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1468
apply (erule rev_mp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1469
apply (induct_tac m)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1470
apply (simp add: le0_iff e_gr_eq nat_0I)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1471
apply (assumption | rule impI id_cont emb_chain_cpo nat_0I)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1472
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1473
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1474
apply (erule impE, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1475
apply (simp add: e_gr_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1476
apply (blast intro: comp_pres_cont Rp_cont emb_chain_cpo emb_chain_emb)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1477
apply (simp add: e_gr_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1478
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1479
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1480
(* Considerably shorter.... 57 against 26 *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1481
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1482
lemma e_less_e_gr_split_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1483
    "[|n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1484
     e_less(DD,ee,m,m#+n) = e_gr(DD,ee,m#+k,m#+n) O e_less(DD,ee,m,m#+k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1485
(* Use mp to prepare for induction. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1486
apply (erule rev_mp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1487
apply (induct_tac k)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1488
apply (simp add: e_gr_eq e_less_eq id_type [THEN id_comp])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1489
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1490
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1491
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1492
apply (erule impE, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1493
apply (simp add: add_succ_right e_gr_le e_less_le add_le_self nat_le_refl add_le_mono add_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1494
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1495
apply (rule_tac s1 = "ee` (m#+x)" in comp_assoc [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1496
apply (subst embRp_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1497
apply (assumption | rule emb_chain_emb add_type emb_chain_cpo nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1498
apply (subst id_comp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1499
apply (blast intro: e_less_cont [THEN cont_fun] add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1500
apply (rule refl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1501
apply (simp del: add_succ_right add: add_succ_right [symmetric]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1502
	    add: e_gr_eq add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1503
apply (blast intro: id_comp [symmetric] e_less_cont [THEN cont_fun]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1504
                    add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1505
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1506
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1507
(* Again considerably shorter, and easy to obtain from the previous thm. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1508
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1509
lemma e_gr_e_less_split_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1510
    "[|m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1511
     e_gr(DD,ee,n#+m,n) = e_gr(DD,ee,n#+k,n) O e_less(DD,ee,n#+m,n#+k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1512
(* Use mp to prepare for induction. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1513
apply (erule rev_mp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1514
apply (induct_tac k)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1515
apply (simp add: e_gr_eq e_less_eq id_type [THEN id_comp])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1516
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1517
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1518
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1519
apply (erule impE, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1520
apply (simp add: e_gr_le e_less_le add_le_self nat_le_refl add_le_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1521
apply (subst comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1522
apply (rule_tac s1 = "ee` (n#+x)" in comp_assoc [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1523
apply (subst embRp_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1524
apply (assumption | rule emb_chain_emb add_type emb_chain_cpo nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1525
apply (subst id_comp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1526
apply (blast intro!: e_less_cont [THEN cont_fun] add_le_mono nat_le_refl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1527
apply (rule refl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1528
apply (simp del: add_succ_right add: add_succ_right [symmetric]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1529
	    add: e_less_eq add_type nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1530
apply (blast intro: comp_id [symmetric] e_gr_cont [THEN cont_fun] add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1531
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1532
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1533
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1534
lemma emb_eps:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1535
    "[|m le n; emb_chain(DD,ee); m \<in> nat; n \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1536
     ==> emb(DD`m,DD`n,eps(DD,ee,m,n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1537
apply (simp add: eps_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1538
apply (blast intro: emb_e_less)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1539
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1540
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1541
lemma eps_fun:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1542
    "[|emb_chain(DD,ee); m \<in> nat; n \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1543
     ==> eps(DD,ee,m,n): set(DD`m)->set(DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1544
apply (simp add: eps_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1545
apply (auto intro: e_less_cont [THEN cont_fun]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1546
                   not_le_iff_lt [THEN iffD1, THEN leI]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1547
                   e_gr_fun nat_into_Ord)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1548
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1549
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1550
lemma eps_id: "n \<in> nat ==> eps(DD,ee,n,n) = id(set(DD`n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1551
by (simp add: eps_def e_less_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1552
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1553
lemma eps_e_less_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1554
    "[|m \<in> nat; n \<in> nat|] ==> eps(DD,ee,m,m#+n) = e_less(DD,ee,m,m#+n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1555
by (simp add: eps_def add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1556
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1557
lemma eps_e_less:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1558
    "[|m le n; m \<in> nat; n \<in> nat|] ==> eps(DD,ee,m,n) = e_less(DD,ee,m,n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1559
by (simp add: eps_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1560
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1561
lemma eps_e_gr_add:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1562
    "[|n \<in> nat; k \<in> nat|] ==> eps(DD,ee,n#+k,n) = e_gr(DD,ee,n#+k,n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1563
by (simp add: eps_def e_less_eq e_gr_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1564
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1565
lemma eps_e_gr:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1566
    "[|n le m; m \<in> nat; n \<in> nat|] ==> eps(DD,ee,m,n) = e_gr(DD,ee,m,n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1567
apply (erule le_exists)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1568
apply (simp_all add: eps_e_gr_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1569
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1570
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1571
lemma eps_succ_ee:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1572
    "[|!!n. n \<in> nat ==> emb(DD`n,DD`succ(n),ee`n); m \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1573
     ==> eps(DD,ee,m,succ(m)) = ee`m"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1574
by (simp add: eps_e_less le_succ_iff e_less_succ_emb)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1575
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1576
lemma eps_succ_Rp:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1577
    "[|emb_chain(DD,ee); m \<in> nat|]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1578
     ==> eps(DD,ee,succ(m),m) = Rp(DD`m,DD`succ(m),ee`m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1579
by (simp add: eps_e_gr le_succ_iff e_gr_succ_emb)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1580
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1581
lemma eps_cont:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1582
  "[|emb_chain(DD,ee); m \<in> nat; n \<in> nat|] ==> eps(DD,ee,m,n): cont(DD`m,DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1583
apply (rule_tac i = m and j = n in nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1584
apply (simp_all add: eps_e_less e_less_cont eps_e_gr e_gr_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1585
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1586
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1587
(* Theorems about splitting. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1588
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1589
lemma eps_split_add_left:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1590
    "[|n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1591
     eps(DD,ee,m,m#+k) = eps(DD,ee,m#+n,m#+k) O eps(DD,ee,m,m#+n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1592
apply (simp add: eps_e_less add_le_self add_le_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1593
apply (auto intro: e_less_split_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1594
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1595
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1596
lemma eps_split_add_left_rev:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1597
    "[|n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1598
     eps(DD,ee,m,m#+n) = eps(DD,ee,m#+k,m#+n) O eps(DD,ee,m,m#+k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1599
apply (simp add: eps_e_less_add eps_e_gr add_le_self add_le_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1600
apply (auto intro: e_less_e_gr_split_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1601
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1602
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1603
lemma eps_split_add_right:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1604
    "[|m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1605
     eps(DD,ee,n#+k,n) = eps(DD,ee,n#+m,n) O eps(DD,ee,n#+k,n#+m)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1606
apply (simp add: eps_e_gr add_le_self add_le_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1607
apply (auto intro: e_gr_split_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1608
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1609
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1610
lemma eps_split_add_right_rev:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1611
    "[|m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1612
     eps(DD,ee,n#+m,n) = eps(DD,ee,n#+k,n) O eps(DD,ee,n#+m,n#+k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1613
apply (simp add: eps_e_gr_add eps_e_less add_le_self add_le_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1614
apply (auto intro: e_gr_e_less_split_add)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1615
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1616
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1617
(* Arithmetic *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1618
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1619
lemma le_exists_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1620
    "[| n le k; k le m;
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1621
        !!p q. [|p le q; k=n#+p; m=n#+q; p \<in> nat; q \<in> nat|] ==> R;
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1622
        m \<in> nat |]==>R"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1623
apply (rule le_exists, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1624
prefer 2 apply (simp add: lt_nat_in_nat)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1625
apply (rule le_trans [THEN le_exists], assumption+, auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1626
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1627
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1628
lemma eps_split_left_le:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1629
    "[|m le k; k le n; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1630
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1631
apply (rule le_exists_lemma, assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1632
apply (auto intro: eps_split_add_left)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1633
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1634
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1635
lemma eps_split_left_le_rev:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1636
    "[|m le n; n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1637
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1638
apply (rule le_exists_lemma, assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1639
apply (auto intro: eps_split_add_left_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1640
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1641
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1642
lemma eps_split_right_le:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1643
    "[|n le k; k le m; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1644
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1645
apply (rule le_exists_lemma, assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1646
apply (auto intro: eps_split_add_right)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1647
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1648
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1649
lemma eps_split_right_le_rev:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1650
    "[|n le m; m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1651
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1652
apply (rule le_exists_lemma, assumption+)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1653
apply (auto intro: eps_split_add_right_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1654
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1655
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1656
(* The desired two theorems about `splitting'. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1657
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1658
lemma eps_split_left:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1659
    "[|m le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1660
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1661
apply (rule nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1662
apply (rule_tac [4] eps_split_right_le_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1663
prefer 4 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1664
apply (rule_tac [3] nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1665
apply (rule_tac [5] eps_split_left_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1666
prefer 6 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1667
apply (simp_all add: eps_split_left_le_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1668
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1669
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1670
lemma eps_split_right:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1671
    "[|n le k; emb_chain(DD,ee); m \<in> nat; n \<in> nat; k \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1672
     eps(DD,ee,m,n) = eps(DD,ee,k,n) O eps(DD,ee,m,k)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1673
apply (rule nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1674
apply (rule_tac [3] eps_split_left_le_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1675
prefer 3 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1676
apply (rule_tac [8] nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1677
apply (rule_tac [10] eps_split_right_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1678
prefer 11 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1679
apply (simp_all add: eps_split_right_le_rev)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1680
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1681
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1682
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1683
(* That was eps: D_m -> D_n, NEXT rho_emb: D_n -> Dinf.                 *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1684
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1685
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1686
(* Considerably shorter. *)
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
  1687
13085
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1688
lemma rho_emb_fun:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1689
    "[|emb_chain(DD,ee); n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1690
     rho_emb(DD,ee,n): set(DD`n) -> set(Dinf(DD,ee))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1691
apply (simp add: rho_emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1692
apply (assumption | rule lam_type DinfI eps_cont [THEN cont_fun, THEN apply_type])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1693
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1694
apply (rule_tac i = "succ (na) " and j = n in nat_linear_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1695
apply blast
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1696
apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1697
apply (subst eps_split_right_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1698
prefer 2 apply assumption
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1699
apply simp (*????SIMPROC FAILURE???*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1700
apply (rule lt_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1701
apply (rule le_refl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1702
apply (blast intro: nat_into_Ord, simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1703
  (*???END OF SIMPROC FAILURE*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1704
apply (assumption | rule add_le_self nat_0I nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1705
apply (simp add: eps_succ_Rp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1706
apply (subst comp_fun_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1707
apply (assumption | rule eps_fun nat_succI Rp_cont [THEN cont_fun] emb_chain_emb emb_chain_cpo refl)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1708
(* Now the second part of the proof. Slightly different than HOL. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1709
apply (simp add: eps_e_less nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1710
apply (erule le_iff [THEN iffD1, THEN disjE])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1711
apply (simp add: e_less_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1712
apply (subst comp_fun_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1713
apply (assumption | rule e_less_cont cont_fun emb_chain_emb emb_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1714
apply (subst embRp_eq_thm)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1715
apply (assumption | rule emb_chain_emb e_less_cont [THEN cont_fun, THEN apply_type] emb_chain_cpo nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1716
apply (simp add: eps_e_less)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1717
apply (drule asm_rl)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1718
apply (simp add: eps_succ_Rp e_less_eq id_conv nat_succI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1719
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1720
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1721
lemma rho_emb_apply1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1722
    "x \<in> set(DD`n) ==> rho_emb(DD,ee,n)`x = (\<lambda>m \<in> nat. eps(DD,ee,n,m)`x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1723
by (simp add: rho_emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1724
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1725
lemma rho_emb_apply2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1726
    "[|x \<in> set(DD`n); m \<in> nat|] ==> rho_emb(DD,ee,n)`x`m = eps(DD,ee,n,m)`x"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1727
by (simp add: rho_emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1728
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1729
lemma rho_emb_id: "[| x \<in> set(DD`n); n \<in> nat|] ==> rho_emb(DD,ee,n)`x`n = x"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1730
apply (simp add: rho_emb_apply2 eps_id)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1731
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1732
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1733
(* Shorter proof, 23 against 62. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1734
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1735
lemma rho_emb_cont:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1736
    "[|emb_chain(DD,ee); n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1737
     rho_emb(DD,ee,n): cont(DD`n,Dinf(DD,ee))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1738
apply (rule contI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1739
apply (assumption | rule rho_emb_fun)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1740
apply (rule rel_DinfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1741
apply (simp add: rho_emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1742
apply (assumption | rule eps_cont [THEN cont_mono]  Dinf_prod apply_type rho_emb_fun)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1743
(* Continuity, different order, slightly different proofs. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1744
apply (subst lub_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1745
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1746
apply (assumption | rule lam_type rho_emb_fun [THEN apply_type]  chain_in)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1747
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1748
apply (rule rel_DinfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1749
apply (simp add: rho_emb_apply2 chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1750
apply (assumption | rule eps_cont [THEN cont_mono]  chain_rel Dinf_prod rho_emb_fun [THEN apply_type]  chain_in nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1751
(* Now, back to the result of applying lub_Dinf *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1752
apply (simp add: rho_emb_apply2 chain_in)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1753
apply (subst rho_emb_apply1)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1754
apply (assumption | rule cpo_lub [THEN islub_in]  emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1755
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1756
apply (assumption | rule lam_type eps_cont [THEN cont_fun, THEN apply_type]  cpo_lub [THEN islub_in]  emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1757
apply (assumption | rule cont_chain eps_cont emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1758
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1759
apply (simp add: eps_cont [THEN cont_lub])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1760
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1761
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1762
(* 32 vs 61, using safe_tac with imp in asm would be unfortunate (5steps) *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1763
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1764
lemma lemma1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1765
    "[|m le n; emb_chain(DD,ee); x \<in> set(Dinf(DD,ee)); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1766
     rel(DD`n,e_less(DD,ee,m,n)`(x`m),x`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1767
apply (erule rev_mp) (* For induction proof *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1768
apply (induct_tac n)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1769
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1770
apply (simp add: e_less_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1771
apply (subst id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1772
apply (assumption | rule apply_type Dinf_prod cpo_refl emb_chain_cpo nat_0I)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1773
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1774
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1775
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1776
apply (drule mp, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1777
apply (rule cpo_trans)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1778
apply (rule_tac [2] e_less_le [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1779
apply (assumption | rule emb_chain_cpo nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1780
apply (subst comp_fun_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1781
apply (assumption | rule emb_chain_emb [THEN emb_cont]  e_less_cont cont_fun apply_type Dinf_prod)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1782
apply (rule_tac y = "x`xa" in emb_chain_emb [THEN emb_cont, THEN cont_mono])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1783
apply (assumption | rule e_less_cont [THEN cont_fun]  apply_type Dinf_prod)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1784
apply (rule_tac x1 = x and n1 = xa in Dinf_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1785
apply (rule_tac [3] comp_fun_apply [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1786
apply (rule_tac [6] P = "%z. rel (DD ` succ (xa), (ee ` xa O Rp (?DD46 (xa) ` xa,?DD46 (xa) ` succ (xa),?ee46 (xa) ` xa)) ` (x ` succ (xa)),z) " in id_conv [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1787
apply (rule_tac [7] rel_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1788
(* Dinf and cont_fun doesn't go well together, both Pi(_,%x._). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1789
(* solves 11 of 12 subgoals *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1790
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1791
       rule Dinf_prod [THEN apply_type] cont_fun Rp_cont e_less_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1792
            emb_cont emb_chain_emb emb_chain_cpo apply_type embRp_rel
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1793
            disjI1 [THEN le_succ_iff [THEN iffD2]]  nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1794
apply (simp add: e_less_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1795
apply (subst id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1796
apply (auto intro: apply_type Dinf_prod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1797
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1798
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1799
(* 18 vs 40 *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1800
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1801
lemma lemma2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1802
    "[|n le m; emb_chain(DD,ee); x \<in> set(Dinf(DD,ee)); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1803
     rel(DD`n,e_gr(DD,ee,m,n)`(x`m),x`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1804
apply (erule rev_mp) (* For induction proof *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1805
apply (induct_tac m)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1806
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1807
apply (simp add: e_gr_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1808
apply (subst id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1809
apply (assumption | rule apply_type Dinf_prod cpo_refl emb_chain_cpo nat_0I)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1810
apply (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1811
apply (rule impI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1812
apply (erule disjE)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1813
apply (drule mp, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1814
apply (subst e_gr_le)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1815
apply (rule_tac [4] comp_fun_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1816
apply (rule_tac [7] Dinf_eq [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1817
apply (assumption | rule emb_chain_emb emb_chain_cpo Rp_cont e_gr_cont cont_fun emb_cont apply_type Dinf_prod nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1818
apply (simp add: e_gr_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1819
apply (subst id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1820
apply (auto intro: apply_type Dinf_prod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1821
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1822
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1823
lemma eps1:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1824
    "[|emb_chain(DD,ee); x \<in> set(Dinf(DD,ee)); m \<in> nat; n \<in> nat|] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1825
     rel(DD`n,eps(DD,ee,m,n)`(x`m),x`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1826
apply (simp add: eps_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1827
apply (blast intro: lemma1 not_le_iff_lt [THEN iffD1, THEN leI, THEN lemma2]  
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1828
                    nat_into_Ord)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1829
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1830
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1831
(* The following theorem is needed/useful due to type check for rel_cfI,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1832
   but also elsewhere.
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1833
   Look for occurences of rel_cfI, rel_DinfI, etc to evaluate the problem. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1834
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1835
lemma lam_Dinf_cont:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1836
  "[| emb_chain(DD,ee); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1837
   (\<lambda>x \<in> set(Dinf(DD,ee)). x`n) \<in> cont(Dinf(DD,ee),DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1838
apply (rule contI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1839
apply (assumption | rule lam_type apply_type Dinf_prod)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1840
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1841
apply (assumption | rule rel_Dinf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1842
apply (subst beta)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1843
apply (auto intro: cpo_Dinf islub_in cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1844
apply (simp add: chain_in lub_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1845
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1846
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1847
lemma rho_projpair:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1848
    "[| emb_chain(DD,ee); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1849
     projpair(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n),rho_proj(DD,ee,n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1850
apply (simp add: rho_proj_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1851
apply (rule projpairI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1852
apply (assumption | rule rho_emb_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1853
(* lemma used, introduced because same fact needed below due to rel_cfI. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1854
apply (assumption | rule lam_Dinf_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1855
(*-----------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1856
(* This part is 7 lines, but 30 in HOL (75% reduction!) *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1857
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1858
apply (rule_tac [3] id_conv [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1859
apply (rule_tac [4] comp_fun_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1860
apply (rule_tac [7] beta [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1861
apply (rule_tac [8] rho_emb_id [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1862
apply (assumption | rule comp_fun id_type lam_type rho_emb_fun Dinf_prod [THEN apply_type]  apply_type refl)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1863
(*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1864
apply (rule rel_cfI) (* ------------------>>>Yields type cond, not in HOL *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1865
apply (subst id_conv)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1866
apply (rule_tac [2] comp_fun_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1867
apply (rule_tac [5] beta [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1868
apply (rule_tac [6] rho_emb_apply1 [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1869
apply (rule_tac [7] rel_DinfI) (* ------------------>>>Yields type cond, not in HOL *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1870
apply (rule_tac [7] beta [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1871
(* Dinf_prod bad with lam_type *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1872
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1873
       rule eps1 lam_type rho_emb_fun eps_fun
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1874
            Dinf_prod [THEN apply_type] refl)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1875
apply (assumption | rule apply_type eps_fun Dinf_prod comp_pres_cont rho_emb_cont lam_Dinf_cont id_cont cpo_Dinf emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1876
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1877
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1878
lemma emb_rho_emb:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1879
  "[| emb_chain(DD,ee); n \<in> nat |] ==> emb(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1880
by (auto simp add: emb_def intro: exI rho_projpair)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1881
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1882
lemma commuteI: "[| emb_chain(DD,ee); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1883
   rho_proj(DD,ee,n) \<in> cont(Dinf(DD,ee),DD`n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1884
by (auto intro: rho_projpair projpair_p_cont)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1885
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1886
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1887
(* Commutivity and universality.                                        *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1888
(*----------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1889
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1890
lemma commuteI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1891
  "[| !!n. n \<in> nat ==> emb(DD`n,E,r(n));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1892
      !!m n. [|m le n; m \<in> nat; n \<in> nat|] ==> r(n) O eps(DD,ee,m,n) = r(m) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1893
   commute(DD,ee,E,r)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1894
by (simp add: commute_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1895
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1896
lemma commute_emb [TC]:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1897
  "[| commute(DD,ee,E,r); n \<in> nat |] ==> emb(DD`n,E,r(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1898
by (simp add: commute_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1899
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1900
lemma commute_eq:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1901
  "[| commute(DD,ee,E,r); m le n; m \<in> nat; n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1902
   r(n) O eps(DD,ee,m,n) = r(m) "
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1903
by (simp add: commute_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1904
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1905
(* Shorter proof: 11 vs 46 lines. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1906
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1907
lemma rho_emb_commute:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1908
  "emb_chain(DD,ee) ==> commute(DD,ee,Dinf(DD,ee),rho_emb(DD,ee))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1909
apply (rule commuteI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1910
apply (assumption | rule emb_rho_emb)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1911
apply (rule fun_extension) (* Manual instantiation in HOL. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1912
apply (rule_tac [3] comp_fun_apply [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1913
apply (rule_tac [6] fun_extension) (* Next, clean up and instantiate unknowns *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1914
apply (assumption | rule comp_fun rho_emb_fun eps_fun Dinf_prod apply_type)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1915
apply (simp add: rho_emb_apply2 eps_fun [THEN apply_type])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1916
apply (rule comp_fun_apply [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1917
apply (rule_tac [4] eps_split_left [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1918
apply (auto intro: eps_fun)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1919
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1920
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1921
lemma le_succ: "n \<in> nat ==> n le succ(n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1922
by (simp add: le_succ_iff)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1923
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1924
(* Shorter proof: 21 vs 83 (106 - 23, due to OAssoc complication) *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1925
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1926
lemma commute_chain:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1927
  "[| commute(DD,ee,E,r); emb_chain(DD,ee); cpo(E) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1928
   chain(cf(E,E),\<lambda>n \<in> nat. r(n) O Rp(DD`n,E,r(n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1929
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1930
apply (blast intro: lam_type cont_cf comp_pres_cont commute_emb Rp_cont emb_cont emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1931
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1932
apply (rule_tac r1 = r and m1 = n in commute_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1933
apply (assumption | rule le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1934
apply (subst Rp_comp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1935
apply (assumption | rule emb_eps commute_emb emb_chain_cpo le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1936
apply (rule comp_assoc [THEN subst]) (* Remember that comp_assoc is simpler in Isa *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1937
apply (rule_tac r1 = "r (succ (n))" in comp_assoc [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1938
apply (rule comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1939
apply (blast intro: comp_pres_cont eps_cont emb_eps commute_emb Rp_cont emb_cont emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1940
apply (rule_tac b = "r (succ (n))" in comp_id [THEN subst]) (* 1 subst too much *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1941
apply (rule_tac [2] comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1942
apply (blast intro: comp_pres_cont eps_cont emb_eps emb_id commute_emb Rp_cont emb_cont cont_fun emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1943
apply (subst comp_id) (* Undoes "1 subst too much", typing next anyway *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1944
apply (blast intro: cont_fun Rp_cont emb_cont commute_emb cont_cf cpo_cf emb_chain_cpo embRp_rel emb_eps le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1945
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1946
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1947
lemma rho_emb_chain:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1948
  "emb_chain(DD,ee) ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1949
   chain(cf(Dinf(DD,ee),Dinf(DD,ee)),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1950
         \<lambda>n \<in> nat. rho_emb(DD,ee,n) O Rp(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1951
by (auto intro: commute_chain rho_emb_commute cpo_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1952
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1953
lemma rho_emb_chain_apply1: "[| emb_chain(DD,ee); x \<in> set(Dinf(DD,ee)) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1954
      chain(Dinf(DD,ee),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1955
          \<lambda>n \<in> nat.
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1956
           (rho_emb(DD,ee,n) O Rp(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n)))`x)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1957
apply (drule rho_emb_chain [THEN chain_cf], assumption, simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1958
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1959
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1960
lemma chain_iprod_emb_chain:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1961
     "[| chain(iprod(DD),X); emb_chain(DD,ee); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1962
      chain(DD`n,\<lambda>m \<in> nat. X `m `n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1963
by (auto intro: chain_iprod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1964
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1965
lemma rho_emb_chain_apply2:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1966
  "[| emb_chain(DD,ee); x \<in> set(Dinf(DD,ee)); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1967
   chain
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1968
    (DD`n,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1969
     \<lambda>xa \<in> nat.
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1970
      (rho_emb(DD, ee, xa) O Rp(DD ` xa, Dinf(DD, ee),rho_emb(DD, ee, xa))) `
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1971
       x ` n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1972
by (frule rho_emb_chain_apply1 [THEN chain_Dinf, THEN chain_iprod_emb_chain], 
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1973
    auto)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1974
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1975
(* Shorter proof: 32 vs 72 (roughly), Isabelle proof has lemmas. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1976
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1977
lemma rho_emb_lub:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1978
  "emb_chain(DD,ee) ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1979
   lub(cf(Dinf(DD,ee),Dinf(DD,ee)),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1980
       \<lambda>n \<in> nat. rho_emb(DD,ee,n) O Rp(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n))) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1981
   id(set(Dinf(DD,ee)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1982
apply (rule cpo_antisym)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1983
apply (rule cpo_cf) (* Instantiate variable, continued below (would loop otherwise) *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1984
apply (assumption | rule cpo_Dinf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1985
apply (rule islub_least)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1986
apply (assumption | rule cpo_lub rho_emb_chain cpo_cf cpo_Dinf isubI cont_cf id_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1987
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1988
apply (assumption | rule embRp_rel emb_rho_emb emb_chain_cpo cpo_Dinf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1989
apply (rule rel_cfI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1990
apply (simp add: lub_cf rho_emb_chain cpo_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1991
apply (rule rel_DinfI) (* Additional assumptions *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1992
apply (subst lub_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1993
apply (assumption | rule rho_emb_chain_apply1)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1994
defer 1
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1995
apply (assumption | rule Dinf_prod cpo_lub [THEN islub_in]  id_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1996
                     cpo_Dinf cpo_cf cf_cont rho_emb_chain rho_emb_chain_apply1 id_cont [THEN cont_cf])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1997
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1998
apply (rule dominate_islub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  1999
apply (rule_tac [3] cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2000
apply (rule_tac [6] x1 = "x`n" in chain_const [THEN chain_fun])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2001
defer 1
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2002
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2003
       rule rho_emb_chain_apply2 emb_chain_cpo islub_const apply_type Dinf_prod emb_chain_cpo chain_fun rho_emb_chain_apply2)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2004
apply (rule dominateI, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2005
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2006
apply (subst comp_fun_apply)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2007
apply (assumption | rule cont_fun Rp_cont emb_cont emb_rho_emb cpo_Dinf emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2008
apply (subst rho_projpair [THEN Rp_unique])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2009
prefer 5
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2010
apply (simp add: rho_proj_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2011
apply (rule rho_emb_id [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2012
apply (auto intro: cpo_Dinf apply_type Dinf_prod emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2013
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2014
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2015
lemma theta_chain: (* almost same proof as commute_chain *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2016
  "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2017
      emb_chain(DD,ee); cpo(E); cpo(G) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2018
   chain(cf(E,G),\<lambda>n \<in> nat. f(n) O Rp(DD`n,E,r(n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2019
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2020
apply (blast intro: lam_type cont_cf comp_pres_cont commute_emb Rp_cont emb_cont emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2021
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2022
apply (rule_tac r1 = r and m1 = n in commute_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2023
apply (rule_tac [5] r1 = f and m1 = n in commute_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2024
apply (assumption | rule le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2025
apply (subst Rp_comp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2026
apply (assumption | rule emb_eps commute_emb emb_chain_cpo le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2027
apply (rule comp_assoc [THEN subst]) (* Remember that comp_assoc is simpler in Isa *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2028
apply (rule_tac r1 = "f (succ (n))" in comp_assoc [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2029
apply (rule comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2030
apply (blast intro: comp_pres_cont eps_cont emb_eps commute_emb Rp_cont emb_cont emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2031
apply (rule_tac b = "f (succ (n))" in comp_id [THEN subst]) (* 1 subst too much *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2032
apply (rule_tac [2] comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2033
apply (blast intro: comp_pres_cont eps_cont emb_eps emb_id commute_emb Rp_cont emb_cont cont_fun emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2034
apply (subst comp_id) (* Undoes "1 subst too much", typing next anyway *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2035
apply (blast intro: cont_fun Rp_cont emb_cont commute_emb cont_cf cpo_cf emb_chain_cpo embRp_rel emb_eps le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2036
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2037
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2038
lemma theta_proj_chain: (* similar proof to theta_chain *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2039
  "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2040
      emb_chain(DD,ee); cpo(E); cpo(G) |]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2041
   ==> chain(cf(G,E),\<lambda>n \<in> nat. r(n) O Rp(DD`n,G,f(n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2042
apply (rule chainI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2043
apply (blast intro: lam_type cont_cf comp_pres_cont commute_emb Rp_cont emb_cont emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2044
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2045
apply (rule_tac r1 = r and m1 = n in commute_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2046
apply (rule_tac [5] r1 = f and m1 = n in commute_eq [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2047
apply (assumption | rule le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2048
apply (subst Rp_comp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2049
apply (assumption | rule emb_eps commute_emb emb_chain_cpo le_succ nat_succI)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2050
apply (rule comp_assoc [THEN subst]) (* Remember that comp_assoc is simpler in Isa *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2051
apply (rule_tac r1 = "r (succ (n))" in comp_assoc [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2052
apply (rule comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2053
apply (blast intro: comp_pres_cont eps_cont emb_eps commute_emb Rp_cont emb_cont emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2054
apply (rule_tac b = "r (succ (n))" in comp_id [THEN subst]) (* 1 subst too much *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2055
apply (rule_tac [2] comp_mono)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2056
apply (blast intro: comp_pres_cont eps_cont emb_eps emb_id commute_emb Rp_cont emb_cont cont_fun emb_chain_cpo le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2057
apply (subst comp_id) (* Undoes "1 subst too much", typing next anyway *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2058
apply (blast intro: cont_fun Rp_cont emb_cont commute_emb cont_cf cpo_cf emb_chain_cpo embRp_rel emb_eps le_succ)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2059
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2060
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2061
(* Simplification with comp_assoc is possible inside a \<lambda>-abstraction,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2062
   because it does not have assumptions. If it had, as the HOL-ST theorem
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2063
   too strongly has, we would be in deep trouble due to HOL's lack of proper
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2064
   conditional rewriting (a HOL contrib provides something that works). *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2065
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2066
(* Controlled simplification inside lambda: introduce lemmas *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2067
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2068
lemma commute_O_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2069
     "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2070
      emb_chain(DD,ee); cpo(E); cpo(G); x \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2071
   r(x) O Rp(DD ` x, G, f(x)) O f(x) O Rp(DD ` x, E, r(x)) =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2072
   r(x) O Rp(DD ` x, E, r(x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2073
apply (rule_tac s1 = "f (x) " in comp_assoc [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2074
apply (subst embRp_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2075
apply (rule_tac [4] id_comp [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2076
apply (auto intro: cont_fun Rp_cont commute_emb emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2077
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2078
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2079
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2080
(* Shorter proof (but lemmas): 19 vs 79 (103 - 24, due to OAssoc)  *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2081
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2082
lemma theta_projpair:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2083
  "[| lub(cf(E,E), \<lambda>n \<in> nat. r(n) O Rp(DD`n,E,r(n))) = id(set(E));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2084
      commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2085
      emb_chain(DD,ee); cpo(E); cpo(G) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2086
   projpair
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2087
    (E,G,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2088
     lub(cf(E,G), \<lambda>n \<in> nat. f(n) O Rp(DD`n,E,r(n))),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2089
     lub(cf(G,E), \<lambda>n \<in> nat. r(n) O Rp(DD`n,G,f(n))))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2090
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2091
apply (simp add: projpair_def rho_proj_def, safe)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2092
apply (rule_tac [3] comp_lubs [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2093
(* The following one line is 15 lines in HOL, and includes existentials. *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2094
apply (assumption | rule cf_cont islub_in cpo_lub cpo_cf theta_chain theta_proj_chain)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2095
apply (simp (no_asm) add: comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2096
apply (simp add: commute_O_lemma)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2097
apply (subst comp_lubs)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2098
apply (assumption | rule cf_cont islub_in cpo_lub cpo_cf theta_chain theta_proj_chain)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2099
apply (simp (no_asm) add: comp_assoc)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2100
apply (simp add: commute_O_lemma)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2101
apply (rule dominate_islub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2102
defer 1
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2103
apply (rule cpo_lub)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2104
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2105
       rule commute_chain commute_emb islub_const cont_cf id_cont
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2106
    cpo_cf chain_fun chain_const)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2107
apply (rule dominateI, assumption)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2108
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2109
apply (blast intro: embRp_rel commute_emb emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2110
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2111
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2112
lemma emb_theta:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2113
  "[| lub(cf(E,E), \<lambda>n \<in> nat. r(n) O Rp(DD`n,E,r(n))) = id(set(E));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2114
      commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2115
      emb_chain(DD,ee); cpo(E); cpo(G) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2116
   emb(E,G,lub(cf(E,G), \<lambda>n \<in> nat. f(n) O Rp(DD`n,E,r(n))))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2117
apply (simp add: emb_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2118
apply (blast intro: theta_projpair)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2119
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2120
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2121
lemma mono_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2122
  "[| g \<in> cont(D,D'); cpo(D); cpo(D'); cpo(E) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2123
   (\<lambda>f \<in> cont(D',E). f O g) \<in> mono(cf(D',E),cf(D,E))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2124
apply (rule monoI)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2125
apply (simp add: set_def cf_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2126
apply (drule cf_cont)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2127
apply simp
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2128
apply (blast intro: comp_mono lam_type comp_pres_cont cpo_cf cont_cf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2129
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2130
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2131
lemma commute_lam_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2132
     "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2133
         emb_chain(DD,ee); cpo(E); cpo(G); n \<in> nat |]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2134
      ==> (\<lambda>na \<in> nat. (\<lambda>f \<in> cont(E, G). f O r(n)) `
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2135
           ((\<lambda>n \<in> nat. f(n) O Rp(DD ` n, E, r(n))) ` na))  =
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2136
          (\<lambda>na \<in> nat. (f(na) O Rp(DD ` na, E, r(na))) O r(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2137
apply (rule fun_extension)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2138
apply (auto intro: lam_type)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2139
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2140
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2141
lemma chain_lemma: "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2142
         emb_chain(DD,ee); cpo(E); cpo(G); n \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2143
      chain(cf(DD`n,G),\<lambda>x \<in> nat. (f(x) O Rp(DD ` x, E, r(x))) O r(n))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2144
apply (rule commute_lam_lemma [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2145
apply (blast intro: theta_chain emb_chain_cpo commute_emb [THEN emb_cont, THEN mono_lemma, THEN mono_chain])+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2146
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2147
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2148
lemma suffix_lemma:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2149
  "[| commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2150
      emb_chain(DD,ee); cpo(E); cpo(G); cpo(DD`x); x \<in> nat |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2151
   suffix(\<lambda>n \<in> nat. (f(n) O Rp(DD`n,E,r(n))) O r(x),x) = (\<lambda>n \<in> nat. f(x))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2152
apply (simp add: suffix_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2153
apply (rule lam_type [THEN fun_extension])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2154
apply (blast intro: lam_type comp_fun cont_fun Rp_cont emb_cont commute_emb add_type emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2155
apply (simp)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2156
apply (subgoal_tac "f (x #+ xa) O (Rp (DD ` (x #+ xa), E, r (x #+ xa)) O r (x #+ xa)) O eps (DD, ee, x, x #+ xa) = f (x) ")
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2157
apply (simp add: comp_assoc commute_eq add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2158
apply (simp add: embRp_eq eps_fun [THEN id_comp] commute_emb emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2159
apply (blast intro: commute_eq add_type add_le_self)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2160
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2161
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2162
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2163
lemma mediatingI:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2164
  "[|emb(E,G,t);  !!n. n \<in> nat ==> f(n) = t O r(n) |]==>mediating(E,G,r,f,t)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2165
by (simp add: mediating_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2166
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2167
lemma mediating_emb: "mediating(E,G,r,f,t) ==> emb(E,G,t)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2168
by (simp add: mediating_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2169
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2170
lemma mediating_eq: "[| mediating(E,G,r,f,t); n \<in> nat |] ==> f(n) = t O r(n)"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2171
by (simp add: mediating_def)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2172
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2173
lemma lub_universal_mediating:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2174
  "[| lub(cf(E,E), \<lambda>n \<in> nat. r(n) O Rp(DD`n,E,r(n))) = id(set(E));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2175
      commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2176
      emb_chain(DD,ee); cpo(E); cpo(G) |]
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2177
   ==> mediating(E,G,r,f,lub(cf(E,G), \<lambda>n \<in> nat. f(n) O Rp(DD`n,E,r(n))))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2178
apply (assumption | rule mediatingI emb_theta)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2179
apply (rule_tac b = "r (n) " in lub_const [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2180
apply (rule_tac [3] comp_lubs [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2181
apply (blast intro: cont_cf emb_cont commute_emb cpo_cf theta_chain chain_const emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2182
apply (simp (no_asm))
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2183
apply (rule_tac n1 = n in lub_suffix [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2184
apply (assumption | rule chain_lemma cpo_cf emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2185
apply (simp add: suffix_lemma lub_const cont_cf emb_cont commute_emb cpo_cf emb_chain_cpo)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2186
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2187
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2188
lemma lub_universal_unique:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2189
  "[| mediating(E,G,r,f,t);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2190
      lub(cf(E,E), \<lambda>n \<in> nat. r(n) O Rp(DD`n,E,r(n))) = id(set(E));
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2191
      commute(DD,ee,E,r); commute(DD,ee,G,f);
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2192
      emb_chain(DD,ee); cpo(E); cpo(G) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2193
   t = lub(cf(E,G), \<lambda>n \<in> nat. f(n) O Rp(DD`n,E,r(n)))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2194
apply (rule_tac b = t in comp_id [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2195
apply (erule_tac [2] subst)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2196
apply (rule_tac [2] b = t in lub_const [THEN subst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2197
apply (rule_tac [4] comp_lubs [THEN ssubst])
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2198
prefer 9 apply (simp add: comp_assoc mediating_eq)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2199
apply (assumption |
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2200
       rule cont_fun emb_cont mediating_emb cont_cf cpo_cf chain_const
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2201
            commute_chain emb_chain_cpo)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2202
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2203
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2204
(*---------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2205
(* Dinf yields the inverse_limit, stated as rho_emb_commute and        *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2206
(* Dinf_universal.                                                     *)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2207
(*---------------------------------------------------------------------*)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2208
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2209
lemma Dinf_universal:
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2210
  "[| commute(DD,ee,G,f); emb_chain(DD,ee); cpo(G) |] ==>
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2211
   mediating
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2212
    (Dinf(DD,ee),G,rho_emb(DD,ee),f,
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2213
     lub(cf(Dinf(DD,ee),G),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2214
         \<lambda>n \<in> nat. f(n) O Rp(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n)))) &
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2215
   (\<forall>t. mediating(Dinf(DD,ee),G,rho_emb(DD,ee),f,t) -->
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2216
     t = lub(cf(Dinf(DD,ee),G),
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2217
         \<lambda>n \<in> nat. f(n) O Rp(DD`n,Dinf(DD,ee),rho_emb(DD,ee,n))))"
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2218
apply safe
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2219
apply (assumption | rule lub_universal_mediating rho_emb_commute rho_emb_lub cpo_Dinf)+
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2220
apply (auto intro: lub_universal_unique rho_emb_commute rho_emb_lub cpo_Dinf)
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2221
done
bfdb0534c8ec converted theory ex/Limit to Isar script, but it still needs work!
paulson
parents: 11316
diff changeset
  2222
1281
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
  2223
68f6be60ab1c The inverse limit construction -- thanks to Sten Agerholm
paulson
parents:
diff changeset
  2224
end