Documentation

Complexitylib.Encoding.DataEncode

Encodings into Data #

This file defines the class that is used to encode arbitrary data structures into Data, so that RTMs (rose tree machines) can operate on them.

Instances are provided for convenience for Data itself, Bool, List α, Option α, α × β, and (binary encoding via List Bool)

Every DataEncode instance also yields a bitstring encoding DataEncode.bitstringEncode, by serializing the target Data value with Data.toBits. Since both the DataEncode instance and Data.toBits are injective, bitstringEncode is injective too (DataEncode.bitstringEncode_injective).

Encoding of types into Data.

  • encode : αData

    Encode a value of α as Data.

  • The encoding is injective, so distinct values never collide.

Instances
    @[implicit_reducible]
    Equations
    • One or more equations did not get rendered due to their size.
    @[implicit_reducible]
    Equations
    @[implicit_reducible]
    Equations
    • One or more equations did not get rendered due to their size.
    @[implicit_reducible]
    Equations
    • One or more equations did not get rendered due to their size.

    Encode a value into a bitstring (List Bool) by first encoding it into Data and then serializing that with the parenthesized Data.toBits. This is the class-inferrable bitstring encoding available for any type with a DataEncode instance.

    Equations
    Instances For

      The bitstring encoding is injective: distinct values yield distinct bitstrings. This composes the injectivity of the DataEncode instance with that of Data.toBits.