ATSLIB/prelude/bool

This package contains various functions on booleans values.


  • g0ofg1_bool
  • g1ofg0_bool
  • int2bool0
  • int2bool1
  • bool2int0
  • bool2int1
  • add_bool0_bool0
  • add_bool1_bool1
  • mul_bool0_bool0
  • mul_bool1_bool1
  • xor_bool0_bool0
  • lt_bool0_bool0
  • lte_bool0_bool0
  • gt_bool0_bool0
  • gte_bool0_bool0
  • eq_bool0_bool0
  • neq_bool0_bool0
  • print_bool
  • prerr_bool
  • fprint_bool
  • Overloaded Symbols
  • g0ofg1
  • g1ofg0
  • +
  • *
  • =
  • !=
  • print
  • prerr
  • fprint

  • g0ofg1_bool

    Synopsis

    castfn g0ofg1_bool (x: Bool):<> bool

    g1ofg0_bool

    Synopsis

    castfn g1ofg0_bool (x: bool):<> Bool

    int2bool0

    Synopsis

    fun int2bool0 (i: int):<> bool = "mac#%"

    Description

    This function maps any nonzero integer to true and zero to false.

    int2bool1

    Synopsis

    fun int2bool1
      {i:int} (i: int i):<> bool (i != 0) = "mac#%"

    Description

    This function does the same as int2bool0 at run-time.

    bool2int0

    Synopsis

    fun bool2int0 (b: bool):<> natLt(2) = "mac#%"

    Description

    This function maps true and false to 1 and 0, respectively.

    bool2int1

    Synopsis

    fun bool2int1
      {b:bool} (b: bool b):<> int (bool2int(b)) = "mac#%"

    Description

    This function does the same as bool2int0 at run-time.

    add_bool0_bool0

    Synopsis

    fun add_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    Description

    This function returns the disjunction of two given boolean values. Note that the two arguments of this function are evaluated before they are passed.

    add_bool1_bool1

    Synopsis

    fun
    add_bool1_bool1
      {b1,b2:bool}
      (b1: bool b1, b2: bool b2):<> bool(b1 || b2) = "mac#%"

    Description

    This function does the same as add_bool0_bool0 except for having a more informative type.

    mul_bool0_bool0

    Synopsis

    fun mul_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    Description

    This function returns the conjunction of two given boolean values. Note that the two arguments of this function are evaluated before they are passed.

    mul_bool1_bool1

    Synopsis

    fun
    mul_bool1_bool1
      {b1,b2:bool}
      (b1: bool b1, b2: bool b2):<> bool(b1 && b2) = "mac#%"

    Description

    This function does the same as mul_bool0_bool0 except for having a more informative type.

    xor_bool0_bool0

    Synopsis

    fun xor_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    Description

    This function is equivalent to neq_bool0_bool0. In other words, it returns true if and only if its two arguments are not equal.

    lt_bool0_bool0

    Synopsis

    fun lt_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    lte_bool0_bool0

    Synopsis

    fun lte_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    gt_bool0_bool0

    Synopsis

    fun gt_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    gte_bool0_bool0

    Synopsis

    fun gte_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    eq_bool0_bool0

    Synopsis

    fun eq_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    Description

    This function tests whether two given booleans are equal.

    neq_bool0_bool0

    Synopsis

    fun neq_bool0_bool0
      (b1: bool, b2: bool):<> bool = "mac#%"

    Description

    This function tests whether two given booleans are not equal.

    print_bool

    Synopsis

    fun print_bool (x: bool): void = "mac#%"

    prerr_bool

    Synopsis

    fun prerr_bool (x: bool): void = "mac#%"

    fprint_bool

    Synopsis

    fun fprint_bool : fprint_type (bool) = "mac#%"

    Overloaded Symbols


    g0ofg1

    Synopsis

    overload g0ofg1 with g0ofg1_bool // index-erasing

    g1ofg0

    Synopsis

    overload g1ofg0 with g1ofg0_bool // index-inducing

    +

    Synopsis

    overload + with add_bool0_bool0 of 0
    overload + with add_bool0_bool1 of 10
    overload + with add_bool1_bool0 of 10
    overload + with add_bool1_bool1 of 20

    *

    Synopsis

    overload * with mul_bool0_bool0 of 0
    overload * with mul_bool0_bool1 of 10
    overload * with mul_bool1_bool0 of 10
    overload * with mul_bool1_bool1 of 20

    =

    Synopsis

    overload = with eq_bool0_bool0 of 0
    overload = with eq_bool1_bool1 of 20

    !=

    Synopsis

    overload != with neq_bool0_bool0 of 0
    overload != with neq_bool1_bool1 of 20

    print

    Synopsis

    overload print with print_bool

    prerr

    Synopsis

    overload prerr with prerr_bool

    fprint

    Synopsis

    overload fprint with fprint_bool

    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo