src/HOLCF/ex/loop.thy
author nipkow
Wed, 19 Jan 1994 17:40:26 +0100
changeset 244 929fc2c63bd0
permissions -rw-r--r--
HOLCF examples
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     1
(*  Title:	HOLCF/ex/loop.thy
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     2
    ID:         $Id$
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     3
    Author: 	Franz Regensburger
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     4
    Copyright	1993 Technische Universitaet Muenchen
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     5
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     6
Theory for a loop primitive like while
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     7
*)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     8
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     9
Loop = Tr2 +
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    10
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    11
consts
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    12
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    13
	step  :: "('a -> tr)->('a -> 'a)->'a->'a"
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    14
	while :: "('a -> tr)->('a -> 'a)->'a->'a"
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    15
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    16
rules
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    17
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    18
  step_def	"step == (LAM b g x. If b[x] then g[x] else x fi)"
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    19
  while_def	"while == (LAM b g. fix[LAM f x.\
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    20
\                 If b[x] then f[g[x]] else x fi])"
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    21
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    22
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    23
end
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    24