https://github.com/andreasabel/sit
Prototypical type checker for Type Theory with Sized Natural Numbers
https://github.com/andreasabel/sit
Last synced: 11 months ago
JSON representation
Prototypical type checker for Type Theory with Sized Natural Numbers
- Host: GitHub
- URL: https://github.com/andreasabel/sit
- Owner: andreasabel
- License: mit
- Created: 2017-05-15T15:14:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-09-22T19:40:59.000Z (almost 2 years ago)
- Last Synced: 2025-03-18T14:53:39.350Z (over 1 year ago)
- Language: Haskell
- Size: 70.3 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Sit: size-irrelevant types
A prototype dependently-typed language with sized natural numbers
Sit parses and typechecks `.agda` that conform to the Sit language syntax.
Syntax (excerpt):
```agda
--- Lexical stuff
--- Single line comment
{- Block comment -}
--; --- End of declaration (mandatory)
f_x'1 --- identifiers start with a letter, then have letters, digits, _ and '
--- Declarations
x : T --; --- type signature
x = t --; --- definition
open import M --; --- ignored, for Agda compatibility
--- Sit specifics
oo --- infinity size
i + 1 --- successor size
Nat a --- type of natural numbers below size a
zero a --- number zero (a is size annotation)
suc a n --- successor of n (a is size annotation)
forall .i -> T --- irrelevant size quantification
forall ..i -> T --- relevant size quantification
fix T t n --- recursive function over natural numbers
--- T: return type
--- t: functional
--- n: natural number argument
\{ (zero _) -> t; (suc _ x) -> u } --- case distinction function
--- Inherited Agda syntax
U -> T --- non-dependent function type
(x y z : U) -> T --- dependent function type
\ x y z -> t --- lambda-abstraction
t u --- application
Set --- first universe
Set1 --- second universe
Set a --- universe of level a
```
## Limitations
Sit only understands a tiny subset of the Agda language.
Sit does not understand layout, instead each declaration has to be terminated with
comment `--;`.
## Installation
Requires GHC and cabal, for instance via the Haskell Platform.
In a shell, type
```
cabal install
```
## Test
In a shell, type
```
Sit.bin test/Test.agda
```
## Example
This is the addition function in Sit:
```
--- Addition of natural numbers
plus : forall .i -> Nat i -> Nat oo -> Nat oo --;
plus = \ i x y ->
fix (\ i x -> Nat oo)
(\ _ f -> \
{ (zero _) -> y
; (suc _ x) -> suc oo (f x)
})
x
```