File: lambda.elpi

package info (click to toggle)
elpi 2.0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 50,296 kB
  • sloc: ml: 18,791; makefile: 229; python: 95; sh: 7
file content (12 lines) | stat: -rw-r--r-- 414 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
% test Z yields Z=impl(impl A B) (impl A B)

% Type inference for simply typed lambda terms
% Syntax: t ::= appl t t | abs F    where F is a function t -> t
% Syntax: ty ::= impl ty ty

:untyped of (appl T1 T2) B :- of T1 (impl A B), of T2 A.
:untyped of (lam F) (impl A B) :- pi x\ of x A => of (F x) B.

:untyped test Z :- of (lam f\ lam a\ appl f a) Z.

:untyped main :- test Z, Z = impl (impl a b) (impl a b).