#line 24 "/home/ubuntu/felix/src/packages/logic.fdoc"
typedef bool = 2;
type cbool = "bool" requires index TYPE_cbool;
open class Bool
{
ctor bool:cbool="$1";
noinline fun andthen (x: bool, y:1->bool) : bool =>
if x then #y else false
;
noinline fun orelse (x: bool, y:1->bool) : bool =>
if x then true else #y
;
fun land: bool * bool -> bool = "$1&&$2";
fun nand: bool * bool -> bool = "!($1&&$2)";
fun lor: bool * bool -> bool = "$1||$2";
fun nor: bool * bool -> bool = "!($1||$2)";
fun xor: bool * bool -> bool = "$1!=$2";
fun lnot: bool -> bool = "!$1";
fun implies: bool * bool -> bool = "!$1||$2";
proc |= : &bool * bool = "*$1|=$2;";
proc &= : &bool * bool = "*$1&=$2;";
}
open class CBool
{
ctor cbool:bool="$1";
const cfalse: cbool="false";
const ctrue: cbool="true";
noinline fun andthen (x: cbool, y:1->cbool) : cbool =>
if x then #y else cfalse
;
noinline fun orelse (x: cbool, y:1->cbool) : cbool =>
if x then ctrue else #y
;
fun land: cbool * cbool -> cbool = "$1&&$2";
fun nand: cbool * cbool -> cbool = "!($1&&$2)";
fun lor: cbool * cbool -> cbool = "$1||$2";
fun nor: cbool * cbool -> cbool = "!($1||$2)";
fun xor: cbool * cbool -> cbool = "$1!=$2";
fun lnot: cbool -> cbool = "!$1";
fun implies: cbool * cbool -> cbool = "!$1||$2";
proc |= : &cbool * cbool = "*$1|=$2;";
proc &= : &cbool * cbool = "*$1&=$2;";
}
instance FloatAddgrp[bool] {
fun zero () => 0 :>> bool;
fun - (x:bool) => (sub (2, caseno x)) :>> bool;
fun + (x:bool, y:bool) : bool => (add ((caseno x , caseno y)) % 2) :>> bool;
fun - (x:bool, y:bool) : bool => (add (2, sub(caseno x , caseno y)) % 2) :>> bool;
}
instance Str[bool] {
fun str (b:bool) : string => if b then "true" else "false" endif;
}
instance Tord[bool] {
fun < : bool * bool -> bool = "$1<$2";
}
open Tord[bool];
open Show[bool];
open Addgrp[bool];
instance Str[cbool] {
fun str (b:cbool) : string => if b then "ctrue" else "cfalse" endif;
}
instance Tord[cbool] {
fun < : cbool * cbool -> cbool = "$1<$2";
}
open Tord[cbool];
open Show[cbool];