about summary refs log tree commit diff
path: root/test/bool.toytt
diff options
context:
space:
mode:
authorMalte Voos <git@mal.tc>2024-07-08 22:01:42 +0200
committerMalte Voos <git@mal.tc>2024-07-08 22:01:42 +0200
commit97f84ccace4e634b4e02178a702818e69292dc9f (patch)
tree9cef95c62e3fa078db256c7fe657732fecef40a8 /test/bool.toytt
parent57de10d8728f51942f676b68f1f3ea29d9b78e6e (diff)
downloadtoytt-97f84ccace4e634b4e02178a702818e69292dc9f.tar.gz
toytt-97f84ccace4e634b4e02178a702818e69292dc9f.zip
implement top-level definitions
Diffstat (limited to 'test/bool.toytt')
-rw-r--r--test/bool.toytt28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/bool.toytt b/test/bool.toytt
new file mode 100644
index 0000000..c8e62fd
--- /dev/null
+++ b/test/bool.toytt
@@ -0,0 +1,28 @@
+def not : bool -> bool :=
+  \x -> bool-elim x at _ -> bool [
+    true => false,
+    false => true
+  ]
+
+def and : bool -> bool -> bool :=
+  \x -> \y -> bool-elim x at _ -> bool [
+    true => bool-elim y at _ -> bool [
+      true => true,
+      false => false
+    ],
+    false => false
+  ]
+
+def or : bool -> bool -> bool :=
+  \x -> \y -> bool-elim x at _ -> bool [
+    true => true,
+    false => bool-elim y at _ -> bool [
+      true => true,
+      false => false
+    ]
+  ]
+
+def xor : bool -> bool -> bool :=
+  \x -> \y -> or
+    (and x (not y))
+	(and (not x) y)