initial commit?

master
Rachel Lambda Samuelsson 2022-08-25 20:29:55 +02:00
commit fc022a16a4
12 changed files with 176 additions and 0 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
_build

34
Eval.ml 100644
View File

@ -0,0 +1,34 @@
module V = Value
module T = Term
let rec index : V.env -> int -> V.value
= fun env i ->
match env with
| [] -> failwith "Can't happen"
| x :: xs -> if i < 1 then x else index xs (i-1)
let rec eval : V.env -> t.term -> V.value
= fun env tr ->
match tr with
| Var i -> index env i
| Type -> V.Type
| T0 -> V.T0
| Ind0 (B b, t) -> failwith "todo"
| T1 -> V.T1
| T1tr -> V.T1tr
| Ind1 (B b, t1 tr) -> failwith "todo"
| TNat -> V.TNat
| Zero -> V.Zero
| Suc n -> failwith "todo"
| IndN (B b, tz, B B ts, n) -> failwith "todo"
| TBool -> failwith "todo"
| True -> failwith "todo"
| False -> failwith "todo"
| IndB (B b, tt, tf, b) -> failwith "todo"
| Pi (dom, B cod) -> failwith "todo"
| Lam (B body) -> failwith "todo"
| App (f, x) -> failwith "todo"
| Sg (ty, tr) -> failwith "todo"
| Pair (x, y) -> failwith "todo"
| Fst tr -> failwith "todo"
| Snd tr -> failwith "todo"

9
README.md 100644
View File

@ -0,0 +1,9 @@
# implicitt
A "proof assistant" with holes and implcit arguments. Developed to learn about elaboration, meta variables and OCaml
# TODO
* Id types, lol (oops)
* evaluation
* conversion

4
bin/dune 100644
View File

@ -0,0 +1,4 @@
(executable
(public_name implicitt)
(name main)
(libraries implicitt))

1
bin/main.ml 100644
View File

@ -0,0 +1 @@
let () = print_endline "Hello, World!"

26
dune-project 100644
View File

@ -0,0 +1,26 @@
(lang dune 3.3)
(name implicitt)
(generate_opam_files true)
(source
(uri "https://githug.xyz/depsterr/implcitt"))
(authors "depsterr")
(maintainers "depsterr")
(license ISC)
; (documentation https://url/to/documentation)
(package
(name implicitt)
(synopsis "A poor proof assitant")
(description "A \"proof assistant\" with holes and implcit arguments. Developed to learn about elaboration, meta variables and OCaml.")
(depends ocaml dune)
(tags
(topics "proof assistant")))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

29
implicitt.opam 100644
View File

@ -0,0 +1,29 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "A poor proof assitant"
description:
"A \"proof assistant\" with holes and implcit arguments. Developed to learn about elaboration, meta variables and OCaml."
maintainer: ["depsterr"]
authors: ["depsterr"]
license: "ISC"
tags: ["topics" "proof assistant"]
depends: [
"ocaml"
"dune" {>= "3.3"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "https://githug.xyz/depsterr/implcitt"

34
lib/Term.ml 100644
View File

@ -0,0 +1,34 @@
type var = Ix of int
type 'a binder = B of 'a
type term
= Var of var
| Type
| T0
| Ind0 of term binder * term
| T1
| T1tr
| Ind1 of term binder * term * term
| TNat
| Zero
| Suc of term
| IndN of term binder * term * term binder binder * term
| TBool
| True
| False
| IndB of term binder * term * term * term
| Pi of term * term binder
| Lam of term binder
| App of term * term
| Sg of term * term binder
| Pair of term * term
| Fst of term
| Snd of term

34
lib/Value.ml 100644
View File

@ -0,0 +1,34 @@
module T = Term
type lvl = Lvl of int
type closure = C of env * T.term
and env = value list
and value
= Type
| T0
| T1
| T1vl
| TNat
| Suc of value
| Zero
| TBool
| True
| False
| Pi of value * closure
| Lam of closure
| Sg of value * closure
| Pair of value * value
| Stuck of stuck * value (* second arg is type *)
and stuck
= Var of lvl
| Ind0 of closure * stuck
| Ind1 of closure * value * stuck
| IndN of closure * value * closure * stuck
| IndB of closure * value * value * stuck
| App of stuck * value * value (* fn; val; type of fn *)
| Fst of stuck
| Snd of stuck

2
lib/dune 100644
View File

@ -0,0 +1,2 @@
(library
(name implicitt))

2
test/dune 100644
View File

@ -0,0 +1,2 @@
(test
(name implicitt))

View File