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
GoodCrypto c ⇒ Sums (IndividualPoolStake c) 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 #

Crypto c ⇒ Sums [Reward c] Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSum ∷ [Reward c] → Coin Source #

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

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

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

updateRew ∷ ∀ c. CoinReward c → Reward c 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 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 #

Sizeable (MultiAsset c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

getSizeMultiAsset c → 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 Source #

showTxAuxDataF era → String Source #

showList ∷ [TxAuxDataF era] → ShowS Source #

Eq (TxAuxDataF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

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

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

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 Source #

showTxF era → String Source #

showList ∷ [TxF era] → ShowS Source #

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 Source #

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

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 Source #

showTxWitsF era → String Source #

showList ∷ [TxWitsF era] → ShowS Source #

Eq (TxWitsF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

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

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

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 Source #

showTxBodyF era → String Source #

showList ∷ [TxBodyF era] → ShowS Source #

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 Source #

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

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 Source #

showTxCertF era → String Source #

showList ∷ [TxCertF era] → ShowS Source #

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 Source #

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

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

Eq (PlutusPurposeF 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 Source #

showTxOutF era → String Source #

showList ∷ [TxOutF era] → ShowS Source #

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 Source #

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

Ord (TxOutF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

compareTxOutF era → TxOutF era → Ordering Source #

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

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

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

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

maxTxOutF era → TxOutF era → TxOutF era Source #

minTxOutF era → TxOutF era → TxOutF era Source #

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 Source #

showValueF era → String Source #

showList ∷ [ValueF era] → ShowS Source #

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 Source #

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

Ord (ValueF era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

compareValueF era → ValueF era → Ordering Source #

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

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

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

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

maxValueF era → ValueF era → ValueF era Source #

minValueF era → ValueF era → ValueF 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 #

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 Source #

showPParamsF era → String Source #

showList ∷ [PParamsF era] → ShowS Source #

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 Source #

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

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

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 (EraCrypto era)) (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

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 Source #

showScriptF era → String Source #

showList ∷ [ScriptF era] → ShowS Source #

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 Source #

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

unScriptFScriptF era → Script era Source #

genScriptFEra era ⇒ Proof 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

Eq OrdCond Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

(==)OrdCondOrdCondBool Source #

(/=)OrdCondOrdCondBool Source #

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

Semigroup (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

Methods

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

sconcatNonEmpty (AddsSpec c) → AddsSpec c Source #

stimesIntegral b ⇒ b → AddsSpec c → AddsSpec c Source #

Show (AddsSpec c) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Classes

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

Crypto c ⇒ Ord (MaryValue c) Source # 
Instance details

Crypto c ⇒ Ord (MultiAsset c) Source # 
Instance details