From 5d227bcd0055d02e1d49a3dcd27e80a756923d5b Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Sun, 23 Jun 2024 23:31:59 +0200 Subject: split code into smaller libraries and make a better repl --- src/nbe/Data.ml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/nbe/Data.ml (limited to 'src/nbe/Data.ml') diff --git a/src/nbe/Data.ml b/src/nbe/Data.ml new file mode 100644 index 0000000..d2f94d3 --- /dev/null +++ b/src/nbe/Data.ml @@ -0,0 +1,53 @@ +open Bwd + +(** Syntactic terms *) + +type syn = + | Var of int + | Pi of Ident.local * syn * (* BINDS *) syn + | Lam of Ident.local * (* BINDS *) syn + | App of syn * syn + | Sg of Ident.local * syn * (* BINDS *) syn + | Pair of syn * syn + | Fst of syn + | Snd of syn + | Type + | Bool + | True + | False + | BoolElim of { + motive_var : Ident.local; + motive : (* BINDS *) syn; + true_case : syn; + false_case : syn; + scrut : syn; + } + +(** Semantic domain *) + +type value = + | Neutral of ne + | Pi of Ident.local * value * clo + | Lam of Ident.local * clo + | Sg of Ident.local * value * clo + | Pair of value * value + | Type + | Bool + | True + | False + +and ne = ne_head * frm bwd +and ne_head = Var of int (* De Bruijn levels *) +and frm = + | App of value + | Fst + | Snd + | BoolElim of { + motive_var : Ident.local; + motive: clo; + true_case: value; + false_case: value; + } + +and env = value bwd +and clo = Clo of { body : syn; env : env } -- cgit 1.4.1