# expressions

Expressions and Formulae a la carte

 Latest on Hackage: 0.4.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

This package is aimed at providing means of fixing a first-order language and declaring sorted expressions and formulae, the types ensure the declared expressions fall within the language.

This package pre-defines the common logical symbols for conjunction, disjunction, negation, and universal and existential quantification as well as some specific non-logical symbols such as equality, addition of linear integer arithmetic, and other. Common languages such as Lia and ALia (standard linear integer arithmetic and linear integer arithmetic with arrays) come included.

An example of a formula declaration:

``````-- Let's state that zero is successor to no integer (while this would be
-- true for non-negative integers, stated this way it is clearly false, but
-- it still is a well-formed first-order statement)

forall [var "x" :: Var 'IntegralSort] (cnst 0 ./=. var "x" .+. cnst 1) :: Lia 'BooleanSort``````

Let's see what declarations the library rejects:

``````(var "x" :: Lia 'BooleanSort) .=. (var "y" :: Lia 'IntegralSort)
(var "x" :: Lia 'BooleanSort) .=. (var "y" :: ALia 'BooleanSort)
forall [var "x" :: Var 'IntegralSort] true :: QFLia 'BooleanSort``````

# Change Log

## 0.4.2

• Allow a wide range of dynamically sorted values (not just expressions)
• Utility for extracting array accesses

## 0.3.1

• Utility for extracting constants from expressions

## 0.3

• Cleanup, GHC 8.6

## 0.2

• Add `embed` and `restrict` to convert between expression languages

## 0.1.9

• Bump dependencies

## 0.1.8

• Bump dependencies

## 0.1.7

• Added simple utility function `toDynamicallySorted`

## 0.1.6

• GHC 8.4 compatibility

## 0.1.5

• Bump dependencies, fix equality, tweak readme

## 0.1.4

• Bump dependencies

## 0.1.3

• Extracting variables occurring in expression
• Distinguish quantifier-free expressions
• Convert to negation normal form
• Convert to prenex form
• Convert to flat form (select and store have only variables or constants as arguments)
• Replace store with an instance of its axiomatization

## 0.1.2

• Foldable with sort index
• Traversable with sort index

## 0.1.1

• Parsing
• Equality of expressions
• Expression substitution

## 0.1.0

• Sorted Expressions à la Carte
Depends on 8 packages:
Used by 1 package: