From 97f84ccace4e634b4e02178a702818e69292dc9f Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Mon, 8 Jul 2024 22:01:42 +0200 Subject: implement top-level definitions --- test/bool.toytt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/bool.toytt (limited to 'test/bool.toytt') 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) -- cgit 1.4.1