src/HOLCF/stream.thy
changeset 243 c22b85994e17
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOLCF/stream.thy	Wed Jan 19 17:35:01 1994 +0100
     1.3 @@ -0,0 +1,102 @@
     1.4 +(*  Title: 	HOLCF/stream.thy
     1.5 +    ID:         $Id$
     1.6 +    Author: 	Franz Regensburger
     1.7 +    Copyright   1993 Technische Universitaet Muenchen
     1.8 +
     1.9 +Theory for streams without defined empty stream
    1.10 +*)
    1.11 +
    1.12 +Stream = Dnat2 +
    1.13 +
    1.14 +types stream 1
    1.15 +
    1.16 +(* ----------------------------------------------------------------------- *)
    1.17 +(* arity axiom is validated by semantic reasoning                          *)
    1.18 +(* partial ordering is implicit in the isomorphism axioms and their cont.  *)
    1.19 +
    1.20 +arities stream::(pcpo)pcpo
    1.21 +
    1.22 +consts
    1.23 +
    1.24 +(* ----------------------------------------------------------------------- *)
    1.25 +(* essential constants                                                     *)
    1.26 +
    1.27 +stream_rep	:: "('a stream) -> ('a ** ('a stream)u)"
    1.28 +stream_abs	:: "('a ** ('a stream)u) -> ('a stream)"
    1.29 +
    1.30 +(* ----------------------------------------------------------------------- *)
    1.31 +(* abstract constants and auxiliary constants                              *)
    1.32 +
    1.33 +stream_copy	:: "('a stream -> 'a stream) ->'a stream -> 'a stream"
    1.34 +
    1.35 +scons		:: "'a -> 'a stream -> 'a stream"
    1.36 +stream_when	:: "('a -> 'a stream -> 'b) -> 'a stream -> 'b"
    1.37 +is_scons	:: "'a stream -> tr"
    1.38 +shd		:: "'a stream -> 'a"
    1.39 +stl		:: "'a stream -> 'a stream"
    1.40 +stream_take	:: "nat => 'a stream -> 'a stream"
    1.41 +stream_finite	:: "'a stream => bool"
    1.42 +stream_bisim	:: "('a stream => 'a stream => bool) => bool"
    1.43 +
    1.44 +rules
    1.45 +
    1.46 +(* ----------------------------------------------------------------------- *)
    1.47 +(* axiomatization of recursive type 'a stream                              *)
    1.48 +(* ----------------------------------------------------------------------- *)
    1.49 +(* ('a stream,stream_abs) is the initial F-algebra where                   *)
    1.50 +(* F is the locally continuous functor determined by domain equation       *)
    1.51 +(* X = 'a ** (X)u                                                          *)
    1.52 +(* ----------------------------------------------------------------------- *)
    1.53 +(* stream_abs is an isomorphism with inverse stream_rep                    *)
    1.54 +(* identity is the least endomorphism on 'a stream                         *)
    1.55 +
    1.56 +stream_abs_iso	"stream_rep[stream_abs[x]] = x"
    1.57 +stream_rep_iso	"stream_abs[stream_rep[x]] = x"
    1.58 +stream_copy_def	"stream_copy == (LAM f. stream_abs oo \
    1.59 +\ 		(ssplit[LAM x y. x ## (lift[up oo f])[y]] oo stream_rep))"
    1.60 +stream_reach	"(fix[stream_copy])[x]=x"
    1.61 +
    1.62 +(* ----------------------------------------------------------------------- *)
    1.63 +(* properties of additional constants                                      *)
    1.64 +(* ----------------------------------------------------------------------- *)
    1.65 +(* constructors                                                            *)
    1.66 +
    1.67 +scons_def	"scons == (LAM x l. stream_abs[x##up[l]])"
    1.68 +
    1.69 +(* ----------------------------------------------------------------------- *)
    1.70 +(* discriminator functional                                                *)
    1.71 +
    1.72 +stream_when_def 
    1.73 +"stream_when == (LAM f l.ssplit[LAM x l.f[x][lift[ID][l]]][stream_rep[l]])"
    1.74 +
    1.75 +(* ----------------------------------------------------------------------- *)
    1.76 +(* discriminators and selectors                                            *)
    1.77 +
    1.78 +is_scons_def	"is_scons == stream_when[LAM x l.TT]"
    1.79 +shd_def		"shd == stream_when[LAM x l.x]"
    1.80 +stl_def		"stl == stream_when[LAM x l.l]"
    1.81 +
    1.82 +(* ----------------------------------------------------------------------- *)
    1.83 +(* the taker for streams                                                   *)
    1.84 +
    1.85 +stream_take_def "stream_take == (%n.iterate(n,stream_copy,UU))"
    1.86 +
    1.87 +(* ----------------------------------------------------------------------- *)
    1.88 +
    1.89 +stream_finite_def	"stream_finite == (%s.? n.stream_take(n)[s]=s)"
    1.90 +
    1.91 +(* ----------------------------------------------------------------------- *)
    1.92 +(* definition of bisimulation is determined by domain equation             *)
    1.93 +(* simplification and rewriting for abstract constants yields def below    *)
    1.94 +
    1.95 +stream_bisim_def "stream_bisim ==\
    1.96 +\(%R.!s1 s2.\
    1.97 +\ 	R(s1,s2) -->\
    1.98 +\  ((s1=UU & s2=UU) |\
    1.99 +\  (? x s11 s21. x~=UU & s1=scons[x][s11] & s2 = scons[x][s21] & R(s11,s21))))"
   1.100 +
   1.101 +end
   1.102 +
   1.103 +
   1.104 +
   1.105 +