Simplee.Goa 1.0.4

Lambda calculus in FSharp

Lambda calculus implementation using FSharp.

There is a newer version of this package available.
See the version list below for details.
Install-Package Simplee.Goa -Version 1.0.4
dotnet add package Simplee.Goa --version 1.0.4
<PackageReference Include="Simplee.Goa" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplee.Goa --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

simplee |> goa

Project which implements lambda calculus parser, and interpreter.

goa |> AST

Contains the definitions of the lambda calculus grammar. Here is an example of the lambda terms:

type GIdentifier = string

type GExpression =
   | GVar      of GIdentifier
   | GApp      of GExpression * GExpression
   | GLambda   of GIdentifier * GExpression

goa |> ofstr

Parses strings and converts them to lambda expressions. The implementation is using the FParse library.
Here are several examples of valid strings which are parsed into lambda expressions.
In the following example, we get a lambda expression from a given string.

"""\x -> (x y)""" |> gexpr
"""\a b -> b""" |> gexpr

The results of parsing these strings are equivalent to the following lambda expressions built using the provided infix operators:

"x" .>> ("x" .<<. "y")
"a" .>> ("b" .>> ("b" |> gvar))

goa |> combinators

The library provides the standard lambda combinators: S, K, I, M, KI, C, B, Th, B1, V

goa |> eval

The library implements normalization function for lambda expression using beta reduction.

GAnd << GTrue << GTrue |> eval (fun _ -> None)

goa |> bool

The library defines Boolean algebra (GTrue, GFalse, GNot, GOr, GAnd, GBeq)

GNot << GTrue
|> norm (fun _ -> None)
|> g2str
|> function
    | s when s = "λa b.b" -> Ok ()
    | s -> s |> sprintf "The not True is not GFalse [%s]" |> Error

GAnd << GTrue << GFalse
|> norm (fun _ -> None)
|> g2str
|> function
    | s when s = "λb x.x" -> Ok ()
    | s -> s |> sprintf "The AND True False is not GFalse [%s]" |> Error

simplee |> goa

Project which implements lambda calculus parser, and interpreter.

goa |> AST

Contains the definitions of the lambda calculus grammar. Here is an example of the lambda terms:

type GIdentifier = string

type GExpression =
   | GVar      of GIdentifier
   | GApp      of GExpression * GExpression
   | GLambda   of GIdentifier * GExpression

goa |> ofstr

Parses strings and converts them to lambda expressions. The implementation is using the FParse library.
Here are several examples of valid strings which are parsed into lambda expressions.
In the following example, we get a lambda expression from a given string.

"""\x -> (x y)""" |> gexpr
"""\a b -> b""" |> gexpr

The results of parsing these strings are equivalent to the following lambda expressions built using the provided infix operators:

"x" .>> ("x" .<<. "y")
"a" .>> ("b" .>> ("b" |> gvar))

goa |> combinators

The library provides the standard lambda combinators: S, K, I, M, KI, C, B, Th, B1, V

goa |> eval

The library implements normalization function for lambda expression using beta reduction.

GAnd << GTrue << GTrue |> eval (fun _ -> None)

goa |> bool

The library defines Boolean algebra (GTrue, GFalse, GNot, GOr, GAnd, GBeq)

GNot << GTrue
|> norm (fun _ -> None)
|> g2str
|> function
    | s when s = "λa b.b" -> Ok ()
    | s -> s |> sprintf "The not True is not GFalse [%s]" |> Error

GAnd << GTrue << GFalse
|> norm (fun _ -> None)
|> g2str
|> function
    | s when s = "λb x.x" -> Ok ()
    | s -> s |> sprintf "The AND True False is not GFalse [%s]" |> Error

Release Notes

Improved the evaluation mechanism for lambda expressions.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.15 246 2/6/2018
1.0.11 235 2/4/2018
1.0.10 228 2/4/2018
1.0.5 235 2/4/2018
1.0.4 290 2/1/2018
1.0.1 246 1/31/2018
1.0.0 271 1/30/2018