diff --git a/cardano-constitution/src/Cardano/Constitution/Validator/Common.hs b/cardano-constitution/src/Cardano/Constitution/Validator/Common.hs index dcbdf83328b..7f97a0d30b5 100644 --- a/cardano-constitution/src/Cardano/Constitution/Validator/Common.hs +++ b/cardano-constitution/src/Cardano/Constitution/Validator/Common.hs @@ -9,7 +9,6 @@ module Cardano.Constitution.Validator.Common ( withChangedParams , ChangedParams , ConstitutionValidator - , lookupUnsafe , validateParamValue ) where @@ -37,7 +36,7 @@ withChangedParams fun (scriptContextToValidGovAction -> validGovAction) = case validGovAction of Just cparams -> if fun cparams then BI.unitval - else BI.trace "ChangedParams failed to validate" (B.error ()) + else traceError "ChangedParams failed to validate" Nothing -> BI.unitval -- this is a treasury withdrawal, we just accept it {-# INLINABLE validateParamValue #-} @@ -89,7 +88,7 @@ scriptContextToValidGovAction = scriptContextToScriptInfo scriptInfoToProposalProcedure (BI.unsafeDataAsConstr -> si) = if BI.fst si `B.equalsInteger` 5 -- Constructor Index of `ProposingScript` then BI.head (BI.tail (BI.snd si)) - else B.trace "Not a ProposalProcedure. This should not ever happen, because ledger should guard before, against it." (B.error ()) + else traceError "Not a ProposalProcedure. This should not ever happen, because ledger should guard before, against it." proposalProcedureToGovernanceAction :: BuiltinData -> BuiltinData proposalProcedureToGovernanceAction = BI.unsafeDataAsConstr @@ -104,14 +103,4 @@ scriptContextToValidGovAction = scriptContextToScriptInfo | govActionConstr `B.equalsInteger` 0 = Just (B.unsafeDataAsMap (BI.head (BI.tail (BI.snd govAction)))) -- Constructor Index of `TreasuryWithdrawals` is 2 | govActionConstr `B.equalsInteger` 2 = Nothing -- means treasurywithdrawal - | otherwise = B.trace "Not a ChangedParams or TreasuryWithdrawals. This should not ever happen, because ledger should guard before, against it." (B.error ()) - -{-# INLINEABLE lookupUnsafe #-} --- | An unsafe version of PlutusTx.AssocMap.lookup, specialised to Integer keys -lookupUnsafe :: Integer -> [(Integer, v)] -> v -lookupUnsafe k = go - where - go [] = B.trace "Unsorted lookup failed" (B.error ()) - go ((k', i) : xs') = if k `B.equalsInteger` k' - then i - else go xs' + | otherwise = traceError "Not a ChangedParams or TreasuryWithdrawals. This should not ever happen, because ledger should guard before, against it." diff --git a/cardano-constitution/src/Cardano/Constitution/Validator/Unsorted.hs b/cardano-constitution/src/Cardano/Constitution/Validator/Unsorted.hs index 2cbe47ccd08..bc204ec3342 100644 --- a/cardano-constitution/src/Cardano/Constitution/Validator/Unsorted.hs +++ b/cardano-constitution/src/Cardano/Constitution/Validator/Unsorted.hs @@ -1,4 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE Strict #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ViewPatterns #-} @@ -32,9 +33,19 @@ validateParam :: ConstitutionConfig -> (BuiltinData, BuiltinData) -> Bool validateParam (ConstitutionConfig cfg) (B.unsafeDataAsI -> actualPid, actualValueData) = Common.validateParamValue -- If param not found, it will error - (Common.lookupUnsafe actualPid cfg) + (lookupUnsafe actualPid cfg) actualValueData +{-# INLINEABLE lookupUnsafe #-} +-- | An unsafe version of PlutusTx.AssocMap.lookup, specialised to Integer keys +lookupUnsafe :: Integer -> [(Integer, v)] -> v +lookupUnsafe k = go + where + go [] = traceError "Unsorted lookup failed" + go ((k', i) : xs') = if k `B.equalsInteger` k' + then i + else go xs' + -- | Statically configure the validator with the `defaultConstitutionConfig`. defaultConstitutionValidator :: ConstitutionValidator defaultConstitutionValidator = constitutionValidator defaultConstitutionConfig diff --git a/cardano-constitution/src/PlutusTx/NonCanonicalRational.hs b/cardano-constitution/src/PlutusTx/NonCanonicalRational.hs index e963fdef248..ab5addf7834 100644 --- a/cardano-constitution/src/PlutusTx/NonCanonicalRational.hs +++ b/cardano-constitution/src/PlutusTx/NonCanonicalRational.hs @@ -11,6 +11,7 @@ import PlutusTx as Tx import PlutusTx.Builtins as B import PlutusTx.Builtins.Internal as BI import PlutusTx.Ratio as Tx +import PlutusTx.Trace (traceError) -- We agreed to have a different BuiltinData encoding for Rationals for the ConstitutionScript, -- other than the canonical encoding for datatypes. @@ -31,5 +32,5 @@ instance UnsafeFromData NonCanonicalRational where let bl' = BI.tail bl in BI.ifThenElse (BI.null (BI.tail bl')) (\() -> NonCanonicalRational (Tx.unsafeRatio (B.unsafeDataAsI (BI.head bl)) (B.unsafeDataAsI (BI.head bl')))) - (\() -> BI.trace "A Rational had too many list components" (B.error ())) + (\() -> traceError "A Rational had too many list components") () diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden index b9dc6e97900..3827a8bde10 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden @@ -1 +1 @@ -2135 \ No newline at end of file +2132 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden index d6ce7d922a4..8fadf8bc196 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 601572171, exBudgetMemory = ExMemory 2972418} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 601524171, exBudgetMemory = ExMemory 2972118} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden index 031b613ff79..46dc8d51161 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden @@ -202,10 +202,6 @@ {all dead. dead}) {all dead. dead} in - let - data Unit | Unit_match where - Unit : Unit - in letrec data ParamValue | ParamValue_match where ParamAny : ParamValue @@ -215,6 +211,10 @@ ParamRational : (\v -> List (Tuple2 PredKey (List v))) Rational -> ParamValue in + let + data Unit | Unit_match where + Unit : Unit + in letrec !validateParamValue : ParamValue -> data -> Bool = \(eta : ParamValue) (eta : data) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden index 6d0ae38c41f..e5a1b195d58 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 91621157, exBudgetMemory = ExMemory 414205} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 91573157, exBudgetMemory = ExMemory 413905} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden index db609c9b03e..cb963ac39a9 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden @@ -42,705 +42,692 @@ (\cse -> (\cse -> (\cse -> - (\cse -> - (\fun - ds -> - force - (case - ((\cse -> - (\x -> - force + (\fun + ds -> + force + (case + ((\cse -> + (\x -> + force + (force (force - (force - ifThenElse - (equalsInteger - 0 - x) + ifThenElse + (equalsInteger + 0 + x) + (delay (delay - (delay - (constr 0 - [ (go - (unMapData + (constr 0 + [ (go + (unMapData + (force + headList (force - headList + tailList (force - tailList (force - (force - sndPair) - cse))))) ]))) + sndPair) + cse))))) ]))) + (delay (delay - (delay + (force (force (force - (force - ifThenElse - (equalsInteger - 2 - x) + ifThenElse + (equalsInteger + 2 + x) + (delay (delay - (delay - (constr 1 - [ ]))) + (constr 1 + [ ]))) + (delay (delay - (delay - error)))))))))) + error)))))))))) + (force (force - (force - fstPair) - cse)) - (unConstrData + fstPair) + cse)) + (unConstrData + (force + headList (force - headList + tailList (force tailList (force - tailList (force - (force - sndPair) - (unConstrData - ((\cse -> - force + sndPair) + (unConstrData + ((\cse -> + force + (force (force - (force - ifThenElse - (equalsInteger - 5 + ifThenElse + (equalsInteger + 5 + (force (force - (force - fstPair) - cse)) + fstPair) + cse)) + (delay (delay - (delay + (force + headList (force - headList + tailList (force - tailList (force - (force - sndPair) - cse))))) + sndPair) + cse))))) + (delay (delay - (delay - error))))) - (unConstrData + error))))) + (unConstrData + (force + headList (force - headList + tailList (force tailList (force - tailList (force - (force - sndPair) - (unConstrData - ds)))))))))))))) - [ (\cparams -> - delay - (force - (case - (fun - cparams) - [ (delay - ()) - , (delay - error) ]))) - , (delay - ()) ])) - (runRules - (constr 1 - [ (constr 0 - [ 0 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 30 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 1000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 1 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 2 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 24576 - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 122880 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 3 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 32768 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 4 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 5 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 1000000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 6 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250000000 - , cse ]) ]) - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 7 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 8 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 2000 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 9 - , (constr 3 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 10 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 1000) - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 200) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 11 - , (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 16 - , (constr 1 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 17 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 3000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 6500 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 18 - , (constr 0 - [ ]) ]) - , (constr 1 - [ (constr 0 - [ 19 - , (constr 2 - [ (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 25) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 20000) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5000) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 20 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 21 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 120000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 22 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 12288 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 23 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 200 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 24 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 25 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , cse ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 26 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , cse ]) ]) - , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 27 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 3 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 28 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 18 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 293 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 29 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 30 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 31 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 100000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 32 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 13 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 37 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 33 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , cse ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (unsafeRatio - 1000 - 1) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]))) - (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ])) + sndPair) + (unConstrData + ds)))))))))))))) + [ (\cparams -> + delay + (force + (case + (fun + cparams) + [ (delay + ()) + , (delay + error) ]))) + , (delay + ()) ])) + (runRules + (constr 1 + [ (constr 0 + [ 0 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 30 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 1000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 1 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 2 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 24576 + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 122880 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 3 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 32768 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 4 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 5 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1000000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 6 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250000000 + , cse ]) ]) + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 7 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 8 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 2000 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 9 + , (constr 3 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 10 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 1000) + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 200) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 11 + , (constr 3 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 16 + , (constr 1 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 17 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 3000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 6500 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 18 + , (constr 0 + [ ]) ]) + , (constr 1 + [ (constr 0 + [ 19 + , (constr 2 + [ (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 25) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 20000) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5000) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 20 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 21 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 120000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 22 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 12288 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 23 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 200 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 24 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 25 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , cse ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 26 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , cse ]) ]) + , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 27 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 3 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 28 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 18 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 293 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 29 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 30 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 31 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 100000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 32 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 13 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 37 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 33 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , cse ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (unsafeRatio + 1000 + 1) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]))) (constr 3 [ (constr 1 [ cse @@ -750,141 +737,151 @@ [ ]) , (constr 1 [ cse - , cse ]) ]) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 3 [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse , (constr 1 [ cse - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 3 - [ (constr 1 + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ])) + (constr 3 + [ (constr 1 + [ cse + , (constr 1 [ (constr 0 - [ (constr 1 + [ (constr 0 [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) - , (constr 0 - [ ]) ])) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 1000000 - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 0 - [ (constr 2 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ])) + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , cse ]) + , (constr 0 + [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 1000000 + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 - [ (constr 0 + [ (constr 2 [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + , cse ]) , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (cse + 4) , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 [ cse , (constr 0 [ ]) ])) - (cse - 1)) + (constr 1 + [ cse + , (constr 0 + [ ]) ])) (cse - 1)) + 100)) (cse - 4)) + 20)) (cse 10)) (cse - 2)) - (cse - 10)) + 1)) + (constr 0 + [ (constr 1 + [ ]) + , cse ])) (constr 0 [ (constr 1 [ ]) - , cse ])) - (cse 100)) - (constr 0 - [ (constr 1 - []) - , (constr 1 - [ 1 - , (constr 0 - [ ]) ]) ])) - (cse 20)) + , (constr 1 + [ 1 + , (constr 0 + [ ]) ]) ])) + (cse 2)) + (cse 1)) + (cse 5)) (unsafeRatio 0)) - (unsafeRatio 13)) - (unsafeRatio 1)) - (unsafeRatio 3)) - (unsafeRatio 51)) - (unsafeRatio 9)) + (unsafeRatio 3)) + (unsafeRatio 13)) + (unsafeRatio 9)) + (unsafeRatio 1)) + (unsafeRatio 51)) (constr 1 [0, (constr 0 [])])) (unsafeRatio 4)) (fix1 diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden index b3aededa3a9..09bc6cfa49b 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden @@ -1 +1 @@ -2128 \ No newline at end of file +2124 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden index f7f97495af1..3742ab98948 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 915786341, exBudgetMemory = ExMemory 4588088} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 960426341, exBudgetMemory = ExMemory 4867088} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden index 8cbf06182e7..e3a7f1ded40 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden @@ -137,6 +137,9 @@ {all dead. dead} in go ds + !equalsInteger : integer -> integer -> Bool + = \(x : integer) (y : integer) -> + ifThenElse {Bool} (equalsInteger x y) True False !`$fOrdInteger_$ccompare` : integer -> integer -> Ordering = \(eta : integer) (eta : integer) -> Bool_match @@ -202,10 +205,6 @@ {all dead. dead}) {all dead. dead} in - let - data Unit | Unit_match where - Unit : Unit - in letrec data ParamValue | ParamValue_match where ParamAny : ParamValue @@ -215,6 +214,10 @@ ParamRational : (\v -> List (Tuple2 PredKey (List v))) Rational -> ParamValue in + let + data Unit | Unit_match where + Unit : Unit + in letrec !validateParamValue : ParamValue -> data -> Bool = \(eta : ParamValue) (eta : data) -> @@ -232,8 +235,7 @@ {integer} (CConsOrd {integer} - (\(x : integer) (y : integer) -> - ifThenElse {Bool} (equalsInteger x y) True False) + equalsInteger `$fOrdInteger_$ccompare` (\(x : integer) (y : integer) -> ifThenElse {Bool} (lessThanInteger x y) True False) @@ -5187,39 +5189,36 @@ {Bool} (\(ds : data) (actualValueData : data) -> validateParamValue - (let - !k : integer = unIData ds - in - letrec - !go : List (Tuple2 integer ParamValue) -> ParamValue - = \(ds : List (Tuple2 integer ParamValue)) -> - List_match - {Tuple2 integer ParamValue} - ds - {all dead. ParamValue} - (/\dead -> error {ParamValue}) - (\(ds : Tuple2 integer ParamValue) - (xs' : List (Tuple2 integer ParamValue)) -> - /\dead -> - Tuple2_match - {integer} - {ParamValue} - ds - {ParamValue} - (\(k' : integer) (i : ParamValue) -> - Bool_match - (ifThenElse - {Bool} + ((let + !k : integer = unIData ds + in + letrec + !go : List (Tuple2 integer ParamValue) -> ParamValue + = \(ds : List (Tuple2 integer ParamValue)) -> + List_match + {Tuple2 integer ParamValue} + ds + {all dead. ParamValue} + (/\dead -> error {ParamValue}) + (\(ds : Tuple2 integer ParamValue) + (xs' : List (Tuple2 integer ParamValue)) -> + /\dead -> + Tuple2_match + {integer} + {ParamValue} + ds + {ParamValue} + (\(k' : integer) (i : ParamValue) -> + Bool_match (equalsInteger k k') - True - False) - {all dead. ParamValue} - (/\dead -> i) - (/\dead -> go xs') - {all dead. dead})) - {all dead. dead} - in - go cfg) + {all dead. ParamValue} + (/\dead -> i) + (/\dead -> go xs') + {all dead. dead})) + {all dead. dead} + in + go) + cfg) actualValueData)) in \(ds : data) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden index 41b796f5651..3f487d3f64f 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 88895267, exBudgetMemory = ExMemory 399703} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 89279267, exBudgetMemory = ExMemory 402103} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden index 1f88e6a462c..f8aa16528b0 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden @@ -3,14 +3,14 @@ ((\fix1 -> (\`$fOrdRational0_$c<=` -> (\`$fOrdInteger_$ccompare` -> - (\validatePreds -> - (\euclid -> - (\unsafeRatio -> - (\cse -> - (\validateParamValue -> - (\validateParamValues -> - (\go -> - (\cse -> + (\equalsInteger -> + (\validatePreds -> + (\euclid -> + (\unsafeRatio -> + (\cse -> + (\validateParamValue -> + (\validateParamValues -> + (\go -> (\cse -> (\cse -> (\cse -> @@ -188,22 +188,18 @@ [ (\k' i -> force - (force - (force - ifThenElse - (equalsInteger - k - k') - (delay - (delay - i)) - (delay - (delay - (go - xs')))))) ])) ])) - cfg) + (case + (equalsInteger + k + k') + [ (delay + i) + , (delay + (go + xs')) ])) ])) ]))) (unIData - ds)) + ds) + cfg) actualValueData) ]) [ (delay (go @@ -793,19 +789,16 @@ [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) (constr 3 [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ])) + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ])) (constr 3 [ (constr 1 [ cse @@ -820,16 +813,19 @@ [ ]) ]) ]) ])) (constr 3 [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 3 [ (constr 1 @@ -850,7 +846,8 @@ , (constr 1 [ cse , (constr 1 - [ cse + [ (cse + 10) , (constr 0 [ ]) ]) ]) ]) , (constr 0 @@ -859,17 +856,18 @@ [ (constr 1 [ ]) , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ])) + [ (cse + 10) + , cse ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 [ (constr 0 @@ -894,22 +892,21 @@ , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + [ cse , (constr 0 [ ]) ])) (constr 1 - [ (cse - 1) + [ cse , (constr 0 [ ]) ])) (constr 1 @@ -917,456 +914,478 @@ , (constr 0 [ ]) ])) (cse - 10)) - (cse - 4)) - (constr 0 - [ (constr 1 - [ ]) - , cse ])) + 1)) + (constr 0 + [ (constr 1 + [ ]) + , cse ])) + (cse + 100)) (cse - 20)) + 2)) (cse - 5)) - (cse - 10)) - (cse 100)) - (cse 1)) - (constr 0 - [ (constr 1 - []) - , (constr 1 - [ 1 - , (constr 0 - [ ]) ]) ])) - (cse 2)) - (unsafeRatio 1)) - (unsafeRatio 51)) - (unsafeRatio 3)) - (unsafeRatio 9)) - (unsafeRatio 13)) - (unsafeRatio 4)) - (constr 1 [0, (constr 0 [])])) - (unsafeRatio 0)) - (fix1 - (\go l -> - force (force chooseList) - l - (\ds -> constr 0 []) - (\ds -> - constr 1 - [ ((\p -> - constr 0 - [ (force (force fstPair) - p) - , (force (force sndPair) - p) ]) - (force headList l)) - , (go (force tailList l)) ]) - ()))) - (cse (\arg_0 arg_1 -> arg_1))) - (cse (\arg_0 arg_1 -> arg_0))) - (force - ((\s -> s s) - (\s h -> - delay - (\fr -> - (\k -> - fr - (\x -> k (\f_0 f_1 -> f_0 x)) - (\x -> k (\f_0 f_1 -> f_1 x))) - (\fq -> force (s s h) (force h fq)))) - (delay - (\choose - validateParamValue - validateParamValues -> - choose - (\eta eta -> - force - (case - eta - [ (delay (constr 0 [])) - , (\preds -> - delay - (validatePreds - (constr 0 - [ (\x y -> - force ifThenElse - (equalsInteger - x - y) - (constr 0 []) - (constr 1 [])) - , `$fOrdInteger_$ccompare` - , (\x y -> - force ifThenElse - (lessThanInteger - x - y) - (constr 0 []) - (constr 1 [])) - , (\x y -> - force ifThenElse - (lessThanEqualsInteger - x - y) - (constr 0 []) - (constr 1 [])) - , (\x y -> - force ifThenElse - (lessThanEqualsInteger - x - y) - (constr 1 []) - (constr 0 [])) - , (\x y -> - force ifThenElse - (lessThanInteger - x - y) - (constr 1 []) - (constr 0 [])) - , (\x y -> - force - (force + 20)) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1 + , (constr 0 + [ ]) ]) ])) + (cse 4)) + (cse 5)) + (cse 1)) + (unsafeRatio 9)) + (unsafeRatio 0)) + (unsafeRatio 3)) + (unsafeRatio 4)) + (unsafeRatio 13)) + (constr 1 [0, (constr 0 [])])) + (unsafeRatio 51)) + (unsafeRatio 1)) + (fix1 + (\go l -> + force (force chooseList) + l + (\ds -> constr 0 []) + (\ds -> + constr 1 + [ ((\p -> + constr 0 + [ (force + (force fstPair) + p) + , (force + (force sndPair) + p) ]) + (force headList l)) + , (go (force tailList l)) ]) + ()))) + (cse (\arg_0 arg_1 -> arg_1))) + (cse (\arg_0 arg_1 -> arg_0))) + (force + ((\s -> s s) + (\s h -> + delay + (\fr -> + (\k -> + fr + (\x -> k (\f_0 f_1 -> f_0 x)) + (\x -> k (\f_0 f_1 -> f_1 x))) + (\fq -> force (s s h) (force h fq)))) + (delay + (\choose + validateParamValue + validateParamValues -> + choose + (\eta eta -> + force + (case + eta + [ (delay (constr 0 [])) + , (\preds -> + delay + (validatePreds + (constr 0 + [ equalsInteger + , `$fOrdInteger_$ccompare` + , (\x y -> + force + ifThenElse + (lessThanInteger + x + y) + (constr 0 + []) + (constr 1 + [])) + , (\x y -> + force + ifThenElse + (lessThanEqualsInteger + x + y) + (constr 0 + []) + (constr 1 + [])) + , (\x y -> + force + ifThenElse + (lessThanEqualsInteger + x + y) + (constr 1 + []) + (constr 0 + [])) + , (\x y -> + force + ifThenElse + (lessThanInteger + x + y) + (constr 1 + []) + (constr 0 + [])) + , (\x y -> + force (force - ifThenElse - (lessThanEqualsInteger - x - y) - (delay + (force + ifThenElse + (lessThanEqualsInteger + x + y) (delay - y)) - (delay + (delay + y)) (delay - x))))) - , (\x y -> - force - (force + (delay + x))))) + , (\x y -> + force (force - ifThenElse - (lessThanEqualsInteger - x - y) - (delay + (force + ifThenElse + (lessThanEqualsInteger + x + y) (delay - x)) - (delay + (delay + x)) (delay - y))))) ]) - preds - (unIData eta))) - , (\paramValues -> - delay - (validateParamValues - paramValues - (unListData eta))) - , (\preds -> - delay - ((\cse -> - validatePreds - (constr 0 - [ (\ds ds -> - case - ds - [ (\n d -> - case - ds - [ (\n' - d' -> - force - (force + (delay + y))))) ]) + preds + (unIData eta))) + , (\paramValues -> + delay + (validateParamValues + paramValues + (unListData eta))) + , (\preds -> + delay + ((\cse -> + validatePreds + (constr 0 + [ (\ds ds -> + case + ds + [ (\n + d -> + case + ds + [ (\n' + d' -> + force (force - ifThenElse - (equalsInteger - n - n') - (delay + (force + ifThenElse + (equalsInteger + n + n') (delay - (force - ifThenElse - (equalsInteger - d - d') - (constr 0 - [ ]) - (constr 1 - [ ])))) - (delay + (delay + (force + ifThenElse + (equalsInteger + d + d') + (constr 0 + [ ]) + (constr 1 + [ ])))) (delay - (constr 1 - [ ])))))) ]) ]) - , (\ds ds -> - case - ds - [ (\n d -> - case - ds - [ (\n' - d' -> - `$fOrdInteger_$ccompare` - (multiplyInteger - n - d') - (multiplyInteger - n' - d)) ]) ]) - , (\ds ds -> - case - ds - [ (\n d -> - case - ds - [ (\n' - d' -> - force - ifThenElse - (lessThanInteger - (multiplyInteger - n - d') - (multiplyInteger - n' - d)) - (constr 0 - [ ]) - (constr 1 - [ ])) ]) ]) - , `$fOrdRational0_$c<=` - , (\ds ds -> - case - ds - [ (\n d -> - case - ds - [ (\n' - d' -> - force - ifThenElse - (lessThanEqualsInteger - (multiplyInteger - n - d') - (multiplyInteger - n' - d)) - (constr 1 - [ ]) - (constr 0 - [ ])) ]) ]) - , (\ds ds -> - case - ds - [ (\n d -> - case - ds - [ (\n' - d' -> - force - ifThenElse - (lessThanInteger + (delay + (constr 1 + [ ])))))) ]) ]) + , (\ds ds -> + case + ds + [ (\n + d -> + case + ds + [ (\n' + d' -> + `$fOrdInteger_$ccompare` (multiplyInteger n d') (multiplyInteger n' - d)) - (constr 1 - [ ]) - (constr 0 - [ ])) ]) ]) - , (\x y -> - force - (case - (`$fOrdRational0_$c<=` - x - y) - [ (delay - y) - , (delay - x) ])) - , (\x y -> - force - (case - (`$fOrdRational0_$c<=` - x - y) - [ (delay - x) - , (delay - y) ])) ]) - preds - ((\cse -> - force ifThenElse - (force nullList + d)) ]) ]) + , (\ds ds -> + case + ds + [ (\n + d -> + case + ds + [ (\n' + d' -> + force + ifThenElse + (lessThanInteger + (multiplyInteger + n + d') + (multiplyInteger + n' + d)) + (constr 0 + [ ]) + (constr 1 + [ ])) ]) ]) + , `$fOrdRational0_$c<=` + , (\ds ds -> + case + ds + [ (\n + d -> + case + ds + [ (\n' + d' -> + force + ifThenElse + (lessThanEqualsInteger + (multiplyInteger + n + d') + (multiplyInteger + n' + d)) + (constr 1 + [ ]) + (constr 0 + [ ])) ]) ]) + , (\ds ds -> + case + ds + [ (\n + d -> + case + ds + [ (\n' + d' -> + force + ifThenElse + (lessThanInteger + (multiplyInteger + n + d') + (multiplyInteger + n' + d)) + (constr 1 + [ ]) + (constr 0 + [ ])) ]) ]) + , (\x y -> + force + (case + (`$fOrdRational0_$c<=` + x + y) + [ (delay + y) + , (delay + x) ])) + , (\x y -> + force + (case + (`$fOrdRational0_$c<=` + x + y) + [ (delay + x) + , (delay + y) ])) ]) + preds + ((\cse -> + force + ifThenElse (force - tailList - cse)) - (\ds -> - unsafeRatio - (unIData - (force - headList - cse)) - (unIData - (force - headList - cse)))) - (force tailList - cse) - (\ds -> error) - (constr 0 []))) - (unListData eta))) ])) - (\ds -> - case - ds - [ (\eta -> - force ifThenElse - (force nullList eta) - (constr 0 []) - (constr 1 [])) - , (\paramValueHd - paramValueTl - actualValueData -> - force - (case - (validateParamValue - paramValueHd - (force headList - actualValueData)) - [ (delay - (validateParamValues - paramValueTl - (force tailList - actualValueData))) - , (delay - (constr 1 - [])) ])) ])))))) + nullList + (force + tailList + cse)) + (\ds -> + unsafeRatio + (unIData + (force + headList + cse)) + (unIData + (force + headList + cse)))) + (force tailList + cse) + (\ds -> error) + (constr 0 []))) + (unListData + eta))) ])) + (\ds -> + case + ds + [ (\eta -> + force ifThenElse + (force nullList eta) + (constr 0 []) + (constr 1 [])) + , (\paramValueHd + paramValueTl + actualValueData -> + force + (case + (validateParamValue + paramValueHd + (force headList + actualValueData)) + [ (delay + (validateParamValues + paramValueTl + (force tailList + actualValueData))) + , (delay + (constr 1 + [])) ])) ])))))) + (fix1 + (\unsafeRatio n d -> + force + (force + (force ifThenElse + (equalsInteger 0 d) + (delay (delay error)) + (delay + (delay + (force + (force + (force ifThenElse + (lessThanInteger d 0) + (delay + (delay + (unsafeRatio + (subtractInteger + 0 + n) + (subtractInteger + 0 + d)))) + (delay + (delay + ((\gcd' -> + constr 0 + [ (quotientInteger + n + gcd') + , (quotientInteger + d + gcd') ]) + (euclid + n + d)))))))))))))) (fix1 - (\unsafeRatio n d -> + (\euclid x y -> force (force (force ifThenElse - (equalsInteger 0 d) - (delay (delay error)) + (equalsInteger 0 y) + (delay (delay x)) (delay - (delay - (force - (force - (force ifThenElse - (lessThanInteger d 0) - (delay - (delay - (unsafeRatio - (subtractInteger 0 n) - (subtractInteger - 0 - d)))) - (delay - (delay - ((\gcd' -> - constr 0 - [ (quotientInteger - n - gcd') - , (quotientInteger - d - gcd') ]) - (euclid - n - d)))))))))))))) - (fix1 - (\euclid x y -> - force - (force - (force ifThenElse - (equalsInteger 0 y) - (delay (delay x)) - (delay (delay (euclid y (modInteger x y))))))))) - (\`$dOrd` ds ds -> - fix1 - (\go ds -> - force - (case - ds - [ (delay (constr 0 [])) - , (\x xs -> - delay - (case - x - [ (\predKey expectedPredValues -> - (\meaning -> - fix1 - (\go ds -> - force - (case - ds - [ (delay (go xs)) - , (\x xs -> - delay - (force - (case - (meaning - x - ds) - [ (delay - (go - xs)) - , (delay - (constr 1 - [ ])) ]))) ])) - expectedPredValues) - (force - (case - predKey - [ (delay - (case - `$dOrd` - [ (\v - v - v - v - v - v - v - v -> - v) ])) - , (delay + (delay (euclid y (modInteger x y))))))))) + (\`$dOrd` ds ds -> + fix1 + (\go ds -> + force + (case + ds + [ (delay (constr 0 [])) + , (\x xs -> + delay + (case + x + [ (\predKey expectedPredValues -> + (\meaning -> + fix1 + (\go ds -> + force (case - `$dOrd` - [ (\v - v - v - v - v - v - v - v -> - v) ])) - , (delay - (\x y -> - force - (case + ds + [ (delay (go xs)) + , (\x xs -> + delay + (force + (case + (meaning + x + ds) + [ (delay + (go + xs)) + , (delay + (constr 1 + [ ])) ]))) ])) + expectedPredValues) + (force + (case + predKey + [ (delay + (case + `$dOrd` + [ (\v + v + v + v + v + v + v + v -> + v) ])) + , (delay + (case + `$dOrd` + [ (\v + v + v + v + v + v + v + v -> + v) ])) + , (delay + (\x y -> + force (case - `$dOrd` - [ (\v - v - v - v - v - v - v - v -> - v) ] - x - y) - [ (delay - (constr 1 - [])) - , (delay - (constr 0 - [ ])) ]))) ]))) ])) ])) - ds)) + (case + `$dOrd` + [ (\v + v + v + v + v + v + v + v -> + v) ] + x + y) + [ (delay + (constr 1 + [])) + , (delay + (constr 0 + [ ])) ]))) ]))) ])) ])) + ds)) + (\x y -> + force ifThenElse + (equalsInteger x y) + (constr 0 []) + (constr 1 []))) (\eta eta -> force (force