Copyright | (c) Alexandre Joannou 2020-2021 |
---|---|
License | MIT |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Blarney.Backend.SMT.BasicDefinitions
Description
This module provides basic SMT types and functions to assist in blarney Netlist code generation
Synopsis
- declareTupleTypes :: [Int] -> Doc
- declareListXType :: Doc
- mkListX :: [String] -> String -> Doc
- defineAndReduce :: Doc
- defineImpliesReduce :: Doc
- defineDistinctListX :: String -> Doc
- defineChain :: String -> (String, (String, String), String) -> Doc
- inlineChain :: Int -> (String, (String, String), String) -> Doc
datatypes declaration
declareTupleTypes :: [Int] -> Doc Source #
list creation
mkListX :: [String] -> String -> Doc Source #
Construct a ListX from a '[Sting]' by chaining the appropriate sequence of "cons" and a "nil" adequately qualified
list reduction
defineAndReduce :: Doc Source #
Define the "andReduce" SMT function operating on a "(ListX Bool)", reducing it using "and"
defineImpliesReduce :: Doc Source #
Define the "impliesReduce" SMT function operating on a "(ListX Bool)", reducing it using "=>" (implication)
defineDistinctListX :: String -> Doc Source #
Define the "init", "allDifferent" and "distinctFrom" family of functions on ListX parameterised on the provided sort. For a given sort S, the defined functions are: * "init_ListX_S" - return all but the last element of the list or nil for an empty list * "allDifferent_ListX_S" - return true if all elements of the list are distinct * "distinctFrom_ListX_S" - return true if the first argument is distinct from all the elements in the second argument
miscellaneous
defineChain :: String -> (String, (String, String), String) -> Doc Source #
Define the repeated application of a function f of 2 arguments returning a pair where * the first argument of f is taken from an overall argument list * the second argument of f is an explicit argument of first invocation, and is the second member of the pair returned by the previous invocation on subsequent calls * the call depth is defined by the length of the explicit argument list * the overall return is a pair of reversed lists of individual returned values