Documentation
¶
Index ¶
- Constants
- Variables
- type AddedSizes
- type AddedSizesModel
- type Arguments
- type Builtin
- type BuiltinArgs
- type BuiltinCosts
- type Builtins
- type Compute
- type ConstAboveDiagonalIntoQuadraticXAndYModel
- type ConstAboveDiagonalModel
- type ConstBelowDiagonalModel
- type Constant
- type ConstantCost
- type ConstantOrLinear
- type ConstantOrTwoArguments
- type Constr
- type CostModel
- type CostingFunc
- type Delay
- type Done
- type Env
- type ExBudget
- func CostPair[T TwoArgument](cf CostingFunc[T], x, y func() ExMem) ExBudget
- func CostSextuple[T SixArgument](cf CostingFunc[T], a, b, c, d, e, f func() ExMem) ExBudget
- func CostSingle[T OneArgument](cf CostingFunc[T], x func() ExMem) ExBudget
- func CostTriple[T ThreeArgument](cf CostingFunc[T], x, y, z func() ExMem) ExBudget
- type ExMem
- type ExpMod
- type FrameAwaitArg
- type FrameAwaitFunTerm
- type FrameAwaitFunValue
- type FrameCases
- type FrameConstr
- type FrameForce
- type Lambda
- type LinearCost
- type LinearInX
- type LinearInXAndY
- type LinearInY
- type LinearOnDiagonalModel
- type Machine
- func (m *Machine[T]) CostOne(b *builtin.DefaultFunction, x func() ExMem) error
- func (m *Machine[T]) CostSix(b *builtin.DefaultFunction, x, y, z, xx, yy, zz func() ExMem) error
- func (m *Machine[T]) CostThree(b *builtin.DefaultFunction, x, y, z func() ExMem) error
- func (m *Machine[T]) CostTwo(b *builtin.DefaultFunction, x, y func() ExMem) error
- func (m *Machine[T]) Run(term syn.Term[T]) (syn.Term[T], error)
- type MachineContext
- type MachineCosts
- type MachineState
- type MaxSize
- type MaxSizeModel
- type MinSize
- type MinSizeModel
- type MultipliedSizes
- type MultipliedSizesModel
- type NoFrame
- type OneArgument
- type QuadraticFunction
- type QuadraticInYModel
- type Return
- type SixArgument
- type StepKind
- type SubtractedSizes
- type SubtractedSizesModel
- type ThreeAddedSizesModel
- type ThreeArgument
- type ThreeLinearInMaxYZ
- type ThreeLinearInX
- type ThreeLinearInY
- type ThreeLinearInYandZ
- type ThreeLinearInZ
- type ThreeLiteralInYorLinearInZ
- type ThreeQuadraticInZ
- type TwoArgument
- type TwoArgumentsQuadraticFunction
- type TwoVariableLinearSize
- type Value
Constants ¶
const ( PairCost = 1 ConsCost = 3 NilCost = 1 DataCost = 4 )
const IntegerToByteStringMaximumOutputLength = 8192
Variables ¶
var DefaultBuiltinCosts = BuiltinCosts{ builtin.AddInteger: &CostingFunc[Arguments]{ mem: &MaxSizeModel{MaxSize{ intercept: 1, slope: 1, }}, cpu: &MaxSizeModel{MaxSize{ intercept: 100788, slope: 420, }}, }, builtin.SubtractInteger: &CostingFunc[Arguments]{ mem: &MaxSizeModel{MaxSize{ intercept: 1, slope: 1, }}, cpu: &MaxSizeModel{MaxSize{ intercept: 100788, slope: 420, }}, }, builtin.MultiplyInteger: &CostingFunc[Arguments]{ mem: &AddedSizesModel{AddedSizes{ intercept: 0, slope: 1, }}, cpu: &MultipliedSizesModel{MultipliedSizes{ intercept: 90434, slope: 519, }}, }, builtin.DivideInteger: &CostingFunc[Arguments]{ mem: &SubtractedSizesModel{SubtractedSizes{ intercept: 0, slope: 1, minimum: 1, }}, cpu: &ConstAboveDiagonalIntoQuadraticXAndYModel{ constant: 85848, TwoArgumentsQuadraticFunction: TwoArgumentsQuadraticFunction{ minimum: 85848, coeff00: 123203, coeff01: 7305, coeff02: -900, coeff10: 1716, coeff11: 549, coeff20: 57, }, }, }, builtin.QuotientInteger: &CostingFunc[Arguments]{ mem: &SubtractedSizesModel{SubtractedSizes{ intercept: 0, slope: 1, minimum: 1, }}, cpu: &ConstAboveDiagonalIntoQuadraticXAndYModel{ 85848, TwoArgumentsQuadraticFunction{ minimum: 85848, coeff00: 123203, coeff01: 7305, coeff02: -900, coeff10: 1716, coeff11: 549, coeff20: 57, }, }, }, builtin.RemainderInteger: &CostingFunc[Arguments]{ mem: &LinearInY{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ConstAboveDiagonalIntoQuadraticXAndYModel{ constant: 85848, TwoArgumentsQuadraticFunction: TwoArgumentsQuadraticFunction{ minimum: 85848, coeff00: 123203, coeff01: 7305, coeff02: -900, coeff10: 1716, coeff11: 549, coeff20: 57, }, }, }, builtin.ModInteger: &CostingFunc[Arguments]{ mem: &LinearInY{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ConstAboveDiagonalIntoQuadraticXAndYModel{ constant: 85848, TwoArgumentsQuadraticFunction: TwoArgumentsQuadraticFunction{ minimum: 85848, coeff00: 123203, coeff01: 7305, coeff02: -900, coeff10: 1716, coeff11: 549, coeff20: 57, }, }, }, builtin.EqualsInteger: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 51775, slope: 558, }}, }, builtin.LessThanInteger: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 44749, slope: 541, }}, }, builtin.LessThanEqualsInteger: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 43285, slope: 552, }}, }, builtin.AppendByteString: &CostingFunc[Arguments]{ mem: &AddedSizesModel{AddedSizes{ intercept: 0, slope: 1, }}, cpu: &AddedSizesModel{AddedSizes{ intercept: 1000, slope: 173, }}, }, builtin.ConsByteString: &CostingFunc[Arguments]{ mem: &AddedSizesModel{AddedSizes{ intercept: 0, slope: 1, }}, cpu: &LinearInY{LinearCost{ intercept: 72010, slope: 178, }}, }, builtin.SliceByteString: &CostingFunc[Arguments]{ mem: &ThreeLinearInZ{LinearCost{ intercept: 4, slope: 0, }}, cpu: &ThreeLinearInZ{LinearCost{ intercept: 20467, slope: 1, }}, }, builtin.LengthOfByteString: &CostingFunc[Arguments]{ mem: &ConstantCost{10}, cpu: &ConstantCost{22100}, }, builtin.IndexByteString: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &ConstantCost{13169}, }, builtin.EqualsByteString: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &LinearOnDiagonalModel{ConstantOrLinear{ constant: 24548, intercept: 29498, slope: 38, }}, }, builtin.LessThanByteString: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 28999, slope: 74, }}, }, builtin.LessThanEqualsByteString: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 28999, slope: 74, }}, }, builtin.Sha2_256: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &LinearCost{ intercept: 270652, slope: 22588, }, }, builtin.Sha3_256: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &LinearCost{ intercept: 1457325, slope: 64566, }, }, builtin.Blake2b_256: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &LinearCost{ intercept: 201305, slope: 8356, }, }, builtin.Blake2b_224: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &LinearCost{ intercept: 207616, slope: 8310, }, }, builtin.Keccak_256: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &LinearCost{ intercept: 2261318, slope: 64571, }, }, builtin.VerifyEd25519Signature: &CostingFunc[Arguments]{ mem: &ConstantCost{10}, cpu: &ThreeLinearInY{LinearCost{ intercept: 53384111, slope: 14333, }}, }, builtin.VerifyEcdsaSecp256k1Signature: &CostingFunc[Arguments]{ mem: &ConstantCost{10}, cpu: &ConstantCost{43053543}, }, builtin.VerifySchnorrSecp256k1Signature: &CostingFunc[Arguments]{ mem: &ConstantCost{10}, cpu: &ThreeLinearInY{LinearCost{ intercept: 43574283, slope: 26308, }}, }, builtin.AppendString: &CostingFunc[Arguments]{ mem: &AddedSizesModel{AddedSizes{ intercept: 4, slope: 1, }}, cpu: &AddedSizesModel{AddedSizes{ intercept: 1000, slope: 59957, }}, }, builtin.EqualsString: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &LinearOnDiagonalModel{ConstantOrLinear{ constant: 39184, intercept: 1000, slope: 60594, }}, }, builtin.EncodeUtf8: &CostingFunc[Arguments]{ mem: &LinearCost{ intercept: 4, slope: 2, }, cpu: &LinearCost{ intercept: 1000, slope: 42921, }, }, builtin.DecodeUtf8: &CostingFunc[Arguments]{ mem: &LinearCost{ intercept: 4, slope: 2, }, cpu: &LinearCost{ intercept: 91189, slope: 769, }, }, builtin.IfThenElse: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &ConstantCost{76049}, }, builtin.ChooseUnit: &CostingFunc[Arguments]{ mem: &ConstantCost{4}, cpu: &ConstantCost{61462}, }, builtin.Trace: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{59498}, }, builtin.FstPair: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{141895}, }, builtin.SndPair: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{141992}, }, builtin.ChooseList: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{132994}, }, builtin.MkCons: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{72362}, }, builtin.HeadList: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{83150}, }, builtin.TailList: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{81663}, }, builtin.NullList: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{74433}, }, builtin.ChooseData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{94375}, }, builtin.ConstrData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{22151}, }, builtin.MapData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{68246}, }, builtin.ListData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{33852}, }, builtin.IData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{15299}, }, builtin.BData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{11183}, }, builtin.UnConstrData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{24588}, }, builtin.UnMapData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{24623}, }, builtin.UnListData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{25933}, }, builtin.UnIData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{20744}, }, builtin.UnBData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{20142}, }, builtin.EqualsData: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &MinSizeModel{MinSize{ intercept: 898148, slope: 27279, }}, }, builtin.SerialiseData: &CostingFunc[Arguments]{ mem: &LinearCost{ intercept: 0, slope: 2, }, cpu: &LinearCost{ intercept: 955506, slope: 213312, }, }, builtin.MkPairData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{11546}, }, builtin.MkNilData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{7243}, }, builtin.MkNilPairData: &CostingFunc[Arguments]{ mem: &ConstantCost{32}, cpu: &ConstantCost{7391}, }, builtin.Bls12_381_G1_Add: &CostingFunc[Arguments]{ mem: &ConstantCost{18}, cpu: &ConstantCost{962335}, }, builtin.Bls12_381_G1_Neg: &CostingFunc[Arguments]{ mem: &ConstantCost{18}, cpu: &ConstantCost{267929}, }, builtin.Bls12_381_G1_ScalarMul: &CostingFunc[Arguments]{ mem: &ConstantCost{18}, cpu: &LinearInX{LinearCost{ intercept: 76433006, slope: 8868, }}, }, builtin.Bls12_381_G1_Equal: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &ConstantCost{442008}, }, builtin.Bls12_381_G1_Compress: &CostingFunc[Arguments]{ mem: &ConstantCost{6}, cpu: &ConstantCost{2780678}, }, builtin.Bls12_381_G1_Uncompress: &CostingFunc[Arguments]{ mem: &ConstantCost{18}, cpu: &ConstantCost{52948122}, }, builtin.Bls12_381_G1_HashToGroup: &CostingFunc[Arguments]{ mem: &ConstantCost{18}, cpu: &LinearInX{LinearCost{ intercept: 52538055, slope: 3756, }}, }, builtin.Bls12_381_G2_Add: &CostingFunc[Arguments]{ mem: &ConstantCost{36}, cpu: &ConstantCost{1995836}, }, builtin.Bls12_381_G2_Neg: &CostingFunc[Arguments]{ mem: &ConstantCost{36}, cpu: &ConstantCost{284546}, }, builtin.Bls12_381_G2_ScalarMul: &CostingFunc[Arguments]{ mem: &ConstantCost{36}, cpu: &LinearInX{LinearCost{ intercept: 158221314, slope: 26549, }}, }, builtin.Bls12_381_G2_Equal: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &ConstantCost{901022}, }, builtin.Bls12_381_G2_Compress: &CostingFunc[Arguments]{ mem: &ConstantCost{12}, cpu: &ConstantCost{3227919}, }, builtin.Bls12_381_G2_Uncompress: &CostingFunc[Arguments]{ mem: &ConstantCost{36}, cpu: &ConstantCost{74698472}, }, builtin.Bls12_381_G2_HashToGroup: &CostingFunc[Arguments]{ mem: &ConstantCost{36}, cpu: &LinearInX{LinearCost{ intercept: 166917843, slope: 4307, }}, }, builtin.Bls12_381_MillerLoop: &CostingFunc[Arguments]{ mem: &ConstantCost{72}, cpu: &ConstantCost{254006273}, }, builtin.Bls12_381_MulMlResult: &CostingFunc[Arguments]{ mem: &ConstantCost{72}, cpu: &ConstantCost{2174038}, }, builtin.Bls12_381_FinalVerify: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &ConstantCost{333849714}, }, builtin.IntegerToByteString: &CostingFunc[Arguments]{ mem: &ThreeLiteralInYorLinearInZ{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ThreeQuadraticInZ{QuadraticFunction{ coeff0: 1293828, coeff1: 28716, coeff2: 63, }}, }, builtin.ByteStringToInteger: &CostingFunc[Arguments]{ mem: &LinearInY{LinearCost{ intercept: 0, slope: 1, }}, cpu: &QuadraticInYModel{QuadraticFunction{ coeff0: 1006041, coeff1: 43623, coeff2: 251, }}, }, builtin.AndByteString: &CostingFunc[Arguments]{ mem: &ThreeLinearInMaxYZ{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ThreeLinearInYandZ{TwoVariableLinearSize{ intercept: 100181, slope1: 726, slope2: 719, }}, }, builtin.OrByteString: &CostingFunc[Arguments]{ mem: &ThreeLinearInMaxYZ{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ThreeLinearInYandZ{TwoVariableLinearSize{ intercept: 100181, slope1: 726, slope2: 719, }}, }, builtin.XorByteString: &CostingFunc[Arguments]{ mem: &ThreeLinearInMaxYZ{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ThreeLinearInYandZ{TwoVariableLinearSize{ intercept: 100181, slope1: 726, slope2: 719, }}, }, builtin.ComplementByteString: &CostingFunc[Arguments]{ mem: &LinearCost{ intercept: 0, slope: 1, }, cpu: &LinearCost{ intercept: 107878, slope: 680, }, }, builtin.ReadBit: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &ConstantCost{95336}, }, builtin.WriteBits: &CostingFunc[Arguments]{ mem: &ThreeLinearInX{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ThreeLinearInY{LinearCost{ intercept: 281145, slope: 18848, }}, }, builtin.ReplicateByte: &CostingFunc[Arguments]{ mem: &LinearInX{LinearCost{ intercept: 1, slope: 1, }}, cpu: &LinearInX{LinearCost{ intercept: 180194, slope: 159, }}, }, builtin.ShiftByteString: &CostingFunc[Arguments]{ mem: &LinearInX{LinearCost{ intercept: 0, slope: 1, }}, cpu: &LinearInX{LinearCost{ intercept: 158519, slope: 8942, }}, }, builtin.RotateByteString: &CostingFunc[Arguments]{ mem: &LinearInX{LinearCost{ intercept: 0, slope: 1, }}, cpu: &LinearInX{LinearCost{ intercept: 159378, slope: 8813, }}, }, builtin.CountSetBits: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &LinearInX{LinearCost{ intercept: 107490, slope: 3298, }}, }, builtin.FindFirstSetBit: &CostingFunc[Arguments]{ mem: &ConstantCost{1}, cpu: &LinearInX{LinearCost{ intercept: 106057, slope: 655, }}, }, builtin.Ripemd_160: &CostingFunc[Arguments]{ mem: &ConstantCost{3}, cpu: &LinearInX{LinearCost{ intercept: 1964219, slope: 24520, }}, }, builtin.ExpModInteger: &CostingFunc[Arguments]{ mem: &ThreeLinearInZ{LinearCost{ intercept: 0, slope: 1, }}, cpu: &ExpMod{ coeff00: 607153, coeff11: 231697, coeff12: 53144, }, }, builtin.CaseList: &CostingFunc[Arguments]{}, builtin.CaseData: &CostingFunc[Arguments]{}, builtin.DropList: &CostingFunc[Arguments]{}, builtin.LengthOfArray: &CostingFunc[Arguments]{}, builtin.ListToArray: &CostingFunc[Arguments]{}, builtin.IndexArray: &CostingFunc[Arguments]{}, }
var DefaultCostModel = CostModel{ // contains filtered or unexported fields }
var DefaultExBudget = ExBudget{
Mem: 14_000_000,
Cpu: 10_000_000_000,
}
var DefaultMachineCosts = MachineCosts{ // contains filtered or unexported fields }
Functions ¶
This section is empty.
Types ¶
type AddedSizes ¶
type AddedSizes struct {
// contains filtered or unexported fields
}
type AddedSizesModel ¶
type AddedSizesModel struct {
AddedSizes
}
AddedSizesModel costs based on the sum of arguments
func (AddedSizesModel) CostTwo ¶
func (a AddedSizesModel) CostTwo(x, y ExMem) int
func (AddedSizesModel) HasConstants ¶
func (AddedSizesModel) HasConstants() []bool
type Arguments ¶
type Arguments interface { HasConstants() []bool // contains filtered or unexported methods }
type Builtin ¶
type Builtin[T syn.Eval] struct { Func builtin.DefaultFunction Forces uint ArgCount uint Args *BuiltinArgs[T] }
func (*Builtin[T]) ConsumeForce ¶
func (Builtin[T]) NeedsForce ¶
type BuiltinArgs ¶ added in v0.0.6
func (*BuiltinArgs[T]) Extend ¶ added in v0.0.6
func (b *BuiltinArgs[T]) Extend(data Value[T]) *BuiltinArgs[T]
func (*BuiltinArgs[T]) Extract ¶ added in v0.0.6
func (b *BuiltinArgs[T]) Extract(holder *argHolder[T], count uint)
type BuiltinCosts ¶
type BuiltinCosts [builtin.TotalBuiltinCount]*CostingFunc[Arguments]
type ConstAboveDiagonalIntoQuadraticXAndYModel ¶
type ConstAboveDiagonalIntoQuadraticXAndYModel struct { TwoArgumentsQuadraticFunction // contains filtered or unexported fields }
ConstAboveDiagonalIntoQuadraticXAndYModel costs constant when x < y, uses a quadratic function otherwise
func (ConstAboveDiagonalIntoQuadraticXAndYModel) CostTwo ¶
func (c ConstAboveDiagonalIntoQuadraticXAndYModel) CostTwo(x, y ExMem) int
func (ConstAboveDiagonalIntoQuadraticXAndYModel) HasConstants ¶
func (ConstAboveDiagonalIntoQuadraticXAndYModel) HasConstants() []bool
type ConstAboveDiagonalModel ¶
type ConstAboveDiagonalModel struct {
ConstantOrTwoArguments
}
ConstAboveDiagonalModel costs constant when x < y, uses another model otherwise
func (ConstAboveDiagonalModel) CostTwo ¶
func (c ConstAboveDiagonalModel) CostTwo(x, y ExMem) int
func (ConstAboveDiagonalModel) HasConstants ¶
func (ConstAboveDiagonalModel) HasConstants() []bool
type ConstBelowDiagonalModel ¶
type ConstBelowDiagonalModel struct {
ConstantOrTwoArguments
}
ConstBelowDiagonalModel costs constant when x > y, uses another model otherwise
func (ConstBelowDiagonalModel) CostTwo ¶
func (c ConstBelowDiagonalModel) CostTwo(x, y ExMem) int
func (ConstBelowDiagonalModel) HasConstants ¶
func (ConstBelowDiagonalModel) HasConstants() []bool
type ConstantCost ¶
type ConstantCost struct {
// contains filtered or unexported fields
}
func (ConstantCost) Cost ¶
func (c ConstantCost) Cost(x ExMem) int
func (ConstantCost) CostSix ¶
func (c ConstantCost) CostSix(a, b, c2, d, e, f ExMem) int
Using existing ConstantCost for six arguments
func (ConstantCost) CostThree ¶
func (c ConstantCost) CostThree(x, y, z ExMem) int
Using existing ConstantCost for three arguments
func (ConstantCost) CostTwo ¶
func (c ConstantCost) CostTwo(x, y ExMem) int
Implementations for TwoArguments variants Using existing ConstantCost for two arguments
func (ConstantCost) HasConstants ¶
func (ConstantCost) HasConstants() []bool
type ConstantOrLinear ¶
type ConstantOrLinear struct {
// contains filtered or unexported fields
}
type ConstantOrTwoArguments ¶
type ConstantOrTwoArguments struct {
// contains filtered or unexported fields
}
type CostingFunc ¶
type CostingFunc[T Arguments] struct { // contains filtered or unexported fields }
type ExBudget ¶
func CostPair ¶
func CostPair[T TwoArgument](cf CostingFunc[T], x, y func() ExMem) ExBudget
Function to cost TwoArguments similar to CostSingle for OneArgument
func CostSextuple ¶
func CostSextuple[T SixArgument]( cf CostingFunc[T], a, b, c, d, e, f func() ExMem, ) ExBudget
Function to cost SixArguments
func CostSingle ¶
func CostSingle[T OneArgument](cf CostingFunc[T], x func() ExMem) ExBudget
func CostTriple ¶
func CostTriple[T ThreeArgument]( cf CostingFunc[T], x, y, z func() ExMem, ) ExBudget
Function to cost ThreeArguments
type ExpMod ¶
type ExpMod struct {
// contains filtered or unexported fields
}
func (ExpMod) HasConstants ¶
type FrameAwaitArg ¶
type FrameAwaitArg[T syn.Eval] struct { Value Value[T] Ctx MachineContext[T] }
func (FrameAwaitArg[T]) String ¶
func (f FrameAwaitArg[T]) String() string
type FrameAwaitFunTerm ¶
func (FrameAwaitFunTerm[T]) String ¶
func (f FrameAwaitFunTerm[T]) String() string
type FrameAwaitFunValue ¶
type FrameAwaitFunValue[T syn.Eval] struct { Value Value[T] Ctx MachineContext[T] }
func (FrameAwaitFunValue[T]) String ¶
func (f FrameAwaitFunValue[T]) String() string
type FrameCases ¶
func (FrameCases[T]) String ¶
func (f FrameCases[T]) String() string
type FrameConstr ¶
type FrameConstr[T syn.Eval] struct { Env *Env[T] Tag uint Fields []syn.Term[T] ResolvedFields []Value[T] Ctx MachineContext[T] }
func (FrameConstr[T]) String ¶
func (f FrameConstr[T]) String() string
type FrameForce ¶
type FrameForce[T syn.Eval] struct { Ctx MachineContext[T] }
func (FrameForce[T]) String ¶
func (f FrameForce[T]) String() string
type LinearCost ¶
type LinearCost struct {
// contains filtered or unexported fields
}
func (LinearCost) Cost ¶
func (l LinearCost) Cost(x ExMem) int
func (LinearCost) HasConstants ¶
func (LinearCost) HasConstants() []bool
type LinearInX ¶
type LinearInX struct {
LinearCost
}
LinearInX costs based only on the first argument
type LinearInXAndY ¶
type LinearInXAndY struct {
TwoVariableLinearSize
}
LinearInXAndY costs based on both arguments with different slopes
func (LinearInXAndY) CostTwo ¶
func (l LinearInXAndY) CostTwo(x, y ExMem) int
func (LinearInXAndY) HasConstants ¶
func (LinearInXAndY) HasConstants() []bool
type LinearInY ¶
type LinearInY struct {
LinearCost
}
LinearInY costs based only on the second argument
type LinearOnDiagonalModel ¶
type LinearOnDiagonalModel struct {
ConstantOrLinear
}
LinearOnDiagonalModel costs linearly when arguments are equal, constant otherwise
func (LinearOnDiagonalModel) CostTwo ¶
func (l LinearOnDiagonalModel) CostTwo(x, y ExMem) int
func (LinearOnDiagonalModel) HasConstants ¶
func (LinearOnDiagonalModel) HasConstants() []bool
type Machine ¶
type Machine[T syn.Eval] struct { ExBudget ExBudget Logs []string // contains filtered or unexported fields }
func (*Machine[T]) CostOne ¶
func (m *Machine[T]) CostOne(b *builtin.DefaultFunction, x func() ExMem) error
func (*Machine[T]) CostSix ¶
func (m *Machine[T]) CostSix( b *builtin.DefaultFunction, x, y, z, xx, yy, zz func() ExMem, ) error
func (*Machine[T]) CostThree ¶
func (m *Machine[T]) CostThree( b *builtin.DefaultFunction, x, y, z func() ExMem, ) error
type MachineContext ¶
type MachineCosts ¶
type MachineCosts struct {
// contains filtered or unexported fields
}
type MachineState ¶
type MaxSizeModel ¶
type MaxSizeModel struct {
MaxSize
}
MaxSizeModel costs based on the maximum of arguments
func (MaxSizeModel) CostTwo ¶
func (m MaxSizeModel) CostTwo(x, y ExMem) int
func (MaxSizeModel) HasConstants ¶
func (MaxSizeModel) HasConstants() []bool
type MinSizeModel ¶
type MinSizeModel struct {
MinSize
}
MinSizeModel costs based on the minimum of arguments
func (MinSizeModel) CostTwo ¶
func (m MinSizeModel) CostTwo(x, y ExMem) int
func (MinSizeModel) HasConstants ¶
func (MinSizeModel) HasConstants() []bool
type MultipliedSizes ¶
type MultipliedSizes struct {
// contains filtered or unexported fields
}
type MultipliedSizesModel ¶
type MultipliedSizesModel struct {
MultipliedSizes
}
MultipliedSizesModel costs based on the product of arguments
func (MultipliedSizesModel) CostTwo ¶
func (m MultipliedSizesModel) CostTwo(x, y ExMem) int
func (MultipliedSizesModel) HasConstants ¶
func (MultipliedSizesModel) HasConstants() []bool
type OneArgument ¶
type QuadraticFunction ¶
type QuadraticFunction struct {
// contains filtered or unexported fields
}
type QuadraticInYModel ¶
type QuadraticInYModel struct {
QuadraticFunction
}
QuadraticInYModel costs based on a quadratic function of y
func (QuadraticInYModel) CostTwo ¶
func (q QuadraticInYModel) CostTwo(x, y ExMem) int
func (QuadraticInYModel) HasConstants ¶
func (QuadraticInYModel) HasConstants() []bool
X is not used so constant
type SixArgument ¶
SixArgument interface for costing functions with six arguments
type SubtractedSizes ¶
type SubtractedSizes struct {
// contains filtered or unexported fields
}
type SubtractedSizesModel ¶
type SubtractedSizesModel struct {
SubtractedSizes
}
SubtractedSizesModel costs based on the difference of arguments
func (SubtractedSizesModel) CostTwo ¶
func (s SubtractedSizesModel) CostTwo(x, y ExMem) int
func (SubtractedSizesModel) HasConstants ¶
func (SubtractedSizesModel) HasConstants() []bool
type ThreeAddedSizesModel ¶
type ThreeAddedSizesModel struct {
AddedSizes
}
ThreeAddedSizesModel costs based on the sum of three arguments
func (ThreeAddedSizesModel) CostThree ¶
func (a ThreeAddedSizesModel) CostThree(x, y, z ExMem) int
func (ThreeAddedSizesModel) HasConstants ¶
func (ThreeAddedSizesModel) HasConstants() []bool
type ThreeArgument ¶
ThreeArgument interface for costing functions with three arguments
type ThreeLinearInMaxYZ ¶
type ThreeLinearInMaxYZ struct {
LinearCost
}
LinearInMaxYZ costs based on the maximum of y and z
func (ThreeLinearInMaxYZ) CostThree ¶
func (l ThreeLinearInMaxYZ) CostThree(x, y, z ExMem) int
func (ThreeLinearInMaxYZ) HasConstants ¶
func (ThreeLinearInMaxYZ) HasConstants() []bool
X is not used so constant
type ThreeLinearInX ¶
type ThreeLinearInX struct {
LinearCost
}
LinearInX costs based only on the first argument
func (ThreeLinearInX) CostThree ¶
func (l ThreeLinearInX) CostThree(x, y, z ExMem) int
func (ThreeLinearInX) HasConstants ¶
func (ThreeLinearInX) HasConstants() []bool
Y,Z are not used so constant
type ThreeLinearInY ¶
type ThreeLinearInY struct {
LinearCost
}
LinearInY costs based only on the second argument
func (ThreeLinearInY) CostThree ¶
func (l ThreeLinearInY) CostThree(x, y, z ExMem) int
func (ThreeLinearInY) HasConstants ¶
func (ThreeLinearInY) HasConstants() []bool
X,Z are not used so constant
type ThreeLinearInYandZ ¶
type ThreeLinearInYandZ struct {
TwoVariableLinearSize
}
LinearInYandZ costs based on both y and z arguments
func (ThreeLinearInYandZ) CostThree ¶
func (l ThreeLinearInYandZ) CostThree(x, y, z ExMem) int
func (ThreeLinearInYandZ) HasConstants ¶
func (ThreeLinearInYandZ) HasConstants() []bool
X is not used so constant
type ThreeLinearInZ ¶
type ThreeLinearInZ struct {
LinearCost
}
LinearInZ costs based only on the third argument
func (ThreeLinearInZ) CostThree ¶
func (l ThreeLinearInZ) CostThree(x, y, z ExMem) int
func (ThreeLinearInZ) HasConstants ¶
func (ThreeLinearInZ) HasConstants() []bool
X,Y are not used so constant
type ThreeLiteralInYorLinearInZ ¶
type ThreeLiteralInYorLinearInZ struct {
LinearCost
}
LiteralInYorLinearInZ costs y if y != 0, otherwise linear in z
func (ThreeLiteralInYorLinearInZ) CostThree ¶
func (l ThreeLiteralInYorLinearInZ) CostThree(x, y, z ExMem) int
func (ThreeLiteralInYorLinearInZ) HasConstants ¶
func (ThreeLiteralInYorLinearInZ) HasConstants() []bool
X is not used so constant
type ThreeQuadraticInZ ¶
type ThreeQuadraticInZ struct {
QuadraticFunction
}
QuadraticInZ costs based on a quadratic function of the third argument
func (ThreeQuadraticInZ) CostThree ¶
func (q ThreeQuadraticInZ) CostThree(x, y, z ExMem) int
X,Y are not used so constant
func (ThreeQuadraticInZ) HasConstants ¶
func (ThreeQuadraticInZ) HasConstants() []bool
type TwoArgument ¶
TwoArgument interface for costing functions with two arguments
type TwoArgumentsQuadraticFunction ¶
type TwoArgumentsQuadraticFunction struct {
// contains filtered or unexported fields
}
type TwoVariableLinearSize ¶
type TwoVariableLinearSize struct {
// contains filtered or unexported fields
}