Simplee.Goa 1.0.0

Simplee FSharp Goa

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.0
dotnet add package Simplee.Goa --version 1.0.0
<PackageReference Include="Simplee.Goa" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplee.Goa --version 1.0.0
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

goa |> eval

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

let lam = "x" |> gvar |> glambda "x"
let body = "y" |> gvar
let term = gapp lam body

let fail' a = 
    fail 
        nm 
        (sprintf "The app /w lambda failed. s=[%s] e=[%s] a=[%s]" (term |> gte2str) (body |> gte2str) (a |> gte2str))

match term |> eval (fun _ -> None) with
| t when t = ("y" |> gvar) ->
    pass nm
| t ->
    fail' t

goa |> bool

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

GNot << GTrue
|> norm (fun _ -> None)
|> gte2str
|> 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)
|> gte2str
|> 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

goa |> eval

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

let lam = "x" |> gvar |> glambda "x"
let body = "y" |> gvar
let term = gapp lam body

let fail' a = 
    fail 
        nm 
        (sprintf "The app /w lambda failed. s=[%s] e=[%s] a=[%s]" (term |> gte2str) (body |> gte2str) (a |> gte2str))

match term |> eval (fun _ -> None) with
| t when t = ("y" |> gvar) ->
    pass nm
| t ->
    fail' t

goa |> bool

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

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

Release Notes

Initial release of the package which contains parser for lambda expressions, beta reduction, boolean algebra.

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
Show less