cardano-ledger-test-9.9.9.9: Testing harness, tests and benchmarks for Shelley style cardano ledgers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Constrained.Classes

Synopsis

Documentation

gaussFloating a ⇒ a → a → a → a Source #

class (Eq x, Show x, Typeable x) ⇒ Adds x where Source #

The Adds class

Some methods of Adds like minus, genAdds, partition and fromI are partial. That is they might not be defined on all inputs. The `[string]` is a representation of a stack trace, that describes what the sytem was doing, so if the function is partial it can raise an appropriate error. The function Test.Cardano.Ledger.Constrained.Combinators(errorMess) is used to raise an error and properly report the stack trace.

Methods

zero ∷ x Source #

Additive identity

one ∷ x Source #

Just the unit of increment.

add ∷ x → x → x Source #

Add two of these

minus ∷ [String] → x → x → x Source #

Subtract one from another

increaseBy1IntInt Source #

Increase by unit of increment

decreaseBy1IntInt Source #

Decrease by unit of increment

partition ∷ x → [String] → Int → x → Gen [x] Source #

Generate a list of values partition 7 trace 4 235 generate a list of length 4 that adds up t0 235, where the smallest number is >= 7

genAdds ∷ [String] → AddsSpec x → Gen x Source #

Generate a single value genAdds trace spec generates an x in the range specified by spec

fromI ∷ [String] → Int → x Source #

Analogous to fromIntegral, translate an Int to an appropriate x

toI ∷ x → Int Source #

translate an x Int to an appropriate Int

genSmallGen Int Source #

Used in testing to get appropriate smallest values to test 'partition smallest trace count total'. The generator should choose from several values appropriate for the type x. choose [0,1,2] would be appropriate for Natural, since there are no negative Natural numbers.

runOrdConditionOrdCond → x → x → Bool Source #

supportsNegative ∷ x → Bool Source #

smallerOf ∷ x → x → x Source #

Instances

Instances details
Adds Rational Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds Word64 Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds DeltaCoin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds ExUnits Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds Natural Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Adds Int Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

sumAdds ∷ (Foldable t, Adds c) ⇒ t c → c Source #

lensAdds ∷ (Foldable t, Adds b) ⇒ Lens' a b → t a → b Source #

class (Show x, Adds x) ⇒ Sums t x | t → x where Source #

Methods

getSum ∷ t → x Source #

genT ∷ [String] → x → Gen t Source #

Instances

Instances details
Sums IndividualPoolStake Rational Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Reflect era ⇒ Sums (TxOutF era) Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSumTxOutF era → Coin Source #

genT ∷ [String] → CoinGen (TxOutF era) Source #

Reflect era ⇒ Sums (ValueF era) Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSumValueF era → Coin Source #

genT ∷ [String] → CoinGen (ValueF era) Source #

Sums [Reward] Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSum ∷ [Reward] → Coin Source #

genT ∷ [String] → CoinGen [Reward] Source #

genTxOutXReflect era ⇒ Proof era → CoinGen (TxOutF era) Source #

genValueXReflect era ⇒ Proof era → CoinGen (ValueF era) Source #

class Show t ⇒ Sizeable t where Source #

Methods

getSize ∷ t → Int Source #

extract the size of t

Instances

Instances details
Sizeable Word64 Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeWord64Int Source #

Sizeable Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeCoinInt Source #

Sizeable MultiAsset Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeMultiAssetInt Source #

Sizeable EpochNo Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeEpochNoInt Source #

Sizeable SlotNo Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeSlotNoInt Source #

Sizeable Natural Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeNaturalInt Source #

Sizeable Int Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeIntInt Source #

