Documentation ¶
Index ¶
- Variables
- func ConcAorReduce(term Term, out chan Term, done chan bool)
- func ConcNorReduce(term Term, out chan Term, done chan bool)
- type Abst
- func (la Abst) AlphaEquivalent(other Term) bool
- func (la Abst) AorReduce() (Term, error)
- func (la Abst) BetaReduce(sub Term) Term
- func (la Abst) Copy() Term
- func (la Abst) EtaReduce() Term
- func (la Abst) NorReduce() (Term, error)
- func (la Abst) Reduce() (Term, error)
- func (la Abst) Serialize() string
- func (la Abst) String() string
- func (la Abst) WHNF() Abst
- type Appl
- func (lx Appl) AlphaEquivalent(other Term) bool
- func (lx Appl) AorReduce() (Term, error)
- func (lx Appl) Copy() Term
- func (lx Appl) EtaReduce() Term
- func (lx Appl) NorReduce() (Term, error)
- func (lx Appl) Reduce() (Term, error)
- func (lx Appl) Serialize() string
- func (lx Appl) String() string
- func (lx Appl) WHNF() Abst
- type Free
- func (lf Free) AlphaEquivalent(other Term) bool
- func (lf Free) AorReduce() (Term, error)
- func (lf Free) Copy() Term
- func (lf Free) EtaReduce() Term
- func (lf Free) NorReduce() (Term, error)
- func (lf Free) Reduce() (Term, error)
- func (lf Free) Serialize() string
- func (lf Free) String() string
- func (lf Free) WHNF() Abst
- type Term
- type Var
- func (lv Var) AlphaEquivalent(other Term) bool
- func (lv Var) AorReduce() (Term, error)
- func (lv Var) Copy() Term
- func (lv Var) EtaReduce() Term
- func (lv Var) NorReduce() (Term, error)
- func (lv Var) Reduce() (Term, error)
- func (lv Var) Serialize() string
- func (lv Var) String() string
- func (lv Var) WHNF() Abst
Constants ¶
This section is empty.
Variables ¶
var MaxReductions = 10000
MaxReductions determines the maximum amount of expansions before we give up use a negative value to have no limit (use with care...)
Functions ¶
func ConcAorReduce ¶
ConcAorReduce reduces a lambda expression using applicative order, ignores MaxReductions, instead stops calculations once a signal is sent to done. If stopped mids computation puts nil on out channel.
func ConcNorReduce ¶
ConcNorReduce reduces a lambda expression using normal order, ignores MaxReductions, instead stops calculations once a signal is sent to done. If stopped mids computation puts nil on out channel.
Types ¶
type Abst ¶
type Abst [1]Term
Abst represents a lambda abstraction
func (Abst) AlphaEquivalent ¶
AlphaEquivalent checks whether a Abst and a Term are identical
func (Abst) BetaReduce ¶
BetaReduce substitutes the localy bound variable of the Abst by sub
func (Abst) Serialize ¶
Serialize returns the lambda abstraction as a De Bruijn index representation
type Appl ¶
type Appl [2]Term
Appl represents an application
func (Appl) AlphaEquivalent ¶
AlphaEquivalent checks whether the Appl is identical to a Term
type Free ¶
type Free string
Free is a free variable
func (Free) AlphaEquivalent ¶
AlphaEquivalent checks whether a Free and a Term are identical
type Term ¶
type Term interface { AlphaEquivalent(Term) bool EtaReduce() Term String() string Reduce() (Term, error) NorReduce() (Term, error) AorReduce() (Term, error) WHNF() Abst Copy() Term Serialize() string // contains filtered or unexported methods }
Term is a general type to represent both Applns, Absts, Vars and Frees
func Deserialize ¶
Deserialize turns a De Bruijn index representation into the internal representation
func MustDeserialize ¶
MustDeserialize turns a De Bruijn index representation into the internal representation, panics on error
type Var ¶
type Var uint
Var is the De Bruijn index of a bound variable minus one
func (Var) AlphaEquivalent ¶
AlphaEquivalent checks whether a Var and a Term are identical