Main Page Modules Compound List File List Compound Members File Members
peano.c File Reference
The implementation for Peano Arithmetic.
More...
#include "peano.h"
Include dependency graph for peano.c:
Detailed Description
The implementation for Peano Arithmetic.
Operations on Natnum_t objects are defined.
struct Natnum is a cell containing just a pointer. A linked list with
of those cells, followed by a null pointer represents the integer
:
iterations of
, the sucessor function applied to
, the zero constructor.
Function Documentation
|
equlity test
Notice that equality is defined with respect to the intended representation |
void error |
( |
const char * |
s, |
|
|
const int |
n |
|
) |
[static] |
|
|
a local error procedure
A procedure for producing an error message and aborting the program -
Parameters:
-
s |
pointer to error message |
n |
an interger constant to be returned to the operating system |
|
|
tail recursive function for computing sum over Natnum |
|
The sum of two Natnum object, using iteration
It implements invariant assertion. |
|
An allocator for Natnum
It uses malloc to allocate space for Natnum, possibly aborting the program -
Returns:
-
pointer to newly allocated Natnum
|
|
Converting a Natnum_t to binary representation |
|
the predecessor of a given number |
|
recursive function for computing sum over Natnum
it computes sum of two Natnum objects, using recursion with suspended computation (computation with draft on stack) |
|
A constructor for an object representing the successor of a given number -
Parameters:
-
-
Returns:
-
the successor of n
|
Generated on Wed Jun 11 08:35:43 2003 for Peano Arithmetic by
1.2.14 written by Dimitri van Heesch,
© 1997-2002