EraPParams era ⇒ Sizeable (Proposals era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeProposals era → Int Source #

Show t ⇒ Sizeable (Set t) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeSet t → Int Source #

Show t ⇒ Sizeable [t] Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSize ∷ [t] → Int Source #

(Show dom, Show rng) ⇒ Sizeable (Map dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeMap dom rng → Int Source #

class Count t where Source #

Methods

canFollow ∷ t → t → Bool Source #

'canFollow x y', is x an appropriate successor to y

genPred ∷ t → Gen t Source #

Generate the predecessor, given the successor

genSucc ∷ t → Gen t Source #

Generate the successor, given the predecessor

data TxAuxDataF era where Source #

Constructors

TxAuxDataFProof era → TxAuxData era → TxAuxDataF era 

Instances

Instances details
Show (TxAuxDataF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxAuxDataF era → ShowS #

showTxAuxDataF era → String #

showList ∷ [TxAuxDataF era] → ShowS #

Eq (TxAuxDataF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxAuxDataF era → TxAuxDataF era → Bool #

(/=)TxAuxDataF era → TxAuxDataF era → Bool #

pcAuxDataProof era → TxAuxData era → PDoc Source #

data TxF era where Source #

Constructors

TxFProof era → Tx era → TxF era 

Instances

Instances details
PrettyA (PParamsUpdate era) ⇒ Show (TxF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxF era → ShowS #

showTxF era → String #

showList ∷ [TxF era] → ShowS #

PrettyA (TxF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyATxF era → PDoc Source #

Eq (TxF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxF era → TxF era → Bool #

(/=)TxF era → TxF era → Bool #

unTxFTxF era → Tx era Source #

data TxWitsF era where Source #

Constructors

TxWitsFProof era → TxWits era → TxWitsF era 

Instances

Instances details
Show (TxWitsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxWitsF era → ShowS #

showTxWitsF era → String #

showList ∷ [TxWitsF era] → ShowS #

Eq (TxWitsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxWitsF era → TxWitsF era → Bool #

(/=)TxWitsF era → TxWitsF era → Bool #

unTxWitsFTxWitsF era → TxWits era Source #

data TxBodyF era where Source #

Constructors

TxBodyFProof era → TxBody era → TxBodyF era 

Instances

Instances details
PrettyA (PParamsUpdate era) ⇒ Show (TxBodyF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxBodyF era → ShowS #

showTxBodyF era → String #

showList ∷ [TxBodyF era] → ShowS #

PrettyA (TxBodyF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyATxBodyF era → PDoc Source #

Eq (TxBodyF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxBodyF era → TxBodyF era → Bool #

(/=)TxBodyF era → TxBodyF era → Bool #

unTxBodyFTxBodyF era → TxBody era Source #

data TxCertF era where Source #

Constructors

TxCertFProof era → TxCert era → TxCertF era 

Instances

Instances details
Show (TxCertF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxCertF era → ShowS #

showTxCertF era → String #

showList ∷ [TxCertF era] → ShowS #

PrettyA (TxCertF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyATxCertF era → PDoc Source #

Eq (TxCertF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxCertF era → TxCertF era → Bool #

(/=)TxCertF era → TxCertF era → Bool #

unTxCertFTxCertF era → TxCert era Source #

data PlutusPurposeF era where Source #

Constructors

PlutusPurposeFProof era → PlutusPurpose AsIxItem era → PlutusPurposeF era 

Instances

Instances details
Show (PlutusPurposeF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntPlutusPurposeF era → ShowS #

showPlutusPurposeF era → String #

showList ∷ [PlutusPurposeF era] → ShowS #

Eq (PlutusPurposeF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)PlutusPurposeF era → PlutusPurposeF era → Bool #

(/=)PlutusPurposeF era → PlutusPurposeF era → Bool #

data PlutusPointerF era where Source #

Constructors

PlutusPointerFProof era → PlutusPurpose AsIx era → PlutusPointerF era 

Instances

Instances details
Show (PlutusPointerF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntPlutusPointerF era → ShowS #

showPlutusPointerF era → String #

showList ∷ [PlutusPointerF era] → ShowS #

Eq (PlutusPointerF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)PlutusPointerF era → PlutusPointerF era → Bool #

(/=)PlutusPointerF era → PlutusPointerF era → Bool #

Ord (PlutusPointerF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

data TxOutF era where Source #

Constructors

TxOutFProof era → TxOut era → TxOutF era 

Instances

Instances details
Show (TxOutF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntTxOutF era → ShowS #

showTxOutF era → String #

showList ∷ [TxOutF era] → ShowS #

PrettyA (TxOutF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyATxOutF era → PDoc Source #

Eq (TxOutF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)TxOutF era → TxOutF era → Bool #

(/=)TxOutF era → TxOutF era → Bool #

Ord (TxOutF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

compareTxOutF era → TxOutF era → Ordering #

(<)TxOutF era → TxOutF era → Bool #

(<=)TxOutF era → TxOutF era → Bool #

(>)TxOutF era → TxOutF era → Bool #

(>=)TxOutF era → TxOutF era → Bool #

maxTxOutF era → TxOutF era → TxOutF era #

minTxOutF era → TxOutF era → TxOutF era #

Reflect era ⇒ Sums (TxOutF era) Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSumTxOutF era → Coin Source #

genT ∷ [String] → CoinGen (TxOutF era) Source #

unTxOutTxOutF era → TxOut era Source #

data ValueF era where Source #

Constructors

ValueFProof era → Value era → ValueF era 

Instances

Instances details
Show (ValueF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntValueF era → ShowS #

showValueF era → String #

showList ∷ [ValueF era] → ShowS #

PrettyA (ValueF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyAValueF era → PDoc Source #

Eq (ValueF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)ValueF era → ValueF era → Bool #

(/=)ValueF era → ValueF era → Bool #

Ord (ValueF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

compareValueF era → ValueF era → Ordering #

(<)ValueF era → ValueF era → Bool #

(<=)ValueF era → ValueF era → Bool #

(>)ValueF era → ValueF era → Bool #

(>=)ValueF era → ValueF era → Bool #

maxValueF era → ValueF era → ValueF era #

minValueF era → ValueF era → ValueF era #

Reflect era ⇒ Sums (ValueF era) Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSumValueF era → Coin Source #

genT ∷ [String] → CoinGen (ValueF era) Source #

unValueValueF era → Value era Source #

data PParamsF era where Source #

Constructors

PParamsFProof era → PParams era → PParamsF era 

Instances

Instances details
Show (PParamsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntPParamsF era → ShowS #

showPParamsF era → String #

showList ∷ [PParamsF era] → ShowS #

PrettyA (PParamsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyAPParamsF era → PDoc Source #

Eq (PParamsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)PParamsF era → PParamsF era → Bool #

(/=)PParamsF era → PParamsF era → Bool #

data PParamsUpdateF era where Source #

Constructors

PParamsUpdateFProof era → PParamsUpdate era → PParamsUpdateF era 

Instances

Instances details
Show (PParamsUpdateF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntPParamsUpdateF era → ShowS #

showPParamsUpdateF era → String #

showList ∷ [PParamsUpdateF era] → ShowS #

data ProposedPPUpdatesF era where Source #

Constructors

ProposedPPUpdatesFProof era → ProposedPPUpdates era → ProposedPPUpdatesF era 

data GovState era Source #

Constructors

GovState (Proof era) (GovState era) 

getPPUP ∷ ∀ era. Proof era → GovState era → ShelleyGovState era Source #

putPPUP ∷ ∀ era. Proof era → ShelleyGovState era → GovState era Source #

liftUTxOMap TxIn (TxOutF era) → UTxO era Source #

genValueProof era → Gen (ValueF era) Source #

genTxOutProof era → Gen (TxOutF era) Source #

genPParamsProof era → Gen (PParamsF era) Source #

genGovStateProof era → Gen (GovState era) Source #

genUTxOProof era → Gen (UTxO era) Source #

data ScriptsNeededF era where Source #

Constructors

ScriptsNeededFProof era → ScriptsNeeded era → ScriptsNeededF era 

Instances

Instances details
Show (ScriptsNeededF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntScriptsNeededF era → ShowS #

showScriptsNeededF era → String #

showList ∷ [ScriptsNeededF era] → ShowS #

data ScriptF era where Source #

Constructors

ScriptFProof era → Script era → ScriptF era 

Instances

Instances details
Show (ScriptF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntScriptF era → ShowS #

showScriptF era → String #

showList ∷ [ScriptF era] → ShowS #

PrettyA (ScriptF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

prettyAScriptF era → PDoc Source #

Eq (ScriptF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)ScriptF era → ScriptF era → Bool #

(/=)ScriptF era → ScriptF era → Bool #

unScriptFScriptF era → Script era Source #

genScriptFProof era → Gen (ScriptF era) Source #

zeroCountShow a ⇒ [Char] → a → [Char] Source #

integerPartition ∷ [String] → StringIntegerIntIntegerGen [Integer] Source #

Generate a list of length size that sums to total, where the minimum element is (>= smallest)

partitionCoinCoin → [String] → IntCoinGen [Coin] Source #

partitionIntInt → [String] → IntIntGen [Int] Source #

ordCondToSize ∷ ∀ a. Adds a ⇒ (String, OrdCond, a) → Size Source #

Translate (s,cond,n), into a Size which specifies the Int range on which the OrdCond is True. The triple (s, EQL, 2) denotes s = 2 (s, LTH, 7) denotes s < 7 (s, GTH, 5) denotes s > 5 ...

varOnLeftAdds a ⇒ StringOrdCond → a → AddsSpec c Source #

varOnLeftSizeAdds a ⇒ StringOrdCond → a → Size Source #

varOnRightAdds a ⇒ [String] → a → OrdCond → a → StringAddsSpec c Source #

varOnRightSizeAdds a ⇒ [String] → a → OrdCond → a → StringSize Source #

varOnLeftNegAdds a ⇒ StringOrdCond → a → AddsSpec c Source #

varOnRightNegAdds a ⇒ a → OrdCond → a → StringAddsSpec c Source #

reverseOrdCondOrdCondOrdCond Source #

This function reverseOrdCond has been defined to handle the Pred SumsTo when the variable is on the right-hand-side (rhs) of the OrdCond operator. In order to do that we must multiply both sides of the inequality by (-1). For example consider [SumsTo (DeltaCoin 1) ▵₳ -2 > ∑ ▵₳ -1 + x] Note variable x on the rhs ^ To solve we subtract x from both sides, and add '▵₳ -2' from bothsides getting (-x) > ∑ (▵₳ -1) + (▵₳ -2) reduced to (-x) > ∑ (▵₳ -3) to solve we must multiply both sides by (-1) x ?? ∑ (▵₳ 3) What operator do we replace ?? by to make the original (▵₳ -2 > ∑ ▵₳ -1 + x) True? The change in the operator is called "reversing" the operator. See https://www.mathsisfun.com/algebra/inequality-solving.html for one explantion.

data OrdCond Source #

First order representation of the Ord comparisons

Constructors

EQL 
LTH 
LTE 
GTH 
GTE 

Instances

Instances details
Show OrdCond Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntOrdCondShowS #

showOrdCondString #

showList ∷ [OrdCond] → ShowS #

Eq OrdCond Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)OrdCondOrdCondBool #

(/=)OrdCondOrdCondBool #

runOrdCondOrd c ⇒ OrdCond → c → c → Bool Source #

data AddsSpec c where Source #

A specification of summation. like: lhs = ∑ rhs The idea is that the rhs can contain multiple terms: rhs = ∑ r1 + r2 + r3 Other example conditions: (lhs rhs), and (lhs= ∑ rhs) The invariant is that only a single variable appears in the summation. It can appear on either side. If it appears in the rhs then there may be other, constant terms, in the rhs: 7 = ∑ 3 + v + 9 We always do the sums and solving at type Int, and cast back and forth to accommodate other types with (Adds c) instances, using the methods 'fromI" and toI This allows the instance to deal with special conditions. There are two (non-failure) possibilities 1) Var on the left, 2) Var on the right We supply functions varOnLeft :: String -> OrdCond -> Integer -> AddsSpec c SumsTo _ x 4 + 6 + 9 === (varOnLeft x LTE 19) == (AddsSpecSize x (AtMost 19)) varOnRight :: Integer -> OrdCond -> Integer -> String -> AddsSpec c SumsTo _ 8 + x + 3 === (varOnRight 8 LTH 5 x) == (AddsSpecSize x (AtLeast 4)) But internally we store the information as a String and a Size (I.e. a range of Int)

Constructors

AddsSpecSize 

Fields

AddsSpecAnyAddsSpec c 
AddsSpecNever ∷ [String] → AddsSpec c 

Instances

Instances details
Monoid (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

memptyAddsSpec c #

mappendAddsSpec c → AddsSpec c → AddsSpec c #

mconcat ∷ [AddsSpec c] → AddsSpec c #

Semigroup (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(<>)AddsSpec c → AddsSpec c → AddsSpec c #

sconcatNonEmpty (AddsSpec c) → AddsSpec c #

stimesIntegral b ⇒ b → AddsSpec c → AddsSpec c #

Show (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

showsPrecIntAddsSpec c → ShowS #

showAddsSpec c → String #

showList ∷ [AddsSpec c] → ShowS #

LiftT (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

liftTAddsSpec c → Typed (AddsSpec c) Source #

dropTTyped (AddsSpec c) → AddsSpec c Source #

vLeftStringOrdCondIntAddsSpec c Source #

vRightIntOrdCondIntStringAddsSpec c Source #

vRightSizeIntOrdCondIntStringSize Source #

vRightNegIntOrdCondIntStringAddsSpec c Source #

Orphan instances