nimber-0.1.2: Finite nimber arithmetic

PortabilityNon-portable (GHC extensions)
Stabilityexperimental
MaintainerAnders Kaseorg <andersk@mit.edu>
Safe HaskellNone

Data.Nimber

Description

The finite nimbers, Nimber, are a quadratically closed field of characteristic 2 introduced in combinatorial game theory.

>>> 257 + 258 :: Nimber
*3
>>> sqrt 123456789 :: Nimber
*98433322
>>> 123456789/sqrt 123456789 :: Nimber
*98433322

This implementation was inspired by Patrick Hurst’s slow Haskell implementation that this replaced (with his permission), and by Michel Van den Bergh’s Python implementation at https://web.archive.org/web/20101124110959/http://alpha.uhasselt.be/Research/Algebra/Members/nimbers/nimbers.py.

Synopsis

Documentation

data Nimber Source

The type of finite nimbers.

Instances

Enum Nimber 
Eq Nimber 
Floating Nimber

This partial Floating instance only supports sqrt. All other operations will throw the Innimerable exception.

Fractional Nimber

Note: Although nimbers support division, the fromRational operation makes little sense because Rationals are reduced according to ordinary multiplication instead of nimber multiplication.

Num Nimber 
Ord Nimber 
Read Nimber 
Show Nimber 

data NimberException Source

The type of exceptions thrown by impossible Nimber operations.

Constructors

NegativeNimber

A negative integer was converted to a nimber.

Innimerable String

A transcendental function was called on nimbers.