A next-gen functional language
Go to file
2023-05-08 17:02:02 -03:00
.github/workflows fix: inlining, tests for eval and tests 2023-01-16 09:20:12 -03:00
crates feat: added flag to remove error dependenies 2023-05-08 17:02:02 -03:00
example test: added test for wikind and fixed example 2022-12-16 12:12:16 -03:00
guide fix: change guide URLs 2022-11-29 13:57:46 -03:00
img chore: improved readme a little bit 2023-01-17 09:49:34 -03:00
.gitignore Add conv_eval 2022-07-19 20:23:07 -03:00
Cargo.lock feat: added '/' with empty right side 2023-05-08 10:54:43 -03:00
Cargo.toml style: added a lot of tests, benchmarks and fixed code style 2022-11-30 11:19:14 -03:00
CHANGELOG.md refactor: started to refactor the entire compiler inspired in rustc 2022-10-04 14:02:44 -03:00
FEATURES.md merge: with main 2022-11-30 13:44:20 -03:00
LICENSE chore: added license 2023-01-16 10:56:06 -03:00
README.md docs: fix top level declarations names cases 2023-03-23 08:45:45 -03:00
rust-toolchain.toml fix: fix rust-toolchain file 2023-03-22 17:18:13 -03:00
SYNTAX.md fix: Remove copy/paste leftover in syntax.md 2022-11-10 17:49:53 +01:00

banner

 

crates.io discord.invite build.badge

Kind is a pure functional programming language and proof assistant.

Getting startedExamplesInstallation

 

Getting started

It is a complete rewrite of Kind1, based on HVM, a lazy, non-garbage-collected and massively parallel virtual machine. In our benchmarks, its type-checker outperforms every alternative proof assistant by a far margin, and its programs can offer exponential speedups over Haskell's GHC. Kind2 unleashes the inherent parallelism of the Lambda Calculus to become the ultimate programming language of the next century.

Welcome to the inevitable parallel, functional future of computers!

Examples

Pure functions are defined via equations, as in Haskell:

// Applies a function to every element of a list
Map <a> <b> (list: List a) (f: a -> b) : List b
Map a b Nil              f             = Nil
Map a b (Cons head tail) f             = Cons (f head) (Map tail f)

Theorems can be proved inductively, as in Agda and Idris:

// Black Friday Theorem. Proof that, for every Nat n: n * 2 / 2 == n.
BlackFridayTheorem (n: Nat)     : Equal Nat (Nat.half (Nat.double n)) n
BlackFridayTheorem Nat.zero     = Equal.refl
BlackFridayTheorem (Nat.succ n) = Equal.apply (x => Nat.succ x) (BlackFridayTheorem n)

For more examples, check the Wikind.

Installation

First, install Rust first, then enter:

cargo install kind2

Then, use any of the commands below:

Command Usage Note
Check kind2 check file.kind2 Checks all definitions.
Eval kind2 eval file.kind2 Runs using the type-checker's evaluator.
Run kind2 run file.kind2 Runs using HVM's evaluator, on Rust-mode.
To-HVM kind2 to-hvm file.kind2 Generates a .hvm file. Can then be compiled to a rust crate using HVM.
To-KDL kind2 to-kdl file.kind2 Generates a .kdl file. Can then be deployed to Kindelia.

The rust crate can be generated via HVM:

kind2 to-hvm file.kind2 > file.hvm
hvm compile file.hvm