/usr/lib/ats-anairiats-0.2.11/prelude/SATS/bool.sats is in ats-lang-anairiats 0.2.11-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | (***********************************************************************)
(* *)
(* Applied Type System *)
(* *)
(* Hongwei Xi *)
(* *)
(***********************************************************************)
(*
** ATS - Unleashing the Potential of Types!
** Copyright (C) 2002-2008 Hongwei Xi, Boston University
** All rights reserved
**
** ATS is free software; you can redistribute it and/or modify it under
** the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by the
** Free Software Foundation; either version 2.1, or (at your option) any
** later version.
**
** ATS is distributed in the hope that it will be useful, but WITHOUT ANY
** WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
** for more details.
**
** You should have received a copy of the GNU General Public License
** along with ATS; see the file COPYING. If not, please write to the
** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
** 02110-1301, USA.
*)
(* ****** ****** *)
(* author: Hongwei Xi (hwxi AT cs DOT bu DOT edu) *)
(* ****** ****** *)
#include "prelude/params.hats"
(* ****** ****** *)
#if VERBOSE_PRELUDE #then
#print "Loading [bool.sats] starts!\n"
#endif // end of [VERBOSE_PRELUDE]
(* ****** ****** *)
//
// some basic operations on boolean values
//
(* ****** ****** *)
castfn bool1_of_bool (x: bool):<> Bool
(* ****** ****** *)
fun bool_of_int (i: int):<> bool
fun int_of_bool (b: bool):<> natLt(2) // Two
fun bool1_of_int1 {i:int} (i: int i):<> bool (i <> 0)
fun int1_of_bool1 {b:bool} (b: bool b):<> int (int_of_bool b)
(* ****** ****** *)
fun neg_bool
(b: bool):<> bool = "atspre_neg_bool"
overload ~ with neg_bool
overload not with neg_bool
fun add_bool_bool
(b1: bool, b2: bool):<> bool = "mac#atspre_add_bool_bool"
overload || with add_bool_bool
fun mul_bool_bool
(b1: bool, b2: bool):<> bool = "mac#atspre_mul_bool_bool"
overload && with mul_bool_bool
(* ****** ****** *)
fun lt_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_lt_bool_bool"
and lte_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_lte_bool_bool"
overload < with lt_bool_bool
overload <= with lte_bool_bool
fun gt_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_gt_bool_bool"
and gte_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_gte_bool_bool"
overload > with gt_bool_bool
overload >= with gte_bool_bool
fun eq_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_eq_bool_bool"
and neq_bool_bool
(b1: bool, b2: bool):<> bool = "atspre_neq_bool_bool"
overload = with eq_bool_bool
overload <> with neq_bool_bool
overload != with neq_bool_bool
fun compare_bool_bool
(b1: bool, b2: bool):<> Sgn = "atspre_compare_bool_bool"
overload compare with compare_bool_bool
(* ****** ****** *)
//
// print functions for booleans
//
(* ****** ****** *)
symintr fprint_bool
fun fprint0_bool (out: FILEref, x: bool):<!exnref> void
= "atspre_fprint_bool"
overload fprint_bool with fprint0_bool
fun fprint1_bool {m:file_mode}
(pf: file_mode_lte (m, w) | out: &FILE m, x: bool):<!exnref> void
= "atspre_fprint_bool"
overload fprint_bool with fprint1_bool
overload fprint with fprint_bool
fun print_bool (b: bool):<!ref> void = "atspre_print_bool"
overload print with print_bool
fun prerr_bool (b: bool):<!ref> void = "atspre_prerr_bool"
overload prerr with prerr_bool
(* ****** ****** *)
//
// HX: stringization
//
fun tostring_bool
(b: bool):<> string = "atspre_tostring_bool"
overload tostring with tostring_bool
(* ****** ****** *)
fun neg_bool1 {b:bool}
(b: bool b):<> bool (~b) = "atspre_neg_bool1"
overload ~ with neg_bool1
overload not with neg_bool1
(* ****** ****** *)
fun add_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 || b2)
= "mac#atspre_add_bool1_bool1"
overload || with add_bool1_bool1
fun mul_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 && b2)
= "mac#atspre_mul_bool1_bool1"
overload && with mul_bool1_bool1
(* ****** ****** *)
fun lt_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (~b1 && b2)
= "atspre_lt_bool1_bool1"
and lte_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (~b1 || b2)
= "atspre_lte_bool1_bool1"
overload < with lt_bool1_bool1
overload <= with lte_bool1_bool1
fun gt_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 && ~b2)
= "atspre_gt_bool1_bool1"
and gte_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 || ~b2)
= "atspre_gte_bool1_bool1"
overload > with gt_bool1_bool1
overload >= with gte_bool1_bool1
fun eq_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 == b2)
= "atspre_eq_bool1_bool1"
and neq_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> bool (b1 <> b2)
= "atspre_neq_bool1_bool1"
overload = with eq_bool1_bool1
overload <> with neq_bool1_bool1
(* ****** ****** *)
local
stadef b2i = int_of_bool
in // in of [in]
fun compare_bool1_bool1 {b1,b2:bool}
(b1: bool b1, b2: bool b2):<> int (b2i b1 - b2i b2)
= "atspre_compare_bool1_bool1"
overload compare with compare_bool1_bool1
end // end of [local]
(* ****** ****** *)
#if VERBOSE_PRELUDE #then
#print "Loading [bool.sats] finishes!\n"
#endif // end of [VERBOSE_PRELUDE]
(* end of [bool.sats] *)
|