diff --git a/doc/docusaurus/docs/delve-deeper/plinth-compiler-options.md b/doc/docusaurus/docs/delve-deeper/plinth-compiler-options.md index 9a1218349cb..90beba91602 100644 --- a/doc/docusaurus/docs/delve-deeper/plinth-compiler-options.md +++ b/doc/docusaurus/docs/delve-deeper/plinth-compiler-options.md @@ -22,6 +22,7 @@ For each boolean option, you can add a `no-` prefix to switch it off, such as `n |-|-|-|-| |`apply-to-case`|Bool|True|Run the apply-to-case pass, turning multi-argument applications into case-constr form.| |`certify`|Maybe [Char]||Produce a certificate for the compiled program, with the given name. This certificate provides evidence that the compiler optimizations have preserved the functional behavior of the original program. Currently, this is only supported for the UPLC compilation pipeline.| +|`certified-opts-only`|Bool|False|Run only those optimisation passes which are certified to preserve the functional behavior of the original program.| |`conservative-optimisation`|Bool|False|When conservative optimisation is used, only the optimisations that never make the program worse (in terms of cost or size) are employed. Implies `no-relaxed-float-in`, `no-inline-constants`, `no-inline-fix`, `no-simplifier-evaluate-builtins`, and `preserve-logging`.| |`context-level`|Int|1|Set context level for error messages.| |`coverage-all`|Bool|False|Add all available coverage annotations in the trace output| diff --git a/plutus-benchmark/certifier/bench/Main.hs b/plutus-benchmark/certifier/bench/Main.hs index 2c5268d06f4..f19ef455ec8 100644 --- a/plutus-benchmark/certifier/bench/Main.hs +++ b/plutus-benchmark/certifier/bench/Main.hs @@ -5,7 +5,7 @@ import Control.DeepSeq (force) import Control.Exception (evaluate) import Control.Monad import Criterion.Main -import FFI.SimplifierTrace +import FFI.OptimizerTrace import FFI.Untyped (UTerm) import MAlonzo.Code.Certifier (runCertifierMain) diff --git a/plutus-benchmark/certifier/src/Certifier/Common.hs b/plutus-benchmark/certifier/src/Certifier/Common.hs index aacdfa134ed..4b3977bf6e7 100644 --- a/plutus-benchmark/certifier/src/Certifier/Common.hs +++ b/plutus-benchmark/certifier/src/Certifier/Common.hs @@ -4,10 +4,11 @@ import Control.Lens ((&), (.~)) import Control.Monad.Trans.Except import Data.ByteString qualified as B import Data.ByteString.Short qualified as SBS -import FFI.SimplifierTrace +import FFI.OptimizerTrace import FFI.Untyped (UTerm) import PlutusBenchmark.Common (getDataDir) import PlutusCore.Default.Builtins +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) import PlutusCore.Quote import PlutusLedgerApi.Common import System.FilePath @@ -32,21 +33,22 @@ loadFrom name = do . runQuote . runExceptT $ UPLC.unDeBruijnTerm (UPLC._progTerm prog) - pure . runQuote $ mkFfiSimplifierTrace . snd <$> simplify term + pure . runQuote $ mkFfiOptimizerTrace . snd <$> simplify term simplify :: Term Name DefaultUni DefaultFun () -> Quote ( Term Name DefaultUni DefaultFun () - , SimplifierTrace Name DefaultUni DefaultFun () + , OptimizerTrace Name DefaultUni DefaultFun () ) simplify = - runSimplifierT - . termSimplifier - ( defaultSimplifyOpts - & soPreserveLogging .~ False + runOptimizerT + . termOptimizer + ( defaultOptimizeOpts + & ooPreserveLogging .~ False ) DefaultFunSemanticsVariantE + defaultBuiltinCostModelForTesting testScripts :: [FilePath] testScripts = diff --git a/plutus-benchmark/certifier/test/Main.hs b/plutus-benchmark/certifier/test/Main.hs index b41799b33b8..a592a05becd 100644 --- a/plutus-benchmark/certifier/test/Main.hs +++ b/plutus-benchmark/certifier/test/Main.hs @@ -4,7 +4,7 @@ import Certifier.Common (loadFrom, testScripts) import Control.DeepSeq (force) import Control.Exception (evaluate) import Control.Monad -import FFI.SimplifierTrace +import FFI.OptimizerTrace import FFI.Untyped (UTerm) import MAlonzo.Code.Certifier (runCertifierMain) import Test.Tasty (defaultMain, testGroup) diff --git a/plutus-core/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md b/plutus-core/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md new file mode 100644 index 00000000000..a6d43d1b9fa --- /dev/null +++ b/plutus-core/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md @@ -0,0 +1,3 @@ +### Added + +- Added a new command line option `--certified-opts-only` which disables those optimization passes which are not certified. diff --git a/plutus-core/plutus-core.cabal b/plutus-core/plutus-core.cabal index 8a9f31b4951..3e1311943d1 100644 --- a/plutus-core/plutus-core.cabal +++ b/plutus-core/plutus-core.cabal @@ -230,12 +230,13 @@ library UntypedPlutusCore.Transform.Certify.Hints UntypedPlutusCore.Transform.Certify.Trace UntypedPlutusCore.Transform.Cse + UntypedPlutusCore.Transform.EvaluateBuiltins UntypedPlutusCore.Transform.FloatDelay UntypedPlutusCore.Transform.ForceCaseDelay UntypedPlutusCore.Transform.ForceDelay UntypedPlutusCore.Transform.Inline UntypedPlutusCore.Transform.LetFloatOut - UntypedPlutusCore.Transform.Simplifier + UntypedPlutusCore.Transform.Optimizer other-modules: Data.Aeson.Flatten @@ -289,8 +290,8 @@ library UntypedPlutusCore.Evaluation.Machine.Cek.EmitterMode UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode UntypedPlutusCore.Evaluation.Machine.CommonAPI - UntypedPlutusCore.Simplify - UntypedPlutusCore.Simplify.Opts + UntypedPlutusCore.Optimize + UntypedPlutusCore.Optimize.Opts UntypedPlutusCore.Subst reexported-modules: Data.SatInt @@ -479,6 +480,7 @@ library untyped-plutus-core-testlib Generators.Spec Scoping.Spec Transform.CaseOfCase.Spec + Transform.EvaluateBuiltins.Spec Transform.Inline.Spec Transform.Simplify.Lib Transform.Simplify.Spec diff --git a/plutus-core/plutus-core/src/PlutusCore/Compiler.hs b/plutus-core/plutus-core/src/PlutusCore/Compiler.hs index 638401228c7..c69cf4d1996 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Compiler.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Compiler.hs @@ -5,6 +5,7 @@ module PlutusCore.Compiler , compileProgramWithTrace ) where +import PlutusCore.Builtin (CostingPart) import PlutusCore.Compiler.Erase import PlutusCore.Compiler.Opts as Opts import PlutusCore.Compiler.Types @@ -12,7 +13,7 @@ import PlutusCore.Core import PlutusCore.Name.Unique import PlutusCore.Rename import UntypedPlutusCore.Core.Type qualified as UPLC -import UntypedPlutusCore.Simplify qualified as UPLC +import UntypedPlutusCore.Optimize qualified as UPLC import Control.Lens (view) import Control.Monad.Reader (MonadReader) @@ -22,23 +23,25 @@ compileTerm :: ( Compiling m uni fun name a , MonadReader (CompilationOpts name fun a) m ) - => Term tyname name uni fun a + => CostingPart uni fun + -> Term tyname name uni fun a -> m (UPLC.Term name uni fun a) -compileTerm t = do - simplOpts <- view coSimplifyOpts +compileTerm costingPart t = do + optimizeOpts <- view coOptimizeOpts builtinSemanticsVariant <- view coBuiltinSemanticsVariant let erased = eraseTerm t renamed <- rename erased - UPLC.simplifyTerm simplOpts builtinSemanticsVariant renamed + UPLC.optimizeTerm optimizeOpts builtinSemanticsVariant costingPart renamed -- | Compile a PLC program to UPLC, and optimize it. compileProgram :: ( Compiling m uni fun name a , MonadReader (CompilationOpts name fun a) m ) - => Program tyname name uni fun a + => CostingPart uni fun + -> Program tyname name uni fun a -> m (UPLC.Program name uni fun a) -compileProgram (Program a v t) = UPLC.Program a v <$> compileTerm t +compileProgram costingPart (Program a v t) = UPLC.Program a v <$> compileTerm costingPart t {-| Compile a PLC program to UPLC, and optimize it. This includes the compilation trace in the result. -} @@ -46,14 +49,16 @@ compileProgramWithTrace :: ( Compiling m uni fun name a , MonadReader (CompilationOpts name fun a) m ) - => Program tyname name uni fun a - -> m (UPLC.Program name uni fun a, UPLC.SimplifierTrace name uni fun a) -compileProgramWithTrace (Program a v t) = do - simplOpts <- view coSimplifyOpts + => CostingPart uni fun + -> Program tyname name uni fun a + -> m (UPLC.Program name uni fun a, UPLC.OptimizerTrace name uni fun a) +compileProgramWithTrace costingPart (Program a v t) = do + optimizeOpts <- view coOptimizeOpts builtinSemanticsVariant <- view coBuiltinSemanticsVariant let erased = eraseTerm t renamedProgram <- UPLC.Program a v <$> rename erased - UPLC.simplifyProgramWithTrace - simplOpts + UPLC.optimizeProgramWithTrace + optimizeOpts builtinSemanticsVariant + costingPart renamedProgram diff --git a/plutus-core/plutus-core/src/PlutusCore/Compiler/Opts.hs b/plutus-core/plutus-core/src/PlutusCore/Compiler/Opts.hs index 79e647a3ba8..99e1dc845bc 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Compiler/Opts.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Compiler/Opts.hs @@ -2,7 +2,7 @@ module PlutusCore.Compiler.Opts ( CompilationOpts (..) - , coSimplifyOpts + , coOptimizeOpts , coBuiltinSemanticsVariant , defaultCompilationOpts ) where @@ -10,10 +10,10 @@ module PlutusCore.Compiler.Opts import Control.Lens (makeLenses) import Data.Default.Class (Default (def)) import PlutusCore.Builtin.Meaning (BuiltinSemanticsVariant) -import UntypedPlutusCore.Simplify.Opts (SimplifyOpts, defaultSimplifyOpts) +import UntypedPlutusCore.Optimize.Opts (OptimizeOpts, defaultOptimizeOpts) data CompilationOpts name fun a = CompilationOpts - { _coSimplifyOpts :: SimplifyOpts name a + { _coOptimizeOpts :: OptimizeOpts name a , _coBuiltinSemanticsVariant :: BuiltinSemanticsVariant fun } @@ -22,6 +22,6 @@ $(makeLenses ''CompilationOpts) defaultCompilationOpts :: Default (BuiltinSemanticsVariant fun) => CompilationOpts name fun a defaultCompilationOpts = CompilationOpts - { _coSimplifyOpts = defaultSimplifyOpts + { _coOptimizeOpts = defaultOptimizeOpts , _coBuiltinSemanticsVariant = def } diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictLetRec/Tests/Lib.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictLetRec/Tests/Lib.hs index 81336af95a5..11f667eca97 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictLetRec/Tests/Lib.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictLetRec/Tests/Lib.hs @@ -91,7 +91,7 @@ compileTplcProgramOrFail -> m (UPLC.Program Name DefaultUni DefaultFun ()) compileTplcProgramOrFail plcProgram = handlePirErrorByFailing @SrcSpan =<< do - TPLC.compileProgram plcProgram + TPLC.compileProgram defaultBuiltinCostModelForTesting plcProgram & flip runReaderT TPLC.defaultCompilationOpts & runQuoteT & runExceptT diff --git a/plutus-core/testlib/PlutusCore/Test.hs b/plutus-core/testlib/PlutusCore/Test.hs index be8cdad0c95..9f393cc24c7 100644 --- a/plutus-core/testlib/PlutusCore/Test.hs +++ b/plutus-core/testlib/PlutusCore/Test.hs @@ -194,6 +194,7 @@ instance , TPLC.GEq uni , TPLC.Closed uni , TPLC.Everywhere uni Eq + , Default (CostingPart uni fun) ) => ToUPlc (TPLC.Program TPLC.TyName UPLC.Name uni fun ()) uni fun where @@ -201,7 +202,7 @@ instance pure . TPLC.runQuote . flip runReaderT TPLC.defaultCompilationOpts - . TPLC.compileProgram + . TPLC.compileProgram def instance ToUPlc (UPLC.Program UPLC.NamedDeBruijn uni fun ()) uni fun where toUPlc p = diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore.hs index cb6c7b785cd..4bfd66cbd72 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore.hs @@ -13,8 +13,8 @@ import UntypedPlutusCore.AstSize as Export import UntypedPlutusCore.Check.Scope as Export import UntypedPlutusCore.Core as Export import UntypedPlutusCore.DeBruijn as Export +import UntypedPlutusCore.Optimize as Export import UntypedPlutusCore.Parser as Parser (parseScoped) -import UntypedPlutusCore.Simplify as Export import UntypedPlutusCore.Subst as Export import PlutusCore.Default qualified as PLC diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Type.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Type.hs index 5bb131cd520..f1890dbaad9 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Type.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Type.hs @@ -34,6 +34,7 @@ import PlutusPrelude import Data.Vector import PlutusCore.Builtin qualified as TPLC import PlutusCore.Core qualified as TPLC +import PlutusCore.Evaluation.Machine.ExMemoryUsage (ExMemoryUsage (..)) import PlutusCore.MkPlc import PlutusCore.Name.Unique qualified as TPLC import Universe @@ -152,6 +153,10 @@ instance TPLC.HasConstant (Term name uni fun ()) where fromConstant = Constant () +-- See Note [ExMemoryUsage instances for non-constants]. +instance ExMemoryUsage (Term name uni fun ann) where + memoryUsage = Prelude.error "Internal error: 'memoryUsage' for UPLC 'Term' is not supposed to be forced" + type instance TPLC.HasUniques (Term name uni fun ann) = TPLC.HasUnique name TPLC.TermUnique type instance TPLC.HasUniques (Program name uni fun ann) = TPLC.HasUniques (Term name uni fun ann) diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize.hs new file mode 100644 index 00000000000..4f1f88a23ed --- /dev/null +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize.hs @@ -0,0 +1,223 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeApplications #-} + +module UntypedPlutusCore.Optimize + ( module Opts + , optimizeTerm + , optimizeProgram + , optimizeProgramWithTrace + , InlineHints (..) + , CseWhichSubterms (..) + , termOptimizer + , module UntypedPlutusCore.Transform.Optimizer + ) where + +import PlutusCore.Builtin +import PlutusCore.Compiler.Types +import PlutusCore.Default qualified as PLC +import PlutusCore.Default.Builtins +import PlutusCore.Name.Unique +import UntypedPlutusCore.Core.Type +import UntypedPlutusCore.Optimize.Opts as Opts +import UntypedPlutusCore.Transform.ApplyToCase (applyToCase) +import UntypedPlutusCore.Transform.CaseOfCase +import UntypedPlutusCore.Transform.CaseReduce +import UntypedPlutusCore.Transform.Cse +import UntypedPlutusCore.Transform.EvaluateBuiltins (certifiedBuiltinToFun, evaluateBuiltins) +import UntypedPlutusCore.Transform.FloatDelay (floatDelay) +import UntypedPlutusCore.Transform.ForceCaseDelay (forceCaseDelay) +import UntypedPlutusCore.Transform.ForceDelay (forceDelay) +import UntypedPlutusCore.Transform.Inline (InlineHints (..), inline) +import UntypedPlutusCore.Transform.LetFloatOut (letFloatOut) +import UntypedPlutusCore.Transform.Optimizer + +import Control.Monad +import Data.Either (isRight) +import Data.List as List (foldl') +import Data.Set qualified as Set +import Data.Typeable +import Data.Vector.Orphans () +import Universe (Some (..), ValueOf (..)) + +optimizeProgram + :: forall name uni fun m a + . Compiling m uni fun name a + => OptimizeOpts name a + -> BuiltinSemanticsVariant fun + -> CostingPart uni fun + -> Program name uni fun a + -> m (Program name uni fun a) +optimizeProgram opts builtinSemanticsVariant costingPart (Program a v t) = + Program a v <$> optimizeTerm opts builtinSemanticsVariant costingPart t + +optimizeProgramWithTrace + :: forall name uni fun m a + . Compiling m uni fun name a + => OptimizeOpts name a + -> BuiltinSemanticsVariant fun + -> CostingPart uni fun + -> Program name uni fun a + -> m (Program name uni fun a, OptimizerTrace name uni fun a) +optimizeProgramWithTrace opts builtinSemanticsVariant costingPart (Program a v t) = do + (result, trace) <- + runOptimizerT $ + termOptimizer opts builtinSemanticsVariant costingPart t + pure (Program a v result, trace) + +optimizeTerm + :: forall name uni fun m a + . Compiling m uni fun name a + => OptimizeOpts name a + -> BuiltinSemanticsVariant fun + -> CostingPart uni fun + -> Term name uni fun a + -> m (Term name uni fun a) +optimizeTerm opts builtinSemanticsVariant costingPart term = + evalOptimizerT $ termOptimizer opts builtinSemanticsVariant costingPart term + +termOptimizer + :: forall name uni fun m a + . Compiling m uni fun name a + => OptimizeOpts name a + -> BuiltinSemanticsVariant fun + -> CostingPart uni fun + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) +termOptimizer opts builtinSemanticsVariant costingPart = + simplifyNTimes (_ooMaxSimplifierIterations opts) + >=> runStage CseStage + >=> runStage ApplyToCaseStage + where + -- Run the simplifier @n@ times + simplifyNTimes + :: Int + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) + simplifyNTimes n = List.foldl' (>=>) pure $ map simplifyStep [1 .. n] + + -- Run CSE @n@ times, interleaved with the simplifier. + -- See Note [CSE] + cseNTimes + :: Int + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) + cseNTimes n = foldl' (>=>) pure $ concatMap (\i -> [cseStep i, simplifyStep i]) [1 .. n] + + -- generate simplification step + simplifyStep + :: Int + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) + simplifyStep _ = + runStage FloatDelayStage + >=> runStage ForceCaseDelayStage + >=> runStage LetFloatOutStage + >=> runStage ForceDelayStage + >=> runStage CaseOfCaseStage + >=> runStage CaseReduceStage + >=> runStage InlineStage + >=> runStage ConstantFoldStage + >=> runStage UncertifiedConstantFoldStage + + runStage stage' = + let certified = isRight stage' + withCertifiedOptsOnly action + | _ooCertifiedOptsOnly opts && not certified = pure + | otherwise = action + in case stage' of + FloatDelayStage -> + withCertifiedOptsOnly floatDelay + ForceCaseDelayStage -> + withCertifiedOptsOnly forceCaseDelay + ForceDelayStage -> + withCertifiedOptsOnly $ + case (eqT @uni @PLC.DefaultUni, eqT @fun @DefaultFun) of + (Just Refl, Just Refl) -> forceDelay builtinSemanticsVariant + _ -> pure + CaseOfCaseStage -> + withCertifiedOptsOnly caseOfCase' + CaseReduceStage -> + withCertifiedOptsOnly caseReduce + InlineStage -> + withCertifiedOptsOnly $ + inline + (_ooInlineCallsiteGrowth opts) + (_ooInlineConstants opts) + (_ooPreserveLogging opts) + (_ooInlineHints opts) + builtinSemanticsVariant + CseStage -> + withCertifiedOptsOnly $ cseNTimes cseTimes + ApplyToCaseStage -> + withCertifiedOptsOnly $ + if _ooApplyToCase opts then applyToCase else pure + LetFloatOutStage -> + withCertifiedOptsOnly letFloatOut + ConstantFoldStage -> + withCertifiedOptsOnly $ + case eqT @fun @DefaultFun of + Just Refl -> + evaluateBuiltins + (_ooPreserveLogging opts) + builtinSemanticsVariant + costingPart + (`Set.member` certifiedFuns) + (const True) + ConstantFoldStage + Nothing -> pure + UncertifiedConstantFoldStage -> + withCertifiedOptsOnly $ + case (eqT @fun @DefaultFun, eqT @uni @PLC.DefaultUni) of + (Just Refl, Just Refl) -> + evaluateBuiltins + (_ooPreserveLogging opts) + builtinSemanticsVariant + costingPart + (`Set.notMember` certifiedFuns) + defaultUniConstantIsSerializable + UncertifiedConstantFoldStage + (Just Refl, Nothing) -> + evaluateBuiltins + (_ooPreserveLogging opts) + builtinSemanticsVariant + costingPart + (`Set.notMember` certifiedFuns) + (const True) + UncertifiedConstantFoldStage + (Nothing, _) -> + evaluateBuiltins + (_ooPreserveLogging opts) + builtinSemanticsVariant + costingPart + (const True) + (const True) + UncertifiedConstantFoldStage + + caseOfCase' + :: Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) + caseOfCase' = case eqT @fun @DefaultFun of + Just Refl -> caseOfCase + Nothing -> pure + + cseStep + :: Int + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) + cseStep _ = + case (eqT @name @Name, eqT @uni @PLC.DefaultUni) of + (Just Refl, Just Refl) -> cse (_ooCseWhichSubterms opts) builtinSemanticsVariant + _ -> pure + + cseTimes = if _ooConservativeOpts opts then 0 else _ooMaxCseIterations opts + + certifiedFuns :: Set.Set DefaultFun + certifiedFuns = Set.fromList (map certifiedBuiltinToFun [minBound .. maxBound]) + +defaultUniConstantIsSerializable :: Some (ValueOf PLC.DefaultUni) -> Bool +defaultUniConstantIsSerializable c = case c of + Some (ValueOf PLC.DefaultUniBLS12_381_G1_Element _) -> False + Some (ValueOf PLC.DefaultUniBLS12_381_G2_Element _) -> False + Some (ValueOf PLC.DefaultUniBLS12_381_MlResult _) -> False + _ -> True diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize/Opts.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize/Opts.hs new file mode 100644 index 00000000000..84789e28984 --- /dev/null +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Optimize/Opts.hs @@ -0,0 +1,63 @@ +{-# LANGUAGE TemplateHaskell #-} + +module UntypedPlutusCore.Optimize.Opts + ( OptimizeOpts (..) + , ooApplyToCase + , ooMaxSimplifierIterations + , ooMaxCseIterations + , ooCseWhichSubterms + , ooInlineHints + , ooConservativeOpts + , ooInlineConstants + , ooInlineCallsiteGrowth + , ooPreserveLogging + , ooCertifiedOptsOnly + , defaultOptimizeOpts + , CseWhichSubterms (..) + ) where + +import Control.Lens.TH (makeLenses) +import Data.Default.Class + +import PlutusCore.Annotation (InlineHints (..)) +import PlutusCore.AstSize +import PlutusCore.Pretty +import Prettyprinter (viaShow) + +-- | Which subterms should be considered as candidates for CSE? +data CseWhichSubterms = AllSubterms | ExcludeWorkFree + deriving stock (Show, Read) + +instance Pretty CseWhichSubterms where + pretty = viaShow + +data OptimizeOpts name a = OptimizeOpts + { _ooMaxSimplifierIterations :: Int + , _ooMaxCseIterations :: Int + , _ooCseWhichSubterms :: CseWhichSubterms + , _ooConservativeOpts :: Bool + , _ooInlineHints :: InlineHints name a + , _ooInlineConstants :: Bool + , _ooInlineCallsiteGrowth :: AstSize + , _ooPreserveLogging :: Bool + , _ooApplyToCase :: Bool + , _ooCertifiedOptsOnly :: Bool + } + deriving stock (Show) + +$(makeLenses ''OptimizeOpts) + +defaultOptimizeOpts :: OptimizeOpts name a +defaultOptimizeOpts = + OptimizeOpts + { _ooMaxSimplifierIterations = 12 + , _ooMaxCseIterations = 4 + , _ooCseWhichSubterms = ExcludeWorkFree + , _ooConservativeOpts = False + , _ooInlineHints = def + , _ooInlineConstants = True + , _ooInlineCallsiteGrowth = 5 + , _ooPreserveLogging = True + , _ooApplyToCase = True + , _ooCertifiedOptsOnly = False + } diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify.hs deleted file mode 100644 index 3fc9331bcac..00000000000 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify.hs +++ /dev/null @@ -1,135 +0,0 @@ -{-# LANGUAGE GADTs #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeApplications #-} - -module UntypedPlutusCore.Simplify - ( module Opts - , simplifyTerm - , simplifyProgram - , simplifyProgramWithTrace - , InlineHints (..) - , CseWhichSubterms (..) - , termSimplifier - , module UntypedPlutusCore.Transform.Simplifier - ) where - -import PlutusCore.Compiler.Types -import PlutusCore.Default qualified as PLC -import PlutusCore.Default.Builtins -import PlutusCore.Name.Unique -import UntypedPlutusCore.Core.Type -import UntypedPlutusCore.Simplify.Opts as Opts -import UntypedPlutusCore.Transform.ApplyToCase (applyToCase) -import UntypedPlutusCore.Transform.CaseOfCase -import UntypedPlutusCore.Transform.CaseReduce -import UntypedPlutusCore.Transform.Cse -import UntypedPlutusCore.Transform.FloatDelay (floatDelay) -import UntypedPlutusCore.Transform.ForceCaseDelay (forceCaseDelay) -import UntypedPlutusCore.Transform.ForceDelay (forceDelay) -import UntypedPlutusCore.Transform.Inline (InlineHints (..), inline) -import UntypedPlutusCore.Transform.LetFloatOut (letFloatOut) -import UntypedPlutusCore.Transform.Simplifier - -import Control.Monad -import Data.List as List (foldl') -import Data.Typeable -import Data.Vector.Orphans () - -simplifyProgram - :: forall name uni fun m a - . Compiling m uni fun name a - => SimplifyOpts name a - -> BuiltinSemanticsVariant fun - -> Program name uni fun a - -> m (Program name uni fun a) -simplifyProgram opts builtinSemanticsVariant (Program a v t) = - Program a v <$> simplifyTerm opts builtinSemanticsVariant t - -simplifyProgramWithTrace - :: forall name uni fun m a - . Compiling m uni fun name a - => SimplifyOpts name a - -> BuiltinSemanticsVariant fun - -> Program name uni fun a - -> m (Program name uni fun a, SimplifierTrace name uni fun a) -simplifyProgramWithTrace opts builtinSemanticsVariant (Program a v t) = do - (result, trace) <- - runSimplifierT $ - termSimplifier opts builtinSemanticsVariant t - pure (Program a v result, trace) - -simplifyTerm - :: forall name uni fun m a - . Compiling m uni fun name a - => SimplifyOpts name a - -> BuiltinSemanticsVariant fun - -> Term name uni fun a - -> m (Term name uni fun a) -simplifyTerm opts builtinSemanticsVariant term = - evalSimplifierT $ termSimplifier opts builtinSemanticsVariant term - -termSimplifier - :: forall name uni fun m a - . Compiling m uni fun name a - => SimplifyOpts name a - -> BuiltinSemanticsVariant fun - -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) -termSimplifier opts builtinSemanticsVariant = - simplifyNTimes (_soMaxSimplifierIterations opts) - >=> cseNTimes cseTimes - >=> (if _soApplyToCase opts then applyToCase else pure) - where - -- Run the simplifier @n@ times - simplifyNTimes - :: Int - -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) - simplifyNTimes n = List.foldl' (>=>) pure $ map simplifyStep [1 .. n] - - -- Run CSE @n@ times, interleaved with the simplifier. - -- See Note [CSE] - cseNTimes - :: Int - -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) - cseNTimes n = foldl' (>=>) pure $ concatMap (\i -> [cseStep i, simplifyStep i]) [1 .. n] - - -- generate simplification step - simplifyStep - :: Int - -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) - simplifyStep _ = - floatDelay - >=> forceCaseDelay - >=> letFloatOut - >=> case (eqT @uni @PLC.DefaultUni, eqT @fun @DefaultFun) of - (Just Refl, Just Refl) -> forceDelay builtinSemanticsVariant - _ -> pure - >=> caseOfCase' - >=> caseReduce - >=> inline - (_soInlineCallsiteGrowth opts) - (_soInlineConstants opts) - (_soPreserveLogging opts) - (_soInlineHints opts) - builtinSemanticsVariant - - caseOfCase' - :: Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) - caseOfCase' = case eqT @fun @DefaultFun of - Just Refl -> caseOfCase - Nothing -> pure - - cseStep - :: Int - -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) - cseStep _ = - case (eqT @name @Name, eqT @uni @PLC.DefaultUni) of - (Just Refl, Just Refl) -> cse (_soCseWhichSubterms opts) builtinSemanticsVariant - _ -> pure - - cseTimes = if _soConservativeOpts opts then 0 else _soMaxCseIterations opts diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify/Opts.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify/Opts.hs deleted file mode 100644 index ff78d22fe86..00000000000 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Simplify/Opts.hs +++ /dev/null @@ -1,51 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} - -module UntypedPlutusCore.Simplify.Opts - ( SimplifyOpts (..) - , soApplyToCase - , soMaxSimplifierIterations - , soMaxCseIterations - , soCseWhichSubterms - , soInlineHints - , soConservativeOpts - , soInlineConstants - , soInlineCallsiteGrowth - , soPreserveLogging - , defaultSimplifyOpts - ) where - -import Control.Lens.TH (makeLenses) -import Data.Default.Class - -import PlutusCore.Annotation (InlineHints (..)) -import PlutusCore.AstSize -import UntypedPlutusCore.Transform.Cse (CseWhichSubterms (..)) - -data SimplifyOpts name a = SimplifyOpts - { _soMaxSimplifierIterations :: Int - , _soMaxCseIterations :: Int - , _soCseWhichSubterms :: CseWhichSubterms - , _soConservativeOpts :: Bool - , _soInlineHints :: InlineHints name a - , _soInlineConstants :: Bool - , _soInlineCallsiteGrowth :: AstSize - , _soPreserveLogging :: Bool - , _soApplyToCase :: Bool - } - deriving stock (Show) - -$(makeLenses ''SimplifyOpts) - -defaultSimplifyOpts :: SimplifyOpts name a -defaultSimplifyOpts = - SimplifyOpts - { _soMaxSimplifierIterations = 12 - , _soMaxCseIterations = 4 - , _soCseWhichSubterms = ExcludeWorkFree - , _soConservativeOpts = False - , _soInlineHints = def - , _soInlineConstants = True - , _soInlineCallsiteGrowth = 5 - , _soPreserveLogging = True - , _soApplyToCase = True - } diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ApplyToCase.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ApplyToCase.hs index f699f52cb51..3e6f59a340f 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ApplyToCase.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ApplyToCase.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE PatternSynonyms #-} + {-| Transform multi-argument applications into case-constr form. @@ -16,10 +18,10 @@ module UntypedPlutusCore.Transform.ApplyToCase (applyToCase) where import Control.Lens (over) import Data.Vector qualified as V import UntypedPlutusCore.Core -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (ApplyToCase) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern ApplyToCaseStage ) minArgs :: Int @@ -29,10 +31,10 @@ minArgs = 3 applyToCase :: Monad m => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) applyToCase term = do let result = processTerm term - recordSimplification term ApplyToCase result + recordOptimization term ApplyToCaseStage result pure result processTerm :: Term name uni fun a -> Term name uni fun a diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs index 2c20e0ba42c..5e591852d23 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} @@ -42,10 +43,10 @@ import PlutusCore.Builtin (CaseBuiltin (..)) import PlutusCore.MkPlc (mkIterApp) import UntypedPlutusCore.Core import UntypedPlutusCore.Transform.CaseReduce qualified as CaseReduce -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (CaseOfCase) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern CaseOfCaseStage ) import Control.Lens @@ -60,10 +61,10 @@ caseOfCase , uni `PLC.Everywhere` Eq ) => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) caseOfCase term = do let result = transformOf termSubterms processTerm term - recordSimplification term CaseOfCase result + recordOptimization term CaseOfCaseStage result return result processTerm diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs index d907688e33c..9a3a53d75d2 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TupleSections #-} module UntypedPlutusCore.Transform.CaseReduce @@ -12,19 +13,19 @@ import Data.Vector qualified as V import PlutusCore.Builtin (CaseBuiltin (..)) import PlutusCore.MkPlc import UntypedPlutusCore.Core -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (CaseReduce) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern CaseReduceStage ) caseReduce :: (Monad m, CaseBuiltin uni) => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) caseReduce term = do let result = transformOf termSubterms processTerm term - recordSimplification term CaseReduce result + recordOptimization term CaseReduceStage result return result processTerm :: CaseBuiltin uni => Term name uni fun a -> Term name uni fun a diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Certify/Trace.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Certify/Trace.hs index e3c796e7b1d..e2be25d6e97 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Certify/Trace.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Certify/Trace.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} module UntypedPlutusCore.Transform.Certify.Trace where @@ -9,42 +10,154 @@ import UntypedPlutusCore.Transform.Certify.Hints qualified as Certify import Control.DeepSeq import GHC.Generics -data SimplifierStage +{-| Datatype which represents optimization passes which are also +certified. + +This means that these passes are formalized as part of the certifier, +and adding a new pass constructor to this type means that it is expected +the pass will be also certified in the same PR. -} +data CertifiedOptStage = FloatDelay | ForceDelay | ForceCaseDelay - | CaseOfCase | CaseReduce | Inline | CSE | ApplyToCase + | ConstantFold + deriving stock (Show, Generic) + deriving anyclass (NFData) + +{-| Datatype which represents optimization passes which are not yet +certified. + +IMPORTANT: if you add a new pass, or modify an existing pass, without +also modifying the certifier in the same PR, you must add/move its +corresponding constructor to this type. Please also open an issue +at https://github.com/IntersectMBO/plutus/issues. -} +data UncertifiedOptStage + = CaseOfCase | LetFloatOut - | Unknown + | UncertifiedConstantFold deriving stock (Show, Generic) deriving anyclass (NFData) -data Simplification name uni fun a - = Simplification +type OptStage = Either UncertifiedOptStage CertifiedOptStage + +pattern FloatDelayStage :: OptStage +pattern FloatDelayStage = Right FloatDelay + +pattern ForceDelayStage :: OptStage +pattern ForceDelayStage = Right ForceDelay + +pattern ForceCaseDelayStage :: OptStage +pattern ForceCaseDelayStage = Right ForceCaseDelay + +pattern CaseReduceStage :: OptStage +pattern CaseReduceStage = Right CaseReduce + +pattern InlineStage :: OptStage +pattern InlineStage = Right Inline + +pattern CseStage :: OptStage +pattern CseStage = Right CSE + +pattern ApplyToCaseStage :: OptStage +pattern ApplyToCaseStage = Right ApplyToCase + +pattern CaseOfCaseStage :: OptStage +pattern CaseOfCaseStage = Left CaseOfCase + +pattern LetFloatOutStage :: OptStage +pattern LetFloatOutStage = Left LetFloatOut + +pattern ConstantFoldStage :: OptStage +pattern ConstantFoldStage = Right ConstantFold + +pattern UncertifiedConstantFoldStage :: OptStage +pattern UncertifiedConstantFoldStage = Left UncertifiedConstantFold + +{-# COMPLETE + FloatDelayStage + , ForceDelayStage + , ForceCaseDelayStage + , CaseReduceStage + , InlineStage + , CseStage + , ApplyToCaseStage + , ConstantFoldStage + , CaseOfCaseStage + , LetFloatOutStage + , UncertifiedConstantFoldStage + #-} + +{-| The set of 'DefaultFun' builtins that can be constant-folded in the +certified optimization stage, i.e. those whose Agda implementations use +only native Agda operations (no postulated functions). + +This type is FFI-linked to the Agda certifier via a @COMPILE GHC@ pragma. +Adding a constructor here requires adding the corresponding native Agda +implementation in the certifier; the Agda compiler will reject the build if +the two types diverge in constructor count or order. -} +data CertifiedBuiltin + = CertAddInteger + | CertSubtractInteger + | CertMultiplyInteger + | CertDivideInteger + | CertQuotientInteger + | CertRemainderInteger + | CertModInteger + | CertEqualsInteger + | CertLessThanInteger + | CertLessThanEqualsInteger + | CertIfThenElse + | CertChooseUnit + | CertFstPair + | CertSndPair + | CertChooseList + | CertMkCons + | CertHeadList + | CertTailList + | CertNullList + | CertDropList + | CertChooseData + | CertConstrData + | CertMapData + | CertListData + | CertIData + | CertUnConstrData + | CertUnMapData + | CertUnListData + | CertUnIData + | CertEqualsData + | CertMkPairData + | CertMkNilData + | CertMkNilPairData + deriving stock (Show, Eq, Ord, Enum, Bounded, Generic) + deriving anyclass (NFData) + +data Optimization name uni fun a + = Optimization { beforeAST :: Term name uni fun a - , stage :: SimplifierStage + , stage :: OptStage , hints :: Certify.Hints , afterAST :: Term name uni fun a } -- TODO2: we probably don't want this in memory so after MVP -- we should consider serializing this to disk -newtype SimplifierTrace name uni fun a - = SimplifierTrace - { simplifierTrace - :: [Simplification name uni fun a] +newtype OptimizerTrace name uni fun a + = OptimizerTrace + { optimizerTrace + :: [Optimization name uni fun a] } -initSimplifierTrace :: SimplifierTrace name uni fun a -initSimplifierTrace = SimplifierTrace [] +initOptimizerTrace :: OptimizerTrace name uni fun a +initOptimizerTrace = OptimizerTrace [] -allASTs :: SimplifierTrace name uni fun a -> [Term name uni fun a] +allASTs :: OptimizerTrace name uni fun a -> [Term name uni fun a] allASTs = \case - SimplifierTrace [] -> [] - SimplifierTrace xs@(x : _) -> - -- `SimplifierTrace` is in reverse order: the first item is the last pass run. + OptimizerTrace [] -> [] + OptimizerTrace xs@(x : _) -> + -- `OptimizerTrace` is in reverse order: the first item is the last pass run. afterAST x : map beforeAST xs diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Cse.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Cse.hs index 43a5167962e..f61c4355129 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Cse.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Cse.hs @@ -1,22 +1,22 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} -module UntypedPlutusCore.Transform.Cse (cse, CseWhichSubterms (..)) where +module UntypedPlutusCore.Transform.Cse (cse) where import PlutusCore (MonadQuote, Name, Rename, freshName, rename) import PlutusCore.Builtin (ToBuiltinMeaning (BuiltinSemanticsVariant)) -import PlutusCore.Pretty -import Prettyprinter (viaShow) import UntypedPlutusCore.AstSize (termAstSize) import UntypedPlutusCore.Core +import UntypedPlutusCore.Optimize.Opts (CseWhichSubterms (..)) import UntypedPlutusCore.Purity (isWorkFree) -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (CSE) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern CseStage ) import Control.Arrow ((>>>)) @@ -205,13 +205,6 @@ type Path = [Int] isAncestorOrSelf :: Path -> Path -> Bool isAncestorOrSelf = isSuffixOf --- | Which subterms should be considered as candidates? -data CseWhichSubterms = AllSubterms | ExcludeWorkFree - deriving stock (Show, Read) - -instance Pretty CseWhichSubterms where - pretty = viaShow - data CseCandidate uni fun ann = CseCandidate { ccFreshName :: Name , ccTerm :: Term Name uni fun () @@ -229,7 +222,7 @@ cse => CseWhichSubterms -> BuiltinSemanticsVariant fun -> Term Name uni fun ann - -> SimplifierT Name uni fun ann m (Term Name uni fun ann) + -> OptimizerT Name uni fun ann m (Term Name uni fun ann) cse whichSubterms builtinSemanticsVariant t0 = do t <- rename t0 let annotated = annotate t @@ -244,7 +237,7 @@ cse whichSubterms builtinSemanticsVariant t0 = do . Map.elems $ countOccs whichSubterms builtinSemanticsVariant annotated result <- mkCseTerm commonSubexprs annotated - recordSimplification t0 CSE result + recordOptimization t0 CseStage result return result -- | The second pass. See Note [CSE]. diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/EvaluateBuiltins.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/EvaluateBuiltins.hs new file mode 100644 index 00000000000..ee7d95079b1 --- /dev/null +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/EvaluateBuiltins.hs @@ -0,0 +1,158 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ViewPatterns #-} + +{-| A pass that evaluates fully-applied builtin applications in the program. +This functions as a generic constant-folding pass. -} +module UntypedPlutusCore.Transform.EvaluateBuiltins + ( evaluateBuiltins + , certifiedBuiltinToFun + ) where + +import PlutusCore.Builtin +import PlutusCore.Default.Builtins (DefaultFun (..)) +import UntypedPlutusCore.Core.Plated (termSubterms) +import UntypedPlutusCore.Core.Type +import UntypedPlutusCore.Transform.Certify.Trace qualified as Trace +import UntypedPlutusCore.Transform.Optimizer + +import Control.Lens (transformOf) +import Data.Functor (void) +import Universe (Some (..), ValueOf (..)) + +{-| Application context for UPLC terms. Unlike the PIR @AppContext@, there are +no type applications, so 'Force' takes the place of 'TypeAppContext'. -} +data AppContext name uni fun a + = TermAppContext (Term name uni fun a) a (AppContext name uni fun a) + | ForceContext a (AppContext name uni fun a) + | AppContextEnd + +{-| Split a term into its head and the sequence of 'Apply'/'Force' wrappers +surrounding it. This handles 'Force' in addition to 'Apply', unlike the +exported 'splitApplication'. -} +splitBuiltinApplication + :: Term name uni fun a + -> (Term name uni fun a, AppContext name uni fun a) +splitBuiltinApplication = go AppContextEnd + where + go ctx = \case + Apply ann fun arg -> go (TermAppContext arg ann ctx) fun + Force ann t -> go (ForceContext ann ctx) t + t -> (t, ctx) + +{-| Evaluate fully-applied builtin applications. + +The @shouldFold@ predicate determines which builtins may be folded; use +'certifiedBuiltins' for the certified subset or @const True@ for all builtins. + +The @isSerializableConstant@ predicate guards against introducing constants +that cannot be flat-encoded (e.g. BLS12-381 group elements). +See Note [Unserializable constants] in PlutusIR.Analysis.Builtins. -} +evaluateBuiltins + :: forall name uni fun m a + . ( Monad m + , ToBuiltinMeaning uni fun + , Typeable name + ) + => Bool + -- ^ If 'True', do not fold builtins that emit logs (e.g. @trace@). + -> BuiltinSemanticsVariant fun + -> CostingPart uni fun + -> (fun -> Bool) + -- ^ Which builtins to fold. + -> (Some (ValueOf uni) -> Bool) + {-^ Whether a constant produced by folding is serializable. Return 'False' + to prevent the fold from introducing an unserializable constant into the + program (e.g. BLS12-381 group elements). -} + -> Trace.OptStage + -> Term name uni fun a + -> OptimizerT name uni fun a m (Term name uni fun a) +evaluateBuiltins preserveLogging semVar costModel shouldFold isSerializableConstant optStage term = do + let result = transformOf termSubterms processTerm term + recordOptimization term optStage result + pure result + where + eval + :: BuiltinRuntime (Term name uni fun ()) + -> AppContext name uni fun a + -> Maybe (Term name uni fun ()) + eval (BuiltinCostedResult _ getFXs) AppContextEnd = + case getFXs of + BuiltinSuccess y -> Just y + -- Leave terms that produce logs if we're asked to preserve logging + -- behaviour (e.g. `trace "hello" x` in certified mode). + BuiltinSuccessWithLogs _ y -> if preserveLogging then Nothing else Just y + -- Evaluation failure (e.g. divideInteger 1 0) – leave unchanged. + BuiltinFailure {} -> Nothing + eval (BuiltinExpectArgument toRuntime) (TermAppContext arg _ ctx) = + eval (toRuntime $ void arg) ctx + eval (BuiltinExpectForce runtime) (ForceContext _ ctx) = + eval runtime ctx + -- Argument mismatch (including under-application) – leave unchanged. + eval _ _ = Nothing + + termIsSerializable :: Term name uni fun () -> Bool + termIsSerializable = \case + Constant _ c -> isSerializableConstant c + Var {} -> True + Builtin {} -> True + Error {} -> True + LamAbs _ _ body -> termIsSerializable body + Delay _ body -> termIsSerializable body + Force _ body -> termIsSerializable body + Apply _ f arg -> termIsSerializable f && termIsSerializable arg + Constr _ _ args -> all termIsSerializable args + Case _ scrut alts -> termIsSerializable scrut && all termIsSerializable alts + + processTerm :: Term name uni fun a -> Term name uni fun a + processTerm t = case splitBuiltinApplication t of + (Builtin x bn, argCtx) + | shouldFold bn -> + let runtime = toBuiltinRuntime costModel (toBuiltinMeaning semVar bn) + in case eval runtime argCtx of + -- Replace all annotations in the result with the annotation of + -- the Builtin node (see the analogous note in PIR.EvaluateBuiltins). + -- Guard against introducing unserializable constants (e.g. BLS + -- group elements); see Note [Unserializable constants]. + Just t' | termIsSerializable t' -> x <$ t' + _ -> t + _ -> t + +{-| Map each 'Trace.CertifiedBuiltin' to its corresponding 'DefaultFun'. +This is the single authoritative mapping between the FFI-linked +'Trace.CertifiedBuiltin' type (shared with the Agda certifier) and +the Haskell 'DefaultFun' enum. -} +certifiedBuiltinToFun :: Trace.CertifiedBuiltin -> DefaultFun +certifiedBuiltinToFun = \case + Trace.CertAddInteger -> AddInteger + Trace.CertSubtractInteger -> SubtractInteger + Trace.CertMultiplyInteger -> MultiplyInteger + Trace.CertDivideInteger -> DivideInteger + Trace.CertQuotientInteger -> QuotientInteger + Trace.CertRemainderInteger -> RemainderInteger + Trace.CertModInteger -> ModInteger + Trace.CertEqualsInteger -> EqualsInteger + Trace.CertLessThanInteger -> LessThanInteger + Trace.CertLessThanEqualsInteger -> LessThanEqualsInteger + Trace.CertIfThenElse -> IfThenElse + Trace.CertChooseUnit -> ChooseUnit + Trace.CertFstPair -> FstPair + Trace.CertSndPair -> SndPair + Trace.CertChooseList -> ChooseList + Trace.CertMkCons -> MkCons + Trace.CertHeadList -> HeadList + Trace.CertTailList -> TailList + Trace.CertNullList -> NullList + Trace.CertDropList -> DropList + Trace.CertChooseData -> ChooseData + Trace.CertConstrData -> ConstrData + Trace.CertMapData -> MapData + Trace.CertListData -> ListData + Trace.CertIData -> IData + Trace.CertUnConstrData -> UnConstrData + Trace.CertUnMapData -> UnMapData + Trace.CertUnListData -> UnListData + Trace.CertUnIData -> UnIData + Trace.CertEqualsData -> EqualsData + Trace.CertMkPairData -> MkPairData + Trace.CertMkNilData -> MkNilData + Trace.CertMkNilPairData -> MkNilPairData diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/FloatDelay.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/FloatDelay.hs index f30e193efec..f2356586fab 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/FloatDelay.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/FloatDelay.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-| The Float Delay optimization floats `Delay` from arguments into function bodies, if possible. It turns @(\n -> ...Force n...Force n...) (Delay arg)@ into @@ -60,10 +61,10 @@ import PlutusCore.Name.UniqueMap qualified as UMap import PlutusCore.Name.UniqueSet qualified as USet import UntypedPlutusCore.Core.Plated (termSubterms) import UntypedPlutusCore.Core.Type (Term (..)) -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (FloatDelay) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern FloatDelayStage ) import Control.Lens (forOf, forOf_, transformOf) @@ -75,12 +76,12 @@ floatDelay , PLC.HasUnique name PLC.TermUnique ) => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) floatDelay term = do result <- PLC.rename term >>= \t -> pure . uncurry (flip simplifyBodies) $ simplifyArgs (unforcedVars t) t - recordSimplification term FloatDelay result + recordOptimization term FloatDelayStage result return result {-| First pass. Returns the names of all variables, at least one occurrence diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceCaseDelay.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceCaseDelay.hs index 4b8e4be9133..a9db82bff5e 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceCaseDelay.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceCaseDelay.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {- Note [Applying force to delays in case branches] @@ -35,10 +36,10 @@ module UntypedPlutusCore.Transform.ForceCaseDelay where import UntypedPlutusCore.Core -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (ForceCaseDelay) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern ForceCaseDelayStage ) import Control.Lens @@ -46,10 +47,10 @@ import Control.Lens forceCaseDelay :: Monad m => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) forceCaseDelay term = do let result = transformOf termSubterms processTerm term - recordSimplification term ForceCaseDelay result + recordOptimization term ForceCaseDelayStage result return result processTerm :: Term name uni fun a -> Term name uni fun a diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceDelay.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceDelay.hs index 677cca24e83..8a18e700c66 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceDelay.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/ForceDelay.hs @@ -141,6 +141,7 @@ if both @x@ and @y@ are pure and work-free. -} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} @@ -154,10 +155,10 @@ import PlutusCore.Default (DefaultFun (IfThenElse), DefaultUni) import PlutusCore.MkPlc (mkIterApp) import UntypedPlutusCore.Core import UntypedPlutusCore.Purity (isPure, isWorkFree) -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (ForceDelay) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern ForceDelayStage ) import Control.Lens (transformOf) @@ -170,10 +171,10 @@ forceDelay :: (uni ~ DefaultUni, fun ~ DefaultFun, Monad m) => BuiltinSemanticsVariant fun -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) forceDelay semVar term = do let result = transformOf termSubterms (processTerm semVar) term - recordSimplification term ForceDelay result + recordOptimization term ForceDelayStage result return result {-| Checks whether the term is of the right form, and "pushes" diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Inline.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Inline.hs index 79ded2e02dd..8bbe1b300a9 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Inline.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Inline.hs @@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} @@ -69,10 +70,10 @@ import UntypedPlutusCore.Purity import UntypedPlutusCore.Rename () import UntypedPlutusCore.Subst (termSubstNamesM) import UntypedPlutusCore.Transform.Certify.Hints qualified as CertifierHints -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (Inline) - , SimplifierT - , recordSimplificationWithHints +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimizationWithHints + , pattern InlineStage ) {- Note [Differences from PIR inliner] @@ -214,7 +215,7 @@ inline -> InlineHints name a -> PLC.BuiltinSemanticsVariant fun -> Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) inline callsiteGrowth inlineConstants @@ -236,7 +237,11 @@ inline , _iiPreserveLogging = preserveLogging } let result = snd <$> decoratedResult - recordSimplificationWithHints (CertifierHints.Inline (mkHints decoratedResult)) t Inline result + recordOptimizationWithHints + (CertifierHints.Inline (mkHints decoratedResult)) + t + InlineStage + result return result -- See Note [Differences from PIR inliner] 3 diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/LetFloatOut.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/LetFloatOut.hs index 11ddaed1633..150343d2a22 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/LetFloatOut.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/LetFloatOut.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} {-| Floats immediately-applied lambdas ("let bindings") outwards, as long as doing so cannot cause any expression to be evaluated more than before. @@ -23,10 +24,10 @@ module UntypedPlutusCore.Transform.LetFloatOut (letFloatOut) where import PlutusCore qualified as PLC import UntypedPlutusCore.Core -import UntypedPlutusCore.Transform.Simplifier - ( SimplifierStage (LetFloatOut) - , SimplifierT - , recordSimplification +import UntypedPlutusCore.Transform.Optimizer + ( OptimizerT + , recordOptimization + , pattern LetFloatOutStage ) import Control.Lens (transformOf) @@ -36,10 +37,10 @@ letFloatOut , PLC.Rename (Term name uni fun a) ) => Term name uni fun a - -> SimplifierT name uni fun a m (Term name uni fun a) + -> OptimizerT name uni fun a m (Term name uni fun a) letFloatOut term = do result <- PLC.rename term >>= pure . transformOf termSubterms processTerm - recordSimplification term LetFloatOut result + recordOptimization term LetFloatOutStage result pure result processTerm :: Term name uni fun a -> Term name uni fun a diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Optimizer.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Optimizer.hs new file mode 100644 index 00000000000..a5ba6037419 --- /dev/null +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Optimizer.hs @@ -0,0 +1,90 @@ +{-# LANGUAGE PatternSynonyms #-} + +module UntypedPlutusCore.Transform.Optimizer + ( OptimizerT (..) + , Trace.OptStage + , pattern Trace.FloatDelayStage + , pattern Trace.ForceDelayStage + , pattern Trace.ForceCaseDelayStage + , pattern Trace.CaseReduceStage + , pattern Trace.InlineStage + , pattern Trace.CseStage + , pattern Trace.ApplyToCaseStage + , pattern Trace.CaseOfCaseStage + , pattern Trace.LetFloatOutStage + , pattern Trace.ConstantFoldStage + , pattern Trace.UncertifiedConstantFoldStage + , Trace.OptimizerTrace (..) + , Trace.Optimization (..) + , runOptimizerT + , evalOptimizerT + , execOptimizerT + , Optimizer + , runOptimizer + , evalOptimizer + , execOptimizer + , Trace.initOptimizerTrace + , recordOptimization + , recordOptimizationWithHints + ) where + +import Control.Monad.State (MonadTrans, StateT) +import Control.Monad.State qualified as State + +import Control.Monad.Identity (Identity, runIdentity) +import PlutusCore.Quote (MonadQuote) +import UntypedPlutusCore.Core.Type (Term) +import UntypedPlutusCore.Transform.Certify.Hints qualified as Hints +import UntypedPlutusCore.Transform.Certify.Trace qualified as Trace + +newtype OptimizerT name uni fun ann m a + = OptimizerT + { getOptimizerT :: StateT (Trace.OptimizerTrace name uni fun ann) m a + } + deriving newtype (Functor, Applicative, Monad, MonadTrans) + +instance MonadQuote m => MonadQuote (OptimizerT name uni fun ann m) + +runOptimizerT + :: OptimizerT name uni fun ann m a + -> m (a, Trace.OptimizerTrace name uni fun ann) +runOptimizerT = flip State.runStateT Trace.initOptimizerTrace . getOptimizerT + +evalOptimizerT + :: Monad m => OptimizerT name uni fun ann m a -> m a +evalOptimizerT = flip State.evalStateT Trace.initOptimizerTrace . getOptimizerT + +execOptimizerT + :: Monad m => OptimizerT name uni fun ann m a -> m (Trace.OptimizerTrace name uni fun ann) +execOptimizerT = flip State.execStateT Trace.initOptimizerTrace . getOptimizerT + +type Optimizer name uni fun ann = OptimizerT name uni fun ann Identity + +runOptimizer :: Optimizer name uni fun ann a -> (a, Trace.OptimizerTrace name uni fun ann) +runOptimizer = runIdentity . runOptimizerT + +evalOptimizer :: Optimizer name uni fun ann a -> a +evalOptimizer = runIdentity . evalOptimizerT + +execOptimizer :: Optimizer name uni fun ann a -> Trace.OptimizerTrace name uni fun ann +execOptimizer = runIdentity . execOptimizerT + +recordOptimization + :: Monad m + => Term name uni fun a + -> Trace.OptStage + -> Term name uni fun a + -> OptimizerT name uni fun a m () +recordOptimization = recordOptimizationWithHints Hints.NoHints + +recordOptimizationWithHints + :: Monad m + => Hints.Hints + -> Term name uni fun a + -> Trace.OptStage + -> Term name uni fun a + -> OptimizerT name uni fun a m () +recordOptimizationWithHints hints before stage after = + let optimization = Trace.Optimization before stage hints after + in OptimizerT . State.modify' $ \st -> + st {Trace.optimizerTrace = optimization : Trace.optimizerTrace st} diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Simplifier.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Simplifier.hs deleted file mode 100644 index 5d907ff5ea0..00000000000 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/Simplifier.hs +++ /dev/null @@ -1,77 +0,0 @@ -module UntypedPlutusCore.Transform.Simplifier - ( SimplifierT (..) - , Trace.SimplifierTrace (..) - , Trace.SimplifierStage (..) - , Trace.Simplification (..) - , runSimplifierT - , evalSimplifierT - , execSimplifierT - , Simplifier - , runSimplifier - , evalSimplifier - , execSimplifier - , Trace.initSimplifierTrace - , recordSimplification - , recordSimplificationWithHints - ) where - -import Control.Monad.State (MonadTrans, StateT) -import Control.Monad.State qualified as State - -import Control.Monad.Identity (Identity, runIdentity) -import PlutusCore.Quote (MonadQuote) -import UntypedPlutusCore.Core.Type (Term) -import UntypedPlutusCore.Transform.Certify.Hints qualified as Hints -import UntypedPlutusCore.Transform.Certify.Trace qualified as Trace - -newtype SimplifierT name uni fun ann m a - = SimplifierT - { getSimplifierT :: StateT (Trace.SimplifierTrace name uni fun ann) m a - } - deriving newtype (Functor, Applicative, Monad, MonadTrans) - -instance MonadQuote m => MonadQuote (SimplifierT name uni fun ann m) - -runSimplifierT - :: SimplifierT name uni fun ann m a - -> m (a, Trace.SimplifierTrace name uni fun ann) -runSimplifierT = flip State.runStateT Trace.initSimplifierTrace . getSimplifierT - -evalSimplifierT - :: Monad m => SimplifierT name uni fun ann m a -> m a -evalSimplifierT = flip State.evalStateT Trace.initSimplifierTrace . getSimplifierT - -execSimplifierT - :: Monad m => SimplifierT name uni fun ann m a -> m (Trace.SimplifierTrace name uni fun ann) -execSimplifierT = flip State.execStateT Trace.initSimplifierTrace . getSimplifierT - -type Simplifier name uni fun ann = SimplifierT name uni fun ann Identity - -runSimplifier :: Simplifier name uni fun ann a -> (a, Trace.SimplifierTrace name uni fun ann) -runSimplifier = runIdentity . runSimplifierT - -evalSimplifier :: Simplifier name uni fun ann a -> a -evalSimplifier = runIdentity . evalSimplifierT - -execSimplifier :: Simplifier name uni fun ann a -> Trace.SimplifierTrace name uni fun ann -execSimplifier = runIdentity . execSimplifierT - -recordSimplification - :: Monad m - => Term name uni fun a - -> Trace.SimplifierStage - -> Term name uni fun a - -> SimplifierT name uni fun a m () -recordSimplification = recordSimplificationWithHints Hints.NoHints - -recordSimplificationWithHints - :: Monad m - => Hints.Hints - -> Term name uni fun a - -> Trace.SimplifierStage - -> Term name uni fun a - -> SimplifierT name uni fun a m () -recordSimplificationWithHints hints before stage after = - let simplification = Trace.Simplification before stage hints after - in SimplifierT . State.modify' $ \st -> - st {Trace.simplifierTrace = simplification : Trace.simplifierTrace st} diff --git a/plutus-core/untyped-plutus-core/test/Spec.hs b/plutus-core/untyped-plutus-core/test/Spec.hs index 0accb0b0c75..5fb2951d184 100644 --- a/plutus-core/untyped-plutus-core/test/Spec.hs +++ b/plutus-core/untyped-plutus-core/test/Spec.hs @@ -17,6 +17,7 @@ import Flat.Spec (test_flat) import Generators.Spec (test_parsing) import Scoping.Spec (test_names) import Transform.CaseOfCase.Spec (test_caseOfCase) +import Transform.EvaluateBuiltins.Spec (test_evaluateBuiltins) import Transform.Inline.Spec (test_inline) import Transform.Simplify.Spec (test_simplify) @@ -32,6 +33,7 @@ main = do , test_builtins , test_budget , test_caseOfCase + , test_evaluateBuiltins , test_inline , test_golden , test_tallying diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.certifier-hints new file mode 100644 index 00000000000..434bc0a0ebc --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.certifier-hints @@ -0,0 +1,35 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.uplc new file mode 100644 index 00000000000..e440e5c8425 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAddInteger.golden.uplc @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.certifier-hints new file mode 100644 index 00000000000..434bc0a0ebc --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.certifier-hints @@ -0,0 +1,35 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.uplc new file mode 100644 index 00000000000..5939c0d3aa2 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteString.golden.uplc @@ -0,0 +1 @@ +#61626364 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.certifier-hints new file mode 100644 index 00000000000..c5b20633dfb --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.certifier-hints @@ -0,0 +1,26 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Right ForceDelay) -- +NoHints + +-- Certifier hints #4 (Right CaseReduce) -- +NoHints + +-- Certifier hints #5 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlCon + InlCon + + +-- Certifier hints #6 (Right ConstantFold) -- +NoHints + +-- Certifier hints #7 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.uplc new file mode 100644 index 00000000000..159638c860a --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfAppendByteStringCertifiedOnly.golden.uplc @@ -0,0 +1 @@ +appendByteString #6162 #6364 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.certifier-hints new file mode 100644 index 00000000000..434bc0a0ebc --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.certifier-hints @@ -0,0 +1,35 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.uplc new file mode 100644 index 00000000000..1f11dc4236f --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfDivisionByZero.golden.uplc @@ -0,0 +1 @@ +divideInteger 1 0 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.certifier-hints new file mode 100644 index 00000000000..434bc0a0ebc --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.certifier-hints @@ -0,0 +1,35 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.uplc new file mode 100644 index 00000000000..4791ed5559b --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfEqualsInteger.golden.uplc @@ -0,0 +1 @@ +True \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.certifier-hints new file mode 100644 index 00000000000..29d9b04fa96 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.certifier-hints @@ -0,0 +1,38 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlApply + InlForce + InlBuiltin + InlCon + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.uplc new file mode 100644 index 00000000000..56a6051ca2b --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfIfThenElse.golden.uplc @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.certifier-hints new file mode 100644 index 00000000000..4386a00a725 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.certifier-hints @@ -0,0 +1,39 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlApply + InlBuiltin + InlApply + InlApply + InlBuiltin + InlCon + InlCon + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.uplc new file mode 100644 index 00000000000..9a037142aa3 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfNested.golden.uplc @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.certifier-hints new file mode 100644 index 00000000000..afb357e8aed --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.certifier-hints @@ -0,0 +1,33 @@ +-- Certifier hints #1 (Right FloatDelay) -- +NoHints + +-- Certifier hints #2 (Right ForceCaseDelay) -- +NoHints + +-- Certifier hints #3 (Left LetFloatOut) -- +NoHints + +-- Certifier hints #4 (Right ForceDelay) -- +NoHints + +-- Certifier hints #5 (Left CaseOfCase) -- +NoHints + +-- Certifier hints #6 (Right CaseReduce) -- +NoHints + +-- Certifier hints #7 (Right Inline) -- +InlApply + InlBuiltin + InlCon + + +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- +NoHints + diff --git a/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.uplc new file mode 100644 index 00000000000..51e72e82dd1 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Transform/EvaluateBuiltins/cfUnderApplied.golden.uplc @@ -0,0 +1 @@ +addInteger 1 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/basic.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/basic.golden.certifier-hints index e06a48642b9..de40334dc3c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/basic.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/basic.golden.certifier-hints @@ -1,25 +1,31 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/basicInline.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/basicInline.golden.certifier-hints index b90352ca89c..1c4498488ad 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/basicInline.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/basicInline.golden.certifier-hints @@ -1,27 +1,33 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlExpand InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/callsiteInline.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/callsiteInline.golden.certifier-hints index af376e1901c..1ee9486e8c3 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/callsiteInline.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/callsiteInline.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlLam InlApply @@ -46,6 +46,12 @@ InlLam InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/cse2.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/cse2.golden.uplc index 6922068a035..ac8c8049ae7 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/cse2.golden.uplc +++ b/plutus-core/untyped-plutus-core/test/Transform/cse2.golden.uplc @@ -1,8 +1,5 @@ force (force (case - (constr 0 - [ (lessThanInteger 0 0) - , (delay ((\cse -> addInteger cse cse) (addInteger 1 2))) - , (delay (addInteger 1 2)) ]) + (constr 0 [False, (delay ((\cse -> addInteger cse cse) 3)), (delay 3)]) [ifThenElse])) \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/cseExpensive.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/cseExpensive.golden.uplc index 79b6fe2109c..6b25f80cf2c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/cseExpensive.golden.uplc +++ b/plutus-core/untyped-plutus-core/test/Transform/cseExpensive.golden.uplc @@ -604,566 +604,204 @@ cse) cse) cse)) - (addInteger - 4 - 5)) - (addInteger - 30 - 31)) - (addInteger - 132 - 133)) - (addInteger - 358 - 359)) - (addInteger - 182 - 183)) - (addInteger - 340 - 341)) - (addInteger - 342 - 343)) - (addInteger - 128 - 129)) - (addInteger - 126 - 127)) - (addInteger - 18 - 19)) - (addInteger - 264 - 265)) - (addInteger - 260 - 261)) - (addInteger - 174 - 175)) - (addInteger - 6 - 7)) - (addInteger - 370 - 371)) - (addInteger - 190 - 191)) - (addInteger - 72 - 73)) - (addInteger - 24 - 25)) - (addInteger - 44 - 45)) - (addInteger - 336 - 337)) - (addInteger - 138 - 139)) - (addInteger - 192 - 193)) - (addInteger - 278 - 279)) - (addInteger - 230 - 231)) - (addInteger - 74 - 75)) - (addInteger - 246 - 247)) - (addInteger - 292 - 293)) - (addInteger - 316 - 317)) - (addInteger - 388 - 389)) - (addInteger - 122 - 123)) - (addInteger - 102 - 103)) - (addInteger - 262 - 263)) - (addInteger - 62 - 63)) - (addInteger - 34 - 35)) - (addInteger - 352 - 353)) - (addInteger - 104 - 105)) - (addInteger - 362 - 363)) - (addInteger - 46 - 47)) - (addInteger - 344 - 345)) - (addInteger - 232 - 233)) - (addInteger - 328 - 329)) - (addInteger - 20 - 21)) - (addInteger - 378 - 379)) - (addInteger - 92 - 93)) - (addInteger - 268 - 269)) - (addInteger - 78 - 79)) - (addInteger - 286 - 287)) - (addInteger - 64 - 65)) - (addInteger - 2 - 3)) - (addInteger - 228 - 229)) - (addInteger - 172 - 173)) - (addInteger - 296 - 297)) - (addInteger - 86 - 87)) - (addInteger - 178 - 179)) - (addInteger - 244 - 245)) - (addInteger - 12 - 13)) - (addInteger - 392 - 393)) - (addInteger - 384 - 385)) - (addInteger - 134 - 135)) - (addInteger - 304 - 305)) - (addInteger - 54 - 55)) - (addInteger - 356 - 357)) - (addInteger - 150 - 151)) - (addInteger - 270 - 271)) - (addInteger - 28 - 29)) - (addInteger - 204 - 205)) - (addInteger - 222 - 223)) - (addInteger - 84 - 85)) - (addInteger - 320 - 321)) - (addInteger - 170 - 171)) - (addInteger - 200 - 201)) - (addInteger - 306 - 307)) - (addInteger - 152 - 153)) - (addInteger - 186 - 187)) - (addInteger - 272 - 273)) - (addInteger - 58 - 59)) - (addInteger - 52 - 53)) - (addInteger - 290 - 291)) - (addInteger - 32 - 33)) - (addInteger - 364 - 365)) - (addInteger - 14 - 15)) - (addInteger - 110 - 111)) - (addInteger - 212 - 213)) - (addInteger - 208 - 209)) - (addInteger - 90 - 91)) - (addInteger - 252 - 253)) - (addInteger - 124 - 125)) - (addInteger - 216 - 217)) - (addInteger - 354 - 355)) - (addInteger - 146 - 147)) - (addInteger - 196 - 197)) - (addInteger - 236 - 237)) - (addInteger - 96 - 97)) - (addInteger - 332 - 333)) - (addInteger - 184 - 185)) - (addInteger - 106 - 107)) - (addInteger - 8 - 9)) - (addInteger - 22 - 23)) - (addInteger - 168 - 169)) - (addInteger - 98 - 99)) - (addInteger - 94 - 95)) - (addInteger - 390 - 391)) - (addInteger - 206 - 207)) - (addInteger - 10 - 11)) - (addInteger - 318 - 319)) - (addInteger - 108 - 109)) - (addInteger - 350 - 351)) - (addInteger - 256 - 257)) - (addInteger - 372 - 373)) - (addInteger - 386 - 387)) - (addInteger - 214 - 215)) - (addInteger - 156 - 157)) - (addInteger - 162 - 163)) - (addInteger - 300 - 301)) - (addInteger - 158 - 159)) - (addInteger - 284 - 285)) - (addInteger - 120 - 121)) - (addInteger - 382 - 383)) - (addInteger - 346 - 347)) - (addInteger - 298 - 299)) - (addInteger - 288 - 289)) - (addInteger - 166 - 167)) - (addInteger - 310 - 311)) - (addInteger - 68 - 69)) - (addInteger - 224 - 225)) - (addInteger - 250 - 251)) - (addInteger - 112 - 113)) - (addInteger - 188 - 189)) - (addInteger - 116 - 117)) - (addInteger - 164 - 165)) - (addInteger - 118 - 119)) - (addInteger - 16 - 17)) - (addInteger - 376 - 377)) - (addInteger - 282 - 283)) - (addInteger - 220 - 221)) - (addInteger - 100 - 101)) - (addInteger - 234 - 235)) - (addInteger - 60 - 61)) - (addInteger - 88 - 89)) - (addInteger - 240 - 241)) - (addInteger - 242 - 243)) - (addInteger - 40 - 41)) - (addInteger - 56 - 57)) - (addInteger - 26 - 27)) - (addInteger - 140 - 141)) - (addInteger - 312 - 313)) - (addInteger - 326 - 327)) - (addInteger - 50 - 51)) - (addInteger - 322 - 323)) - (addInteger - 154 - 155)) - (addInteger - 258 - 259)) - (addInteger - 180 - 181)) - (addInteger - 400 - 401)) - (addInteger - 276 - 277)) - (addInteger - 394 - 395)) - (addInteger - 360 - 361)) - (addInteger - 202 - 203)) - (addInteger - 148 - 149)) - (addInteger - 70 - 71)) - (addInteger - 48 - 49)) - (addInteger - 210 - 211)) - (addInteger - 144 - 145)) - (addInteger - 398 - 399)) - (addInteger - 338 - 339)) - (addInteger - 226 - 227)) - (addInteger - 280 - 281)) - (addInteger - 348 - 349)) - (addInteger - 142 - 143)) - (addInteger - 254 - 255)) - (addInteger - 248 - 249)) - (addInteger - 374 - 375)) - (addInteger - 366 - 367)) - (addInteger - 160 - 161)) - (addInteger - 198 - 199)) - (addInteger - 368 - 369)) - (addInteger - 76 - 77)) - (addInteger - 294 - 295)) - (addInteger - 80 - 81)) - (addInteger - 380 - 381)) - (addInteger - 176 - 177)) - (addInteger - 396 - 397)) - (addInteger 194 195)) - (addInteger 42 43)) - (addInteger 66 67)) - (addInteger 0 1)) - (addInteger 324 325)) - (addInteger 308 309)) - (addInteger 114 115)) - (addInteger 238 239)) - (addInteger 218 219)) - (addInteger 36 37)) - (addInteger 136 137)) - (addInteger 274 275)) - (addInteger 302 303)) - (addInteger 82 83)) - (addInteger 314 315)) - (addInteger 266 267)) - (addInteger 130 131)) - (addInteger 334 335)) - (addInteger 330 331)) - (addInteger 38 39) \ No newline at end of file + 9) + 61) + 265) + 717) + 365) + 681) + 685) + 257) + 253) + 37) + 529) + 521) + 349) + 13) + 741) + 381) + 145) + 49) + 89) + 673) + 277) + 385) + 557) + 461) + 149) + 493) + 585) + 633) + 777) + 245) + 205) + 525) + 125) + 69) + 705) + 209) + 725) + 93) + 689) + 465) + 657) + 41) + 757) + 185) + 537) + 157) + 573) + 129) + 5) + 457) + 345) + 593) + 173) + 357) + 489) + 25) + 785) + 769) + 269) + 609) + 109) + 713) + 301) + 541) + 57) + 409) + 445) + 169) + 641) + 341) + 401) + 613) + 305) + 373) + 545) + 117) + 105) + 581) + 65) + 729) + 29) + 221) + 425) + 417) + 181) + 505) + 249) + 433) + 709) + 293) + 393) + 473) + 193) + 665) + 369) + 213) + 17) + 45) + 337) + 197) + 189) + 781) + 413) + 21) + 637) + 217) + 701) + 513) + 745) + 773) + 429) + 313) + 325) + 601) + 317) + 569) + 241) + 765) + 693) + 597) + 577) + 333) + 621) + 137) + 449) + 501) + 225) + 377) + 233) + 329) + 237) + 33) + 753) + 565) + 441) + 201) + 469) + 121) + 177) + 481) + 485) + 81) + 113) + 53) + 281) + 625) + 653) + 101) + 645) + 309) + 517) + 361) + 801) + 553) + 789) + 721) + 405) + 297) + 141) + 97) + 421) + 289) + 797) + 677) + 453) + 561) + 697) + 285) + 509) + 497) + 749) + 733) + 321) + 397) + 737) + 153) + 589) + 161) + 761) + 353) + 793) + 389) + 85) + 133) + 1) + 649) + 617) + 229) + 477) + 437) + 73) + 273) + 549) + 605) + 165) + 629) + 533) + 261) + 669) + 661) + 77 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/csePlusTree.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/csePlusTree.golden.uplc index 11e5be629e8..b1375c680f2 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/csePlusTree.golden.uplc +++ b/plutus-core/untyped-plutus-core/test/Transform/csePlusTree.golden.uplc @@ -3,4 +3,4 @@ (\cse -> (\cse -> addInteger cse cse) (addInteger cse cse)) (addInteger cse cse)) (addInteger cse cse)) - (addInteger 1 1) \ No newline at end of file + 2 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/extraDelays.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/extraDelays.golden.certifier-hints index 881e1629410..d2aaca39e35 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/extraDelays.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/extraDelays.golden.certifier-hints @@ -1,26 +1,32 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDelay InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.certifier-hints index 1bd20a131c7..f29e1245c56 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlApply InlApply @@ -27,6 +27,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.uplc index b7b8ae1aa74..d8263ee9860 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.uplc +++ b/plutus-core/untyped-plutus-core/test/Transform/floatDelay1.golden.uplc @@ -1 +1 @@ -addInteger 1 1 \ No newline at end of file +2 \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.certifier-hints index eaf79604cbc..f62a9235da2 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlApply InlLam InlApply @@ -34,6 +34,12 @@ InlApply InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.uplc b/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.uplc index 87366c81f72..98b96f2992a 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.uplc +++ b/plutus-core/untyped-plutus-core/test/Transform/floatDelay2.golden.uplc @@ -1 +1 @@ -(\a -> addInteger (force a) (force a)) (delay (addInteger 1 2)) \ No newline at end of file +(\a -> addInteger (force a) (force a)) (delay 3) \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Transform/floatDelay3.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/floatDelay3.golden.certifier-hints index 16ad4f57902..8c78a0e95ff 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/floatDelay3.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/floatDelay3.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlApply InlApply @@ -33,6 +33,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps1.golden.certifier-hints index f2e5a4d6694..9bb58bab3ac 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps1.golden.certifier-hints @@ -1,28 +1,34 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlCase InlVar InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2.golden.certifier-hints index 35e7b9ec8b9..ca41492366f 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlCase InlVar @@ -24,6 +24,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2Fail.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2Fail.golden.certifier-hints index 3c059f65a3f..6f43dfae0df 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2Fail.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayNoApps2Fail.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlForce InlCase @@ -26,6 +26,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps1.golden.certifier-hints index 907204e2581..ee3356c41a3 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps1.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlCase InlVar @@ -24,6 +24,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2.golden.certifier-hints index 9b4a32dfd5c..41fd4d6b39c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlCase InlVar @@ -25,6 +25,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2Fail.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2Fail.golden.certifier-hints index 094edd72621..b509bbe7321 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2Fail.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceCaseDelayWithApps2Fail.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlForce InlCase @@ -29,6 +29,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelayComplex.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelayComplex.golden.certifier-hints index 90bdebe3625..3e667e310ef 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelayComplex.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelayComplex.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlDrop @@ -47,6 +47,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiApply.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiApply.golden.certifier-hints index bf37cd05ea3..ef0badcd056 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiApply.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiApply.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlDrop @@ -35,6 +35,12 @@ InlLam InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiForce.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiForce.golden.certifier-hints index b90352ca89c..1c4498488ad 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiForce.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelayMultiForce.golden.certifier-hints @@ -1,27 +1,33 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlExpand InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoApps.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoApps.golden.certifier-hints index e06a48642b9..de40334dc3c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoApps.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoApps.golden.certifier-hints @@ -1,25 +1,31 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoAppsLayered.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoAppsLayered.golden.certifier-hints index e06a48642b9..de40334dc3c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoAppsLayered.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelayNoAppsLayered.golden.certifier-hints @@ -1,25 +1,31 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/forceDelaySimple.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/forceDelaySimple.golden.certifier-hints index ceb438d982a..78eba079e6c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/forceDelaySimple.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/forceDelaySimple.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlDrop InlDrop @@ -24,6 +24,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure1.golden.certifier-hints index 2f3075a63ef..13419a5817b 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure1.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlApply InlLam InlLam @@ -24,6 +24,12 @@ InlApply InlError --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure2.golden.certifier-hints index 2f3075a63ef..13419a5817b 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlApply InlLam InlLam @@ -24,6 +24,12 @@ InlApply InlError --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure3.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure3.golden.certifier-hints index 2f3075a63ef..13419a5817b 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure3.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure3.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlApply InlLam InlLam @@ -24,6 +24,12 @@ InlApply InlError --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure4.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure4.golden.certifier-hints index ab1f2cd991c..2efaa5c56fd 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlineImpure4.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlineImpure4.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlApply InlLam @@ -26,6 +26,12 @@ InlLam InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlinePure1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlinePure1.golden.certifier-hints index 68a0a5510c0..8a815630ca1 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlinePure1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlinePure1.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlLam @@ -24,6 +24,12 @@ InlLam InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlinePure2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlinePure2.golden.certifier-hints index 68a0a5510c0..8a815630ca1 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlinePure2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlinePure2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlLam @@ -24,6 +24,12 @@ InlLam InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlinePure3.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlinePure3.golden.certifier-hints index 02e859bb342..e9fe8322595 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlinePure3.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlinePure3.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlLam InlExpand @@ -29,6 +29,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/inlinePure4.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/inlinePure4.golden.certifier-hints index a179e0978d6..a06bf0024c4 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/inlinePure4.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/inlinePure4.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlLam InlExpand @@ -32,6 +32,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/interveningLambda.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/interveningLambda.golden.certifier-hints index cb1cc7836eb..50c87e76c2d 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/interveningLambda.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/interveningLambda.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlApply InlExpand @@ -25,6 +25,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase1.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase1.golden.certifier-hints index 7a0683f10b3..98e30cad70e 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase1.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase1.golden.certifier-hints @@ -1,26 +1,32 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase2.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase2.golden.certifier-hints index 30a70d2ce89..0e4d6b9298b 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase2.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutCase2.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlApply @@ -28,6 +28,12 @@ InlLam InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutForce.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutForce.golden.certifier-hints index dfbfc3c4679..4faae2ef3e9 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/letFloatOutForce.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/letFloatOutForce.golden.certifier-hints @@ -1,28 +1,34 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlLam InlDrop InlExpand InlVar --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/multiApp.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/multiApp.golden.certifier-hints index fa1ce6ea23f..d1905d96611 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/multiApp.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/multiApp.golden.certifier-hints @@ -1,22 +1,22 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlDrop InlDrop InlDrop @@ -30,6 +30,12 @@ InlDrop InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/test/Transform/nested.golden.certifier-hints b/plutus-core/untyped-plutus-core/test/Transform/nested.golden.certifier-hints index e06a48642b9..de40334dc3c 100644 --- a/plutus-core/untyped-plutus-core/test/Transform/nested.golden.certifier-hints +++ b/plutus-core/untyped-plutus-core/test/Transform/nested.golden.certifier-hints @@ -1,25 +1,31 @@ --- Certifier hints #1 (FloatDelay) -- +-- Certifier hints #1 (Right FloatDelay) -- NoHints --- Certifier hints #2 (ForceCaseDelay) -- +-- Certifier hints #2 (Right ForceCaseDelay) -- NoHints --- Certifier hints #3 (LetFloatOut) -- +-- Certifier hints #3 (Left LetFloatOut) -- NoHints --- Certifier hints #4 (ForceDelay) -- +-- Certifier hints #4 (Right ForceDelay) -- NoHints --- Certifier hints #5 (CaseOfCase) -- +-- Certifier hints #5 (Left CaseOfCase) -- NoHints --- Certifier hints #6 (CaseReduce) -- +-- Certifier hints #6 (Right CaseReduce) -- NoHints --- Certifier hints #7 (Inline) -- +-- Certifier hints #7 (Right Inline) -- InlCon --- Certifier hints #8 (ApplyToCase) -- +-- Certifier hints #8 (Right ConstantFold) -- +NoHints + +-- Certifier hints #9 (Left UncertifiedConstantFold) -- +NoHints + +-- Certifier hints #10 (Right ApplyToCase) -- NoHints diff --git a/plutus-core/untyped-plutus-core/testlib/Scoping/Spec.hs b/plutus-core/untyped-plutus-core/testlib/Scoping/Spec.hs index 096d1197853..0256f5580c6 100644 --- a/plutus-core/untyped-plutus-core/testlib/Scoping/Spec.hs +++ b/plutus-core/untyped-plutus-core/testlib/Scoping/Spec.hs @@ -86,37 +86,37 @@ test_names = (genTerm @DefaultFun) T.BindingRemovalOk -- COKC removes branches, which may (and likely do) contain bindings. T.PrerenameYes - (evalSimplifierT . caseReduce) + (evalOptimizerT . caseReduce) , -- CSE creates entirely new names, which isn't supported by the scoping check machinery. T.test_scopingBad "cse" (genTerm @DefaultFun) T.BindingRemovalOk T.PrerenameYes - (evalSimplifierT . cse ExcludeWorkFree maxBound) + (evalOptimizerT . cse ExcludeWorkFree maxBound) , T.test_scopingGood "float-delay" (genTerm @DefaultFun) T.BindingRemovalNotOk T.PrerenameNo - (evalSimplifierT . floatDelay) + (evalOptimizerT . floatDelay) , T.test_scopingGood "force-delay" (genTerm @DefaultFun) T.BindingRemovalNotOk T.PrerenameYes - (evalSimplifierT . forceDelay maxBound) + (evalOptimizerT . forceDelay maxBound) , T.test_scopingGood "inline" (genTerm @DefaultFun) T.BindingRemovalOk T.PrerenameYes - ( evalSimplifierT + ( evalOptimizerT . inline 0 True - (_soPreserveLogging defaultSimplifyOpts) - (_soInlineHints defaultSimplifyOpts) + (_ooPreserveLogging defaultOptimizeOpts) + (_ooInlineHints defaultOptimizeOpts) maxBound ) , test_mangle diff --git a/plutus-core/untyped-plutus-core/testlib/Transform/CaseOfCase/Spec.hs b/plutus-core/untyped-plutus-core/testlib/Transform/CaseOfCase/Spec.hs index 9a450eeb7f2..adb79cb57d9 100644 --- a/plutus-core/untyped-plutus-core/testlib/Transform/CaseOfCase/Spec.hs +++ b/plutus-core/untyped-plutus-core/testlib/Transform/CaseOfCase/Spec.hs @@ -36,7 +36,7 @@ import UntypedPlutusCore.Evaluation.Machine.Cek , unsafeSplitStructuralOperational ) import UntypedPlutusCore.Transform.CaseOfCase (caseOfCase) -import UntypedPlutusCore.Transform.Simplifier (evalSimplifier) +import UntypedPlutusCore.Transform.Optimizer (evalOptimizer) test_caseOfCase :: TestTree test_caseOfCase = @@ -128,7 +128,7 @@ testCaseOfCaseWithError = evalCaseOfCase :: Term Name DefaultUni DefaultFun () -> Term Name DefaultUni DefaultFun () -evalCaseOfCase term = evalSimplifier $ caseOfCase term +evalCaseOfCase term = evalOptimizer $ caseOfCase term evaluateUplc :: UPLC.Term Name DefaultUni DefaultFun () diff --git a/plutus-core/untyped-plutus-core/testlib/Transform/EvaluateBuiltins/Spec.hs b/plutus-core/untyped-plutus-core/testlib/Transform/EvaluateBuiltins/Spec.hs new file mode 100644 index 00000000000..76c987d90da --- /dev/null +++ b/plutus-core/untyped-plutus-core/testlib/Transform/EvaluateBuiltins/Spec.hs @@ -0,0 +1,173 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} + +module Transform.EvaluateBuiltins.Spec where + +import Control.Lens ((&), (.~)) +import Data.ByteString qualified as BS +import Data.ByteString.Lazy qualified as BSL +import Data.Text.Encoding (encodeUtf8) +import PlutusCore qualified as PLC +import PlutusCore.Builtin (BuiltinSemanticsVariant) +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) +import PlutusCore.MkPlc (mkConstant, mkIterApp) +import PlutusCore.Pretty (PrettyPlc, Render (render), prettyPlcReadableSimple) +import PlutusPrelude (Default (def)) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.Golden (goldenVsString) +import Transform.Simplify.Lib (renderCertifierHints, testOptimize) +import UntypedPlutusCore + ( Name + , OptimizerTrace + , Term (..) + , defaultOptimizeOpts + , ooCertifiedOptsOnly + , ooInlineCallsiteGrowth + , ooMaxCseIterations + , ooMaxSimplifierIterations + , ooPreserveLogging + , runOptimizerT + , termOptimizer + ) + +test_evaluateBuiltins :: TestTree +test_evaluateBuiltins = + testGroup + "EvaluateBuiltins" + [ goldenVsOptimized "cfAddInteger" cfAddInteger + , goldenVsOptimized "cfNested" cfNested + , goldenVsOptimized "cfIfThenElse" cfIfThenElse + , goldenVsOptimized "cfEqualsInteger" cfEqualsInteger + , goldenVsOptimized "cfDivisionByZero" cfDivisionByZero + , goldenVsOptimized "cfUnderApplied" cfUnderApplied + , goldenVsOptimized "cfAppendByteString" cfAppendByteString + , goldenVsCertifiedOnly "cfAppendByteStringCertifiedOnly" cfAppendByteString + ] + +-- | @addInteger 1 2@ — folds to @3@. +cfAddInteger :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfAddInteger = + Apply + () + (Apply () (Builtin () PLC.AddInteger) (mkConstant @Integer () 1)) + (mkConstant @Integer () 2) + +-- | @addInteger (multiplyInteger 2 3) 4@ — bottom-up folding produces @10@. +cfNested :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfNested = + Apply + () + ( Apply + () + (Builtin () PLC.AddInteger) + ( Apply + () + (Apply () (Builtin () PLC.MultiplyInteger) (mkConstant @Integer () 2)) + (mkConstant @Integer () 3) + ) + ) + (mkConstant @Integer () 4) + +-- | @(force ifThenElse) True 1 2@ — folds to @1@. +cfIfThenElse :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfIfThenElse = + mkIterApp + (Force () (Builtin () PLC.IfThenElse)) + [ ((), mkConstant @Bool () True) + , ((), mkConstant @Integer () 1) + , ((), mkConstant @Integer () 2) + ] + +-- | @equalsInteger 3 3@ — folds to @True@. +cfEqualsInteger :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfEqualsInteger = + Apply + () + (Apply () (Builtin () PLC.EqualsInteger) (mkConstant @Integer () 3)) + (mkConstant @Integer () 3) + +-- | @divideInteger 1 0@ — not folded because evaluation fails. +cfDivisionByZero :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfDivisionByZero = + Apply + () + (Apply () (Builtin () PLC.DivideInteger) (mkConstant @Integer () 1)) + (mkConstant @Integer () 0) + +-- | @addInteger 1@ — not folded because it is under-applied. +cfUnderApplied :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfUnderApplied = + Apply () (Builtin () PLC.AddInteger) (mkConstant @Integer () 1) + +{-| @appendByteString "ab" "cd"@ — an uncertified builtin. +Folds to @"abcd"@ in normal mode; left unchanged in certified-only mode +(see 'cfAppendByteStringCertifiedOnly'). -} +cfAppendByteString :: Term Name PLC.DefaultUni PLC.DefaultFun () +cfAppendByteString = + Apply + () + ( Apply + () + (Builtin () PLC.AppendByteString) + (mkConstant @BS.ByteString () "ab") + ) + (mkConstant @BS.ByteString () "cd") + +---------------------------------------------------------------------------------------------------- +-- Helpers ----------------------------------------------------------------------------------------- + +goldenDir :: String +goldenDir = "untyped-plutus-core/test/Transform/EvaluateBuiltins/" + +goldenVsOptimized :: String -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree +goldenVsOptimized name t = + testGroup + name + [ goldenVsPretty ".golden.uplc" name t' + , goldenVsString (name ++ ".certifier-hints") (goldenDir ++ name ++ ".golden.certifier-hints") + . pure + . BSL.fromStrict + . encodeUtf8 + $ renderCertifierHints trace + ] + where + (t', trace) = PLC.runQuote (testOptimize t) + +goldenVsCertifiedOnly :: String -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree +goldenVsCertifiedOnly name t = + testGroup + name + [ goldenVsPretty ".golden.uplc" name t' + , goldenVsString (name ++ ".certifier-hints") (goldenDir ++ name ++ ".golden.certifier-hints") + . pure + . BSL.fromStrict + . encodeUtf8 + $ renderCertifierHints trace + ] + where + (t', trace) = PLC.runQuote (testOptimizeCertifiedOnly t) + +goldenVsPretty :: PrettyPlc a => String -> String -> a -> TestTree +goldenVsPretty extn name value = + goldenVsString name (goldenDir ++ name ++ extn) $ + pure . BSL.fromStrict . encodeUtf8 . render $ + prettyPlcReadableSimple value + +testOptimizeCertifiedOnly + :: Term Name PLC.DefaultUni PLC.DefaultFun () + -> PLC.Quote + ( Term Name PLC.DefaultUni PLC.DefaultFun () + , OptimizerTrace Name PLC.DefaultUni PLC.DefaultFun () + ) +testOptimizeCertifiedOnly = + runOptimizerT + . termOptimizer + ( defaultOptimizeOpts + & ooMaxSimplifierIterations .~ 1 + & ooMaxCseIterations .~ 0 + & ooInlineCallsiteGrowth .~ 0 + & ooPreserveLogging .~ False + & ooCertifiedOptsOnly .~ True + ) + (def :: BuiltinSemanticsVariant PLC.DefaultFun) + defaultBuiltinCostModelForTesting diff --git a/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Lib.hs b/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Lib.hs index d78e01c17df..467234d5758 100644 --- a/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Lib.hs +++ b/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Lib.hs @@ -11,6 +11,7 @@ import Data.Text.Encoding (encodeUtf8) import Data.Tuple.Extra ((&&&)) import PlutusCore qualified as PLC import PlutusCore.Builtin (BuiltinSemanticsVariant) +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) import PlutusCore.Pretty (PrettyPlc, Render (render), prettyPlcReadableSimple) import PlutusPrelude (Default (def)) import Test.Tasty (TestTree, testGroup) @@ -18,16 +19,16 @@ import Test.Tasty.Golden (goldenVsString) import UntypedPlutusCore ( CseWhichSubterms , Name - , SimplifierTrace + , OptimizerTrace , Term - , defaultSimplifyOpts - , runSimplifierT - , soCseWhichSubterms - , soInlineCallsiteGrowth - , soMaxCseIterations - , soMaxSimplifierIterations - , soPreserveLogging - , termSimplifier + , defaultOptimizeOpts + , ooCseWhichSubterms + , ooInlineCallsiteGrowth + , ooMaxCseIterations + , ooMaxSimplifierIterations + , ooPreserveLogging + , runOptimizerT + , termOptimizer ) import UntypedPlutusCore.Transform.Certify.Hints qualified as Hints import UntypedPlutusCore.Transform.Certify.Trace qualified as Trace @@ -39,8 +40,8 @@ goldenVsPretty extn name value = pure . BSL.fromStrict . encodeUtf8 . render $ prettyPlcReadableSimple value -goldenVsSimplified :: String -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree -goldenVsSimplified name t = +goldenVsOptimized :: String -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree +goldenVsOptimized name t = testGroup name [ goldenVsPretty ".golden.uplc" name t' @@ -51,11 +52,11 @@ goldenVsSimplified name t = $ renderCertifierHints trace ] where - (t', trace) = PLC.runQuote (testSimplify t) + (t', trace) = PLC.runQuote (testOptimize t) hintsPath = "untyped-plutus-core/test/Transform/" ++ name ++ ".golden.certifier-hints" -renderCertifierHints :: Trace.SimplifierTrace Name PLC.DefaultUni PLC.DefaultFun () -> Text -renderCertifierHints (Trace.SimplifierTrace ss) +renderCertifierHints :: Trace.OptimizerTrace Name PLC.DefaultUni PLC.DefaultFun () -> Text +renderCertifierHints (Trace.OptimizerTrace ss) | null ss = "" | otherwise = T.unlines $ @@ -96,23 +97,24 @@ renderCertifierHints (Trace.SimplifierTrace ss) line i payload = T.replicate i " " <> payload <> "\n" -testSimplify +testOptimize :: Term Name PLC.DefaultUni PLC.DefaultFun () -> PLC.Quote ( Term Name PLC.DefaultUni PLC.DefaultFun () - , SimplifierTrace Name PLC.DefaultUni PLC.DefaultFun () + , OptimizerTrace Name PLC.DefaultUni PLC.DefaultFun () ) -testSimplify = - runSimplifierT - . termSimplifier - ( defaultSimplifyOpts +testOptimize = + runOptimizerT + . termOptimizer + ( defaultOptimizeOpts -- Just run one iteration, to see what that does - & soMaxSimplifierIterations .~ 1 - & soMaxCseIterations .~ 0 - & soInlineCallsiteGrowth .~ 0 - & soPreserveLogging .~ False + & ooMaxSimplifierIterations .~ 1 + & ooMaxCseIterations .~ 0 + & ooInlineCallsiteGrowth .~ 0 + & ooPreserveLogging .~ False ) (def :: BuiltinSemanticsVariant PLC.DefaultFun) + defaultBuiltinCostModelForTesting goldenVsCse :: CseWhichSubterms @@ -130,17 +132,18 @@ testCse -> Term Name PLC.DefaultUni PLC.DefaultFun () -> PLC.Quote ( Term Name PLC.DefaultUni PLC.DefaultFun () - , SimplifierTrace Name PLC.DefaultUni PLC.DefaultFun () + , OptimizerTrace Name PLC.DefaultUni PLC.DefaultFun () ) testCse whichSubterms = - runSimplifierT - . termSimplifier - ( defaultSimplifyOpts + runOptimizerT + . termOptimizer + ( defaultOptimizeOpts -- Just run one iteration, to see what that does - & soMaxSimplifierIterations .~ 0 - & soMaxCseIterations .~ 1 - & soCseWhichSubterms .~ whichSubterms - & soInlineCallsiteGrowth .~ 0 - & soPreserveLogging .~ False + & ooMaxSimplifierIterations .~ 0 + & ooMaxCseIterations .~ 1 + & ooCseWhichSubterms .~ whichSubterms + & ooInlineCallsiteGrowth .~ 0 + & ooPreserveLogging .~ False ) (def :: BuiltinSemanticsVariant PLC.DefaultFun) + defaultBuiltinCostModelForTesting diff --git a/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Spec.hs b/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Spec.hs index d8e46e42b79..34001aed43b 100644 --- a/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Spec.hs +++ b/plutus-core/untyped-plutus-core/testlib/Transform/Simplify/Spec.hs @@ -9,7 +9,7 @@ import PlutusCore qualified as PLC import PlutusCore.MkPlc (mkConstant, mkIterApp, mkIterAppNoAnn) import PlutusCore.Quote (Quote, freshName, runQuote) import Test.Tasty (TestTree, testGroup) -import Transform.Simplify.Lib (goldenVsCse, goldenVsSimplified) +import Transform.Simplify.Lib (goldenVsCse, goldenVsOptimized) import UntypedPlutusCore ( CseWhichSubterms (..) , DefaultFun @@ -674,6 +674,6 @@ test_simplify :: TestTree test_simplify = testGroup "simplify" - $ fmap (uncurry goldenVsSimplified) testSimplifyInputs + $ fmap (uncurry goldenVsOptimized) testSimplifyInputs <> fmap (uncurry (goldenVsCse ExcludeWorkFree)) testCseInputs <> fmap (uncurry (goldenVsCse AllSubterms)) testCseInputsWorkFree diff --git a/plutus-executables/executables/pir/Main.hs b/plutus-executables/executables/pir/Main.hs index f05033d839e..ad37e43b843 100644 --- a/plutus-executables/executables/pir/Main.hs +++ b/plutus-executables/executables/pir/Main.hs @@ -12,6 +12,7 @@ import Paths_plutus_executables qualified as Paths import PlutusCore qualified as PLC import PlutusCore.Compiler qualified as PLC import PlutusCore.Error (ParserErrorBundle (..)) +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) import PlutusCore.Executable.Common hiding (runPrint) import PlutusCore.Executable.Parsers import PlutusCore.Quote (runQuote, runQuoteT) @@ -194,10 +195,12 @@ compileToUplc optimise plcProg = then PLC.defaultCompilationOpts else PLC.defaultCompilationOpts - & PLC.coSimplifyOpts - . UPLC.soMaxSimplifierIterations + & PLC.coOptimizeOpts + . UPLC.ooMaxSimplifierIterations .~ 0 - in runQuote $ flip runReaderT plcCompilerOpts $ PLC.compileProgram plcProg + in runQuote $ + flip runReaderT plcCompilerOpts $ + PLC.compileProgram defaultBuiltinCostModelForTesting plcProg loadPirAndCompile :: CompileOptions -> IO () loadPirAndCompile (CompileOptions language optimise test inp ifmt outp ofmt mode) = do diff --git a/plutus-executables/executables/uplc/Main.hs b/plutus-executables/executables/uplc/Main.hs index c8d49051d28..aff34188fff 100644 --- a/plutus-executables/executables/uplc/Main.hs +++ b/plutus-executables/executables/uplc/Main.hs @@ -349,7 +349,7 @@ runOptimiseSingle -> PrintMode -> Certifier -> CertifierOutputMode - -> UPLC.SimplifyOpts UPLC.Name SrcSpan + -> UPLC.OptimizeOpts UPLC.Name SrcSpan -> OptimiseEvalOpts -> IO () runOptimiseSingle inp ifmt outp ofmt mode mcert certifierOutput sopts eopts = do @@ -363,7 +363,7 @@ runOptimiseSingle inp ifmt outp ofmt mode mcert certifierOutput sopts eopts = do Nothing -> [] Just args -> let evalCtx = mkDefaultEvalCtx def - in evalSimplifierTrace evalCtx simplificationTrace args + in evalOptimizerTrace evalCtx simplificationTrace args certDir = cert <> "-" <> show time certOutput = case certifierOutput of CertBasic -> BasicOutput @@ -377,7 +377,7 @@ runOptimiseBlueprint -> Format -> Certifier -> CertifierOutputMode - -> UPLC.SimplifyOpts UPLC.Name SrcSpan + -> UPLC.OptimizeOpts UPLC.Name SrcSpan -> OptimiseEvalOpts -> IO () runOptimiseBlueprint inp outp ofmt mcert certifierOutput sopts eopts @@ -398,7 +398,7 @@ runOptimiseBlueprint inp outp ofmt mcert certifierOutput sopts eopts margs <- loadBlueprintArgs eopts validatorName let costs = case margs of Nothing -> [] - Just args -> evalSimplifierTrace evalCtx simplTrace args + Just args -> evalOptimizerTrace evalCtx simplTrace args certDir = cert <> "-" <> validatorName <> "-" <> show time certOutput = case certifierOutput of CertBasic -> BasicOutput @@ -411,20 +411,24 @@ runOptimiseBlueprint inp outp ofmt mcert certifierOutput sopts eopts optimiseProgram :: forall m name a . (UPLC.HasUnique name UPLC.TermUnique, Monad m, Ord name, Typeable name) - => UPLC.SimplifyOpts name a + => UPLC.OptimizeOpts name a -> UPLC.Program name UPLC.DefaultUni UPLC.DefaultFun a -> m ( UPLC.Program name UPLC.DefaultUni UPLC.DefaultFun a - , UPLC.SimplifierTrace name UPLC.DefaultUni UPLC.DefaultFun a + , UPLC.OptimizerTrace name UPLC.DefaultUni UPLC.DefaultFun a ) optimiseProgram opts prog = PLC.runQuoteT $ do renamed <- PLC.rename prog let defaultBuiltinSemanticsVariant :: BuiltinSemanticsVariant PLC.DefaultFun defaultBuiltinSemanticsVariant = def - UPLC.simplifyProgramWithTrace opts defaultBuiltinSemanticsVariant renamed + UPLC.optimizeProgramWithTrace + opts + defaultBuiltinSemanticsVariant + PLC.defaultBuiltinCostModelForTesting + renamed execCertifier - :: UPLC.SimplifierTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a + :: UPLC.OptimizerTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a -> CertName -> CertifierOutput -> [ ( Maybe diff --git a/plutus-executables/plutus/AnyProgram/Compile.hs b/plutus-executables/plutus/AnyProgram/Compile.hs index 839e0acfec4..fc75ce67ef0 100644 --- a/plutus-executables/plutus/AnyProgram/Compile.hs +++ b/plutus-executables/plutus/AnyProgram/Compile.hs @@ -24,6 +24,7 @@ import PlutusCore.Compiler qualified as PLC import PlutusCore.DeBruijn qualified as PLC import PlutusCore.Default import PlutusCore.Error as PLC +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) import PlutusCore.MkPlc hiding (error) import PlutusIR qualified as PIR import PlutusIR.Compiler qualified as PIR @@ -127,7 +128,7 @@ compileProgram = curry $ \case -- PLC.compileProgram subsumes uplcOptimise >=> ( PLC.runQuoteT . flip runReaderT PLC.defaultCompilationOpts - . plcToUplcViaName n2 PLC.compileProgram + . plcToUplcViaName n2 (PLC.compileProgram defaultBuiltinCostModelForTesting) ) >=> pure . UPLC.UnrestrictedProgram @@ -253,14 +254,14 @@ uplcOptimise = case _optimiseLvl ?opts of NoOptimise -> const pure -- short-circuit to avoid renaming safeOrUnsafe -> - let sOpts = - UPLC.defaultSimplifyOpts + let oOpts = + UPLC.defaultOptimizeOpts & case safeOrUnsafe of - SafeOptimise -> set UPLC.soConservativeOpts True + SafeOptimise -> set UPLC.ooConservativeOpts True UnsafeOptimise -> id in fmap PLC.runQuoteT . _Wrapped - . uplcViaName (UPLC.simplifyProgram sOpts def) + . uplcViaName (UPLC.optimizeProgram oOpts def defaultBuiltinCostModelForTesting) -- | We do not have a typechecker for uplc, but we could pretend that scopecheck is a "typechecker" uplcTypecheck diff --git a/plutus-executables/test/certifier/Test/Certifier/Executable.hs b/plutus-executables/test/certifier/Test/Certifier/Executable.hs index 31792e7255a..84d0460bf95 100644 --- a/plutus-executables/test/certifier/Test/Certifier/Executable.hs +++ b/plutus-executables/test/certifier/Test/Certifier/Executable.hs @@ -2,6 +2,7 @@ module Test.Certifier.Executable where import Certifier import PlutusCore.Default.Builtins +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) import PlutusCore.Executable.Common import PlutusCore.Quote import UntypedPlutusCore as UPLC @@ -25,14 +26,15 @@ loadUplc path = UPLC._progTerm . void . snd <$> parseInput (FileInput path) simplify :: Term Name DefaultUni DefaultFun () - -> SimplifierTrace Name DefaultUni DefaultFun () + -> OptimizerTrace Name DefaultUni DefaultFun () simplify = runQuote . fmap snd - . runSimplifierT - . termSimplifier - defaultSimplifyOpts + . runOptimizerT + . termOptimizer + defaultOptimizeOpts DefaultFunSemanticsVariantE + defaultBuiltinCostModelForTesting loadAndMakeCert :: String -> IO FilePath loadAndMakeCert name = diff --git a/plutus-ledger-api/executables/src/PlutusCore/Executable/Eval.hs b/plutus-ledger-api/executables/src/PlutusCore/Executable/Eval.hs index 9714a488479..a4ec9406931 100644 --- a/plutus-ledger-api/executables/src/PlutusCore/Executable/Eval.hs +++ b/plutus-ledger-api/executables/src/PlutusCore/Executable/Eval.hs @@ -52,9 +52,9 @@ mkDefaultEvalCtx semvar = {-| Evaluate all ASTs in the trace, each applied to the given arguments arguments, in counting mode. Returns @(Maybe error, budget)@. -} -evalSimplifierTrace +evalOptimizerTrace :: EvaluationContext - -> SimplifierTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a + -> OptimizerTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a -> [UPLC.Term UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun ()] -- ^ Arguments to apply to each AST before evaluation -> [ ( Maybe @@ -62,7 +62,7 @@ evalSimplifierTrace , ExBudget ) ] -evalSimplifierTrace evalCtx trace args = +evalOptimizerTrace evalCtx trace args = first (either Just (const Nothing)) . evalCounting evalCtx newestPV <$> appliedTerms where diff --git a/plutus-ledger-api/executables/src/PlutusCore/Executable/Parsers.hs b/plutus-ledger-api/executables/src/PlutusCore/Executable/Parsers.hs index 5f92bb87e8f..9776cb93c17 100644 --- a/plutus-ledger-api/executables/src/PlutusCore/Executable/Parsers.hs +++ b/plutus-ledger-api/executables/src/PlutusCore/Executable/Parsers.hs @@ -9,7 +9,6 @@ import PlutusCore.AstSize (AstSize (..)) import PlutusCore.Default (BuiltinSemanticsVariant (..), DefaultFun) import PlutusCore.Executable.Types import UntypedPlutusCore qualified as UPLC -import UntypedPlutusCore.Transform.Cse (CseWhichSubterms (..)) import Control.Lens ((^.)) import Data.Maybe @@ -198,64 +197,64 @@ certifierOutputMode = ) ] -simplifyOpts :: Parser (UPLC.SimplifyOpts name a) -simplifyOpts = do - _soMaxSimplifierIterations <- +optimizeOpts :: Parser (UPLC.OptimizeOpts name a) +optimizeOpts = do + _ooMaxSimplifierIterations <- option auto ( long "opt-simplifier-iterations" <> metavar "INT" - <> value (UPLC.defaultSimplifyOpts ^. UPLC.soMaxSimplifierIterations) + <> value (UPLC.defaultOptimizeOpts ^. UPLC.ooMaxSimplifierIterations) <> showDefault <> help "Number of simplifier iterations" ) - _soMaxCseIterations <- + _ooMaxCseIterations <- option auto ( long "opt-cse-iterations" <> metavar "INT" - <> value (UPLC.defaultSimplifyOpts ^. UPLC.soMaxCseIterations) + <> value (UPLC.defaultOptimizeOpts ^. UPLC.ooMaxCseIterations) <> showDefault <> help "Number of CSE iterations" ) - _soCseWhichSubterms <- + _ooCseWhichSubterms <- option ( maybeReader ( \case - "all" -> Just AllSubterms - "exclude-work-free" -> Just ExcludeWorkFree + "all" -> Just UPLC.AllSubterms + "exclude-work-free" -> Just UPLC.ExcludeWorkFree _ -> Nothing ) ) ( long "opt-cse-which-subterms" <> metavar "MODE" - <> value ExcludeWorkFree - <> showDefaultWith (\case AllSubterms -> "all"; ExcludeWorkFree -> "exclude-work-free") + <> value UPLC.ExcludeWorkFree + <> showDefaultWith (\case UPLC.AllSubterms -> "all"; UPLC.ExcludeWorkFree -> "exclude-work-free") <> help "CSE subterm selection: all | exclude-work-free" ) - _soConservativeOpts <- + _ooConservativeOpts <- switch ( long "opt-conservative" <> help "Use conservative optimisation options. May result in less optimized code." ) - let _soInlineHints = UPLC.defaultSimplifyOpts ^. UPLC.soInlineHints - _soInlineConstants <- + let _ooInlineHints = UPLC.defaultOptimizeOpts ^. UPLC.ooInlineHints + _ooInlineConstants <- flag True False ( long "opt-no-inline-constants" <> help "Disable constant inlining" ) - _soInlineCallsiteGrowth <- + _ooInlineCallsiteGrowth <- option (AstSize <$> auto) ( long "opt-inline-callsite-growth" <> metavar "INT" - <> value (UPLC.defaultSimplifyOpts ^. UPLC.soInlineCallsiteGrowth) + <> value (UPLC.defaultOptimizeOpts ^. UPLC.ooInlineCallsiteGrowth) <> showDefault <> help "Maximum allowed AST growth at call sites for inlining" ) - _soPreserveLogging <- + _ooPreserveLogging <- switch ( long "opt-preserve-logging" <> help @@ -263,14 +262,22 @@ simplifyOpts = do <> " May result in less optimized code." ) ) - _soApplyToCase <- + _ooApplyToCase <- flag True False ( long "opt-no-apply-to-case" <> help "Disable apply-to-case optimization" ) - pure UPLC.SimplifyOpts {..} + _ooCertifiedOptsOnly <- + flag + False + True + ( long "certified-opts-only" + <> help + "Run only those optimisation passes which are certified to preserve the functional behavior of the original program." + ) + pure UPLC.OptimizeOpts {..} optimiseEvalOpts :: Parser OptimiseEvalOpts optimiseEvalOpts = @@ -341,7 +348,7 @@ optimiseOpts = <*> printmode <*> certifier <*> certifierOutputMode - <*> simplifyOpts + <*> optimizeOpts <*> optimiseEvalOpts exampleMode :: Parser ExampleMode diff --git a/plutus-ledger-api/executables/src/PlutusCore/Executable/Types.hs b/plutus-ledger-api/executables/src/PlutusCore/Executable/Types.hs index d2f3556d9d8..7239dd533ca 100644 --- a/plutus-ledger-api/executables/src/PlutusCore/Executable/Types.hs +++ b/plutus-ledger-api/executables/src/PlutusCore/Executable/Types.hs @@ -101,7 +101,7 @@ data OptimiseOptions name a PrintMode Certifier CertifierOutputMode - (UPLC.SimplifyOpts name a) + (UPLC.OptimizeOpts name a) OptimiseEvalOpts data PrintOptions = PrintOptions Input Output PrintMode newtype ExampleOptions = ExampleOptions ExampleMode diff --git a/plutus-metatheory/changelog.d/20260415_215838_ana.pantilie95_safe_opt_mode.md b/plutus-metatheory/changelog.d/20260415_215838_ana.pantilie95_safe_opt_mode.md new file mode 100644 index 00000000000..9393b44623c --- /dev/null +++ b/plutus-metatheory/changelog.d/20260415_215838_ana.pantilie95_safe_opt_mode.md @@ -0,0 +1,3 @@ +### Fixed + +- The certifier reports now include the number of optimization sites for the force-case-delay pass as well. diff --git a/plutus-metatheory/plutus-metatheory.cabal b/plutus-metatheory/plutus-metatheory.cabal index f5aae713bcf..944abc836b2 100644 --- a/plutus-metatheory/plutus-metatheory.cabal +++ b/plutus-metatheory/plutus-metatheory.cabal @@ -95,8 +95,8 @@ library Certifier FFI.AgdaUnparse FFI.CostInfo + FFI.OptimizerTrace FFI.Opts - FFI.SimplifierTrace FFI.Untyped Raw @@ -378,6 +378,7 @@ library MAlonzo.Code.VerifiedCompilation.UApplyToCase MAlonzo.Code.VerifiedCompilation.UCaseOfCase MAlonzo.Code.VerifiedCompilation.UCaseReduce + MAlonzo.Code.VerifiedCompilation.UConstantFold MAlonzo.Code.VerifiedCompilation.UCSE MAlonzo.Code.VerifiedCompilation.UFloatDelay MAlonzo.Code.VerifiedCompilation.UForceCaseDelay diff --git a/plutus-metatheory/src/Certifier.hs b/plutus-metatheory/src/Certifier.hs index 5cdd1dc5bc8..d0bfbc5c747 100644 --- a/plutus-metatheory/src/Certifier.hs +++ b/plutus-metatheory/src/Certifier.hs @@ -22,13 +22,13 @@ import System.FilePath (()) import FFI.AgdaUnparse (AgdaUnparse (..)) import FFI.CostInfo -import FFI.SimplifierTrace (Trace, mkFfiSimplifierTrace, toEvalResult) +import FFI.OptimizerTrace (Trace, mkFfiOptimizerTrace, toEvalResult) import FFI.Untyped (UTerm) import MAlonzo.Code.Certifier (runCertifierMain) import PlutusLedgerApi.Common import UntypedPlutusCore qualified as UPLC import UntypedPlutusCore.Evaluation.Machine.Cek -import UntypedPlutusCore.Transform.Simplifier +import UntypedPlutusCore.Transform.Optimizer type CertName = String type CertDir = FilePath @@ -73,7 +73,7 @@ runCertifier = runExceptT -- | Run the Agda certifier on the simplification trace, if requested mkCertifier - :: SimplifierTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a + :: OptimizerTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a -- ^ The trace produced by the simplification process -> CertName -- ^ The name of the certificate to be produced @@ -85,7 +85,7 @@ mkCertifier ] -> Certifier Bool mkCertifier simplTrace certName certOutput costs = do - let rawAgdaTrace = mkFfiSimplifierTrace simplTrace + let rawAgdaTrace = mkFfiOptimizerTrace simplTrace costs' :: [EvalResult] costs' = uncurry toEvalResult <$> reverse costs case runCertifierMain rawAgdaTrace costs' of @@ -300,7 +300,7 @@ mkCertificateModule certModule agdaTrace imports = <> unlines imports <> "\n" <> "\n\ - \\nasts : List (SimplifierTag × Hints × Untyped × Untyped)\ + \\nasts : List (OptTag × Hints × Untyped × Untyped)\ \\nasts = " <> agdaTrace <> "\n\ diff --git a/plutus-metatheory/src/CertifierReport.lagda.md b/plutus-metatheory/src/CertifierReport.lagda.md index 7b1e194f64e..2448a561498 100644 --- a/plutus-metatheory/src/CertifierReport.lagda.md +++ b/plutus-metatheory/src/CertifierReport.lagda.md @@ -13,7 +13,7 @@ open import VerifiedCompilation.UntypedTranslation open import VerifiedCompilation.UInline open import Untyped open import Untyped.RenamingSubstitution using (Sub) -open import Utils as U using (_×_; _,_; Either; either) +open import Utils as U using (_×_; _,_; Either; either; inj₁; inj₂) open import Agda.Builtin.Sigma using (Σ; _,_; snd) open import Data.Bool using (if_then_else_) @@ -35,17 +35,24 @@ nl = "\n" hl : String hl = "\n──────────────────────────────────────────────────────\n" -showTag : SimplifierTag → String -showTag floatDelayT = "Float Delay" -showTag forceDelayT = "Force-Delay Cancellation" -showTag forceCaseDelayT = "Float Force into Case Branches" -showTag caseOfCaseT = "Case-of-Case" -showTag caseReduceT = "Case-Constr and Case-Constant Cancellation" -showTag inlineT = "Inlining" -showTag cseT = "Common Subexpression Elimination" -showTag applyToCaseT = "Transform multi-argument applications into case-constr form" -showTag letFloatOutT = "Float bindings outwards" -showTag unknown = "Unknown Pass" +showCertifiedOptTag : CertifiedOptTag → String +showCertifiedOptTag floatDelayT = "Float Delay" +showCertifiedOptTag forceDelayT = "Force-Delay Cancellation" +showCertifiedOptTag forceCaseDelayT = "Float Force into Case Branches" +showCertifiedOptTag caseReduceT = "Case-Constr and Case-Constant Cancellation" +showCertifiedOptTag inlineT = "Inlining" +showCertifiedOptTag cseT = "Common Subexpression Elimination" +showCertifiedOptTag applyToCaseT = "Transform multi-argument applications into case-constr form" +showCertifiedOptTag constantFoldT = "Constant Folding" + +showUncertifiedOptTag : UncertifiedOptTag → String +showUncertifiedOptTag caseOfCaseT = "Case-of-Case" +showUncertifiedOptTag letFloatOutT = "Float bindings outwards" +showUncertifiedOptTag uncertifiedConstantFoldT = "Constant Folding (uncertified)" + +showTag : OptTag → String +showTag (inj₁ tag) = showUncertifiedOptTag tag ++ " ⚠ (certifier unavailable)" +showTag (inj₂ tag) = showCertifiedOptTag tag ++ " ✅" ``` Number of times an optimization is applied on the given term in one compiler pass: @@ -108,22 +115,19 @@ numSitesInline (case r rs) = numSitesInline r + numSitesInlineᵖʷ rs numSitesInlineᵖʷ Pointwise.[] = 0 numSitesInlineᵖʷ (x Pointwise.∷ xs) = numSitesInline x + numSitesInlineᵖʷ xs -numSites : {M N : 0 ⊢} (tag : SimplifierTag) → RelationOf tag M N → Maybe ℕ -numSites forceDelayT p = just (numSites′ p) -numSites floatDelayT p = just (numSites′ p) -numSites cseT p = just (numSites′ p) -numSites caseReduceT p = just (numSites′ p) -numSites inlineT p = just (numSitesInline p) -numSites forceCaseDelayT _ = nothing -numSites caseOfCaseT _ = nothing -numSites applyToCaseT p = just (numSites′ p) -numSites letFloatOutT _ = nothing -numSites unknown _ = nothing - -showSites : {M N : 0 ⊢} → (tag : SimplifierTag) → RelationOf tag M N → String -showSites t p with numSites t p -... | just n = ⇉ "Optimization sites: " ++ showℕ n -... | nothing = "" +numSites : {M N : 0 ⊢} (tag : CertifiedOptTag) → RelationOf (inj₂ tag) M N → ℕ +numSites forceDelayT p = numSites′ p +numSites floatDelayT p = numSites′ p +numSites cseT p = numSites′ p +numSites caseReduceT p = numSites′ p +numSites inlineT p = numSitesInline p +numSites forceCaseDelayT p = numSites′ p +numSites applyToCaseT p = numSites′ p +numSites constantFoldT p = numSites′ p + +showSites : {M N : 0 ⊢} → (tag : OptTag) → RelationOf tag M N → String +showSites (inj₁ _) _ = "" +showSites (inj₂ t) p = ⇉ "Optimization sites: " ++ showℕ (numSites t p) termSize : {X : ℕ} → X ⊢ → ℕ termSizeᵖʷ : {X : ℕ} → List (X ⊢) → ℕ @@ -174,8 +178,7 @@ reportPasses : reportPasses _ (done _) _ _ = "" reportPasses n (step tag _ x trace) (p , proofs) costs = hl ++ - "Pass " ++ showℕ n ++ ": " ++ showTag tag - ++ (if hasRelation tag then " ✅" else " ⚠ (certifier unavailable)") ++ + "Pass " ++ showℕ n ++ ": " ++ showTag tag ++ hl ++ (⇉ "Program Size: ") ++ showℕ (termSize x) ++ " (before)" ++ nl ++ diff --git a/plutus-metatheory/src/FFI/AgdaUnparse.hs b/plutus-metatheory/src/FFI/AgdaUnparse.hs index a40afb59073..bffe54b6802 100644 --- a/plutus-metatheory/src/FFI/AgdaUnparse.hs +++ b/plutus-metatheory/src/FFI/AgdaUnparse.hs @@ -19,7 +19,7 @@ import PlutusCore.Value (Value) import PlutusPrelude import UntypedPlutusCore qualified as UPLC import UntypedPlutusCore.Transform.Certify.Hints qualified as Hints -import UntypedPlutusCore.Transform.Simplifier +import UntypedPlutusCore.Transform.Certify.Trace usToHyphen :: String -> String usToHyphen = map (\c -> if c == '_' then '-' else c) @@ -50,17 +50,20 @@ instance AgdaUnparse AgdaFFI.UTerm where instance AgdaUnparse UPLC.DefaultFun where agdaUnparse = usToHyphen . lowerInitialChar . show -instance AgdaUnparse SimplifierStage where +instance AgdaUnparse CertifiedOptStage where agdaUnparse FloatDelay = "floatDelayT" agdaUnparse ForceDelay = "forceDelayT" agdaUnparse ForceCaseDelay = "forceCaseDelayT" - agdaUnparse CaseOfCase = "caseOfCaseT" agdaUnparse CaseReduce = "caseReduceT" agdaUnparse Inline = "inlineT" agdaUnparse CSE = "cseT" agdaUnparse ApplyToCase = "applyToCaseT" + agdaUnparse ConstantFold = "constantFoldT" + +instance AgdaUnparse UncertifiedOptStage where + agdaUnparse CaseOfCase = "caseOfCaseT" agdaUnparse LetFloatOut = "letFloatOutT" - agdaUnparse Unknown = "unknown" + agdaUnparse UncertifiedConstantFold = "uncertifiedConstantFoldT" instance AgdaUnparse Hints.Hints where agdaUnparse = \case @@ -117,6 +120,9 @@ instance (AgdaUnparse a, AgdaUnparse b) => AgdaUnparse (a, b) where instance AgdaUnparse a => AgdaUnparse (Vector a) where agdaUnparse v = "(mkArray (" ++ agdaUnfold v ++ "))" +instance (AgdaUnparse a, AgdaUnparse b) => AgdaUnparse (Either a b) where + agdaUnparse (Left a) = "(inj₁ " ++ agdaUnparse a ++ ")" + agdaUnparse (Right b) = "(inj₂ " ++ agdaUnparse b ++ ")" instance AgdaUnparse Data where agdaUnparse (Data.Constr i args) = "(ConstrDATA " ++ agdaUnparse i ++ " " ++ agdaUnparse args ++ ")" diff --git a/plutus-metatheory/src/FFI/SimplifierTrace.hs b/plutus-metatheory/src/FFI/OptimizerTrace.hs similarity index 76% rename from plutus-metatheory/src/FFI/SimplifierTrace.hs rename to plutus-metatheory/src/FFI/OptimizerTrace.hs index 24c397d7039..1f2fa0bcd1d 100644 --- a/plutus-metatheory/src/FFI/SimplifierTrace.hs +++ b/plutus-metatheory/src/FFI/OptimizerTrace.hs @@ -1,9 +1,9 @@ {-# OPTIONS_GHC -Wall #-} -module FFI.SimplifierTrace +module FFI.OptimizerTrace ( TraceElem , Trace - , mkFfiSimplifierTrace + , mkFfiOptimizerTrace , toEvalResult ) where @@ -14,22 +14,22 @@ import PlutusCore.Evaluation.Machine.ExMemory import UntypedPlutusCore qualified as UPLC import UntypedPlutusCore.Evaluation.Machine.Cek import UntypedPlutusCore.Transform.Certify.Hints qualified as Certify -import UntypedPlutusCore.Transform.Simplifier +import UntypedPlutusCore.Transform.Optimizer import Data.Coerce import Data.Functor import Data.SatInt import Data.Text qualified as T -type TraceElem a = (SimplifierStage, (Certify.Hints, (a, a))) +type TraceElem a = (OptStage, (Certify.Hints, (a, a))) type Trace a = [TraceElem a] -mkFfiSimplifierTrace - :: SimplifierTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a +mkFfiOptimizerTrace + :: OptimizerTrace UPLC.Name UPLC.DefaultUni UPLC.DefaultFun a -> Trace FFI.UTerm -mkFfiSimplifierTrace (SimplifierTrace simplTrace) = reverse $ toFfiAst <$> simplTrace +mkFfiOptimizerTrace (OptimizerTrace simplTrace) = reverse $ toFfiAst <$> simplTrace where - toFfiAst (Simplification before stage hints after) = + toFfiAst (Optimization before stage hints after) = case (UPLC.deBruijnTerm before, UPLC.deBruijnTerm after) of (Right before', Right after') -> (stage, (hints, (FFI.conv (void before'), FFI.conv (void after')))) diff --git a/plutus-metatheory/src/MAlonzo/Code/Certifier.hs b/plutus-metatheory/src/MAlonzo/Code/Certifier.hs index 4db1e142761..443d4e568f5 100644 --- a/plutus-metatheory/src/MAlonzo/Code/Certifier.hs +++ b/plutus-metatheory/src/MAlonzo/Code/Certifier.hs @@ -31,9 +31,11 @@ import qualified MAlonzo.Code.VerifiedCompilation.Trace -- Certifier.runCertifier d_runCertifier_2 :: [MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_52 + MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> @@ -45,7 +47,7 @@ d_runCertifier_2 v0 MAlonzo.Code.Utils.du_eitherBind_54 (coe MAlonzo.Code.Utils.du_try_94 - (coe MAlonzo.Code.VerifiedCompilation.Trace.d_toTrace_78 (coe v0)) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_toTrace_172 (coe v0)) (coe MAlonzo.Code.VerifiedCompilation.C_emptyDump_4)) (coe (\ v1 -> @@ -54,13 +56,13 @@ d_runCertifier_2 v0 (coe MAlonzo.Code.Utils.du_try_94 (coe - MAlonzo.Code.VerifiedCompilation.d_checkScope'7511'_100 (coe v1)) + MAlonzo.Code.VerifiedCompilation.d_checkScope'7511'_102 (coe v1)) (coe MAlonzo.Code.VerifiedCompilation.C_illScoped_6)) (coe (\ v2 -> coe MAlonzo.Code.Utils.du_eitherBind_54 - (coe MAlonzo.Code.VerifiedCompilation.d_certify_44 (coe v2)) + (coe MAlonzo.Code.VerifiedCompilation.d_certify_46 (coe v2)) (coe (\ v3 -> coe @@ -73,14 +75,16 @@ runCertifierMain :: MAlonzo.Code.Agda.Builtin.List.T_List_10 () (MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_52 + MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))) -> MAlonzo.Code.Agda.Builtin.List.T_List_10 - () MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114 -> + () MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208 -> MAlonzo.Code.Agda.Builtin.Maybe.T_Maybe_10 () (MAlonzo.Code.Utils.T__'215'__428 @@ -88,13 +92,15 @@ runCertifierMain :: runCertifierMain = coe d_runCertifierMain_12 d_runCertifierMain_12 :: [MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_52 + MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208] -> Maybe (MAlonzo.Code.Utils.T__'215'__428 Bool MAlonzo.Code.Agda.Builtin.String.T_String_6) @@ -115,7 +121,7 @@ d_runCertifierMain_12 v0 v1 MAlonzo.Code.Utils.C__'44'__442 (coe MAlonzo.Code.Agda.Builtin.Bool.C_false_8) (coe - MAlonzo.Code.CertifierReport.d_makeReport_290 (coe v2) (coe v1))) + MAlonzo.Code.CertifierReport.d_makeReport_288 (coe v2) (coe v1))) MAlonzo.Code.VerifiedCompilation.C_abort_10 v4 -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 @@ -123,7 +129,7 @@ d_runCertifierMain_12 v0 v1 MAlonzo.Code.Utils.C__'44'__442 (coe MAlonzo.Code.Agda.Builtin.Bool.C_false_8) (coe - MAlonzo.Code.CertifierReport.d_makeReport_290 (coe v2) (coe v1))) + MAlonzo.Code.CertifierReport.d_makeReport_288 (coe v2) (coe v1))) _ -> MAlonzo.RTE.mazUnreachableError MAlonzo.Code.Utils.C_inj'8322'_14 v3 -> coe @@ -134,5 +140,5 @@ d_runCertifierMain_12 v0 v1 MAlonzo.Code.Utils.C__'44'__442 (coe MAlonzo.Code.Agda.Builtin.Bool.C_true_10) (coe - MAlonzo.Code.CertifierReport.d_makeReport_290 (coe v2) (coe v1)))) + MAlonzo.Code.CertifierReport.d_makeReport_288 (coe v2) (coe v1)))) _ -> MAlonzo.RTE.mazUnreachableError) diff --git a/plutus-metatheory/src/MAlonzo/Code/CertifierReport.hs b/plutus-metatheory/src/MAlonzo/Code/CertifierReport.hs index 0385be18c73..f5df543de0e 100644 --- a/plutus-metatheory/src/MAlonzo/Code/CertifierReport.hs +++ b/plutus-metatheory/src/MAlonzo/Code/CertifierReport.hs @@ -17,10 +17,8 @@ import MAlonzo.RTE (coe, erased, AgdaAny, addInt, subInt, mulInt, rem64, lt64, eq64, word64FromNat, word64ToNat) import qualified MAlonzo.RTE import qualified Data.Text -import qualified MAlonzo.Code.Agda.Builtin.Maybe import qualified MAlonzo.Code.Agda.Builtin.Sigma import qualified MAlonzo.Code.Agda.Builtin.String -import qualified MAlonzo.Code.Data.Bool.Base import qualified MAlonzo.Code.Data.Fin.Base import qualified MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base import qualified MAlonzo.Code.Data.Nat.Show @@ -51,39 +49,66 @@ d_hl_8 ("\n\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\9472\n" :: Data.Text.Text) --- CertifierReport.showTag -d_showTag_10 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> +-- CertifierReport.showCertifiedOptTag +d_showCertifiedOptTag_10 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_showTag_10 v0 +d_showCertifiedOptTag_10 v0 = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6 + MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_14 -> coe ("Float Delay" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8 + MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_16 -> coe ("Force-Delay Cancellation" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10 + MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_18 -> coe ("Float Force into Case Branches" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12 - -> coe ("Case-of-Case" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14 + MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_20 -> coe ("Case-Constr and Case-Constant Cancellation" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16 + MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_22 -> coe ("Inlining" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18 + MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_24 -> coe ("Common Subexpression Elimination" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20 + MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_26 -> coe ("Transform multi-argument applications into case-constr form" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_letFloatOutT_22 + MAlonzo.Code.VerifiedCompilation.Trace.C_constantFoldT_28 + -> coe ("Constant Folding" :: Data.Text.Text) + _ -> MAlonzo.RTE.mazUnreachableError +-- CertifierReport.showUncertifiedOptTag +d_showUncertifiedOptTag_12 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 -> + MAlonzo.Code.Agda.Builtin.String.T_String_6 +d_showUncertifiedOptTag_12 v0 + = case coe v0 of + MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_6 + -> coe ("Case-of-Case" :: Data.Text.Text) + MAlonzo.Code.VerifiedCompilation.Trace.C_letFloatOutT_8 -> coe ("Float bindings outwards" :: Data.Text.Text) - MAlonzo.Code.VerifiedCompilation.Trace.C_unknown_24 - -> coe ("Unknown Pass" :: Data.Text.Text) + MAlonzo.Code.VerifiedCompilation.Trace.C_uncertifiedConstantFoldT_10 + -> coe ("Constant Folding (uncertified)" :: Data.Text.Text) + _ -> MAlonzo.RTE.mazUnreachableError +-- CertifierReport.showTag +d_showTag_14 :: + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> + MAlonzo.Code.Agda.Builtin.String.T_String_6 +d_showTag_14 v0 + = case coe v0 of + MAlonzo.Code.Utils.C_inj'8321'_12 v1 + -> coe + MAlonzo.Code.Data.String.Base.d__'43''43'__20 + (d_showUncertifiedOptTag_12 (coe v1)) + (" \9888 (certifier unavailable)" :: Data.Text.Text) + MAlonzo.Code.Utils.C_inj'8322'_14 v1 + -> coe + MAlonzo.Code.Data.String.Base.d__'43''43'__20 + (d_showCertifiedOptTag_10 (coe v1)) (" \9989" :: Data.Text.Text) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.numSites′ -d_numSites'8242'_18 :: +d_numSites'8242'_26 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> @@ -91,18 +116,18 @@ d_numSites'8242'_18 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_Translation_12 -> Integer -d_numSites'8242'_18 ~v0 v1 v2 = du_numSites'8242'_18 v1 v2 -du_numSites'8242'_18 :: +d_numSites'8242'_26 ~v0 v1 v2 = du_numSites'8242'_26 v1 v2 +du_numSites'8242'_26 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_Translation_12 -> Integer -du_numSites'8242'_18 v0 v1 +du_numSites'8242'_26 v0 v1 = coe - du_go_32 (coe v0) (coe v1) (coe (0 :: Integer)) (coe v0) (coe v1) + du_go_40 (coe v0) (coe v1) (coe (0 :: Integer)) (coe v0) (coe v1) (coe (0 :: Integer)) -- CertifierReport._.go -d_go_32 :: +d_go_40 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> @@ -117,9 +142,9 @@ d_go_32 :: Integer -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_Translation_12 -> Integer -d_go_32 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 - = du_go_32 v1 v2 v4 v5 v6 v7 v8 -du_go_32 :: +d_go_40 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 + = du_go_40 v1 v2 v4 v5 v6 v7 v8 +du_go_40 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> Integer -> @@ -128,17 +153,17 @@ du_go_32 :: Integer -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_Translation_12 -> Integer -du_go_32 v0 v1 v2 v3 v4 v5 v6 +du_go_40 v0 v1 v2 v3 v4 v5 v6 = case coe v6 of MAlonzo.Code.VerifiedCompilation.UntypedTranslation.C_istranslation_92 v9 -> coe addInt (coe (1 :: Integer)) (coe v5) MAlonzo.Code.VerifiedCompilation.UntypedTranslation.C_match_98 v9 -> coe - du_go'7504'_42 (coe v0) (coe v1) (coe v2) (coe v3) (coe v4) + du_go'7504'_50 (coe v0) (coe v1) (coe v2) (coe v3) (coe v4) (coe v5) (coe v9) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport._.goᵐ -d_go'7504'_42 :: +d_go'7504'_50 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> @@ -153,9 +178,9 @@ d_go'7504'_42 :: Integer -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_TransMatch_18 -> Integer -d_go'7504'_42 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 - = du_go'7504'_42 v1 v2 v4 v5 v6 v7 v8 -du_go'7504'_42 :: +d_go'7504'_50 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 + = du_go'7504'_50 v1 v2 v4 v5 v6 v7 v8 +du_go'7504'_50 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> Integer -> @@ -164,7 +189,7 @@ du_go'7504'_42 :: Integer -> MAlonzo.Code.VerifiedCompilation.UntypedTranslation.T_TransMatch_18 -> Integer -du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 +du_go'7504'_50 v0 v1 v2 v3 v4 v5 v6 = case coe v6 of MAlonzo.Code.VerifiedCompilation.UntypedTranslation.C_var_26 -> coe v5 @@ -174,7 +199,7 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C_ƛ_20 v11 -> coe - du_go_32 (coe v0) (coe v1) + du_go_40 (coe v0) (coe v1) (coe addInt (coe (1 :: Integer)) (coe v2)) (coe v10) (coe v11) (coe v5) (coe v9) _ -> MAlonzo.RTE.mazUnreachableError @@ -185,9 +210,9 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C__'183'__22 v15 v16 -> coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) (coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) (coe v5) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) (coe v5) (coe v11)) (coe v12) _ -> MAlonzo.RTE.mazUnreachableError @@ -198,7 +223,7 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C_force_24 v11 -> coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v10) (coe v11) (coe v5) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v10) (coe v11) (coe v5) (coe v9) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError @@ -208,7 +233,7 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C_delay_26 v11 -> coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v10) (coe v11) (coe v5) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v10) (coe v11) (coe v5) (coe v9) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError @@ -220,7 +245,7 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C_constr_34 v13 v14 -> coe - du_go'7510''695'_52 (coe v0) (coe v1) (coe v2) (coe v12) (coe v14) + du_go'7510''695'_60 (coe v0) (coe v1) (coe v2) (coe v12) (coe v14) (coe v5) (coe v10) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError @@ -230,9 +255,9 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of MAlonzo.Code.Untyped.C_case_40 v15 v16 -> coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) (coe - du_go'7510''695'_52 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) + du_go'7510''695'_60 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) (coe v5) (coe v11)) (coe v12) _ -> MAlonzo.RTE.mazUnreachableError @@ -243,7 +268,7 @@ du_go'7504'_42 v0 v1 v2 v3 v4 v5 v6 -> coe v5 _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport._.goᵖʷ -d_go'7510''695'_52 :: +d_go'7510''695'_60 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> @@ -258,9 +283,9 @@ d_go'7510''695'_52 :: Integer -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> Integer -d_go'7510''695'_52 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 - = du_go'7510''695'_52 v1 v2 v4 v5 v6 v7 v8 -du_go'7510''695'_52 :: +d_go'7510''695'_60 ~v0 v1 v2 ~v3 v4 v5 v6 v7 v8 + = du_go'7510''695'_60 v1 v2 v4 v5 v6 v7 v8 +du_go'7510''695'_60 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> Integer -> @@ -269,7 +294,7 @@ du_go'7510''695'_52 :: Integer -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> Integer -du_go'7510''695'_52 v0 v1 v2 v3 v4 v5 v6 +du_go'7510''695'_60 v0 v1 v2 v3 v4 v5 v6 = case coe v6 of MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.C_'91''93'_56 -> coe v5 @@ -279,16 +304,16 @@ du_go'7510''695'_52 v0 v1 v2 v3 v4 v5 v6 -> case coe v4 of (:) v15 v16 -> coe - du_go'7510''695'_52 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) + du_go'7510''695'_60 (coe v0) (coe v1) (coe v2) (coe v14) (coe v16) (coe - du_go_32 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) (coe v5) + du_go_40 (coe v0) (coe v1) (coe v2) (coe v13) (coe v15) (coe v5) (coe v11)) (coe v12) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.numSitesInlineᵖʷ -d_numSitesInline'7510''695'_114 :: +d_numSitesInline'7510''695'_122 :: Integer -> (MAlonzo.Code.Data.Fin.Base.T_Fin_10 -> MAlonzo.Code.Untyped.T__'8866'_14) -> @@ -296,7 +321,7 @@ d_numSitesInline'7510''695'_114 :: [MAlonzo.Code.Untyped.T__'8866'_14] -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> Integer -d_numSitesInline'7510''695'_114 v0 v1 v2 v3 v4 +d_numSitesInline'7510''695'_122 v0 v1 v2 v3 v4 = case coe v4 of MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.C_'91''93'_56 -> coe (0 :: Integer) @@ -308,19 +333,19 @@ d_numSitesInline'7510''695'_114 v0 v1 v2 v3 v4 -> coe addInt (coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) (coe v11) (coe v13) (coe v9)) (coe - d_numSitesInline'7510''695'_114 (coe v0) (coe v1) (coe v12) + d_numSitesInline'7510''695'_122 (coe v0) (coe v1) (coe v12) (coe v14) (coe v10)) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.numSitesInline -d_numSitesInline_132 :: +d_numSitesInline_140 :: Integer -> (MAlonzo.Code.Data.Fin.Base.T_Fin_10 -> MAlonzo.Code.Untyped.T__'8866'_14) -> @@ -330,7 +355,7 @@ d_numSitesInline_132 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.UInline.T_Inline_224 -> Integer -d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 +d_numSitesInline_140 v0 v1 v2 v3 v4 v5 v6 v7 = case coe v7 of MAlonzo.Code.VerifiedCompilation.UInline.C_'96'_230 -> coe (0 :: Integer) @@ -340,7 +365,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> coe addInt (coe (1 :: Integer)) (coe - d_numSitesInline_132 (coe v0) (coe v1) (coe v2) (coe v3) (coe v4) + d_numSitesInline_140 (coe v0) (coe v1) (coe v2) (coe v3) (coe v4) (coe v1 v15) (coe v6) (coe v14)) _ -> MAlonzo.RTE.mazUnreachableError MAlonzo.Code.VerifiedCompilation.UInline.C_ƛ'9633'_236 v11 @@ -349,7 +374,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v6 of MAlonzo.Code.Untyped.C_ƛ_20 v13 -> coe - d_numSitesInline_132 (coe addInt (coe (1 :: Integer)) (coe v0)) + d_numSitesInline_140 (coe addInt (coe (1 :: Integer)) (coe v0)) (coe MAlonzo.Code.Untyped.RenamingSubstitution.du_lifts_378 (coe v0) (coe v1)) @@ -371,7 +396,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v6 of MAlonzo.Code.Untyped.C_ƛ_20 v25 -> coe - d_numSitesInline_132 + d_numSitesInline_140 (coe addInt (coe (1 :: Integer)) (coe v0)) (coe MAlonzo.Code.Untyped.RenamingSubstitution.du_extend_454 @@ -406,7 +431,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v5 of MAlonzo.Code.Untyped.C_ƛ_20 v24 -> coe - d_numSitesInline_132 + d_numSitesInline_140 (coe addInt (coe (1 :: Integer)) (coe v0)) (coe MAlonzo.Code.Untyped.RenamingSubstitution.du_extend_454 @@ -442,13 +467,13 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> coe addInt (coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) (coe v19) (coe v21) (coe v17)) (coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C__'183'__34 (coe v2) (coe v19)) @@ -463,7 +488,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v5 of MAlonzo.Code.Untyped.C__'183'__22 v16 v17 -> coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C__'183'__34 (coe v2) (coe v17)) @@ -479,7 +504,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v6 of MAlonzo.Code.Untyped.C_force_24 v16 -> coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) @@ -492,7 +517,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v6 of MAlonzo.Code.Untyped.C_delay_26 v16 -> coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) @@ -509,7 +534,7 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v6 of MAlonzo.Code.Untyped.C_constr_34 v18 v19 -> coe - d_numSitesInline'7510''695'_114 (coe v0) (coe v1) (coe v17) + d_numSitesInline'7510''695'_122 (coe v0) (coe v1) (coe v17) (coe v19) (coe v15) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError @@ -521,13 +546,13 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> coe addInt (coe - d_numSitesInline_132 (coe v0) (coe v1) + d_numSitesInline_140 (coe v0) (coe v1) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) (coe v18) (coe v20) (coe v16)) (coe - d_numSitesInline'7510''695'_114 (coe v0) (coe v1) (coe v19) + d_numSitesInline'7510''695'_122 (coe v0) (coe v1) (coe v19) (coe v21) (coe v17)) _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError @@ -535,127 +560,112 @@ d_numSitesInline_132 v0 v1 v2 v3 v4 v5 v6 v7 -> coe (0 :: Integer) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.numSites -d_numSites_170 :: +d_numSites_178 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> - AgdaAny -> Maybe Integer -d_numSites_170 v0 v1 v2 v3 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> + AgdaAny -> Integer +d_numSites_178 v0 v1 v2 v3 = case coe v2 of - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6 - -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_numSites'8242'_18 v0 v1 v3) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8 - -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_numSites'8242'_18 v0 v1 v3) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14 - -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_numSites'8242'_18 v0 v1 v3) - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16 - -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe - d_numSitesInline_132 (coe (0 :: Integer)) erased - (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) - (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) - (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) - (coe v0) (coe v1) (coe v3)) - MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18 - -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_numSites'8242'_18 v0 v1 v3) - MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20 + MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_14 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_16 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_18 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_20 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_22 -> coe - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_numSites'8242'_18 v0 v1 v3) - MAlonzo.Code.VerifiedCompilation.Trace.C_letFloatOutT_22 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - MAlonzo.Code.VerifiedCompilation.Trace.C_unknown_24 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 + d_numSitesInline_140 (coe (0 :: Integer)) erased + (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) + (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_32) + (coe MAlonzo.Code.VerifiedCompilation.UInline.C_'9633'_106) + (coe v0) (coe v1) (coe v3) + MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_24 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_26 + -> coe du_numSites'8242'_26 v0 v1 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_constantFoldT_28 + -> coe du_numSites'8242'_26 v0 v1 v3 _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.showSites -d_showSites_190 :: +d_showSites_202 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_showSites_190 v0 v1 v2 v3 - = let v4 = d_numSites_170 (coe v0) (coe v1) (coe v2) (coe v3) in - coe - (case coe v4 of - MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 v5 - -> coe - d_'8649'__2 +d_showSites_202 v0 v1 v2 v3 + = case coe v2 of + MAlonzo.Code.Utils.C_inj'8321'_12 v4 -> coe ("" :: Data.Text.Text) + MAlonzo.Code.Utils.C_inj'8322'_14 v4 + -> coe + d_'8649'__2 + (coe + MAlonzo.Code.Data.String.Base.d__'43''43'__20 + ("Optimization sites: " :: Data.Text.Text) (coe - MAlonzo.Code.Data.String.Base.d__'43''43'__20 - ("Optimization sites: " :: Data.Text.Text) - (coe MAlonzo.Code.Data.Nat.Show.d_show_56 v5)) - MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - -> coe ("" :: Data.Text.Text) - _ -> MAlonzo.RTE.mazUnreachableError) + MAlonzo.Code.Data.Nat.Show.d_show_56 + (d_numSites_178 (coe v0) (coe v1) (coe v4) (coe v3)))) + _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.termSize -d_termSize_212 :: +d_termSize_210 :: Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> Integer -d_termSize_212 v0 v1 +d_termSize_210 v0 v1 = case coe v1 of MAlonzo.Code.Untyped.C_'96'_18 v2 -> coe (1 :: Integer) MAlonzo.Code.Untyped.C_ƛ_20 v2 -> coe addInt (coe (1 :: Integer)) (coe - d_termSize_212 (coe addInt (coe (1 :: Integer)) (coe v0)) (coe v2)) + d_termSize_210 (coe addInt (coe (1 :: Integer)) (coe v0)) (coe v2)) MAlonzo.Code.Untyped.C__'183'__22 v2 v3 -> coe addInt (coe - addInt (coe (1 :: Integer)) (coe d_termSize_212 (coe v0) (coe v2))) - (coe d_termSize_212 (coe v0) (coe v3)) + addInt (coe (1 :: Integer)) (coe d_termSize_210 (coe v0) (coe v2))) + (coe d_termSize_210 (coe v0) (coe v3)) MAlonzo.Code.Untyped.C_force_24 v2 -> coe - addInt (coe (1 :: Integer)) (coe d_termSize_212 (coe v0) (coe v2)) + addInt (coe (1 :: Integer)) (coe d_termSize_210 (coe v0) (coe v2)) MAlonzo.Code.Untyped.C_delay_26 v2 -> coe - addInt (coe (1 :: Integer)) (coe d_termSize_212 (coe v0) (coe v2)) + addInt (coe (1 :: Integer)) (coe d_termSize_210 (coe v0) (coe v2)) MAlonzo.Code.Untyped.C_con_28 v2 -> coe (1 :: Integer) MAlonzo.Code.Untyped.C_constr_34 v2 v3 -> coe addInt (coe (1 :: Integer)) - (coe d_termSize'7510''695'_216 (coe v0) (coe v3)) + (coe d_termSize'7510''695'_214 (coe v0) (coe v3)) MAlonzo.Code.Untyped.C_case_40 v2 v3 -> coe addInt (coe addInt (coe (1 :: Integer)) - (coe d_termSize'7510''695'_216 (coe v0) (coe v3))) - (coe d_termSize_212 (coe v0) (coe v2)) + (coe d_termSize'7510''695'_214 (coe v0) (coe v3))) + (coe d_termSize_210 (coe v0) (coe v2)) MAlonzo.Code.Untyped.C_builtin_44 v2 -> coe (1 :: Integer) MAlonzo.Code.Untyped.C_error_46 -> coe (1 :: Integer) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.termSizeᵖʷ -d_termSize'7510''695'_216 :: +d_termSize'7510''695'_214 :: Integer -> [MAlonzo.Code.Untyped.T__'8866'_14] -> Integer -d_termSize'7510''695'_216 v0 v1 +d_termSize'7510''695'_214 v0 v1 = case coe v1 of [] -> coe (0 :: Integer) (:) v2 v3 -> coe - addInt (coe d_termSize'7510''695'_216 (coe v0) (coe v3)) - (coe d_termSize_212 (coe v0) (coe v2)) + addInt (coe d_termSize'7510''695'_214 (coe v0) (coe v3)) + (coe d_termSize_210 (coe v0) (coe v2)) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.showEvalResult -d_showEvalResult_238 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114 -> +d_showEvalResult_236 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208 -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_showEvalResult_238 v0 +d_showEvalResult_236 v0 = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_success_116 v1 v2 + MAlonzo.Code.VerifiedCompilation.Trace.C_success_210 v1 v2 -> coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 (d_'8649'__2 (coe ("Execution Cost: CPU = " :: Data.Text.Text))) @@ -666,7 +676,7 @@ d_showEvalResult_238 v0 MAlonzo.Code.Data.String.Base.d__'43''43'__20 (", MEM = " :: Data.Text.Text) (coe MAlonzo.Code.Data.Nat.Show.d_show_56 v2))) - MAlonzo.Code.VerifiedCompilation.Trace.C_failure_118 v1 v2 v3 + MAlonzo.Code.VerifiedCompilation.Trace.C_failure_212 v1 v2 v3 -> coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 (d_'8649'__2 (coe ("Evaluation FAILED: " :: Data.Text.Text))) @@ -686,10 +696,10 @@ d_showEvalResult_238 v0 (coe MAlonzo.Code.Data.Nat.Show.d_show_56 v3)))))) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.showCostPair -d_showCostPair_250 :: - [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114] -> +d_showCostPair_248 :: + [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208] -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_showCostPair_250 v0 +d_showCostPair_248 v0 = let v1 = "" :: Data.Text.Text in coe (case coe v0 of @@ -698,7 +708,7 @@ d_showCostPair_250 v0 (:) v4 v5 -> coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showEvalResult_238 (coe v2)) + (d_showEvalResult_236 (coe v2)) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 (" (before)" :: Data.Text.Text) @@ -706,28 +716,28 @@ d_showCostPair_250 v0 MAlonzo.Code.Data.String.Base.d__'43''43'__20 d_nl_6 (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showEvalResult_238 (coe v4)) (" (after)" :: Data.Text.Text)))) + (d_showEvalResult_236 (coe v4)) (" (after)" :: Data.Text.Text)))) _ -> coe v1 _ -> coe v1) -- CertifierReport.tail -d_tail_258 :: () -> [AgdaAny] -> [AgdaAny] -d_tail_258 ~v0 v1 = du_tail_258 v1 -du_tail_258 :: [AgdaAny] -> [AgdaAny] -du_tail_258 v0 +d_tail_256 :: () -> [AgdaAny] -> [AgdaAny] +d_tail_256 ~v0 v1 = du_tail_256 v1 +du_tail_256 :: [AgdaAny] -> [AgdaAny] +du_tail_256 v0 = case coe v0 of [] -> coe v0 (:) v1 v2 -> coe v2 _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.reportPasses -d_reportPasses_268 :: +d_reportPasses_266 :: Integer -> - MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 -> AgdaAny -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208] -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_reportPasses_268 v0 v1 v2 v3 +d_reportPasses_266 v0 v1 v2 v3 = case coe v1 of - MAlonzo.Code.VerifiedCompilation.Trace.C_step_64 v4 v5 v6 v7 + MAlonzo.Code.VerifiedCompilation.Trace.C_step_158 v4 v5 v6 v7 -> case coe v2 of MAlonzo.Code.Utils.C__'44'__442 v8 v9 -> coe @@ -743,86 +753,77 @@ d_reportPasses_268 v0 v1 v2 v3 (": " :: Data.Text.Text) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showTag_10 (coe v4)) + (d_showTag_14 (coe v4)) (coe - MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (coe - MAlonzo.Code.Data.Bool.Base.du_if_then_else__44 - (coe - MAlonzo.Code.VerifiedCompilation.d_hasRelation_16 (coe v4)) - (coe (" \9989" :: Data.Text.Text)) - (coe (" \9888 (certifier unavailable)" :: Data.Text.Text))) + MAlonzo.Code.Data.String.Base.d__'43''43'__20 d_hl_8 (coe - MAlonzo.Code.Data.String.Base.d__'43''43'__20 d_hl_8 + MAlonzo.Code.Data.String.Base.d__'43''43'__20 + (d_'8649'__2 (coe ("Program Size: " :: Data.Text.Text))) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_'8649'__2 (coe ("Program Size: " :: Data.Text.Text))) + (coe + MAlonzo.Code.Data.Nat.Show.d_show_56 + (d_termSize_210 (coe (0 :: Integer)) (coe v6))) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 + (" (before)" :: Data.Text.Text) (coe - MAlonzo.Code.Data.Nat.Show.d_show_56 - (d_termSize_212 (coe (0 :: Integer)) (coe v6))) - (coe - MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (" (before)" :: Data.Text.Text) + MAlonzo.Code.Data.String.Base.d__'43''43'__20 d_nl_6 (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - d_nl_6 + (d_'8649'__2 + (coe ("Program Size: " :: Data.Text.Text))) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_'8649'__2 - (coe ("Program Size: " :: Data.Text.Text))) + (coe + MAlonzo.Code.Data.Nat.Show.d_show_56 + (d_termSize_210 + (coe (0 :: Integer)) + (coe + MAlonzo.Code.VerifiedCompilation.Trace.d_head_164 + (coe v7)))) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (coe - MAlonzo.Code.Data.Nat.Show.d_show_56 - (d_termSize_212 - (coe (0 :: Integer)) - (coe - MAlonzo.Code.VerifiedCompilation.Trace.d_head_70 - (coe v7)))) + (" (after)" :: Data.Text.Text) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (" (after)" :: Data.Text.Text) + d_nl_6 (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - d_nl_6 + (d_showCostPair_248 (coe v3)) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showCostPair_250 (coe v3)) + d_nl_6 (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - d_nl_6 + (d_showSites_202 + (coe v6) + (coe + MAlonzo.Code.VerifiedCompilation.Trace.d_head_164 + (coe v7)) + (coe v4) (coe v8)) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showSites_190 - (coe v6) + d_nl_6 + (d_reportPasses_266 (coe - MAlonzo.Code.VerifiedCompilation.Trace.d_head_70 - (coe v7)) - (coe v4) (coe v8)) - (coe - MAlonzo.Code.Data.String.Base.d__'43''43'__20 - d_nl_6 - (d_reportPasses_268 - (coe - addInt - (coe (1 :: Integer)) - (coe v0)) - (coe v7) (coe v9) + addInt + (coe (1 :: Integer)) + (coe v0)) + (coe v7) (coe v9) + (coe + du_tail_256 (coe - du_tail_258 - (coe - v3))))))))))))))))))))) + v3)))))))))))))))))))) _ -> MAlonzo.RTE.mazUnreachableError - MAlonzo.Code.VerifiedCompilation.Trace.C_done_66 v4 + MAlonzo.Code.VerifiedCompilation.Trace.C_done_160 v4 -> coe ("" :: Data.Text.Text) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.reportFailure -d_reportFailure_284 :: +d_reportFailure_282 :: MAlonzo.Code.VerifiedCompilation.T_Error_2 -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_reportFailure_284 v0 +d_reportFailure_282 v0 = case coe v0 of MAlonzo.Code.VerifiedCompilation.C_emptyDump_4 -> coe @@ -848,7 +849,7 @@ d_reportFailure_284 v0 ("Pass " :: Data.Text.Text) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showTag_10 (coe v1)) + (d_showTag_14 (coe v1)) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 (" \10060 FAILED" :: Data.Text.Text) d_hl_8))) @@ -860,30 +861,30 @@ d_reportFailure_284 v0 ("Pass " :: Data.Text.Text) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 - (d_showTag_10 (coe v1)) + (d_showTag_14 (coe v1)) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 (" \10060 FAILED" :: Data.Text.Text) d_hl_8))) _ -> MAlonzo.RTE.mazUnreachableError -- CertifierReport.makeReport -d_makeReport_290 :: +d_makeReport_288 :: MAlonzo.Code.Utils.T_Either_6 MAlonzo.Code.VerifiedCompilation.T_Error_2 MAlonzo.Code.Agda.Builtin.Sigma.T_Σ_14 -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_114] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_EvalResult_208] -> MAlonzo.Code.Agda.Builtin.String.T_String_6 -d_makeReport_290 v0 v1 +d_makeReport_288 v0 v1 = coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 ("UPLC OPTIMIZATION: CERTIFIER REPORT" :: Data.Text.Text) (coe MAlonzo.Code.Data.String.Base.d__'43''43'__20 d_nl_6 (coe - MAlonzo.Code.Utils.du_either_22 (coe v0) (coe d_reportFailure_284) + MAlonzo.Code.Utils.du_either_22 (coe v0) (coe d_reportFailure_282) (coe (\ v2 -> case coe v2 of MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 v3 v4 -> coe - d_reportPasses_268 (coe (1 :: Integer)) (coe v3) (coe v4) (coe v1) + d_reportPasses_266 (coe (1 :: Integer)) (coe v3) (coe v4) (coe v1) _ -> MAlonzo.RTE.mazUnreachableError)))) diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation.hs index 8d9d65ab968..20d421dfaca 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation.hs @@ -29,6 +29,7 @@ import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UApplyToCase import qualified MAlonzo.Code.VerifiedCompilation.UCSE import qualified MAlonzo.Code.VerifiedCompilation.UCaseReduce +import qualified MAlonzo.Code.VerifiedCompilation.UConstantFold import qualified MAlonzo.Code.VerifiedCompilation.UFloatDelay import qualified MAlonzo.Code.VerifiedCompilation.UForceCaseDelay import qualified MAlonzo.Code.VerifiedCompilation.UForceDelay @@ -38,143 +39,128 @@ import qualified MAlonzo.Code.VerifiedCompilation.UInline d_Error_2 = () data T_Error_2 = C_emptyDump_4 | C_illScoped_6 | - C_counterExample_8 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 | - C_abort_10 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 --- VerifiedCompilation.mRelationOf -d_mRelationOf_12 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> - Maybe - (MAlonzo.Code.Untyped.T__'8866'_14 -> - MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -d_mRelationOf_12 v0 - = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 erased - MAlonzo.Code.VerifiedCompilation.Trace.C_letFloatOutT_22 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - MAlonzo.Code.VerifiedCompilation.Trace.C_unknown_24 - -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 - _ -> MAlonzo.RTE.mazUnreachableError + C_counterExample_8 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) | + C_abort_10 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) +-- VerifiedCompilation.tagToRelation +d_tagToRelation_12 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.Untyped.T__'8866'_14 -> () +d_tagToRelation_12 = erased -- VerifiedCompilation.RelationOf d_RelationOf_14 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> () d_RelationOf_14 = erased -- VerifiedCompilation.hasRelation -d_hasRelation_16 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> Bool -d_hasRelation_16 v0 - = coe - MAlonzo.Code.Data.Maybe.Base.du_is'45'just_20 - (coe d_mRelationOf_12 (coe v0)) +d_hasRelation_18 :: + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> + Bool +d_hasRelation_18 = coe MAlonzo.Code.Utils.du_is'45'inj'8322'_46 -- VerifiedCompilation.certifyPass -d_certifyPass_24 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_52 -> +d_certifyPass_26 :: + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_Hints_146 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.Certificate.T_CertResult_12 -d_certifyPass_24 v0 v1 +d_certifyPass_26 v0 v1 = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6 - -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UFloatDelay.d_isFloatDelay'63'_488 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8 - -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UForceDelay.d_isForceDelay'63'_178 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10 + MAlonzo.Code.Utils.C_inj'8321'_12 v2 -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UForceCaseDelay.d_isForceCaseDelay'63'_94 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12 - -> coe - (\ v2 v3 -> + (\ v3 v4 -> coe MAlonzo.Code.VerifiedCompilation.NotImplemented.du_certNotImplemented_22) - MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14 - -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UCaseReduce.d_isCaseReduce'63'_26 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16 - -> case coe v1 of - MAlonzo.Code.VerifiedCompilation.Trace.C_inline_54 v2 + MAlonzo.Code.Utils.C_inj'8322'_14 v2 + -> case coe v2 of + MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_14 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UFloatDelay.d_isFloatDelay'63'_488 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_16 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UForceDelay.d_isForceDelay'63'_178 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_18 -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_checker_156 + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 (coe - MAlonzo.Code.VerifiedCompilation.UInline.d_top'45'check_718 - (coe v2)) - MAlonzo.Code.VerifiedCompilation.Trace.C_none_56 + MAlonzo.Code.VerifiedCompilation.UForceCaseDelay.d_isForceCaseDelay'63'_94 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_20 -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_32 (coe v0) + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UCaseReduce.d_isCaseReduce'63'_26 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_22 + -> case coe v1 of + MAlonzo.Code.VerifiedCompilation.Trace.C_inline_148 v3 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_checker_156 + (coe + MAlonzo.Code.VerifiedCompilation.UInline.d_top'45'check_718 + (coe v3)) + MAlonzo.Code.VerifiedCompilation.Trace.C_none_150 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_32 + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40) + _ -> MAlonzo.RTE.mazUnreachableError + MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_24 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UCSE.d_isUntypedCSE'63'_26 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_26 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UApplyToCase.d_a2c'63''7580''7580'_24 + (coe (0 :: Integer))) + MAlonzo.Code.VerifiedCompilation.Trace.C_constantFoldT_28 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 + (coe + MAlonzo.Code.VerifiedCompilation.UConstantFold.d_isUConstantFold'63'_262 + (coe (0 :: Integer))) _ -> MAlonzo.RTE.mazUnreachableError - MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18 - -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UCSE.d_isUntypedCSE'63'_26 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20 - -> coe - MAlonzo.Code.VerifiedCompilation.Certificate.du_decider_192 - (coe - MAlonzo.Code.VerifiedCompilation.UApplyToCase.d_a2c'63''7580''7580'_24 - (coe (0 :: Integer))) - MAlonzo.Code.VerifiedCompilation.Trace.C_letFloatOutT_22 - -> coe - (\ v2 v3 -> - coe - MAlonzo.Code.VerifiedCompilation.NotImplemented.du_certNotImplemented_22) - MAlonzo.Code.VerifiedCompilation.Trace.C_unknown_24 - -> coe - (\ v2 v3 -> - coe - MAlonzo.Code.VerifiedCompilation.NotImplemented.du_certNotImplemented_22) _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.Certificate -d_Certificate_32 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -> () -d_Certificate_32 = erased +d_Certificate_34 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 -> () +d_Certificate_34 = erased -- VerifiedCompilation.certify -d_certify_44 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -> +d_certify_46 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 -> MAlonzo.Code.Utils.T_Either_6 T_Error_2 AgdaAny -d_certify_44 v0 +d_certify_46 v0 = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_step_64 v1 v2 v3 v4 + MAlonzo.Code.VerifiedCompilation.Trace.C_step_158 v1 v2 v3 v4 -> let v5 = coe - d_certifyPass_24 v1 v2 v3 - (MAlonzo.Code.VerifiedCompilation.Trace.d_head_70 (coe v4)) in + d_certifyPass_26 v1 v2 v3 + (MAlonzo.Code.VerifiedCompilation.Trace.d_head_164 (coe v4)) in coe (case coe v5 of MAlonzo.Code.VerifiedCompilation.Certificate.C_proof_18 v6 -> coe - MAlonzo.Code.Utils.du_eitherBind_54 (coe d_certify_44 (coe v4)) + MAlonzo.Code.Utils.du_eitherBind_54 (coe d_certify_46 (coe v4)) (coe (\ v7 -> coe @@ -186,61 +172,61 @@ d_certify_44 v0 MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_32 v8 v9 v10 -> coe MAlonzo.Code.Utils.C_inj'8321'_12 (coe C_abort_10 (coe v8)) _ -> MAlonzo.RTE.mazUnreachableError) - MAlonzo.Code.VerifiedCompilation.Trace.C_done_66 v1 + MAlonzo.Code.VerifiedCompilation.Trace.C_done_160 v1 -> coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe MAlonzo.Code.Agda.Builtin.Unit.C_tt_8) _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.cert -d_cert_94 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -> +d_cert_96 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 -> MAlonzo.Code.Utils.T_Either_6 T_Error_2 AgdaAny -> AgdaAny -> AgdaAny -d_cert_94 ~v0 v1 v2 = du_cert_94 v1 v2 -du_cert_94 :: +d_cert_96 ~v0 v1 v2 = du_cert_96 v1 v2 +du_cert_96 :: MAlonzo.Code.Utils.T_Either_6 T_Error_2 AgdaAny -> AgdaAny -> AgdaAny -du_cert_94 v0 v1 +du_cert_96 v0 v1 = case coe v0 of MAlonzo.Code.Utils.C_inj'8322'_14 v2 -> coe seq (coe v1) (coe v2) _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.checkScope -d_checkScope_98 :: +d_checkScope_100 :: MAlonzo.Code.RawU.T_Untyped_208 -> Maybe MAlonzo.Code.Untyped.T__'8866'_14 -d_checkScope_98 v0 +d_checkScope_100 v0 = coe MAlonzo.Code.Utils.du_eitherToMaybe_104 (coe MAlonzo.Code.Untyped.d_scopeCheckU0_276 (coe v0)) -- VerifiedCompilation.checkScopeᵗ -d_checkScope'7511'_100 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -> - Maybe MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_60 -d_checkScope'7511'_100 v0 +d_checkScope'7511'_102 :: + MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 -> + Maybe MAlonzo.Code.VerifiedCompilation.Trace.T_Trace_154 +d_checkScope'7511'_102 v0 = case coe v0 of - MAlonzo.Code.VerifiedCompilation.Trace.C_step_64 v1 v2 v3 v4 + MAlonzo.Code.VerifiedCompilation.Trace.C_step_158 v1 v2 v3 v4 -> coe MAlonzo.Code.Data.Maybe.Base.du__'62''62''61'__72 - (coe d_checkScope_98 (coe v3)) + (coe d_checkScope_100 (coe v3)) (coe (\ v5 -> coe MAlonzo.Code.Data.Maybe.Base.du__'62''62''61'__72 - (coe d_checkScope'7511'_100 (coe v4)) + (coe d_checkScope'7511'_102 (coe v4)) (coe (\ v6 -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_step_64 (coe v1) (coe v2) + MAlonzo.Code.VerifiedCompilation.Trace.C_step_158 (coe v1) (coe v2) (coe v5) (coe v6)))))) - MAlonzo.Code.VerifiedCompilation.Trace.C_done_66 v1 + MAlonzo.Code.VerifiedCompilation.Trace.C_done_160 v1 -> coe MAlonzo.Code.Data.Maybe.Base.du__'62''62''61'__72 - (coe d_checkScope_98 (coe v1)) + (coe d_checkScope_100 (coe v1)) (coe (\ v2 -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_done_66 (coe v2)))) + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_done_160 (coe v2)))) _ -> MAlonzo.RTE.mazUnreachableError diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Certificate.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Certificate.hs index 9d0eb9371a4..75f7bdc10c4 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Certificate.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Certificate.hs @@ -24,21 +24,28 @@ import qualified MAlonzo.Code.Data.Irrelevant import qualified MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Trace -- VerifiedCompilation.Certificate.CertResult d_CertResult_12 a0 a1 = () data T_CertResult_12 = C_proof_18 AgdaAny | - C_ce_26 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + C_ce_26 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) AgdaAny AgdaAny | - C_abort_32 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + C_abort_32 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) AgdaAny AgdaAny -- VerifiedCompilation.Certificate.ProofOrCE d_ProofOrCE_38 a0 a1 = () data T_ProofOrCE_38 = C_proof_44 AgdaAny | - C_ce_52 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + C_ce_52 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) AgdaAny AgdaAny -- VerifiedCompilation.Certificate.isProof? d_isProof'63'_56 :: @@ -65,7 +72,9 @@ du_isCE'63'_60 v0 d_Proof'63'_66 a0 a1 = () data T_Proof'63'_66 = C_proof_72 AgdaAny | - C_abort_78 MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 + C_abort_78 (MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12) AgdaAny AgdaAny -- VerifiedCompilation.Certificate._>>=_ d__'62''62''61'__88 :: @@ -134,12 +143,16 @@ du_decider_192 v0 v1 v2 d_decToPCE_234 :: () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> MAlonzo.Code.Relation.Nullary.Decidable.Core.T_Dec_20 -> AgdaAny -> AgdaAny -> T_ProofOrCE_38 d_decToPCE_234 ~v0 ~v1 v2 v3 v4 v5 = du_decToPCE_234 v2 v3 v4 v5 du_decToPCE_234 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> MAlonzo.Code.Relation.Nullary.Decidable.Core.T_Dec_20 -> AgdaAny -> AgdaAny -> T_ProofOrCE_38 du_decToPCE_234 v0 v1 v2 v3 @@ -180,7 +193,9 @@ d_matchOrCE_262 :: () -> MAlonzo.Code.Agda.Primitive.T_Level_18 -> (AgdaAny -> AgdaAny -> ()) -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (AgdaAny -> AgdaAny -> MAlonzo.Code.Relation.Nullary.Decidable.Core.T_Dec_20) -> @@ -188,7 +203,9 @@ d_matchOrCE_262 :: d_matchOrCE_262 ~v0 ~v1 ~v2 ~v3 v4 v5 v6 v7 = du_matchOrCE_262 v4 v5 v6 v7 du_matchOrCE_262 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (AgdaAny -> AgdaAny -> MAlonzo.Code.Relation.Nullary.Decidable.Core.T_Dec_20) -> @@ -211,13 +228,17 @@ d_pcePointwise_304 :: () -> MAlonzo.Code.Agda.Primitive.T_Level_18 -> (AgdaAny -> AgdaAny -> ()) -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (AgdaAny -> AgdaAny -> T_ProofOrCE_38) -> [AgdaAny] -> [AgdaAny] -> T_ProofOrCE_38 d_pcePointwise_304 ~v0 ~v1 ~v2 ~v3 v4 v5 v6 v7 = du_pcePointwise_304 v4 v5 v6 v7 du_pcePointwise_304 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (AgdaAny -> AgdaAny -> T_ProofOrCE_38) -> [AgdaAny] -> [AgdaAny] -> T_ProofOrCE_38 du_pcePointwise_304 v0 v1 v2 v3 diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Trace.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Trace.hs index 4be3c493e48..419317d7079 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Trace.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/Trace.hs @@ -23,103 +23,312 @@ import qualified MAlonzo.Code.Agda.Builtin.String import qualified MAlonzo.Code.RawU import qualified MAlonzo.Code.Utils -import UntypedPlutusCore.Transform.Simplifier import UntypedPlutusCore.Transform.Certify.Trace import qualified UntypedPlutusCore.Transform.Certify.Hints as Hints import FFI.CostInfo --- VerifiedCompilation.Trace.SimplifierTag -d_SimplifierTag_4 = () -type T_SimplifierTag_4 = SimplifierStage -pattern C_floatDelayT_6 = FloatDelay -pattern C_forceDelayT_8 = ForceDelay -pattern C_forceCaseDelayT_10 = ForceCaseDelay -pattern C_caseOfCaseT_12 = CaseOfCase -pattern C_caseReduceT_14 = CaseReduce -pattern C_inlineT_16 = Inline -pattern C_cseT_18 = CSE -pattern C_applyToCaseT_20 = ApplyToCase -pattern C_letFloatOutT_22 = LetFloatOut -pattern C_unknown_24 = Unknown -check_floatDelayT_6 :: T_SimplifierTag_4 -check_floatDelayT_6 = FloatDelay -check_forceDelayT_8 :: T_SimplifierTag_4 -check_forceDelayT_8 = ForceDelay -check_forceCaseDelayT_10 :: T_SimplifierTag_4 -check_forceCaseDelayT_10 = ForceCaseDelay -check_caseOfCaseT_12 :: T_SimplifierTag_4 -check_caseOfCaseT_12 = CaseOfCase -check_caseReduceT_14 :: T_SimplifierTag_4 -check_caseReduceT_14 = CaseReduce -check_inlineT_16 :: T_SimplifierTag_4 -check_inlineT_16 = Inline -check_cseT_18 :: T_SimplifierTag_4 -check_cseT_18 = CSE -check_applyToCaseT_20 :: T_SimplifierTag_4 -check_applyToCaseT_20 = ApplyToCase -check_letFloatOutT_22 :: T_SimplifierTag_4 -check_letFloatOutT_22 = LetFloatOut -check_unknown_24 :: T_SimplifierTag_4 -check_unknown_24 = Unknown -cover_SimplifierTag_4 :: SimplifierStage -> () -cover_SimplifierTag_4 x +-- VerifiedCompilation.Trace.UncertifiedOptTag +d_UncertifiedOptTag_4 = () +type T_UncertifiedOptTag_4 = UncertifiedOptStage +pattern C_caseOfCaseT_6 = CaseOfCase +pattern C_letFloatOutT_8 = LetFloatOut +pattern C_uncertifiedConstantFoldT_10 = UncertifiedConstantFold +check_caseOfCaseT_6 :: T_UncertifiedOptTag_4 +check_caseOfCaseT_6 = CaseOfCase +check_letFloatOutT_8 :: T_UncertifiedOptTag_4 +check_letFloatOutT_8 = LetFloatOut +check_uncertifiedConstantFoldT_10 :: T_UncertifiedOptTag_4 +check_uncertifiedConstantFoldT_10 = UncertifiedConstantFold +cover_UncertifiedOptTag_4 :: UncertifiedOptStage -> () +cover_UncertifiedOptTag_4 x + = case x of + CaseOfCase -> () + LetFloatOut -> () + UncertifiedConstantFold -> () +-- VerifiedCompilation.Trace.CertifiedOptTag +d_CertifiedOptTag_12 = () +type T_CertifiedOptTag_12 = CertifiedOptStage +pattern C_floatDelayT_14 = FloatDelay +pattern C_forceDelayT_16 = ForceDelay +pattern C_forceCaseDelayT_18 = ForceCaseDelay +pattern C_caseReduceT_20 = CaseReduce +pattern C_inlineT_22 = Inline +pattern C_cseT_24 = CSE +pattern C_applyToCaseT_26 = ApplyToCase +pattern C_constantFoldT_28 = ConstantFold +check_floatDelayT_14 :: T_CertifiedOptTag_12 +check_floatDelayT_14 = FloatDelay +check_forceDelayT_16 :: T_CertifiedOptTag_12 +check_forceDelayT_16 = ForceDelay +check_forceCaseDelayT_18 :: T_CertifiedOptTag_12 +check_forceCaseDelayT_18 = ForceCaseDelay +check_caseReduceT_20 :: T_CertifiedOptTag_12 +check_caseReduceT_20 = CaseReduce +check_inlineT_22 :: T_CertifiedOptTag_12 +check_inlineT_22 = Inline +check_cseT_24 :: T_CertifiedOptTag_12 +check_cseT_24 = CSE +check_applyToCaseT_26 :: T_CertifiedOptTag_12 +check_applyToCaseT_26 = ApplyToCase +check_constantFoldT_28 :: T_CertifiedOptTag_12 +check_constantFoldT_28 = ConstantFold +cover_CertifiedOptTag_12 :: CertifiedOptStage -> () +cover_CertifiedOptTag_12 x = case x of FloatDelay -> () ForceDelay -> () ForceCaseDelay -> () - CaseOfCase -> () CaseReduce -> () Inline -> () CSE -> () ApplyToCase -> () - LetFloatOut -> () - Unknown -> () + ConstantFold -> () +-- VerifiedCompilation.Trace.OptTag +d_OptTag_30 :: () +d_OptTag_30 = erased +-- VerifiedCompilation.Trace.FloatDelayT +d_FloatDelayT_32 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_FloatDelayT_32 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_floatDelayT_14) +-- VerifiedCompilation.Trace.ForceDelayT +d_ForceDelayT_34 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_ForceDelayT_34 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_forceDelayT_16) +-- VerifiedCompilation.Trace.ForceCaseDelayT +d_ForceCaseDelayT_36 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_ForceCaseDelayT_36 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_forceCaseDelayT_18) +-- VerifiedCompilation.Trace.CaseReduceT +d_CaseReduceT_38 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_CaseReduceT_38 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_caseReduceT_20) +-- VerifiedCompilation.Trace.InlineT +d_InlineT_40 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_InlineT_40 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_inlineT_22) +-- VerifiedCompilation.Trace.CseT +d_CseT_42 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_CseT_42 = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_cseT_24) +-- VerifiedCompilation.Trace.ApplyToCaseT +d_ApplyToCaseT_44 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_ApplyToCaseT_44 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_applyToCaseT_26) +-- VerifiedCompilation.Trace.ConstantFoldT +d_ConstantFoldT_46 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_ConstantFoldT_46 + = coe MAlonzo.Code.Utils.C_inj'8322'_14 (coe C_constantFoldT_28) +-- VerifiedCompilation.Trace.CaseOfCaseT +d_CaseOfCaseT_48 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_CaseOfCaseT_48 + = coe MAlonzo.Code.Utils.C_inj'8321'_12 (coe C_caseOfCaseT_6) +-- VerifiedCompilation.Trace.LetFloatOutT +d_LetFloatOutT_50 :: + MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12 +d_LetFloatOutT_50 + = coe MAlonzo.Code.Utils.C_inj'8321'_12 (coe C_letFloatOutT_8) +-- VerifiedCompilation.Trace.CertifiedBuiltin +d_CertifiedBuiltin_52 = () +type T_CertifiedBuiltin_52 = CertifiedBuiltin +pattern C_certAddInteger_54 = CertAddInteger +pattern C_certSubtractInteger_56 = CertSubtractInteger +pattern C_certMultiplyInteger_58 = CertMultiplyInteger +pattern C_certDivideInteger_60 = CertDivideInteger +pattern C_certQuotientInteger_62 = CertQuotientInteger +pattern C_certRemainderInteger_64 = CertRemainderInteger +pattern C_certModInteger_66 = CertModInteger +pattern C_certEqualsInteger_68 = CertEqualsInteger +pattern C_certLessThanInteger_70 = CertLessThanInteger +pattern C_certLessThanEqualsInteger_72 = CertLessThanEqualsInteger +pattern C_certIfThenElse_74 = CertIfThenElse +pattern C_certChooseUnit_76 = CertChooseUnit +pattern C_certFstPair_78 = CertFstPair +pattern C_certSndPair_80 = CertSndPair +pattern C_certChooseList_82 = CertChooseList +pattern C_certMkCons_84 = CertMkCons +pattern C_certHeadList_86 = CertHeadList +pattern C_certTailList_88 = CertTailList +pattern C_certNullList_90 = CertNullList +pattern C_certDropList_92 = CertDropList +pattern C_certChooseData_94 = CertChooseData +pattern C_certConstrData_96 = CertConstrData +pattern C_certMapData_98 = CertMapData +pattern C_certListData_100 = CertListData +pattern C_certIData_102 = CertIData +pattern C_certUnConstrData_104 = CertUnConstrData +pattern C_certUnMapData_106 = CertUnMapData +pattern C_certUnListData_108 = CertUnListData +pattern C_certUnIData_110 = CertUnIData +pattern C_certEqualsData_112 = CertEqualsData +pattern C_certMkPairData_114 = CertMkPairData +pattern C_certMkNilData_116 = CertMkNilData +pattern C_certMkNilPairData_118 = CertMkNilPairData +check_certAddInteger_54 :: T_CertifiedBuiltin_52 +check_certAddInteger_54 = CertAddInteger +check_certSubtractInteger_56 :: T_CertifiedBuiltin_52 +check_certSubtractInteger_56 = CertSubtractInteger +check_certMultiplyInteger_58 :: T_CertifiedBuiltin_52 +check_certMultiplyInteger_58 = CertMultiplyInteger +check_certDivideInteger_60 :: T_CertifiedBuiltin_52 +check_certDivideInteger_60 = CertDivideInteger +check_certQuotientInteger_62 :: T_CertifiedBuiltin_52 +check_certQuotientInteger_62 = CertQuotientInteger +check_certRemainderInteger_64 :: T_CertifiedBuiltin_52 +check_certRemainderInteger_64 = CertRemainderInteger +check_certModInteger_66 :: T_CertifiedBuiltin_52 +check_certModInteger_66 = CertModInteger +check_certEqualsInteger_68 :: T_CertifiedBuiltin_52 +check_certEqualsInteger_68 = CertEqualsInteger +check_certLessThanInteger_70 :: T_CertifiedBuiltin_52 +check_certLessThanInteger_70 = CertLessThanInteger +check_certLessThanEqualsInteger_72 :: T_CertifiedBuiltin_52 +check_certLessThanEqualsInteger_72 = CertLessThanEqualsInteger +check_certIfThenElse_74 :: T_CertifiedBuiltin_52 +check_certIfThenElse_74 = CertIfThenElse +check_certChooseUnit_76 :: T_CertifiedBuiltin_52 +check_certChooseUnit_76 = CertChooseUnit +check_certFstPair_78 :: T_CertifiedBuiltin_52 +check_certFstPair_78 = CertFstPair +check_certSndPair_80 :: T_CertifiedBuiltin_52 +check_certSndPair_80 = CertSndPair +check_certChooseList_82 :: T_CertifiedBuiltin_52 +check_certChooseList_82 = CertChooseList +check_certMkCons_84 :: T_CertifiedBuiltin_52 +check_certMkCons_84 = CertMkCons +check_certHeadList_86 :: T_CertifiedBuiltin_52 +check_certHeadList_86 = CertHeadList +check_certTailList_88 :: T_CertifiedBuiltin_52 +check_certTailList_88 = CertTailList +check_certNullList_90 :: T_CertifiedBuiltin_52 +check_certNullList_90 = CertNullList +check_certDropList_92 :: T_CertifiedBuiltin_52 +check_certDropList_92 = CertDropList +check_certChooseData_94 :: T_CertifiedBuiltin_52 +check_certChooseData_94 = CertChooseData +check_certConstrData_96 :: T_CertifiedBuiltin_52 +check_certConstrData_96 = CertConstrData +check_certMapData_98 :: T_CertifiedBuiltin_52 +check_certMapData_98 = CertMapData +check_certListData_100 :: T_CertifiedBuiltin_52 +check_certListData_100 = CertListData +check_certIData_102 :: T_CertifiedBuiltin_52 +check_certIData_102 = CertIData +check_certUnConstrData_104 :: T_CertifiedBuiltin_52 +check_certUnConstrData_104 = CertUnConstrData +check_certUnMapData_106 :: T_CertifiedBuiltin_52 +check_certUnMapData_106 = CertUnMapData +check_certUnListData_108 :: T_CertifiedBuiltin_52 +check_certUnListData_108 = CertUnListData +check_certUnIData_110 :: T_CertifiedBuiltin_52 +check_certUnIData_110 = CertUnIData +check_certEqualsData_112 :: T_CertifiedBuiltin_52 +check_certEqualsData_112 = CertEqualsData +check_certMkPairData_114 :: T_CertifiedBuiltin_52 +check_certMkPairData_114 = CertMkPairData +check_certMkNilData_116 :: T_CertifiedBuiltin_52 +check_certMkNilData_116 = CertMkNilData +check_certMkNilPairData_118 :: T_CertifiedBuiltin_52 +check_certMkNilPairData_118 = CertMkNilPairData +cover_CertifiedBuiltin_52 :: CertifiedBuiltin -> () +cover_CertifiedBuiltin_52 x + = case x of + CertAddInteger -> () + CertSubtractInteger -> () + CertMultiplyInteger -> () + CertDivideInteger -> () + CertQuotientInteger -> () + CertRemainderInteger -> () + CertModInteger -> () + CertEqualsInteger -> () + CertLessThanInteger -> () + CertLessThanEqualsInteger -> () + CertIfThenElse -> () + CertChooseUnit -> () + CertFstPair -> () + CertSndPair -> () + CertChooseList -> () + CertMkCons -> () + CertHeadList -> () + CertTailList -> () + CertNullList -> () + CertDropList -> () + CertChooseData -> () + CertConstrData -> () + CertMapData -> () + CertListData -> () + CertIData -> () + CertUnConstrData -> () + CertUnMapData -> () + CertUnListData -> () + CertUnIData -> () + CertEqualsData -> () + CertMkPairData -> () + CertMkNilData -> () + CertMkNilPairData -> () -- VerifiedCompilation.Trace.InlineHints -d_InlineHints_26 = () -type T_InlineHints_26 = Hints.Inline -pattern C_var_28 = Hints.InlVar -pattern C_expand_30 a0 = Hints.InlExpand a0 -pattern C_ƛ_32 a0 = Hints.InlLam a0 -pattern C__'183'__34 a0 a1 = Hints.InlApply a0 a1 -pattern C__'183''8595'_36 a0 = Hints.InlDrop a0 -pattern C_force_38 a0 = Hints.InlForce a0 -pattern C_delay_40 a0 = Hints.InlDelay a0 -pattern C_con_42 = Hints.InlCon -pattern C_builtin_44 = Hints.InlBuiltin -pattern C_error_46 = Hints.InlError -pattern C_constr_48 a0 = Hints.InlConstr a0 -pattern C_case_50 a0 a1 = Hints.InlCase a0 a1 -check_var_28 :: T_InlineHints_26 -check_var_28 = Hints.InlVar -check_expand_30 :: T_InlineHints_26 -> T_InlineHints_26 -check_expand_30 = Hints.InlExpand -check_ƛ_32 :: T_InlineHints_26 -> T_InlineHints_26 -check_ƛ_32 = Hints.InlLam -check__'183'__34 :: - T_InlineHints_26 -> T_InlineHints_26 -> T_InlineHints_26 -check__'183'__34 = Hints.InlApply -check__'183''8595'_36 :: T_InlineHints_26 -> T_InlineHints_26 -check__'183''8595'_36 = Hints.InlDrop -check_force_38 :: T_InlineHints_26 -> T_InlineHints_26 -check_force_38 = Hints.InlForce -check_delay_40 :: T_InlineHints_26 -> T_InlineHints_26 -check_delay_40 = Hints.InlDelay -check_con_42 :: T_InlineHints_26 -check_con_42 = Hints.InlCon -check_builtin_44 :: T_InlineHints_26 -check_builtin_44 = Hints.InlBuiltin -check_error_46 :: T_InlineHints_26 -check_error_46 = Hints.InlError -check_constr_48 :: - MAlonzo.Code.Agda.Builtin.List.T_List_10 () T_InlineHints_26 -> - T_InlineHints_26 -check_constr_48 = Hints.InlConstr -check_case_50 :: - T_InlineHints_26 -> - MAlonzo.Code.Agda.Builtin.List.T_List_10 () T_InlineHints_26 -> - T_InlineHints_26 -check_case_50 = Hints.InlCase -cover_InlineHints_26 :: Hints.Inline -> () -cover_InlineHints_26 x +d_InlineHints_120 = () +type T_InlineHints_120 = Hints.Inline +pattern C_var_122 = Hints.InlVar +pattern C_expand_124 a0 = Hints.InlExpand a0 +pattern C_ƛ_126 a0 = Hints.InlLam a0 +pattern C__'183'__128 a0 a1 = Hints.InlApply a0 a1 +pattern C__'183''8595'_130 a0 = Hints.InlDrop a0 +pattern C_force_132 a0 = Hints.InlForce a0 +pattern C_delay_134 a0 = Hints.InlDelay a0 +pattern C_con_136 = Hints.InlCon +pattern C_builtin_138 = Hints.InlBuiltin +pattern C_error_140 = Hints.InlError +pattern C_constr_142 a0 = Hints.InlConstr a0 +pattern C_case_144 a0 a1 = Hints.InlCase a0 a1 +check_var_122 :: T_InlineHints_120 +check_var_122 = Hints.InlVar +check_expand_124 :: T_InlineHints_120 -> T_InlineHints_120 +check_expand_124 = Hints.InlExpand +check_ƛ_126 :: T_InlineHints_120 -> T_InlineHints_120 +check_ƛ_126 = Hints.InlLam +check__'183'__128 :: + T_InlineHints_120 -> T_InlineHints_120 -> T_InlineHints_120 +check__'183'__128 = Hints.InlApply +check__'183''8595'_130 :: T_InlineHints_120 -> T_InlineHints_120 +check__'183''8595'_130 = Hints.InlDrop +check_force_132 :: T_InlineHints_120 -> T_InlineHints_120 +check_force_132 = Hints.InlForce +check_delay_134 :: T_InlineHints_120 -> T_InlineHints_120 +check_delay_134 = Hints.InlDelay +check_con_136 :: T_InlineHints_120 +check_con_136 = Hints.InlCon +check_builtin_138 :: T_InlineHints_120 +check_builtin_138 = Hints.InlBuiltin +check_error_140 :: T_InlineHints_120 +check_error_140 = Hints.InlError +check_constr_142 :: + MAlonzo.Code.Agda.Builtin.List.T_List_10 () T_InlineHints_120 -> + T_InlineHints_120 +check_constr_142 = Hints.InlConstr +check_case_144 :: + T_InlineHints_120 -> + MAlonzo.Code.Agda.Builtin.List.T_List_10 () T_InlineHints_120 -> + T_InlineHints_120 +check_case_144 = Hints.InlCase +cover_InlineHints_120 :: Hints.Inline -> () +cover_InlineHints_120 x = case x of Hints.InlVar -> () Hints.InlExpand _ -> () @@ -134,101 +343,110 @@ cover_InlineHints_26 x Hints.InlConstr _ -> () Hints.InlCase _ _ -> () -- VerifiedCompilation.Trace.Hints -d_Hints_52 = () -type T_Hints_52 = Hints.Hints -pattern C_inline_54 a0 = Hints.Inline a0 -pattern C_none_56 = Hints.NoHints -check_inline_54 :: T_InlineHints_26 -> T_Hints_52 -check_inline_54 = Hints.Inline -check_none_56 :: T_Hints_52 -check_none_56 = Hints.NoHints -cover_Hints_52 :: Hints.Hints -> () -cover_Hints_52 x +d_Hints_146 = () +type T_Hints_146 = Hints.Hints +pattern C_inline_148 a0 = Hints.Inline a0 +pattern C_none_150 = Hints.NoHints +check_inline_148 :: T_InlineHints_120 -> T_Hints_146 +check_inline_148 = Hints.Inline +check_none_150 :: T_Hints_146 +check_none_150 = Hints.NoHints +cover_Hints_146 :: Hints.Hints -> () +cover_Hints_146 x = case x of Hints.Inline _ -> () Hints.NoHints -> () -- VerifiedCompilation.Trace.Trace -d_Trace_60 a0 = () -data T_Trace_60 - = C_step_64 T_SimplifierTag_4 T_Hints_52 AgdaAny T_Trace_60 | - C_done_66 AgdaAny +d_Trace_154 a0 = () +data T_Trace_154 + = C_step_158 (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) + T_Hints_146 AgdaAny T_Trace_154 | + C_done_160 AgdaAny -- VerifiedCompilation.Trace.head -d_head_70 :: T_Trace_60 -> AgdaAny -d_head_70 v0 +d_head_164 :: T_Trace_154 -> AgdaAny +d_head_164 v0 = case coe v0 of - C_step_64 v1 v2 v3 v4 -> coe v3 - C_done_66 v1 -> coe v1 + C_step_158 v1 v2 v3 v4 -> coe v3 + C_done_160 v1 -> coe v1 _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.Trace.Dump -d_Dump_76 :: () -d_Dump_76 = erased +d_Dump_170 :: () +d_Dump_170 = erased -- VerifiedCompilation.Trace.toTrace -d_toTrace_78 :: +d_toTrace_172 :: [MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> - Maybe T_Trace_60 -d_toTrace_78 v0 + Maybe T_Trace_154 +d_toTrace_172 v0 = case coe v0 of [] -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 (:) v1 v2 -> coe MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 - (coe du_go_88 (coe v1) (coe v2)) + (coe du_go_182 (coe v1) (coe v2)) _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.Trace._.go -d_go_88 :: +d_go_182 :: MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208)) -> [MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208)) -> [MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> - T_Trace_60 -d_go_88 ~v0 ~v1 v2 v3 = du_go_88 v2 v3 -du_go_88 :: + T_Trace_154 +d_go_182 ~v0 ~v1 v2 v3 = du_go_182 v2 v3 +du_go_182 :: MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208)) -> [MAlonzo.Code.Utils.T__'215'__428 - T_SimplifierTag_4 + (MAlonzo.Code.Utils.T_Either_6 + T_UncertifiedOptTag_4 T_CertifiedOptTag_12) (MAlonzo.Code.Utils.T__'215'__428 - T_Hints_52 + T_Hints_146 (MAlonzo.Code.Utils.T__'215'__428 MAlonzo.Code.RawU.T_Untyped_208 MAlonzo.Code.RawU.T_Untyped_208))] -> - T_Trace_60 -du_go_88 v0 v1 + T_Trace_154 +du_go_182 v0 v1 = case coe v0 of MAlonzo.Code.Utils.C__'44'__442 v2 v3 -> case coe v3 of @@ -238,7 +456,7 @@ du_go_88 v0 v1 -> case coe v1 of [] -> coe - C_step_64 (coe v2) (coe v4) (coe v6) (coe C_done_66 (coe v7)) + C_step_158 (coe v2) (coe v4) (coe v6) (coe C_done_160 (coe v7)) (:) v8 v9 -> case coe v8 of MAlonzo.Code.Utils.C__'44'__442 v10 v11 @@ -247,9 +465,9 @@ du_go_88 v0 v1 -> case coe v13 of MAlonzo.Code.Utils.C__'44'__442 v14 v15 -> coe - C_step_64 (coe v2) (coe v4) (coe v6) + C_step_158 (coe v2) (coe v4) (coe v6) (coe - du_go_88 + du_go_182 (coe MAlonzo.Code.Utils.C__'44'__442 (coe v10) @@ -268,18 +486,18 @@ du_go_88 v0 v1 _ -> MAlonzo.RTE.mazUnreachableError _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.Trace.EvalResult -d_EvalResult_114 = () -type T_EvalResult_114 = EvalResult -pattern C_success_116 a0 a1 = EvalSuccess a0 a1 -pattern C_failure_118 a0 a1 a2 = EvalFailure a0 a1 a2 -check_success_116 :: Integer -> Integer -> T_EvalResult_114 -check_success_116 = EvalSuccess -check_failure_118 :: +d_EvalResult_208 = () +type T_EvalResult_208 = EvalResult +pattern C_success_210 a0 a1 = EvalSuccess a0 a1 +pattern C_failure_212 a0 a1 a2 = EvalFailure a0 a1 a2 +check_success_210 :: Integer -> Integer -> T_EvalResult_208 +check_success_210 = EvalSuccess +check_failure_212 :: MAlonzo.Code.Agda.Builtin.String.T_String_6 -> - Integer -> Integer -> T_EvalResult_114 -check_failure_118 = EvalFailure -cover_EvalResult_114 :: EvalResult -> () -cover_EvalResult_114 x + Integer -> Integer -> T_EvalResult_208 +check_failure_212 = EvalFailure +cover_EvalResult_208 :: EvalResult -> () +cover_EvalResult_208 x = case x of EvalSuccess _ _ -> () EvalFailure _ _ _ -> () diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UApplyToCase.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UApplyToCase.hs index 590cf608646..438bc1e9acd 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UApplyToCase.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UApplyToCase.hs @@ -24,6 +24,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.Reduction +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -43,7 +44,7 @@ d_a2c'63''7580''7580'_24 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44) (coe d_a2c'63'_32) -- VerifiedCompilation.UApplyToCase.a2c? d_a2c'63'_32 :: @@ -74,38 +75,31 @@ d_a2c'63'_32 v0 v1 v2 MAlonzo.Code.Untyped.C_'96'_18 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_ƛ_20 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C__'183'__22 v5 v6 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_force_24 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_delay_26 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_con_28 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_constr_34 v5 v6 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_case_40 v5 v6 -> let v7 = coe @@ -247,21 +241,18 @@ d_a2c'63'_32 v0 v1 v2 seq (coe v12) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError) MAlonzo.Code.Untyped.C_builtin_44 v5 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 MAlonzo.Code.Untyped.C_error_46 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_applyToCaseT_20) v1 - v2 + MAlonzo.Code.VerifiedCompilation.Trace.d_ApplyToCaseT_44 v1 v2 _ -> MAlonzo.RTE.mazUnreachableError)) -- VerifiedCompilation.UApplyToCase..extendedlambda0 d_'46'extendedlambda0_48 :: @@ -283,7 +274,9 @@ d_'46'extendedlambda1_94 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> T_ApplyToCase_4 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20 diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCSE.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCSE.hs index bae548fe205..54b40b35e7a 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCSE.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCSE.hs @@ -22,6 +22,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.RenamingSubstitution +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -46,7 +47,7 @@ d_isUntypedCSE'63'_26 :: d_isUntypedCSE'63'_26 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 - (coe v0) (coe MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18) + (coe v0) (coe MAlonzo.Code.VerifiedCompilation.Trace.d_CseT_42) (coe d_isUCSE'63'_30) -- VerifiedCompilation.UCSE.isUCSE? d_isUCSE'63'_30 :: @@ -115,7 +116,7 @@ d_isUCSE'63'_30 v0 v1 v2 seq (coe v5) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_cseT_18) v1 v2) + MAlonzo.Code.VerifiedCompilation.Trace.d_CseT_42 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UCSE..extendedlambda0 d_'46'extendedlambda0_46 :: @@ -136,7 +137,9 @@ d_'46'extendedlambda1_78 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> T_UCSE_4 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20 d_'46'extendedlambda1_78 = erased diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseOfCase.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseOfCase.hs index efab228a744..17269c21022 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseOfCase.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseOfCase.hs @@ -26,6 +26,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.Equality +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -559,7 +560,7 @@ d_isCaseOfCase'63'_256 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48) (coe d_isCoC'63'_264) -- VerifiedCompilation.UCaseOfCase.isCoC? d_isCoC'63'_264 :: @@ -670,7 +671,7 @@ d_isCoC'63'_264 v0 v1 v2 = coe MAlonzo.Code.VerifiedCompilation.Certificate.du_pcePointwise_304 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48) (coe d_isCaseOfCase'63'_256 (coe @@ -687,7 +688,7 @@ d_isCoC'63'_264 v0 v1 v2 = coe MAlonzo.Code.VerifiedCompilation.Certificate.du_pcePointwise_304 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48) (coe d_isCaseOfCase'63'_256 (coe @@ -704,7 +705,7 @@ d_isCoC'63'_264 v0 v1 v2 = coe MAlonzo.Code.VerifiedCompilation.Certificate.du_pcePointwise_304 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48) (coe d_isCaseOfCase'63'_256 (coe @@ -753,8 +754,7 @@ d_isCoC'63'_264 v0 v1 v2 v40) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48 (coe MAlonzo.Code.Untyped.C_case_40 (coe @@ -826,8 +826,7 @@ d_isCoC'63'_264 v0 v1 v2 seq (coe v5) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_caseOfCaseT_12) v1 - v2) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseOfCaseT_48 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UCaseOfCase..extendedlambda4 d_'46'extendedlambda4_280 :: @@ -866,7 +865,9 @@ d_'46'extendedlambda6_444 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -887,7 +888,9 @@ d_'46'extendedlambda7_524 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> [MAlonzo.Code.Untyped.T__'8866'_14] -> @@ -909,7 +912,9 @@ d_'46'extendedlambda8_608 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> [MAlonzo.Code.Untyped.T__'8866'_14] -> diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseReduce.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseReduce.hs index f3a5c043e91..eb6735813db 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseReduce.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UCaseReduce.hs @@ -29,6 +29,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.CEK import qualified MAlonzo.Code.Untyped.Reduction +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -49,7 +50,7 @@ d_isCaseReduce'63'_26 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_CaseReduceT_38) (coe d_isCR'63'_42) -- VerifiedCompilation.UCaseReduce.justEq d_justEq_34 :: @@ -132,8 +133,7 @@ d_isCR'63'_42 v0 v1 v2 MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseReduceT_38 v1 v2 _ -> MAlonzo.RTE.mazUnreachableError))) _ -> MAlonzo.RTE.mazUnreachableError @@ -145,8 +145,7 @@ d_isCR'63'_42 v0 v1 v2 seq (coe v5) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_caseReduceT_14) v1 - v2) + MAlonzo.Code.VerifiedCompilation.Trace.d_CaseReduceT_38 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UCaseReduce..extendedlambda0 d_'46'extendedlambda0_58 :: @@ -191,7 +190,9 @@ d_'46'extendedlambda3_142 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> [MAlonzo.Code.Untyped.T__'8866'_14] -> diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UConstantFold.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UConstantFold.hs new file mode 100644 index 00000000000..60af93e4ccd --- /dev/null +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UConstantFold.hs @@ -0,0 +1,1376 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE EmptyCase #-} +{-# LANGUAGE EmptyDataDecls #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE NoMonomorphismRestriction #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} + +{-# OPTIONS_GHC -Wno-overlapping-patterns #-} + +module MAlonzo.Code.VerifiedCompilation.UConstantFold where + +import MAlonzo.RTE (coe, erased, AgdaAny, addInt, subInt, mulInt, + quotInt, remInt, geqInt, ltInt, eqInt, add64, sub64, mul64, quot64, + rem64, lt64, eq64, word64FromNat, word64ToNat) +import qualified MAlonzo.RTE +import qualified Data.Text +import qualified MAlonzo.Code.Agda.Builtin.Bool +import qualified MAlonzo.Code.Agda.Builtin.Equality +import qualified MAlonzo.Code.Agda.Builtin.Maybe +import qualified MAlonzo.Code.Builtin +import qualified MAlonzo.Code.Builtin.Constant.AtomicType +import qualified MAlonzo.Code.Builtin.Signature +import qualified MAlonzo.Code.Data.Bool.Base +import qualified MAlonzo.Code.Data.Integer.Base +import qualified MAlonzo.Code.Data.Integer.Properties +import qualified MAlonzo.Code.RawU +import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core +import qualified MAlonzo.Code.Untyped +import qualified MAlonzo.Code.Untyped.Equality +import qualified MAlonzo.Code.Utils +import qualified MAlonzo.Code.VerifiedCompilation.Certificate +import qualified MAlonzo.Code.VerifiedCompilation.Trace +import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation + +-- VerifiedCompilation.UConstantFold.evalCF +d_evalCF_6 :: + Integer -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + Maybe MAlonzo.Code.Untyped.T__'8866'_14 +d_evalCF_6 ~v0 v1 = du_evalCF_6 v1 +du_evalCF_6 :: + MAlonzo.Code.Untyped.T__'8866'_14 -> + Maybe MAlonzo.Code.Untyped.T__'8866'_14 +du_evalCF_6 v0 + = let v1 = coe MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 in + coe + (case coe v0 of + MAlonzo.Code.Untyped.C__'183'__22 v2 v3 + -> case coe v2 of + MAlonzo.Code.Untyped.C__'183'__22 v4 v5 + -> case coe v4 of + MAlonzo.Code.Untyped.C__'183'__22 v6 v7 + -> case coe v6 of + MAlonzo.Code.Untyped.C__'183'__22 v8 v9 + -> case coe v8 of + MAlonzo.Code.Untyped.C__'183'__22 v10 v11 + -> case coe v10 of + MAlonzo.Code.Untyped.C__'183'__22 v12 v13 + -> case coe v12 of + MAlonzo.Code.Untyped.C_force_24 v14 + -> case coe v14 of + MAlonzo.Code.Untyped.C_builtin_44 v15 + -> case coe v15 of + MAlonzo.Code.Builtin.C_chooseData_86 + -> case coe v13 of + MAlonzo.Code.Untyped.C_con_28 v16 + -> case coe v16 of + MAlonzo.Code.RawU.C_tmCon_206 v17 v18 + -> case coe v17 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v20 + -> case coe + v20 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe + v18 of + MAlonzo.Code.Utils.C_ConstrDATA_612 v21 v22 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + v11) + MAlonzo.Code.Utils.C_MapDATA_614 v21 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + v9) + MAlonzo.Code.Utils.C_ListDATA_616 v21 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + v7) + MAlonzo.Code.Utils.C_iDATA_618 v21 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + v5) + MAlonzo.Code.Utils.C_bDATA_620 v21 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + v3) + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe + v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_force_24 v8 + -> case coe v8 of + MAlonzo.Code.Untyped.C_force_24 v9 + -> case coe v9 of + MAlonzo.Code.Untyped.C_builtin_44 v10 + -> case coe v10 of + MAlonzo.Code.Builtin.C_chooseList_70 + -> case coe v7 of + MAlonzo.Code.Untyped.C_con_28 v11 + -> case coe v11 of + MAlonzo.Code.RawU.C_tmCon_206 v12 v13 + -> case coe v12 of + MAlonzo.Code.Builtin.Signature.C_list_16 v15 + -> case coe v13 of + MAlonzo.Code.Utils.C_'91''93'_450 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe v5) + MAlonzo.Code.Utils.C__'8759'__452 v16 v17 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe v3) + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_builtin_44 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.C_ifThenElse_60 + -> case coe v7 of + MAlonzo.Code.Untyped.C_con_28 v10 + -> case coe v10 of + MAlonzo.Code.RawU.C_tmCon_206 v11 v12 + -> case coe v11 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v14 + -> case coe v14 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Data.Bool.Base.du_if_then_else__44 + (coe v12) (coe v5) + (coe v3)) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_force_24 v6 + -> case coe v6 of + MAlonzo.Code.Untyped.C_builtin_44 v7 + -> case coe v7 of + MAlonzo.Code.Builtin.C_chooseUnit_62 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v8 + -> case coe v8 of + MAlonzo.Code.RawU.C_tmCon_206 v9 v10 + -> case coe v9 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v12 + -> case coe v12 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aUnit_14 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe v3) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_mkCons_72 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v8 + -> case coe v8 of + MAlonzo.Code.RawU.C_tmCon_206 v9 v10 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v11 + -> case coe v11 of + MAlonzo.Code.RawU.C_tmCon_206 v12 v13 + -> case coe v12 of + MAlonzo.Code.Builtin.Signature.C_list_16 v15 + -> let v16 + = MAlonzo.Code.RawU.d_decTyTag_68 + (coe v9) + (coe v15) in + coe + (case coe v16 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v17 v18 + -> if coe v17 + then coe + seq + (coe + v18) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + v9) + (coe + MAlonzo.Code.Utils.C__'8759'__452 + (coe + v10) + (coe + v13))))) + else coe + seq + (coe + v18) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18) + _ -> MAlonzo.RTE.mazUnreachableError) + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_dropList_186 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v8 + -> case coe v8 of + MAlonzo.Code.RawU.C_tmCon_206 v9 v10 + -> case coe v9 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v12 + -> case coe v12 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v13 + -> case coe v13 of + MAlonzo.Code.RawU.C_tmCon_206 v14 v15 + -> case coe v14 of + MAlonzo.Code.Builtin.Signature.C_list_16 v17 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + v17) + (coe + MAlonzo.Code.Utils.du_dropLIST_520 + (coe + v10) + (coe + v15)))) + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_builtin_44 v6 + -> case coe v6 of + MAlonzo.Code.Builtin.C_addInteger_4 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Data.Integer.Base.d__'43'__284 + (coe + v9) + (coe + v14)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_subtractInteger_6 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Data.Integer.Base.d__'45'__302 + (coe + v9) + (coe + v14)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_multiplyInteger_8 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Data.Integer.Base.d__'42'__316 + (coe + v9) + (coe + v14)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_divideInteger_10 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> let v17 + = MAlonzo.Code.Data.Integer.Properties.d__'8799'__2800 + (coe + v14) + (coe + (0 :: + Integer)) in + coe + (case coe + v17 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v18 v19 + -> if coe + v18 + then coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18) + else coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Builtin.d_div_312 + v9 + v14)))) + _ -> MAlonzo.RTE.mazUnreachableError) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_quotientInteger_12 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> let v17 + = MAlonzo.Code.Data.Integer.Properties.d__'8799'__2800 + (coe + v14) + (coe + (0 :: + Integer)) in + coe + (case coe + v17 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v18 v19 + -> if coe + v18 + then coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18) + else coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Builtin.d_quot_314 + v9 + v14)))) + _ -> MAlonzo.RTE.mazUnreachableError) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_remainderInteger_14 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> let v17 + = MAlonzo.Code.Data.Integer.Properties.d__'8799'__2800 + (coe + v14) + (coe + (0 :: + Integer)) in + coe + (case coe + v17 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v18 v19 + -> if coe + v18 + then coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18) + else coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Builtin.d_rem_316 + v9 + v14)))) + _ -> MAlonzo.RTE.mazUnreachableError) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_modInteger_16 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> let v17 + = MAlonzo.Code.Data.Integer.Properties.d__'8799'__2800 + (coe + v14) + (coe + (0 :: + Integer)) in + coe + (case coe + v17 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v18 v19 + -> if coe + v18 + then coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18) + else coe + seq + (coe + v19) + (coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Builtin.d_mod_318 + v9 + v14)))) + _ -> MAlonzo.RTE.mazUnreachableError) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_equalsInteger_18 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Relation.Nullary.Decidable.Core.d_does_28 + (coe + MAlonzo.Code.Data.Integer.Properties.d__'8799'__2800 + (coe + v9) + (coe + v14))))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_lessThanInteger_20 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Relation.Nullary.Decidable.Core.d_does_28 + (coe + MAlonzo.Code.Data.Integer.Properties.d__'60''63'__3190 + (coe + v9) + (coe + v14))))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_lessThanEqualsInteger_22 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Relation.Nullary.Decidable.Core.d_does_28 + (coe + MAlonzo.Code.Data.Integer.Properties.d__'8804''63'__2880 + (coe + v9) + (coe + v14))))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_constrData_88 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_list_16 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v18 + -> case coe + v18 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v18) + (coe + MAlonzo.Code.Utils.C_ConstrDATA_612 + (coe + v9) + (coe + v14)))) + _ -> coe + v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_equalsData_108 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Utils.d_eqDATA_622 + (coe + v9) + (coe + v14)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_mkPairData_112 + -> case coe v5 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v12 + -> case coe v12 of + MAlonzo.Code.RawU.C_tmCon_206 v13 v14 + -> case coe v13 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_pair_24 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16)) + (coe + MAlonzo.Code.Utils.C__'44'__442 + (coe + v9) + (coe + v14)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_force_24 v4 + -> case coe v4 of + MAlonzo.Code.Untyped.C_force_24 v5 + -> case coe v5 of + MAlonzo.Code.Untyped.C_builtin_44 v6 + -> case coe v6 of + MAlonzo.Code.Builtin.C_fstPair_66 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_pair_24 v11 v12 + -> case coe v9 of + MAlonzo.Code.Utils.C__'44'__442 v13 v14 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe v11) (coe v13))) + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_sndPair_68 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v7 + -> case coe v7 of + MAlonzo.Code.RawU.C_tmCon_206 v8 v9 + -> case coe v8 of + MAlonzo.Code.Builtin.Signature.C_pair_24 v11 v12 + -> case coe v9 of + MAlonzo.Code.Utils.C__'44'__442 v13 v14 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe v12) (coe v14))) + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_builtin_44 v5 + -> case coe v5 of + MAlonzo.Code.Builtin.C_headList_74 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v6 + -> case coe v6 of + MAlonzo.Code.RawU.C_tmCon_206 v7 v8 + -> case coe v7 of + MAlonzo.Code.Builtin.Signature.C_list_16 v10 + -> case coe v8 of + MAlonzo.Code.Utils.C__'8759'__452 v11 v12 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe v10) (coe v11))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_tailList_76 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v6 + -> case coe v6 of + MAlonzo.Code.RawU.C_tmCon_206 v7 v8 + -> case coe v7 of + MAlonzo.Code.Builtin.Signature.C_list_16 v10 + -> case coe v8 of + MAlonzo.Code.Utils.C__'8759'__452 v11 v12 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + v10) + (coe v12))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_nullList_78 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v6 + -> case coe v6 of + MAlonzo.Code.RawU.C_tmCon_206 v7 v8 + -> case coe v7 of + MAlonzo.Code.Builtin.Signature.C_list_16 v10 + -> case coe v8 of + MAlonzo.Code.Utils.C_'91''93'_450 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Agda.Builtin.Bool.C_true_10))) + MAlonzo.Code.Utils.C__'8759'__452 v11 v12 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aBool_16)) + (coe + MAlonzo.Code.Agda.Builtin.Bool.C_false_8))) + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + MAlonzo.Code.Untyped.C_builtin_44 v4 + -> case coe v4 of + MAlonzo.Code.Builtin.C_mapData_90 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_list_16 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Signature.C_pair_24 v11 v12 + -> case coe v11 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v14 + -> case coe v14 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v12 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v16 + -> case coe v16 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v16) + (coe + MAlonzo.Code.Utils.C_MapDATA_614 + (coe + v7)))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_listData_92 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_list_16 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v11 + -> case coe v11 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v11) + (coe + MAlonzo.Code.Utils.C_ListDATA_616 + (coe v7)))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_iData_94 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18)) + (coe + MAlonzo.Code.Utils.C_iDATA_618 + (coe v7)))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_unConstrData_98 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v7 of + MAlonzo.Code.Utils.C_ConstrDATA_612 v10 v11 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_pair_24 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8)) + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v9))) + (coe + MAlonzo.Code.Utils.C__'44'__442 + (coe v10) (coe v11)))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_unMapData_100 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v7 of + MAlonzo.Code.Utils.C_MapDATA_614 v10 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + (coe + MAlonzo.Code.Builtin.Signature.C_pair_24 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v9) + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v9))) + (coe v10))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_unListData_102 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v7 of + MAlonzo.Code.Utils.C_ListDATA_616 v10 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + v9)) + (coe v10))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_unIData_104 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18 + -> case coe v7 of + MAlonzo.Code.Utils.C_iDATA_618 v10 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aInteger_8)) + (coe v10))) + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_mkNilData_114 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aUnit_14 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18))) + (coe + MAlonzo.Code.Utils.C_'91''93'_450))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + MAlonzo.Code.Builtin.C_mkNilPairData_116 + -> case coe v3 of + MAlonzo.Code.Untyped.C_con_28 v5 + -> case coe v5 of + MAlonzo.Code.RawU.C_tmCon_206 v6 v7 + -> case coe v6 of + MAlonzo.Code.Builtin.Signature.C_atomic_12 v9 + -> case coe v9 of + MAlonzo.Code.Builtin.Constant.AtomicType.C_aUnit_14 + -> coe + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 + (coe + MAlonzo.Code.Untyped.C_con_28 + (coe + MAlonzo.Code.RawU.C_tmCon_206 + (coe + MAlonzo.Code.Builtin.Signature.C_list_16 + (coe + MAlonzo.Code.Builtin.Signature.C_pair_24 + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18)) + (coe + MAlonzo.Code.Builtin.Signature.C_atomic_12 + (coe + MAlonzo.Code.Builtin.Constant.AtomicType.C_aData_18)))) + (coe + MAlonzo.Code.Utils.C_'91''93'_450))) + _ -> coe v1 + _ -> coe v1 + _ -> MAlonzo.RTE.mazUnreachableError + _ -> coe v1 + _ -> coe v1 + _ -> coe v1 + _ -> coe v1) +-- VerifiedCompilation.UConstantFold.ConstantFold +d_ConstantFold_196 a0 a1 a2 = () +data T_ConstantFold_196 = C_constantFold_204 +-- VerifiedCompilation.UConstantFold.isConstantFold? +d_isConstantFold'63'_208 :: + Integer -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 +d_isConstantFold'63'_208 v0 v1 v2 + = let v3 = coe du_evalCF_6 (coe v1) in + coe + (case coe v3 of + MAlonzo.Code.Agda.Builtin.Maybe.C_just_16 v4 + -> let v5 + = MAlonzo.Code.Untyped.Equality.d_decEq'45''8866'_56 + (coe v0) (coe v4) (coe v2) in + coe + (case coe v5 of + MAlonzo.Code.Relation.Nullary.Decidable.Core.C__because__32 v6 v7 + -> if coe v6 + then coe + seq (coe v7) + (coe + MAlonzo.Code.VerifiedCompilation.Certificate.C_proof_44 + (coe C_constantFold_204)) + else coe + seq (coe v7) + (coe + MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 + MAlonzo.Code.VerifiedCompilation.Trace.d_ConstantFoldT_46 v1 v2) + _ -> MAlonzo.RTE.mazUnreachableError) + MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 + -> coe + MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 + MAlonzo.Code.VerifiedCompilation.Trace.d_ConstantFoldT_46 v1 v2 + _ -> MAlonzo.RTE.mazUnreachableError) +-- VerifiedCompilation.UConstantFold.UConstantFold +d_UConstantFold_258 :: + Integer -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.Untyped.T__'8866'_14 -> () +d_UConstantFold_258 = erased +-- VerifiedCompilation.UConstantFold.isUConstantFold? +d_isUConstantFold'63'_262 :: + Integer -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.Untyped.T__'8866'_14 -> + MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 +d_isUConstantFold'63'_262 v0 + = coe + MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 + (coe v0) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_ConstantFoldT_46) + (coe d_isConstantFold'63'_208) diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UFloatDelay.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UFloatDelay.hs index 4b110408696..b8e1f5857ce 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UFloatDelay.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UFloatDelay.hs @@ -31,6 +31,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.Purity +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -540,7 +541,7 @@ d_isFloatDelay'63'_488 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_FloatDelayT_32) (coe d_isFlD'63'_492) -- VerifiedCompilation.UFloatDelay.isFlD? d_isFlD'63'_492 :: @@ -696,8 +697,7 @@ d_isFlD'63'_492 v0 v1 v2 v38) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6) + MAlonzo.Code.VerifiedCompilation.Trace.d_FloatDelayT_32 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) @@ -726,8 +726,7 @@ d_isFlD'63'_492 v0 v1 v2 v21) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6) + MAlonzo.Code.VerifiedCompilation.Trace.d_FloatDelayT_32 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError)) @@ -742,7 +741,7 @@ d_isFlD'63'_492 v0 v1 v2 seq (coe v5) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_floatDelayT_6) v1 v2) + MAlonzo.Code.VerifiedCompilation.Trace.d_FloatDelayT_32 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UFloatDelay..extendedlambda8 d_'46'extendedlambda8_508 :: @@ -772,7 +771,9 @@ d_'46'extendedlambda10_582 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -788,7 +789,9 @@ d_'46'extendedlambda11_630 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceCaseDelay.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceCaseDelay.hs index 0ea9d7c7a96..79084aae7dc 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceCaseDelay.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceCaseDelay.hs @@ -27,6 +27,7 @@ import qualified MAlonzo.Code.Data.List.Relation.Unary.All import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -166,7 +167,7 @@ d_isForceCaseDelay'63'_94 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36) (coe d_isFCD'63'_96) -- VerifiedCompilation.UForceCaseDelay.isFCD? d_isFCD'63'_96 :: @@ -270,7 +271,7 @@ d_isFCD'63'_96 v0 v1 v2 = coe MAlonzo.Code.VerifiedCompilation.Certificate.du_pcePointwise_304 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36) (coe d_isForceCaseDelay'63'_94 (coe @@ -297,16 +298,14 @@ d_isFCD'63'_96 v0 v1 v2 MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 v36 v37 v38 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36 v1 v2 _ -> MAlonzo.RTE.mazUnreachableError) MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 v34 v35 v36 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36 v1 v2 _ -> MAlonzo.RTE.mazUnreachableError) @@ -317,8 +316,7 @@ d_isFCD'63'_96 v0 v1 v2 v28) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError))) @@ -329,8 +327,7 @@ d_isFCD'63'_96 v0 v1 v2 seq (coe v18) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError))) _ -> MAlonzo.RTE.mazUnreachableError @@ -342,8 +339,7 @@ d_isFCD'63'_96 v0 v1 v2 seq (coe v5) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_forceCaseDelayT_10) - v1 v2) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceCaseDelayT_36 v1 v2) _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UForceCaseDelay..extendedlambda1 d_'46'extendedlambda1_112 :: @@ -384,7 +380,9 @@ d_'46'extendedlambda4_228 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> [MAlonzo.Code.Untyped.T__'8866'_14] -> @@ -401,7 +399,9 @@ d_'46'extendedlambda5_280 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceDelay.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceDelay.hs index b0b9e24228b..fc824c53dab 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceDelay.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UForceDelay.hs @@ -26,6 +26,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.Purity import qualified MAlonzo.Code.Untyped.RenamingSubstitution +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace import qualified MAlonzo.Code.VerifiedCompilation.UntypedTranslation @@ -582,7 +583,7 @@ d_isForceDelay'63'_178 v0 = coe MAlonzo.Code.VerifiedCompilation.UntypedTranslation.du_translation'63'_164 (coe v0) - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + (coe MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34) (coe (\ v1 -> d_isFD'63'_184 (coe v1) (coe C_'9633'_82))) -- VerifiedCompilation.UForceDelay.isFD? d_isFD'63'_184 :: @@ -744,8 +745,7 @@ d_isFD'63'_184 v0 v1 v2 v3 seq (coe v9) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v2 v3) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError) @@ -1114,8 +1114,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v87) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v2 v3) _ -> MAlonzo.RTE.mazUnreachableError) @@ -1147,8 +1146,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v80) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v16 v22) _ -> MAlonzo.RTE.mazUnreachableError @@ -1159,8 +1157,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v77) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v43 v59) _ -> MAlonzo.RTE.mazUnreachableError))))) @@ -1332,8 +1329,7 @@ d_isFD'63'_184 v0 v1 v2 v3 seq (coe v13) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v2 v3) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError)) @@ -1855,8 +1851,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v98) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v15 v3) _ -> MAlonzo.RTE.mazUnreachableError) @@ -1888,8 +1883,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v91) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v27 v33) _ -> MAlonzo.RTE.mazUnreachableError @@ -1900,8 +1894,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v88) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v54 v70) _ -> MAlonzo.RTE.mazUnreachableError))))) @@ -2092,8 +2085,7 @@ d_isFD'63'_184 v0 v1 v2 v3 v24) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v15 v3) _ -> MAlonzo.RTE.mazUnreachableError)) @@ -2236,8 +2228,7 @@ d_isFD'63'_184 v0 v1 v2 v3 seq (coe v14) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_ce_52 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_forceDelayT_8) + MAlonzo.Code.VerifiedCompilation.Trace.d_ForceDelayT_34 v2 v3) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError)) @@ -2262,7 +2253,9 @@ d_'46'extendedlambda2_246 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20 d_'46'extendedlambda2_246 = erased @@ -2278,7 +2271,9 @@ d_'46'extendedlambda3_320 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.VerifiedCompilation.UntypedViews.T_isForce_270 -> @@ -2295,7 +2290,9 @@ d_'46'extendedlambda4_348 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2323,7 +2320,9 @@ d_'46'extendedlambda6_476 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2333,7 +2332,9 @@ d_'46'extendedlambda6_476 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20 d_'46'extendedlambda6_476 = erased @@ -2351,7 +2352,9 @@ d_'46'extendedlambda7_518 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20 d_'46'extendedlambda7_518 = erased @@ -2376,7 +2379,9 @@ d_'46'extendedlambda8_634 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2403,7 +2408,9 @@ d_'46'extendedlambda9_688 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2425,7 +2432,9 @@ d_'46'extendedlambda10_750 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2435,7 +2444,9 @@ d_'46'extendedlambda10_750 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2457,7 +2468,9 @@ d_'46'extendedlambda11_814 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2466,7 +2479,9 @@ d_'46'extendedlambda11_814 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2489,7 +2504,9 @@ d_'46'extendedlambda12_880 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Builtin.T_Builtin_2 -> @@ -2497,7 +2514,9 @@ d_'46'extendedlambda12_880 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2525,7 +2544,9 @@ d_'46'extendedlambda13_1034 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2544,7 +2565,9 @@ d_'46'extendedlambda14_1074 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> @@ -2559,13 +2582,17 @@ d_'46'extendedlambda15_1190 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.Agda.Builtin.Sigma.T_Σ_14 -> @@ -2581,7 +2608,9 @@ d_'46'extendedlambda16_1214 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.Agda.Builtin.Sigma.T_Σ_14 -> @@ -2598,7 +2627,9 @@ d_'46'extendedlambda17_1238 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.Agda.Builtin.Sigma.T_Σ_14 -> @@ -2628,7 +2659,9 @@ d_'46'extendedlambda19_1340 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.VerifiedCompilation.UntypedViews.T_isDelay_356 -> @@ -2646,13 +2679,17 @@ d_'46'extendedlambda20_1454 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2667,7 +2704,9 @@ d_'46'extendedlambda21_1480 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2683,7 +2722,9 @@ d_'46'extendedlambda22_1506 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2699,7 +2740,9 @@ d_'46'extendedlambda23_1574 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.Agda.Builtin.Sigma.T_Σ_14 -> @@ -2735,7 +2778,9 @@ d_'46'extendedlambda25_1698 :: MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> (MAlonzo.Code.VerifiedCompilation.UntypedViews.T_isForce_270 -> @@ -2756,7 +2801,9 @@ d_'46'extendedlambda26_1732 :: (T_FD_112 -> MAlonzo.Code.Data.Irrelevant.T_Irrelevant_20) -> () -> () -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> AgdaAny -> AgdaAny -> MAlonzo.Code.VerifiedCompilation.Certificate.T_ProofOrCE_38 -> diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UInline.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UInline.hs index 7b717663d53..6a42a46b935 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UInline.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UInline.hs @@ -297,7 +297,7 @@ d_checkPointwise_304 :: Integer -> T__'8605'_28 -> T__'8605'_28 -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120] -> (MAlonzo.Code.Data.Fin.Base.T_Fin_10 -> MAlonzo.Code.Untyped.T__'8866'_14) -> T__'8829'__102 -> @@ -308,7 +308,7 @@ d_checkPointwise_304 v0 v1 v2 v3 v4 v5 v6 v7 = let v8 = coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) v6 v7 in + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v6 v7 in coe (case coe v3 of [] @@ -358,19 +358,19 @@ d_check_316 :: MAlonzo.Code.Untyped.T__'8866'_14) -> MAlonzo.Code.Untyped.T__'8866'_14 -> T__'8829'__102 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.Certificate.T_Proof'63'_66 d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 = let v8 = coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) v4 v7 in + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7 in coe (case coe v4 of MAlonzo.Code.Untyped.C_'96'_18 v9 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_var_28 + MAlonzo.Code.VerifiedCompilation.Trace.C_var_122 -> case coe v7 of MAlonzo.Code.Untyped.C_'96'_18 v10 -> let v11 @@ -385,8 +385,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 -> let v15 = coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7 in coe (case coe v13 of @@ -419,8 +418,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 MAlonzo.Code.Agda.Builtin.Maybe.C_nothing_18 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v4 _ -> MAlonzo.RTE.mazUnreachableError) _ -> coe v15 @@ -430,7 +428,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v15) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> coe v8 - MAlonzo.Code.VerifiedCompilation.Trace.C_expand_30 v10 + MAlonzo.Code.VerifiedCompilation.Trace.C_expand_124 v10 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.du__'62''62''61'__88 (coe @@ -446,7 +444,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v5 of C_'9633'_106 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_32 v10 + MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_126 v10 -> case coe v7 of MAlonzo.Code.Untyped.C_ƛ_20 v11 -> coe @@ -471,7 +469,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 -> case coe v2 of C__'183'__34 v16 v17 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_32 v18 + MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_126 v18 -> case coe v7 of MAlonzo.Code.Untyped.C_ƛ_20 v19 -> coe @@ -539,7 +537,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> MAlonzo.RTE.mazUnreachableError MAlonzo.Code.Untyped.C__'183'__22 v9 v10 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C__'183'__34 v11 v12 + MAlonzo.Code.VerifiedCompilation.Trace.C__'183'__128 v11 v12 -> case coe v7 of MAlonzo.Code.Untyped.C__'183'__22 v13 v14 -> coe @@ -561,7 +559,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 MAlonzo.Code.VerifiedCompilation.Certificate.C_proof_72 (coe C__'183'__250 v15 v16))))) _ -> coe v8 - MAlonzo.Code.VerifiedCompilation.Trace.C__'183''8595'_36 v11 + MAlonzo.Code.VerifiedCompilation.Trace.C__'183''8595'_130 v11 -> coe MAlonzo.Code.VerifiedCompilation.Certificate.du__'62''62''61'__88 (coe @@ -576,7 +574,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v8 MAlonzo.Code.Untyped.C_force_24 v9 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_force_38 v10 + MAlonzo.Code.VerifiedCompilation.Trace.C_force_132 v10 -> case coe v7 of MAlonzo.Code.Untyped.C_force_24 v11 -> coe @@ -593,7 +591,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v8 MAlonzo.Code.Untyped.C_delay_26 v9 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_delay_40 v10 + MAlonzo.Code.VerifiedCompilation.Trace.C_delay_134 v10 -> case coe v7 of MAlonzo.Code.Untyped.C_delay_26 v11 -> coe @@ -610,7 +608,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v8 MAlonzo.Code.Untyped.C_con_28 v9 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_con_42 + MAlonzo.Code.VerifiedCompilation.Trace.C_con_136 -> case coe v7 of MAlonzo.Code.Untyped.C_con_28 v10 -> let v11 @@ -629,15 +627,14 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 seq (coe v13) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7) _ -> MAlonzo.RTE.mazUnreachableError) _ -> coe v8 _ -> coe v8 MAlonzo.Code.Untyped.C_constr_34 v9 v10 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_constr_48 v11 + MAlonzo.Code.VerifiedCompilation.Trace.C_constr_142 v11 -> case coe v7 of MAlonzo.Code.Untyped.C_constr_34 v12 v13 -> let v14 @@ -672,15 +669,14 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 seq (coe v16) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7) _ -> MAlonzo.RTE.mazUnreachableError) _ -> coe v8 _ -> coe v8 MAlonzo.Code.Untyped.C_case_40 v9 v10 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_case_50 v11 v12 + MAlonzo.Code.VerifiedCompilation.Trace.C_case_144 v11 v12 -> case coe v7 of MAlonzo.Code.Untyped.C_case_40 v13 v14 -> coe @@ -705,7 +701,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v8 MAlonzo.Code.Untyped.C_builtin_44 v9 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_builtin_44 + MAlonzo.Code.VerifiedCompilation.Trace.C_builtin_138 -> case coe v7 of MAlonzo.Code.Untyped.C_builtin_44 v10 -> let v11 @@ -756,8 +752,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 seq (coe v16) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7) _ -> MAlonzo.RTE.mazUnreachableError) else (let v14 @@ -781,8 +776,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 seq (coe v16) (coe MAlonzo.Code.VerifiedCompilation.Certificate.C_abort_78 - (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_inlineT_16) + MAlonzo.Code.VerifiedCompilation.Trace.d_InlineT_40 v4 v7) _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError) @@ -790,7 +784,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> coe v8 MAlonzo.Code.Untyped.C_error_46 -> case coe v6 of - MAlonzo.Code.VerifiedCompilation.Trace.C_error_46 + MAlonzo.Code.VerifiedCompilation.Trace.C_error_140 -> case coe v7 of MAlonzo.Code.Untyped.C_error_46 -> coe @@ -801,7 +795,7 @@ d_check_316 v0 v1 v2 v3 v4 v5 v6 v7 _ -> MAlonzo.RTE.mazUnreachableError) -- VerifiedCompilation.UInline.top-check d_top'45'check_718 :: - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.VerifiedCompilation.Certificate.T_Proof'63'_66 @@ -891,7 +885,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 C_'96'_230 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_var_28) erased + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_var_122) erased C_'96''8595'_234 v14 -> case coe v5 of MAlonzo.Code.Untyped.C_'96'_18 v15 @@ -904,7 +898,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 v17 v18 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_expand_30 (coe v17)) + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_expand_124 (coe v17)) erased _ -> MAlonzo.RTE.mazUnreachableError) _ -> MAlonzo.RTE.mazUnreachableError @@ -929,7 +923,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_32 (coe v15)) + MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_126 (coe v15)) erased _ -> MAlonzo.RTE.mazUnreachableError)) _ -> MAlonzo.RTE.mazUnreachableError @@ -968,7 +962,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_32 + MAlonzo.Code.VerifiedCompilation.Trace.C_ƛ_126 (coe v27)) erased _ -> MAlonzo.RTE.mazUnreachableError) @@ -1033,7 +1027,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C__'183'__34 + MAlonzo.Code.VerifiedCompilation.Trace.C__'183'__128 (coe v24) (coe v26)) erased _ -> MAlonzo.RTE.mazUnreachableError @@ -1054,7 +1048,8 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C__'183''8595'_36 (coe v19)) + MAlonzo.Code.VerifiedCompilation.Trace.C__'183''8595'_130 + (coe v19)) erased _ -> MAlonzo.RTE.mazUnreachableError) _ -> MAlonzo.RTE.mazUnreachableError @@ -1073,7 +1068,8 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_force_38 (coe v18)) + MAlonzo.Code.VerifiedCompilation.Trace.C_force_132 + (coe v18)) erased _ -> MAlonzo.RTE.mazUnreachableError) _ -> MAlonzo.RTE.mazUnreachableError @@ -1093,7 +1089,8 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_delay_40 (coe v18)) + MAlonzo.Code.VerifiedCompilation.Trace.C_delay_134 + (coe v18)) erased _ -> MAlonzo.RTE.mazUnreachableError) _ -> MAlonzo.RTE.mazUnreachableError @@ -1101,11 +1098,11 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 C_con_266 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_con_42) erased + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_con_136) erased C_builtin_270 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_builtin_44) erased + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_builtin_138) erased C_constr_280 v15 -> case coe v5 of MAlonzo.Code.Untyped.C_constr_34 v16 v17 @@ -1121,7 +1118,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_constr_48 + MAlonzo.Code.VerifiedCompilation.Trace.C_constr_142 (coe v21)) erased _ -> MAlonzo.RTE.mazUnreachableError) @@ -1149,7 +1146,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 -> coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 (coe - MAlonzo.Code.VerifiedCompilation.Trace.C_case_50 + MAlonzo.Code.VerifiedCompilation.Trace.C_case_144 (coe v24) (coe v26)) erased _ -> MAlonzo.RTE.mazUnreachableError @@ -1163,7 +1160,7 @@ d_complete_806 v0 v1 v2 v3 v4 v5 v6 v7 seq (coe v6) (coe MAlonzo.Code.Agda.Builtin.Sigma.C__'44'__32 - (coe MAlonzo.Code.VerifiedCompilation.Trace.C_error_46) erased)) + (coe MAlonzo.Code.VerifiedCompilation.Trace.C_error_140) erased)) _ -> MAlonzo.RTE.mazUnreachableError -- VerifiedCompilation.UInline._.e′ d_e'8242'_818 :: @@ -1185,7 +1182,7 @@ d_e'8242'_864 :: MAlonzo.Code.Data.Fin.Base.T_Fin_10 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8242'_864 = erased @@ -1197,7 +1194,7 @@ d_e'8242'_898 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8242'_898 = erased @@ -1213,7 +1210,7 @@ d_e'8242'_940 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8242'_940 = erased @@ -1229,7 +1226,7 @@ d_e'8242'_982 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8242'_982 = erased @@ -1247,9 +1244,9 @@ d_e'8243'_1036 :: MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8243'_1036 = erased @@ -1265,7 +1262,7 @@ d_e'8242'_1082 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8242'_1082 = erased @@ -1277,7 +1274,7 @@ d_e'8242'_1120 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> T__'8605'_28 -> T__'8605'_28 -> @@ -1291,7 +1288,7 @@ d_e'8242'_1158 :: MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> T_Inline_224 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> T__'8605'_28 -> T__'8605'_28 -> @@ -1327,7 +1324,7 @@ d_e'8242'_1232 :: [MAlonzo.Code.Untyped.T__'8866'_14] -> [MAlonzo.Code.Untyped.T__'8866'_14] -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120] -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> T__'8605'_28 -> T__'8605'_28 -> @@ -1345,9 +1342,9 @@ d_e'8243'_1290 :: [MAlonzo.Code.Untyped.T__'8866'_14] -> T_Inline_224 -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120] -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> T__'8605'_28 -> T__'8605'_28 -> @@ -1367,9 +1364,9 @@ d_e'8243'_1356 :: [MAlonzo.Code.Untyped.T__'8866'_14] -> T_Inline_224 -> MAlonzo.Code.Data.List.Relation.Binary.Pointwise.Base.T_Pointwise_48 -> - MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26 -> + MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> - [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_26] -> + [MAlonzo.Code.VerifiedCompilation.Trace.T_InlineHints_120] -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 -> MAlonzo.Code.Agda.Builtin.Equality.T__'8801'__12 d_e'8243'_1356 = erased diff --git a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UntypedTranslation.hs b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UntypedTranslation.hs index a926a93a2c7..95286113883 100644 --- a/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UntypedTranslation.hs +++ b/plutus-metatheory/src/MAlonzo/Code/VerifiedCompilation/UntypedTranslation.hs @@ -29,6 +29,7 @@ import qualified MAlonzo.Code.Relation.Nullary.Decidable.Core import qualified MAlonzo.Code.Relation.Nullary.Reflects import qualified MAlonzo.Code.Untyped import qualified MAlonzo.Code.Untyped.Equality +import qualified MAlonzo.Code.Utils import qualified MAlonzo.Code.VerifiedCompilation.Certificate import qualified MAlonzo.Code.VerifiedCompilation.Trace @@ -84,7 +85,9 @@ d_translation'63'_164 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -96,7 +99,9 @@ d_translation'63'_164 v0 ~v1 v2 v3 v4 v5 = du_translation'63'_164 v0 v2 v3 v4 v5 du_translation'63'_164 :: Integer -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2920,7 +2925,9 @@ d_decPointwiseTranslation'63'_176 :: (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> ()) -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> @@ -2932,7 +2939,9 @@ d_decPointwiseTranslation'63'_176 v0 ~v1 v2 v3 v4 v5 = du_decPointwiseTranslation'63'_176 v0 v2 v3 v4 v5 du_decPointwiseTranslation'63'_176 :: Integer -> - MAlonzo.Code.VerifiedCompilation.Trace.T_SimplifierTag_4 -> + MAlonzo.Code.Utils.T_Either_6 + MAlonzo.Code.VerifiedCompilation.Trace.T_UncertifiedOptTag_4 + MAlonzo.Code.VerifiedCompilation.Trace.T_CertifiedOptTag_12 -> (Integer -> MAlonzo.Code.Untyped.T__'8866'_14 -> MAlonzo.Code.Untyped.T__'8866'_14 -> diff --git a/plutus-metatheory/src/VerifiedCompilation.lagda.md b/plutus-metatheory/src/VerifiedCompilation.lagda.md index dd5416a801a..2caaf355ef7 100644 --- a/plutus-metatheory/src/VerifiedCompilation.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation.lagda.md @@ -50,6 +50,7 @@ import VerifiedCompilation.UForceCaseDelay as UFCD import VerifiedCompilation.UCSE as UCSE import VerifiedCompilation.UInline as UInline import VerifiedCompilation.UCaseReduce as UCR +import VerifiedCompilation.UConstantFold as UCF open import VerifiedCompilation.NotImplemented open import VerifiedCompilation.Trace open import VerifiedCompilation.Certificate hiding (_>>=_) @@ -59,54 +60,54 @@ open import VerifiedCompilation.Certificate hiding (_>>=_) data Error : Set where emptyDump : Error illScoped : Error - counterExample : SimplifierTag → Error - abort : SimplifierTag → Error + counterExample : OptTag → Error + abort : OptTag → Error ``` ## Translation Relations and Certifiers -We map a `SimplifierTag` to the corresponding translation relation, or `nothing` -if we don't have a translation relation. +We map a `CertifiedOptTag` to the corresponding translation relation. ``` -mRelationOf : SimplifierTag → Maybe (0 ⊢ → 0 ⊢ → Set) -mRelationOf floatDelayT = just UFlD.FloatDelay -mRelationOf forceDelayT = just UFD.ForceDelay -mRelationOf caseReduceT = just UCR.UCaseReduce -mRelationOf cseT = just UCSE.UntypedCSE -mRelationOf inlineT = just (UInline.Inline (λ()) UInline.□) -mRelationOf unknown = nothing -mRelationOf caseOfCaseT = nothing -- FIXME: https://github.com/IntersectMBO/plutus-private/issues/2054 -mRelationOf forceCaseDelayT = just UFCD.ForceCaseDelay -mRelationOf applyToCaseT = just UA2C.UApplyToCase -mRelationOf letFloatOutT = nothing +-- TODO: this should be enforced at the type level somehow +-- i.e. I shouldn't be able to associate 'forceDelayT' with +-- 'floatDelay'! +tagToRelation : CertifiedOptTag → (0 ⊢ → 0 ⊢ → Set) +tagToRelation floatDelayT = UFlD.FloatDelay +tagToRelation forceDelayT = UFD.ForceDelay +tagToRelation forceCaseDelayT = UFCD.ForceCaseDelay +tagToRelation caseReduceT = UCR.UCaseReduce +tagToRelation inlineT = UInline.Inline (λ()) UInline.□ +tagToRelation cseT = UCSE.UntypedCSE +tagToRelation applyToCaseT = UA2C.UApplyToCase +tagToRelation constantFoldT = UCF.UConstantFold ``` -We default to the `NotImplemented` relation to give each `SimplifierTag` a relation: +We default to the `NotImplemented` relation to give each `OptTag` a relation: ``` -RelationOf : SimplifierTag → (0 ⊢ → 0 ⊢ → Set) -RelationOf = fromMaybe (NotImplemented accept) ∘ mRelationOf +RelationOf : OptTag → (0 ⊢ → 0 ⊢ → Set) +RelationOf (inj₁ _) = NotImplemented accept +RelationOf (inj₂ tag) = tagToRelation tag -hasRelation : SimplifierTag → Bool -hasRelation = is-just ∘ mRelationOf +hasRelation : OptTag → Bool +hasRelation = is-inj₂ ``` The corresponding certifier can then be called for a given pass: ``` -certifyPass : (pass : SimplifierTag) → Hints → (M M' : 0 ⊢) → CertResult (RelationOf pass M M') -certifyPass floatDelayT _ = decider UFlD.isFloatDelay? -certifyPass forceDelayT _ = decider UFD.isForceDelay? -certifyPass caseReduceT _ = decider UCR.isCaseReduce? -certifyPass cseT _ = decider UCSE.isUntypedCSE? -certifyPass caseOfCaseT _ = certNotImplemented -certifyPass forceCaseDelayT _ = decider UFCD.isForceCaseDelay? -certifyPass applyToCaseT _ = decider UA2C.a2c?ᶜᶜ -certifyPass inlineT (inline hs) = checker (UInline.top-check hs) -certifyPass inlineT none = λ M M' → abort inlineT M M' -certifyPass letFloatOutT _ = certNotImplemented -certifyPass unknown _ = certNotImplemented +certifyPass : (pass : OptTag) → Hints → (M M' : 0 ⊢) → CertResult (RelationOf pass M M') +certifyPass (inj₁ _) _ = certNotImplemented +certifyPass (inj₂ floatDelayT) _ = decider UFlD.isFloatDelay? +certifyPass (inj₂ forceDelayT) _ = decider UFD.isForceDelay? +certifyPass (inj₂ forceCaseDelayT) _ = decider UFCD.isForceCaseDelay? +certifyPass (inj₂ caseReduceT) _ = decider UCR.isCaseReduce? +certifyPass (inj₂ inlineT) (inline hs) = checker (UInline.top-check hs) +certifyPass (inj₂ inlineT) none = λ M M' → abort InlineT M M' +certifyPass (inj₂ cseT) _ = decider UCSE.isUntypedCSE? +certifyPass (inj₂ applyToCaseT) _ = decider UA2C.a2c?ᶜᶜ +certifyPass (inj₂ constantFoldT) _ = decider UCF.isUConstantFold? ``` A `Certificate t` states the main theorem of a trace `t`: a sequence (product) diff --git a/plutus-metatheory/src/VerifiedCompilation/Certificate.lagda.md b/plutus-metatheory/src/VerifiedCompilation/Certificate.lagda.md index a5e14cb4a15..3d608efed4a 100644 --- a/plutus-metatheory/src/VerifiedCompilation/Certificate.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/Certificate.lagda.md @@ -45,13 +45,13 @@ variable data CertResult (P : Set 𝓁) : Set (suc 𝓁) where proof : (p : P) → CertResult P - ce : (¬p : ¬ P) → {X X' : Set} → SimplifierTag → X → X' → CertResult P - abort : {X X' : Set} → SimplifierTag → X → X' → CertResult P + ce : (¬p : ¬ P) → {X X' : Set} → OptTag → X → X' → CertResult P + abort : {X X' : Set} → OptTag → X → X' → CertResult P -- | Result of a decision procedure: either a proof or a counterexample data ProofOrCE (P : Set 𝓁) : Set (suc 𝓁) where proof : (p : P) → ProofOrCE P - ce : (¬p : ¬ P) → {X X' : Set} → SimplifierTag → X → X' → ProofOrCE P + ce : (¬p : ¬ P) → {X X' : Set} → OptTag → X → X' → ProofOrCE P isProof? : {P : Set 𝓁} → ProofOrCE P → Bool isProof? (proof _) = true @@ -63,7 +63,7 @@ isCE? = not ∘ isProof? -- | Result of a checking procedure: either a proof or a failure data Proof? (P : Set 𝓁) : Set (suc 𝓁) where proof : (p : P) → Proof? P - abort : {X X' : Set} → SimplifierTag → X → X' → Proof? P + abort : {X X' : Set} → OptTag → X → X' → Proof? P infixl 1 _>>=_ @@ -94,7 +94,7 @@ decider f x y with f x y ... | proof p = proof p ... | ce ¬p tag a b = ce ¬p tag a b -decToPCE : {X : Set} {P : Set} → SimplifierTag → Dec P → {before after : X} → ProofOrCE P +decToPCE : {X : Set} {P : Set} → OptTag → Dec P → {before after : X} → ProofOrCE P decToPCE _ (yes p) = proof p decToPCE tag (no ¬p) {before} {after} = ce ¬p tag before after @@ -102,12 +102,12 @@ pceToDec : {P : Set} → ProofOrCE P → Dec P pceToDec (proof p) = yes p pceToDec (ce ¬p _ _ _) = no ¬p -matchOrCE : {X X' : Set} {𝓁 : Level} → {P : X → X' → Set 𝓁} → SimplifierTag → Binary.Decidable P → DecidableCE P +matchOrCE : {X X' : Set} {𝓁 : Level} → {P : X → X' → Set 𝓁} → OptTag → Binary.Decidable P → DecidableCE P matchOrCE tag P a b with P a b ... | yes p = proof p ... | no ¬p = ce ¬p tag a b -pcePointwise : {X X' : Set} {𝓁 : Level} {P : X → X' → Set 𝓁} → SimplifierTag → DecidableCE P → DecidableCE (Pointwise P) +pcePointwise : {X X' : Set} {𝓁 : Level} {P : X → X' → Set 𝓁} → OptTag → DecidableCE P → DecidableCE (Pointwise P) pcePointwise tag isP? [] [] = proof Pointwise.[] pcePointwise {X = X} tag isP? [] (y ∷ ys) = ce (λ ()) {X = List X} tag [] ys pcePointwise {X' = X'} tag isP? (x ∷ xs) [] = ce (λ ()) {X' = List X'} tag xs [] diff --git a/plutus-metatheory/src/VerifiedCompilation/Trace.lagda.md b/plutus-metatheory/src/VerifiedCompilation/Trace.lagda.md index cad3a9f4dff..5d5335f8cdb 100644 --- a/plutus-metatheory/src/VerifiedCompilation/Trace.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/Trace.lagda.md @@ -19,23 +19,67 @@ open Maybe ``` ## Pass tags -We enumerate the known passes: +We enumerate the known passes and partition them into two categories: +- those which are not yet (fully) implemented in the certifier +- those which are implemented in the certifier and we know they are correct. ``` -data SimplifierTag : Set where - floatDelayT : SimplifierTag - forceDelayT : SimplifierTag - forceCaseDelayT : SimplifierTag - caseOfCaseT : SimplifierTag - caseReduceT : SimplifierTag - inlineT : SimplifierTag - cseT : SimplifierTag - applyToCaseT : SimplifierTag - letFloatOutT : SimplifierTag - unknown : SimplifierTag -- a placeholder for passes that we don't yet know of, so the certifier doesn't break if a pass was added - -{-# FOREIGN GHC import UntypedPlutusCore.Transform.Simplifier #-} -{-# COMPILE GHC SimplifierTag = data SimplifierStage (FloatDelay | ForceDelay | ForceCaseDelay | CaseOfCase | CaseReduce | Inline | CSE | ApplyToCase | LetFloatOut | Unknown) #-} + +data UncertifiedOptTag : Set where + caseOfCaseT : UncertifiedOptTag + letFloatOutT : UncertifiedOptTag + uncertifiedConstantFoldT : UncertifiedOptTag + +data CertifiedOptTag : Set where + floatDelayT : CertifiedOptTag + forceDelayT : CertifiedOptTag + forceCaseDelayT : CertifiedOptTag + caseReduceT : CertifiedOptTag + inlineT : CertifiedOptTag + cseT : CertifiedOptTag + applyToCaseT : CertifiedOptTag + constantFoldT : CertifiedOptTag + +OptTag = Utils.Either UncertifiedOptTag CertifiedOptTag + +FloatDelayT : OptTag +FloatDelayT = Utils.inj₂ floatDelayT +ForceDelayT : OptTag +ForceDelayT = Utils.inj₂ forceDelayT +ForceCaseDelayT : OptTag +ForceCaseDelayT = Utils.inj₂ forceCaseDelayT +CaseReduceT : OptTag +CaseReduceT = Utils.inj₂ caseReduceT +InlineT : OptTag +InlineT = Utils.inj₂ inlineT +CseT : OptTag +CseT = Utils.inj₂ cseT +ApplyToCaseT : OptTag +ApplyToCaseT = Utils.inj₂ applyToCaseT + +ConstantFoldT : OptTag +ConstantFoldT = Utils.inj₂ constantFoldT + +CaseOfCaseT : OptTag +CaseOfCaseT = Utils.inj₁ caseOfCaseT +LetFloatOutT : OptTag +LetFloatOutT = Utils.inj₁ letFloatOutT + +{-# COMPILE GHC CertifiedOptTag = data CertifiedOptStage (FloatDelay | ForceDelay | ForceCaseDelay | CaseReduce | Inline | CSE | ApplyToCase | ConstantFold) #-} +{-# COMPILE GHC UncertifiedOptTag = data UncertifiedOptStage (CaseOfCase | LetFloatOut | UncertifiedConstantFold) #-} + +data CertifiedBuiltin : Set where + certAddInteger certSubtractInteger certMultiplyInteger + certDivideInteger certQuotientInteger certRemainderInteger certModInteger + certEqualsInteger certLessThanInteger certLessThanEqualsInteger + certIfThenElse certChooseUnit + certFstPair certSndPair + certChooseList certMkCons certHeadList certTailList certNullList certDropList + certChooseData certConstrData certMapData certListData certIData + certUnConstrData certUnMapData certUnListData certUnIData + certEqualsData certMkPairData certMkNilData certMkNilPairData : CertifiedBuiltin + +{-# COMPILE GHC CertifiedBuiltin = data CertifiedBuiltin (CertAddInteger | CertSubtractInteger | CertMultiplyInteger | CertDivideInteger | CertQuotientInteger | CertRemainderInteger | CertModInteger | CertEqualsInteger | CertLessThanInteger | CertLessThanEqualsInteger | CertIfThenElse | CertChooseUnit | CertFstPair | CertSndPair | CertChooseList | CertMkCons | CertHeadList | CertTailList | CertNullList | CertDropList | CertChooseData | CertConstrData | CertMapData | CertListData | CertIData | CertUnConstrData | CertUnMapData | CertUnListData | CertUnIData | CertEqualsData | CertMkPairData | CertMkNilData | CertMkNilPairData) #-} ``` ## Hints @@ -69,14 +113,14 @@ data Hints : Set where ## Compiler traces A `Trace A` is a sequence of optimisation transformations applied to terms of -type `A`. Each transition is labeled with a `SimplifierTag` that contains +type `A`. Each transition is labeled with a `OptTag` that contains information about which pass was performed. ``` data Trace (A : Set) : Set where -- One step in the pipeline, with its pass and input term - step : SimplifierTag → Hints → A → Trace A → Trace A + step : OptTag → Hints → A → Trace A → Trace A -- Final AST in the trace done : A → Trace A @@ -94,7 +138,7 @@ head (step _ _ x _) = x -- The current trace structure dumped from Haskell Dump : Set -Dump = List (SimplifierTag × Hints × Untyped × Untyped) +Dump = List (OptTag × Hints × Untyped × Untyped) -- -- Since there is duplication in the dump, i.e. it is of the form @@ -108,7 +152,7 @@ toTrace : Dump → Maybe (Trace Untyped) toTrace [] = nothing toTrace (x ∷ xs) = just (go x xs) where - go : SimplifierTag × Hints × Untyped × Untyped → Dump → Trace Untyped + go : OptTag × Hints × Untyped × Untyped → Dump → Trace Untyped go (pass , hints , x , y) [] = step pass hints x (done y) go (pass , hints , x , y) ((pass' , hints' , _ , z) ∷ xs) = step pass hints x (go (pass' , hints' , y , z) xs) ``` diff --git a/plutus-metatheory/src/VerifiedCompilation/UApplyToCase.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UApplyToCase.lagda.md index 07ef45abba2..48cf226e45b 100644 --- a/plutus-metatheory/src/VerifiedCompilation/UApplyToCase.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/UApplyToCase.lagda.md @@ -20,7 +20,7 @@ module VerifiedCompilation.UApplyToCase where ``` open import Untyped using (_⊢; case; constr) open import Untyped.Reduction using (iterApp) -open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; applyToCaseT) +open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; ApplyToCaseT) open import VerifiedCompilation.UCaseReduce using (justEq) open import VerifiedCompilation.UntypedViews open import VerifiedCompilation.UntypedTranslation using (Translation; translation?; Relation) @@ -60,13 +60,13 @@ a2c?ᶜᶜ : {n : ℕ} → (M N : n ⊢) → ProofOrCE (Translation ApplyToCase a2c? : {n : ℕ} → (M N : n ⊢) → ProofOrCE (ApplyToCase M N) a2c? M N with (case? (constr? (_≟_ 0) (⋯ ∷? ⋯)) singleton?) N -... | no ¬p = ce (λ { (a2c _) → ¬p inhabitant } ) applyToCaseT M N +... | no ¬p = ce (λ { (a2c _) → ¬p inhabitant } ) ApplyToCaseT M N ... | yes (case! (constr! refl (match! x ∷! match! xs)) (match! M' ∷! []!)) with a2c?ᶜᶜ M (iterApp M' (x ∷ xs)) ... | proof p = proof (a2c p) ... | ce ¬p tag L L′ = ce (λ { (a2c p) → ¬p p }) tag L L′ -a2c?ᶜᶜ = translation? applyToCaseT a2c? +a2c?ᶜᶜ = translation? ApplyToCaseT a2c? UApplyToCase : Relation UApplyToCase = Translation ApplyToCase diff --git a/plutus-metatheory/src/VerifiedCompilation/UCSE.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UCSE.lagda.md index 04f0e42ebcb..312905c25c9 100644 --- a/plutus-metatheory/src/VerifiedCompilation/UCSE.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/UCSE.lagda.md @@ -27,7 +27,7 @@ open import Data.Empty using (⊥) open import Agda.Builtin.Maybe using (Maybe; just; nothing) open import Untyped.RenamingSubstitution using (_[_]) open import Untyped.Purity using (Pure; isPure?) -open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; pcePointwise; DecidableCE; cseT) +open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; pcePointwise; DecidableCE; CseT) ``` ## Translation Relation @@ -61,9 +61,9 @@ isUntypedCSE? : {X : ℕ} → DecidableCE (Translation UCSE {X}) {-# TERMINATING #-} isUCSE? : {X : ℕ} → DecidableCE (UCSE {X}) isUCSE? ast ast' with (isApp? (isLambda? isTerm?) isTerm?) ast' -... | no ¬match = ce (λ { (cse pt) → ¬match (isapp (islambda (isterm _)) (isterm _))}) cseT ast ast' +... | no ¬match = ce (λ { (cse pt) → ¬match (isapp (islambda (isterm _)) (isterm _))}) CseT ast ast' ... | yes (isapp (islambda (isterm x')) (isterm e)) with (isUntypedCSE? ast (x' [ e ])) ... | ce ¬p t b a = ce (λ { (cse pt) → ¬p pt}) t b a ... | proof p = proof (cse p) -isUntypedCSE? = translation? cseT isUCSE? +isUntypedCSE? = translation? CseT isUCSE? ``` diff --git a/plutus-metatheory/src/VerifiedCompilation/UCaseOfCase.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UCaseOfCase.lagda.md index 25e4edacf7f..b8b0d0dcb39 100644 --- a/plutus-metatheory/src/VerifiedCompilation/UCaseOfCase.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/UCaseOfCase.lagda.md @@ -14,7 +14,7 @@ module VerifiedCompilation.UCaseOfCase where open import Untyped.Equality using (DecEq; _≟_; decPointwise) open import VerifiedCompilation.UntypedViews using (Pred; isCase?; isApp?; isForce?; isBuiltin?; isConstr?; isDelay?; isTerm?; allTerms?; iscase; isapp; isforce; isbuiltin; isconstr; isterm; allterms; isdelay) open import VerifiedCompilation.UntypedTranslation using (Translation; translation?; Relation) -open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; pcePointwise; caseOfCaseT) +open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; pcePointwise; CaseOfCaseT) import Relation.Binary as Binary using (Decidable) import Relation.Unary as Unary using (Decidable) @@ -104,18 +104,18 @@ isCaseOfCase? : {X : ℕ} (ast ast' : X ⊢) → ProofOrCE (Translation CoC {X} isCoC? : {X : ℕ} (ast ast' : X ⊢) → ProofOrCE (CoC {X} ast ast') isCoC? ast ast' with (isCoCCase? ast) ×-dec (isCoCForce? ast') ... | no ¬cf = ce (λ { (isCoC b tn fn tt tt' ft ft' alts alts' x x₁ x₂) → ¬cf - (isCoCCase b tn fn tt ft alts , isCoCForce b tn fn tt' ft' alts') } ) caseOfCaseT ast ast' + (isCoCCase b tn fn tt ft alts , isCoCForce b tn fn tt' ft' alts') } ) CaseOfCaseT ast ast' ... | yes (isCoCCase b tn fn tt ft alts , isCoCForce b₁ tn₁ fn₁ tt' ft' alts') with (b ≟ b₁) ×-dec (tn ≟ tn₁) ×-dec (fn ≟ fn₁) -... | no ¬p = ce (λ { (isCoC .b .tn .fn .tt .tt' .ft .ft' .alts .alts' x x₁ x₂) → ¬p (refl , refl , refl)}) caseOfCaseT ast ast' -... | yes (refl , refl , refl) with pcePointwise caseOfCaseT isCaseOfCase? tt tt' +... | no ¬p = ce (λ { (isCoC .b .tn .fn .tt .tt' .ft .ft' .alts .alts' x x₁ x₂) → ¬p (refl , refl , refl)}) CaseOfCaseT ast ast' +... | yes (refl , refl , refl) with pcePointwise CaseOfCaseT isCaseOfCase? tt tt' ... | ce ¬p t b a = ce (λ { (isCoC _ .tn .fn .tt .tt' .ft .ft' .alts .alts' x x₁ x₂) → ¬p x₁}) t b a -... | proof tt=tt' with pcePointwise caseOfCaseT isCaseOfCase? ft ft' +... | proof tt=tt' with pcePointwise CaseOfCaseT isCaseOfCase? ft ft' ... | ce ¬p t b a = ce (λ { (isCoC _ .tn .fn .tt .tt' .ft .ft' .alts .alts' x x₁ x₂) → ¬p x₂}) t b a -... | proof ft=ft' with pcePointwise caseOfCaseT isCaseOfCase? alts alts' +... | proof ft=ft' with pcePointwise CaseOfCaseT isCaseOfCase? alts alts' ... | ce ¬pp t b a = ce (λ { (isCoC _ .tn .fn .tt .tt' .ft .ft' .alts .alts' x x₁ x₂) → ¬pp x}) t b a ... | proof alts=alts' = proof (isCoC b tn fn tt tt' ft ft' alts alts' alts=alts' tt=tt' ft=ft') -isCaseOfCase? {X} = translation? {X} caseOfCaseT isCoC? +isCaseOfCase? {X} = translation? {X} CaseOfCaseT isCoC? ``` ## Semantic Equivalence diff --git a/plutus-metatheory/src/VerifiedCompilation/UCaseReduce.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UCaseReduce.lagda.md index 881084d5584..d3b3b793a30 100644 --- a/plutus-metatheory/src/VerifiedCompilation/UCaseReduce.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/UCaseReduce.lagda.md @@ -32,7 +32,7 @@ open import RawU using (tag2TyTag; tmCon) open import Agda.Builtin.Int using (Int) open import Data.Empty using (⊥) open import Function using (case_of_) -open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; caseReduceT) +open import VerifiedCompilation.Certificate using (ProofOrCE; ce; proof; CaseReduceT) open import Untyped.Reduction using (iterApp) ``` @@ -56,14 +56,14 @@ justEq refl = refl {-# TERMINATING #-} isCR? : {X : ℕ} → (ast ast' : X ⊢) → ProofOrCE (CaseReduce ast ast') isCR? ast ast' with (isCase? (isConstr? allTerms?) allTerms?) ast -... | no ¬p = ce (λ { (casereduce _ _) → ¬p (iscase (isconstr _ (allterms _)) (allterms _))} ) caseReduceT ast ast' +... | no ¬p = ce (λ { (casereduce _ _) → ¬p (iscase (isconstr _ (allterms _)) (allterms _))} ) CaseReduceT ast ast' ... | yes (iscase (isconstr i (allterms vs)) (allterms xs)) with lookup? i xs in xv -... | nothing = ce (λ { (casereduce p _) → case trans (sym xv) p of λ { () }} ) caseReduceT ast ast' +... | nothing = ce (λ { (casereduce p _) → case trans (sym xv) p of λ { () }} ) CaseReduceT ast ast' ... | just x with isCaseReduce? (iterApp x vs) ast' ... | proof p = proof (casereduce xv p) ... | ce ¬t t b a = ce (λ { (casereduce p t) → ¬t (subst (λ x → Translation CaseReduce (iterApp x vs) ast') (justEq (trans (sym p) xv)) t)}) t b a -isCaseReduce? = translation? caseReduceT isCR? +isCaseReduce? = translation? CaseReduceT isCR? UCaseReduce = Translation CaseReduce diff --git a/plutus-metatheory/src/VerifiedCompilation/UConstantFold.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UConstantFold.lagda.md new file mode 100644 index 00000000000..900b789a79d --- /dev/null +++ b/plutus-metatheory/src/VerifiedCompilation/UConstantFold.lagda.md @@ -0,0 +1,217 @@ +--- +title: VerifiedCompilation.UConstantFold +layout: page +--- + +# Constant Fold Translation Phase + +``` +{-# OPTIONS --type-in-type #-} + +module VerifiedCompilation.UConstantFold where + +``` + +## Imports + +``` +open import Data.Nat using (ℕ) +open import Data.Integer using (ℤ; _+_; _-_; _>=_; InlineHints; var; expand; ƛ; _·_; _·↓; force; delay; con; builtin; error; constr; case; abort; proof; inlineT) +open import VerifiedCompilation.Certificate using (Proof?; _>>=_; InlineHints; var; expand; ƛ; _·_; _·↓; force; delay; con; builtin; error; constr; case; abort; proof; InlineT) ``` # Zippers, and relating two zippers @@ -233,9 +233,9 @@ check {z = z} {z′ = z′} σ M@(` x) zz var M′@(` x′) ... | yes refl | yes refl with zz ≟ᶻᶻ idᶻᶻ z ... | just refl = proof (` x) -... | nothing = abort inlineT M M′ +... | nothing = abort InlineT M M′ check σ M@(` x) zz var M′@(` x′) - | _ | _ = abort inlineT M M′ + | _ | _ = abort InlineT M M′ check σ (` x) zz (expand h) M′ = do r ← check σ (σ x) zz h M′ @@ -273,18 +273,18 @@ check σ (delay M) zz (delay h) (delay M′) = check σ M@(con c) zz con M′@(con c′) with c ≟ c′ ... | yes refl = proof con -... | no _ = abort inlineT M M′ +... | no _ = abort InlineT M M′ check σ M@(builtin b) zz builtin M′@(builtin b′) with b ≟ b′ ... | yes refl = proof builtin -... | no _ = abort inlineT M M′ +... | no _ = abort InlineT M M′ check σ M@(constr i Ms) zz (constr hs) M′@(constr i′ M′s) with i ≟ i′ ... | yes refl = do rs ← checkPointwise hs σ □ Ms M′s proof (constr rs) -... | no _ = abort inlineT M M′ +... | no _ = abort InlineT M M′ check σ (case M Ms) zz (case h hs) (case M′ M′s) = do r ← check σ M □ h M′ @@ -293,14 +293,14 @@ check σ (case M Ms) zz (case h hs) (case M′ M′s) = check σ error zz error error = proof error -check σ M zz h M′ = abort inlineT M M′ +check σ M zz h M′ = abort InlineT M M′ checkPointwise [] σ zz [] [] = proof Pointwise.[] checkPointwise (h ∷ hs) σ zz (M ∷ Ms) (M′ ∷ M′s) = do p ← check σ M zz h M′ ps ← checkPointwise hs σ zz Ms M′s proof (p Pointwise.∷ ps) -checkPointwise _ _ _ Ms M′s = abort inlineT Ms M′s +checkPointwise _ _ _ Ms M′s = abort InlineT Ms M′s ``` # Top-level check diff --git a/plutus-metatheory/src/VerifiedCompilation/UntypedTranslation.lagda.md b/plutus-metatheory/src/VerifiedCompilation/UntypedTranslation.lagda.md index a051b8b3d86..398fcd9b742 100644 --- a/plutus-metatheory/src/VerifiedCompilation/UntypedTranslation.lagda.md +++ b/plutus-metatheory/src/VerifiedCompilation/UntypedTranslation.lagda.md @@ -26,7 +26,7 @@ open import Builtin using (Builtin) import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl) open import Untyped.Equality using (DecEq; _≟_; decPointwise) -open import VerifiedCompilation.Certificate using (ProofOrCE; proof; ce; decToPCE; DecidableCE; SimplifierTag) +open import VerifiedCompilation.Certificate using (ProofOrCE; proof; ce; decToPCE; DecidableCE; OptTag) open import Data.Sum using (_⊎_;inj₁; inj₂) ``` @@ -106,13 +106,13 @@ matchIx error = refl translation? : {X' : ℕ} {R : Relation} - → SimplifierTag + → OptTag → ({ X : ℕ } → DecidableCE (R {X})) → (p q : X' ⊢) → ProofOrCE (Translation R {X'} p q) decPointwiseTranslation? : {X' : ℕ} {R : Relation} - → SimplifierTag + → OptTag → ({ X : ℕ } → DecidableCE (R {X})) → (p q : List (X' ⊢)) → ProofOrCE (Pointwise (Translation R {X'}) p q) decPointwiseTranslation? _ _ [] [] = proof Pointwise.[] diff --git a/plutus-metatheory/test/certifier-report/Test/Certifier/Report.hs b/plutus-metatheory/test/certifier-report/Test/Certifier/Report.hs index 41b3a3f9c09..d4b36cf42c1 100644 --- a/plutus-metatheory/test/certifier-report/Test/Certifier/Report.hs +++ b/plutus-metatheory/test/certifier-report/Test/Certifier/Report.hs @@ -7,7 +7,8 @@ import Paths_plutus_metatheory (getDataDir) import PlutusCore qualified as PLC import PlutusCore.Default.Builtins import PlutusCore.Evaluation.Machine.ExBudget -import PlutusCore.Executable.Eval (evalCounting, evalSimplifierTrace, mkDefaultEvalCtx) +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultBuiltinCostModelForTesting) +import PlutusCore.Executable.Eval (evalCounting, evalOptimizerTrace, mkDefaultEvalCtx) import PlutusCore.Quote import PlutusLedgerApi.Common import PlutusPrelude (def, unsafeFromRight) @@ -30,7 +31,7 @@ import System.IO.Extra import Test.Tasty import Test.Tasty.Golden -loadFrom :: FilePath -> IO (SimplifierTrace Name DefaultUni DefaultFun ()) +loadFrom :: FilePath -> IO (OptimizerTrace Name DefaultUni DefaultFun ()) loadFrom name = do root <- getDataDir prog <- @@ -55,22 +56,23 @@ simplify :: Term Name DefaultUni DefaultFun () -> Quote ( Term Name DefaultUni DefaultFun () - , SimplifierTrace Name DefaultUni DefaultFun () + , OptimizerTrace Name DefaultUni DefaultFun () ) simplify = - runSimplifierT - . termSimplifier - ( defaultSimplifyOpts - & soPreserveLogging .~ False + runOptimizerT + . termOptimizer + ( defaultOptimizeOpts + & ooPreserveLogging .~ False ) def + defaultBuiltinCostModelForTesting evalCtx :: EvaluationContext evalCtx = mkDefaultEvalCtx def {-# OPAQUE evalCtx #-} evalTrace - :: SimplifierTrace Name DefaultUni DefaultFun () + :: OptimizerTrace Name DefaultUni DefaultFun () -> [Term NamedDeBruijn DefaultUni DefaultFun ()] -> [ ( Maybe (CekEvaluationException UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun) , ExBudget @@ -102,7 +104,7 @@ testNQueens :: IO TestTree testNQueens = withTempFile $ \actual -> pure $ goldenVsFile name golden actual $ do trace <- loadFrom $ name <.> "uplc" let costs = - evalSimplifierTrace + evalOptimizerTrace evalCtx trace [ snd $ lift PLC.latestVersion (5 :: Integer) diff --git a/plutus-metatheory/test/certifier-report/golden/n-queens.golden.report b/plutus-metatheory/test/certifier-report/golden/n-queens.golden.report index 18addc468a0..fc65af106da 100644 --- a/plutus-metatheory/test/certifier-report/golden/n-queens.golden.report +++ b/plutus-metatheory/test/certifier-report/golden/n-queens.golden.report @@ -16,7 +16,7 @@ Pass 2: Float Force into Case Branches ✅ Program Size: 3504 (after) Execution Cost: CPU = 288404181782, MEM = 1752469055 (before) Execution Cost: CPU = 283210581782, MEM = 1720009055 (after) - + Optimization sites: 18 ────────────────────────────────────────────────────── Pass 3: Float bindings outwards ⚠ (certifier unavailable) @@ -79,7 +79,7 @@ Pass 9: Float Force into Case Branches ✅ Program Size: 3176 (after) Execution Cost: CPU = 264858581782, MEM = 1605309055 (before) Execution Cost: CPU = 264858581782, MEM = 1605309055 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 10: Float bindings outwards ⚠ (certifier unavailable) @@ -142,7 +142,7 @@ Pass 16: Float Force into Case Branches ✅ Program Size: 2467 (after) Execution Cost: CPU = 218067557782, MEM = 1312865155 (before) Execution Cost: CPU = 217316549782, MEM = 1308171355 (after) - + Optimization sites: 5 ────────────────────────────────────────────────────── Pass 17: Float bindings outwards ⚠ (certifier unavailable) @@ -205,7 +205,7 @@ Pass 23: Float Force into Case Branches ✅ Program Size: 2305 (after) Execution Cost: CPU = 203028821782, MEM = 1218873055 (before) Execution Cost: CPU = 203028821782, MEM = 1218873055 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 24: Float bindings outwards ⚠ (certifier unavailable) @@ -268,7 +268,7 @@ Pass 30: Float Force into Case Branches ✅ Program Size: 2405 (after) Execution Cost: CPU = 173898773782, MEM = 1036810255 (before) Execution Cost: CPU = 173898773782, MEM = 1036810255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 31: Float bindings outwards ⚠ (certifier unavailable) @@ -331,7 +331,7 @@ Pass 37: Float Force into Case Branches ✅ Program Size: 1852 (after) Execution Cost: CPU = 127574757782, MEM = 747285155 (before) Execution Cost: CPU = 120633541782, MEM = 703902555 (after) - + Optimization sites: 28 ────────────────────────────────────────────────────── Pass 38: Float bindings outwards ⚠ (certifier unavailable) @@ -394,7 +394,7 @@ Pass 44: Float Force into Case Branches ✅ Program Size: 1838 (after) Execution Cost: CPU = 118993781782, MEM = 693654055 (before) Execution Cost: CPU = 118993781782, MEM = 693654055 (after) - + Optimization sites: 1 ────────────────────────────────────────────────────── Pass 45: Float bindings outwards ⚠ (certifier unavailable) @@ -457,7 +457,7 @@ Pass 51: Float Force into Case Branches ✅ Program Size: 1770 (after) Execution Cost: CPU = 117353973782, MEM = 683405255 (before) Execution Cost: CPU = 117353973782, MEM = 683405255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 52: Float bindings outwards ⚠ (certifier unavailable) @@ -520,7 +520,7 @@ Pass 58: Float Force into Case Branches ✅ Program Size: 1770 (after) Execution Cost: CPU = 117353973782, MEM = 683405255 (before) Execution Cost: CPU = 117353973782, MEM = 683405255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 59: Float bindings outwards ⚠ (certifier unavailable) @@ -583,7 +583,7 @@ Pass 65: Float Force into Case Branches ✅ Program Size: 1770 (after) Execution Cost: CPU = 117353973782, MEM = 683405255 (before) Execution Cost: CPU = 117353973782, MEM = 683405255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 66: Float bindings outwards ⚠ (certifier unavailable) @@ -646,7 +646,7 @@ Pass 72: Float Force into Case Branches ✅ Program Size: 1770 (after) Execution Cost: CPU = 117353973782, MEM = 683405255 (before) Execution Cost: CPU = 117353973782, MEM = 683405255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 73: Float bindings outwards ⚠ (certifier unavailable) @@ -709,7 +709,7 @@ Pass 79: Float Force into Case Branches ✅ Program Size: 1770 (after) Execution Cost: CPU = 117353973782, MEM = 683405255 (before) Execution Cost: CPU = 117353973782, MEM = 683405255 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 80: Float bindings outwards ⚠ (certifier unavailable) @@ -781,7 +781,7 @@ Pass 87: Float Force into Case Branches ✅ Program Size: 1779 (after) Execution Cost: CPU = 117353877782, MEM = 683404655 (before) Execution Cost: CPU = 117353877782, MEM = 683404655 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 88: Float bindings outwards ⚠ (certifier unavailable) @@ -853,7 +853,7 @@ Pass 95: Float Force into Case Branches ✅ Program Size: 1780 (after) Execution Cost: CPU = 117353829782, MEM = 683404355 (before) Execution Cost: CPU = 117353829782, MEM = 683404355 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 96: Float bindings outwards ⚠ (certifier unavailable) @@ -925,7 +925,7 @@ Pass 103: Float Force into Case Branches ✅ Program Size: 1762 (after) Execution Cost: CPU = 117353781782, MEM = 683404055 (before) Execution Cost: CPU = 117353781782, MEM = 683404055 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 104: Float bindings outwards ⚠ (certifier unavailable) @@ -997,7 +997,7 @@ Pass 111: Float Force into Case Branches ✅ Program Size: 1762 (after) Execution Cost: CPU = 117353781782, MEM = 683404055 (before) Execution Cost: CPU = 117353781782, MEM = 683404055 (after) - + Optimization sites: 0 ────────────────────────────────────────────────────── Pass 112: Float bindings outwards ⚠ (certifier unavailable) diff --git a/plutus-metatheory/test/certifier/Test/Certifier/AST.hs b/plutus-metatheory/test/certifier/Test/Certifier/AST.hs index 525b1373a49..2762f00b763 100644 --- a/plutus-metatheory/test/certifier/Test/Certifier/AST.hs +++ b/plutus-metatheory/test/certifier/Test/Certifier/AST.hs @@ -5,7 +5,7 @@ import PlutusCore.MkPlc (mkConstant) import UntypedPlutusCore import UntypedPlutusCore.Transform.Certify.Hints qualified as Hints -import FFI.SimplifierTrace (mkFfiSimplifierTrace) +import FFI.OptimizerTrace (mkFfiOptimizerTrace) import MAlonzo.Code.Certifier (runCertifierMain) import Data.Text.Encoding qualified as Text @@ -13,14 +13,14 @@ import Test.Tasty import Test.Tasty.HUnit mkMockTracePair - :: SimplifierStage + :: OptStage -> Term Name DefaultUni DefaultFun () -> Term Name DefaultUni DefaultFun () - -> SimplifierTrace Name DefaultUni DefaultFun () + -> OptimizerTrace Name DefaultUni DefaultFun () mkMockTracePair stage before' after' = - SimplifierTrace - { simplifierTrace = - [ Simplification + OptimizerTrace + { optimizerTrace = + [ Optimization { beforeAST = before' , stage = stage , hints = Hints.NoHints @@ -30,10 +30,10 @@ mkMockTracePair stage before' after' = } runCertifierWithMockTrace - :: SimplifierTrace Name DefaultUni DefaultFun () + :: OptimizerTrace Name DefaultUni DefaultFun () -> IO Bool runCertifierWithMockTrace trace = do - let rawAgdaTrace = mkFfiSimplifierTrace trace + let rawAgdaTrace = mkFfiOptimizerTrace trace case runCertifierMain rawAgdaTrace [] of Just (result, _report) -> pure result Nothing -> @@ -41,7 +41,7 @@ runCertifierWithMockTrace trace = do testSuccess :: String - -> SimplifierStage + -> OptStage -> Term Name PLC.DefaultUni PLC.DefaultFun () -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree @@ -55,7 +55,7 @@ testSuccess testName st bf af = testFailure :: String - -> SimplifierStage + -> OptStage -> Term Name PLC.DefaultUni PLC.DefaultFun () -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree @@ -70,7 +70,7 @@ testFailure testName st bf af = -- Helper functions for making lists of tests. testSuccessItem :: ( String - , SimplifierStage + , OptStage , Term Name PLC.DefaultUni PLC.DefaultFun () , Term Name PLC.DefaultUni PLC.DefaultFun () ) @@ -79,7 +79,7 @@ testSuccessItem (name, stage, before, after) = testSuccess name stage before aft testFailureItem :: ( String - , SimplifierStage + , OptStage , Term Name PLC.DefaultUni PLC.DefaultFun () , Term Name PLC.DefaultUni PLC.DefaultFun () ) @@ -90,7 +90,7 @@ testTrivialSuccess1 :: TestTree testTrivialSuccess1 = testSuccess "Trivial success" - FloatDelay + FloatDelayStage (mkConstant () (1 :: Integer)) (mkConstant () (1 :: Integer)) @@ -98,7 +98,7 @@ testTrivialFailure1 :: TestTree testTrivialFailure1 = testFailure "Trivial failure" - FloatDelay + FloatDelayStage (mkConstant () (1 :: Integer)) (mkConstant () (2 :: Integer)) @@ -106,7 +106,7 @@ testByteStringEqSuccess :: TestTree testByteStringEqSuccess = testFailure "bytestrings expected to not be equal" - FloatDelay + FloatDelayStage (mkConstant () (Text.encodeUtf8 "foo")) (mkConstant () (Text.encodeUtf8 "bar")) @@ -114,7 +114,7 @@ testByteStringEqFailure :: TestTree testByteStringEqFailure = testSuccess "bytestrings expected to be equal" - FloatDelay + FloatDelayStage (mkConstant () (Text.encodeUtf8 "foo")) (mkConstant () (Text.encodeUtf8 "foo")) diff --git a/plutus-metatheory/test/certifier/Test/Certifier/AST/ForceDelay.hs b/plutus-metatheory/test/certifier/Test/Certifier/AST/ForceDelay.hs index 5dd673543ed..743397babf2 100644 --- a/plutus-metatheory/test/certifier/Test/Certifier/AST/ForceDelay.hs +++ b/plutus-metatheory/test/certifier/Test/Certifier/AST/ForceDelay.hs @@ -298,7 +298,7 @@ lastAbsBreakAfter = runQuote $ do successItems :: [ ( String - , SimplifierStage + , OptStage , Term Name PLC.DefaultUni PLC.DefaultFun () , Term Name PLC.DefaultUni PLC.DefaultFun () ) @@ -306,26 +306,26 @@ successItems successItems = [ ( "Simple one lambda" - , ForceDelay + , ForceDelayStage , simpleSuccessBefore , simpleSuccessAfter ) , ( "Nested" - , ForceDelay + , ForceDelayStage , nestedBefore , nestedAfter ) , ( "ifThenElse" - , ForceDelay + , ForceDelayStage , ifThenElseSuccessBefore , ifThenElseSuccessAfter ) ] failItems :: [ ( String - , SimplifierStage + , OptStage , Term Name PLC.DefaultUni PLC.DefaultFun () , Term Name PLC.DefaultUni PLC.DefaultFun () ) @@ -333,43 +333,43 @@ failItems failItems = [ ( "Simple extra delay" - , ForceDelay + , ForceDelayStage , simpleFailBefore , simpleFailAfter ) , ( "Simple force break" - , ForceDelay + , ForceDelayStage , simpleForceBreakBefore , simpleForceBreakAfter ) , ( "Simple app break" - , ForceDelay + , ForceDelayStage , simpleAppBreakBefore , simpleAppBreakAfter ) , ( "App term break" - , ForceDelay + , ForceDelayStage , appTermBreakBefore , appTermBreakAfter ) , ( "Lambda break" - , ForceDelay + , ForceDelayStage , lambdaBreakBefore , lambdaBreakAfter ) , ( "Last delay break" - , ForceDelay + , ForceDelayStage , lastDelayBreakBefore , lastDelayBreakAfter ) , ( "Last abs break" - , ForceDelay + , ForceDelayStage , lastAbsBreakBefore , lastAbsBreakAfter ) diff --git a/plutus-metatheory/test/certifier/Test/Certifier/Optimizer.hs b/plutus-metatheory/test/certifier/Test/Certifier/Optimizer.hs index 5c511693f9d..40dc412724f 100644 --- a/plutus-metatheory/test/certifier/Test/Certifier/Optimizer.hs +++ b/plutus-metatheory/test/certifier/Test/Certifier/Optimizer.hs @@ -1,18 +1,18 @@ module Test.Certifier.Optimizer where -import FFI.SimplifierTrace (mkFfiSimplifierTrace) +import FFI.OptimizerTrace (mkFfiOptimizerTrace) import MAlonzo.Code.Certifier (runCertifierMain) import PlutusCore qualified as PLC import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (assertBool, assertFailure, testCase) -import Transform.Simplify.Lib (testCse, testSimplify) +import Transform.Simplify.Lib (testCse, testOptimize) import Transform.Simplify.Spec (testCseInputs, testSimplifyInputs) import UntypedPlutusCore ( CseWhichSubterms (..) , DefaultFun , DefaultUni , Name - , SimplifierTrace + , OptimizerTrace , Term ) @@ -20,7 +20,7 @@ type SimplifierFunc = Term Name PLC.DefaultUni PLC.DefaultFun () -> PLC.Quote ( Term Name PLC.DefaultUni PLC.DefaultFun () - , SimplifierTrace Name PLC.DefaultUni PLC.DefaultFun () + , OptimizerTrace Name PLC.DefaultUni PLC.DefaultFun () ) mkUPLCTest @@ -31,8 +31,8 @@ mkUPLCTest mkUPLCTest simplifierFunc name input = testCase name $ let rawAgdaTrace = PLC.runQuote $ do - simplifierTrace <- snd <$> simplifierFunc input - return $ mkFfiSimplifierTrace simplifierTrace + optimizerTrace <- snd <$> simplifierFunc input + return $ mkFfiOptimizerTrace optimizerTrace in case runCertifierMain rawAgdaTrace [] of Just (result, _report) -> assertBool "The certifier returned false." result @@ -43,7 +43,7 @@ mkUPLCSimplifierTest :: String -> Term Name DefaultUni DefaultFun () -> TestTree -mkUPLCSimplifierTest = mkUPLCTest testSimplify +mkUPLCSimplifierTest = mkUPLCTest testOptimize mkUPLCCseTest :: CseWhichSubterms diff --git a/plutus-tx-plugin/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md b/plutus-tx-plugin/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md new file mode 100644 index 00000000000..121e724b00d --- /dev/null +++ b/plutus-tx-plugin/changelog.d/20260415_215659_ana.pantilie95_safe_opt_mode.md @@ -0,0 +1,3 @@ +### Added + +- Added a new plugin option `certified-opts-only` which disables those optimisation passes which are not certified to preserve the functional behavior of the original program. diff --git a/plutus-tx-plugin/src/PlutusTx/Options.hs b/plutus-tx-plugin/src/PlutusTx/Options.hs index b06cfd36189..c6895506115 100644 --- a/plutus-tx-plugin/src/PlutusTx/Options.hs +++ b/plutus-tx-plugin/src/PlutusTx/Options.hs @@ -85,6 +85,7 @@ data PluginOptions = PluginOptions _posRemoveTrace :: Bool , _posDumpCompilationTrace :: Bool , _posCertify :: Maybe String + , _posCertifiedOptsOnly :: Bool } makeLenses ''PluginOptions @@ -267,7 +268,7 @@ pluginOptions = desc = "Set the max iterations for the PIR simplifier" in (k, PluginOption typeRep (readOption k) posMaxSimplifierIterationsPir desc []) , let k = "max-simplifier-iterations-uplc" - desc = "Set the max iterations for the UPLC simplifier" + desc = "Set the max iterations for the UPLC optimizer" in (k, PluginOption typeRep (readOption k) posMaxSimplifierIterationsUPlc desc []) , let k = "max-cse-iterations" desc = "Set the max iterations for CSE" @@ -339,6 +340,11 @@ pluginOptions = rest <- many (alphaNumChar <|> char '_' <|> char '\\') pure (firstC : rest) in (k, PluginOption typeRep (plcParserOption p k) posCertify desc []) + , let k = "certified-opts-only" + desc = + "Run only those optimisation passes which are certified to preserve the functional " + <> "behavior of the original program." + in (k, PluginOption typeRep (setTrue k) posCertifiedOptsOnly desc []) ] flag :: (a -> a) -> OptionKey -> Maybe OptionValue -> Validation ParseError (a -> a) @@ -391,9 +397,9 @@ defaultPluginOptions = , _posVerbosity = Quiet , _posDatatypes = PIR.defaultDatatypeCompilationOpts , _posMaxSimplifierIterationsPir = view PIR.coMaxSimplifierIterations PIR.defaultCompilationOpts - , _posMaxSimplifierIterationsUPlc = view UPLC.soMaxSimplifierIterations UPLC.defaultSimplifyOpts - , _posMaxCseIterations = view UPLC.soMaxCseIterations UPLC.defaultSimplifyOpts - , _posCseWhichSubterms = view UPLC.soCseWhichSubterms UPLC.defaultSimplifyOpts + , _posMaxSimplifierIterationsUPlc = view UPLC.ooMaxSimplifierIterations UPLC.defaultOptimizeOpts + , _posMaxCseIterations = view UPLC.ooMaxCseIterations UPLC.defaultOptimizeOpts + , _posCseWhichSubterms = view UPLC.ooCseWhichSubterms UPLC.defaultOptimizeOpts , _posDoSimplifierUnwrapCancel = True , _posDoSimplifierBeta = True , _posDoSimplifierInline = True @@ -414,6 +420,7 @@ defaultPluginOptions = , _posRemoveTrace = False , _posDumpCompilationTrace = False , _posCertify = Nothing + , _posCertifiedOptsOnly = False } processOne diff --git a/plutus-tx-plugin/src/PlutusTx/Plugin/Common.hs b/plutus-tx-plugin/src/PlutusTx/Plugin/Common.hs index 1081cd60920..46a94c59028 100644 --- a/plutus-tx-plugin/src/PlutusTx/Plugin/Common.hs +++ b/plutus-tx-plugin/src/PlutusTx/Plugin/Common.hs @@ -783,30 +783,33 @@ runCompiler moduleName opts expr = do plcOpts = PLC.defaultCompilationOpts & set - (PLC.coSimplifyOpts . UPLC.soMaxSimplifierIterations) + (PLC.coOptimizeOpts . UPLC.ooMaxSimplifierIterations) (opts ^. posMaxSimplifierIterationsUPlc) & set - (PLC.coSimplifyOpts . UPLC.soCseWhichSubterms) + (PLC.coOptimizeOpts . UPLC.ooCseWhichSubterms) (opts ^. posCseWhichSubterms) & set - (PLC.coSimplifyOpts . UPLC.soMaxCseIterations) + (PLC.coOptimizeOpts . UPLC.ooMaxCseIterations) (opts ^. posMaxCseIterations) & set - (PLC.coSimplifyOpts . UPLC.soConservativeOpts) + (PLC.coOptimizeOpts . UPLC.ooConservativeOpts) (opts ^. posConservativeOpts) - & set (PLC.coSimplifyOpts . UPLC.soInlineHints) hints + & set (PLC.coOptimizeOpts . UPLC.ooInlineHints) hints & set - (PLC.coSimplifyOpts . UPLC.soInlineConstants) + (PLC.coOptimizeOpts . UPLC.ooInlineConstants) (opts ^. posInlineConstants) & set - (PLC.coSimplifyOpts . UPLC.soInlineCallsiteGrowth) + (PLC.coOptimizeOpts . UPLC.ooInlineCallsiteGrowth) (opts ^. posInlineCallsiteGrowth . to fromIntegral) & set - (PLC.coSimplifyOpts . UPLC.soPreserveLogging) + (PLC.coOptimizeOpts . UPLC.ooPreserveLogging) (opts ^. posPreserveLogging) & set - (PLC.coSimplifyOpts . UPLC.soApplyToCase) + (PLC.coOptimizeOpts . UPLC.ooApplyToCase) (opts ^. posApplyToCase) + & set + (PLC.coOptimizeOpts . UPLC.ooCertifiedOptsOnly) + (opts ^. posCertifiedOptsOnly) -- GHC.Core -> Pir translation. pirT <- original <$> (PIR.runDefT annMayInline $ compileExprWithDefs expr) @@ -837,7 +840,7 @@ runCompiler moduleName opts expr = do PLC.inferTypeOfProgram plcTcConfig (plcP $> annMayInline) let optCertify = opts ^. posCertify - (uplcP, simplTrace) <- flip runReaderT plcOpts $ PLC.compileProgramWithTrace plcP + (uplcP, simplTrace) <- flip runReaderT plcOpts $ PLC.compileProgramWithTrace def plcP liftIO $ case optCertify of Just certName -> do -- FIXME: add a plugin option to choose from BasicOutput vs. other options diff --git a/plutus-tx-plugin/test/Budget/9.6/applicative.golden.eval b/plutus-tx-plugin/test/Budget/9.6/applicative.golden.eval index 09f9aa88b5d..0cb4877735b 100644 --- a/plutus-tx-plugin/test/Budget/9.6/applicative.golden.eval +++ b/plutus-tx-plugin/test/Budget/9.6/applicative.golden.eval @@ -1,6 +1,6 @@ -CPU: 197_308 -Memory: 702 -AST Size: 6 -Flat Size: 13 +CPU: 32_100 +Memory: 300 +AST Size: 2 +Flat Size: 9 (constr 0 (con integer 3)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/applicative.golden.uplc b/plutus-tx-plugin/test/Budget/9.6/applicative.golden.uplc index 1efbfc301cc..2636cbd763d 100644 --- a/plutus-tx-plugin/test/Budget/9.6/applicative.golden.uplc +++ b/plutus-tx-plugin/test/Budget/9.6/applicative.golden.uplc @@ -1 +1 @@ -(program 1.1.0 (constr 0 [(addInteger 1 2)])) \ No newline at end of file +(program 1.1.0 (constr 0 [3])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.eval b/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.eval index 09f9aa88b5d..0cb4877735b 100644 --- a/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.eval +++ b/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.eval @@ -1,6 +1,6 @@ -CPU: 197_308 -Memory: 702 -AST Size: 6 -Flat Size: 13 +CPU: 32_100 +Memory: 300 +AST Size: 2 +Flat Size: 9 (constr 0 (con integer 3)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.uplc b/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.uplc index 1efbfc301cc..2636cbd763d 100644 --- a/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.uplc +++ b/plutus-tx-plugin/test/Budget/9.6/monadicDo.golden.uplc @@ -1 +1 @@ -(program 1.1.0 (constr 0 [(addInteger 1 2)])) \ No newline at end of file +(program 1.1.0 (constr 0 [3])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.eval b/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.eval index 7a5f806f08e..5ae2964777a 100644 --- a/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.eval +++ b/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.eval @@ -1,7 +1,7 @@ -CPU: 3_182_422 -Memory: 13_404 -AST Size: 140 -Flat Size: 153 +CPU: 96_100 +Memory: 700 +AST Size: 6 +Flat Size: 15 (constr 1 (constr 0 (constr 0 (con bool True) (con integer 1) (con bool False))) diff --git a/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.uplc b/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.uplc index 6365cded13b..908c3374348 100644 --- a/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.uplc +++ b/plutus-tx-plugin/test/Budget/9.6/toFromData.golden.uplc @@ -1,82 +1 @@ -(program - 1.1.0 - (case - (unConstrData - (constrData - 1 - (force mkCons - (constrData - 0 - (force mkCons - (constrData - 0 - (force mkCons - (Constr 1 []) - (force mkCons - (iData 1) - (force mkCons (Constr 0 []) [])))) - [])) - []))) - [ (\index - args -> - case - index - [ (\ds -> constr 0 [(unIData (force headList ds))]) - , (\ds -> - constr 1 - [ (case - (unConstrData (force headList ds)) - [ (\index - args -> - case - index - [ (\ds -> - constr 0 - [ (case - (unConstrData (force headList ds)) - [ (\index - args -> - case - index - [ (\ds -> - (\l -> - constr 0 - [ (case - (unConstrData - (force - headList - ds)) - [ (\index - args -> - case - index - [ (\ds -> - False) - , (\ds -> - True) ] - args) ]) - , (unIData - (force - headList - l)) - , (case - (unConstrData - (force - headList - (force - tailList - l))) - [ (\index - args -> - case - index - [ (\ds -> - False) - , (\ds -> - True) ] - args) ]) ]) - (force tailList ds)) ] - args) ]) ]) - , (\ds -> constr 1 []) ] - args) ]) ]) ] - args) ])) \ No newline at end of file +(program 1.1.0 (constr 1 [(constr 0 [(constr 0 [True, 1, False])])])) \ No newline at end of file diff --git a/plutus-tx/src/PlutusTx/Lift.hs b/plutus-tx/src/PlutusTx/Lift.hs index 965d276d724..c09cb70a6a7 100644 --- a/plutus-tx/src/PlutusTx/Lift.hs +++ b/plutus-tx/src/PlutusTx/Lift.hs @@ -106,13 +106,13 @@ safeLiftWith f g v x = do ucOpts = ( g . ( if v == PLC.plcVersion100 - then set (PLC.coSimplifyOpts . UPLC.soApplyToCase) False + then set (PLC.coOptimizeOpts . UPLC.ooApplyToCase) False else id ) ) PLC.defaultCompilationOpts plc <- flip runReaderT ccConfig $ compileProgram (Program () v pir) - uplc <- flip runReaderT ucOpts $ PLC.compileProgram plc + uplc <- flip runReaderT ucOpts $ PLC.compileProgram def plc UPLC.Program _ _ db <- modifyError (PLCError . PLC.FreeVariableErrorE) $ traverseOf UPLC.progTerm UPLC.deBruijnTerm uplc pure (void pir, void db) @@ -164,9 +164,9 @@ safeLiftUnopt safeLiftUnopt = safeLiftWith (set coMaxSimplifierIterations 0) - ( set (PLC.coSimplifyOpts . UPLC.soMaxSimplifierIterations) 0 - . set (PLC.coSimplifyOpts . UPLC.soMaxCseIterations) 0 - . set (PLC.coSimplifyOpts . UPLC.soApplyToCase) False + ( set (PLC.coOptimizeOpts . UPLC.ooMaxSimplifierIterations) 0 + . set (PLC.coOptimizeOpts . UPLC.ooMaxCseIterations) 0 + . set (PLC.coOptimizeOpts . UPLC.ooApplyToCase) False ) {-| Get a Plutus Core program corresponding to the given value, applying default PIR/UPLC @@ -507,7 +507,7 @@ typeCode p prog = do _ <- typeCheckAgainst p prog compiled <- flip runReaderT PLC.defaultCompilationOpts $ - PLC.compileProgram prog + PLC.compileProgram def prog db <- modifyError (PLCError . PLC.FreeVariableErrorE) $ traverseOf UPLC.progTerm UPLC.deBruijnTerm compiled