Main Page   Modules   Compound List   File List   Compound Members   File Members  

peano.h File Reference

An interface (header file) for Peano Arithmetic. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct  Natnum
 A structure for representing Natural Numbers from the Peano Arithmetic. More...


Typedefs

typedef NatnumNatnum_t
 Natnum_t : the object that will be operated on. More...


Functions

Natnum_t Z ()
Natnum_t S (const Natnum_t n)
Natnum_t itsum (const Natnum_t, const Natnum_t)
Natnum_t recsum (const Natnum_t, const Natnum_t)
Natnum_t loopsum (const Natnum_t, const Natnum_t)
const Natnum_t pred (const Natnum_t)
int Zeq (Natnum_t)
int eq (Natnum_t, Natnum_t)
unsigned nn2uns (Natnum_t)
Natnum_t uns2nn (unsigned)


Detailed Description

An interface (header file) for Peano Arithmetic.

It defines the representation for Peano numbers and the interface to operations on them.


Typedef Documentation

Natnum_t
 

Natnum_t : the object that will be operated on.

A Peano number will always be a pointer to a Natnum, i.e., a Natnum_t


Function Documentation

int eq Natnum_t    n0,
Natnum_t    n1
 

equlity test

Notice that equality is defined with respect to the intended representation

Natnum_t itsum const Natnum_t    s0,
const Natnum_t    s1
 

tail recursive function for computing sum over Natnum

Natnum_t loopsum Natnum_t    s0,
Natnum_t    s1
 

The sum of two Natnum object, using iteration

It implements invariant assertion.

unsigned nn2uns Natnum_t   
 

Converting a Natnum_t to binary representation

const Natnum_t pred const    Natnum_t
 

the predecessor of a given number

Natnum_t recsum const Natnum_t    s0,
const Natnum_t    s1
 

recursive function for computing sum over Natnum

it computes sum of two Natnum objects, using recursion with suspended computation (computation with draft on stack)

Natnum_t S const Natnum_t    n
 

A constructor for an object representing the successor of a given number

Parameters:
n  a number
Returns:
the successor of n

Natnum_t uns2nn unsigned   
 

From binary to Natnum_t

Z  
 

A constructor for an object representing the number zero

int Zeq Natnum_t   
 

whether a number is zero


Generated on Wed Jun 11 08:35:43 2003 for Peano Arithmetic by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002