Documentation
¶
Overview ¶
Package runtime provides the SysML v2 execution runtime: expression evaluation, instance materialization, and KerML operator library.
Usage Example ¶
// Create the model-derived part once, then a runtime context over it
model := runtime.NewModel(passes.NewTypedModel(resolver), resolver)
model.SetExpressionParser(parser.ParseOneExpression)
ctx := runtime.NewContext(model, runtime.DefaultMaxSteps)
// Instantiate a part
partSym := resolveSymbol(root, "MyCar")
inst, err := ctx.Instantiate(partSym)
if err != nil {
log.Fatal(err)
}
// Evaluate an expression
exprNode := parseExpression("1 + 2")
result, err := ctx.Eval(exprNode)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Const.Int) // 3
Architecture ¶
The runtime is organized in three tiers:
- Tier 1: Feature flattening (effective-feature lists per type)
- Tier 2: Instance model (lazy feature value materialization, multiplicity-driven collections)
- Tier 3: Expression evaluator (literals, operators, feature access, calc invocation, KerML builtins)
Key types:
- Context: Runtime execution context (ID allocator, instance registry, memoization)
- Value: Runtime-evaluable value (int/real/bool/string/null/instance/Sequence/Set)
- EffectiveFeature: One entry in a type's effective feature list (Tier 1 schema)
- Instance: Runtime-materialized object with typed feature values
- EvalContext: Lexical environment for evaluation (frame stack)
Integration ¶
- Consumes semantics.Model (inherits features, multiplicity, constant folding)
- Gates on pass-validated models (LevelConstraint success)
- One Context per workspace session (LSP/REPL lifetime)
Behavioral simulation (actions, state machines) is out of scope (future Tiers 4–5).
Index ¶
- Constants
- Variables
- func ActionNodeName(node ast.Node) string
- func ActionNodeNames(node ast.Node) []string
- func BranchLabel(pos int, target ast.Node) string
- func CalcCompileFromEnv() bool
- func CheckClockStep(step float64) error
- func DecisionPlace(node ast.Node) string
- func DeclScope(sym *symbols.Symbol) *symbols.Scope
- func ExecutorBound(name string, b Budgets) (int64, bool)
- func FormatChoices(choices []ChoiceTaken) string
- func FormatComplex(z complex128) string
- func FormatTraceValue(v Value) string
- func FormatValue(v Value) string
- func FormatWeight(w float64) string
- func IsRunnableCaseSymbol(sym *symbols.Symbol) bool
- func IsSignalDefinition(sym *symbols.Symbol) bool
- func IsVerificationCaseSymbol(sym *symbols.Symbol) bool
- func LibraryFunctionParams(fqn string) (params []string, ok bool)
- func Magnitude(value Value) (float64, bool)
- func MagnitudeValue(value Value) (semantics.Value, bool)
- func NegatedDecl(sym *symbols.Symbol) bool
- func NewSampleSource(seed uint64) *rand.Rand
- func ParseClockStep(text string) (float64, error)
- func PooledDeviation(mean float64, spreads []Spread, dof int) float64
- func ReplaySpelling(spelling string) bool
- func RequireAnalysis(sym *symbols.Symbol) error
- func RequireConstraint(sym *symbols.Symbol) error
- func RequireObject(sym *symbols.Symbol) error
- func RequireRequirement(sym *symbols.Symbol) error
- func ResolveCheckFeatures(exec *ActionExecutor, names []string) (map[string]FeatureOwner, error)
- func RunNumber(bindings []SweepBinding) (int64, bool)
- func RunSeed(seed uint64, i int64) uint64
- func SettleMonteCarloRuns(runs []*MonteCarloRun, stats *MonteCarloStatistics) ([]bool, error)
- func SharedDefaultsFromEnv() bool
- func StateVertexName(node ast.Node) string
- func TokenLabel(id int64, node ast.Node) string
- func TraceLabel(node ast.Node) string
- func WeightedMean(weighted []Counted) (mean float64, count int64)
- type AcceptWait
- type ActionExecutor
- func (e *ActionExecutor) AcceptTaking(m Message) (taking []TakingAccept, err error)
- func (e *ActionExecutor) AcceptsMessage(m Message) (accepted bool, err error)
- func (e *ActionExecutor) ActionSymbol() *symbols.Symbol
- func (e *ActionExecutor) Awaiting(token Token) []lower.ActionEdge
- func (e *ActionExecutor) ClearBreakpoints()
- func (e *ActionExecutor) Data() map[string]Value
- func (e *ActionExecutor) Graph() *lower.ActionGraph
- func (e *ActionExecutor) HasPendingSignal() bool
- func (e *ActionExecutor) Held() Held
- func (e *ActionExecutor) Holds(sym *symbols.Symbol, scope *symbols.Scope) (bool, error)
- func (e *ActionExecutor) KeepTraversals(keep bool)
- func (e *ActionExecutor) NextWait() (float64, bool)
- func (e *ActionExecutor) NodeNames() []string
- func (e *ActionExecutor) NoteCount() int
- func (e *ActionExecutor) Notes() []RunNote
- func (e *ActionExecutor) NotesSince(mark int) []RunNote
- func (e *ActionExecutor) Outcome() Outcome
- func (e *ActionExecutor) PausedAt() string
- func (e *ActionExecutor) PausedBreakpoint() (NodeBreakpoint, bool)
- func (e *ActionExecutor) Performer() *Instance
- func (e *ActionExecutor) PerformerAttributes() []string
- func (e *ActionExecutor) Release()
- func (e *ActionExecutor) ReplaceBreakpointsAt(bps []NodeBreakpoint)
- func (e *ActionExecutor) Results() map[string]Value
- func (e *ActionExecutor) Resume() bool
- func (e *ActionExecutor) RunToCompletion() error
- func (e *ActionExecutor) RunToQuiescence() error
- func (e *ActionExecutor) SetBreakpoint(nodeName string)
- func (e *ActionExecutor) SetInputs(inputs map[string]Value)
- func (e *ActionExecutor) SetTrace(trace *TraceRecorder)
- func (e *ActionExecutor) Snapshot() (*Snapshot, error)
- func (e *ActionExecutor) State() ExecutionState
- func (e *ActionExecutor) Step() error
- func (e *ActionExecutor) StepToBreakpoint() error
- func (e *ActionExecutor) TimeWaits() []string
- func (e *ActionExecutor) Tokens() []Token
- func (e *ActionExecutor) TraversalCount() int
- func (e *ActionExecutor) Traversals() []Traversal
- func (e *ActionExecutor) TraversalsSince(mark int) []Traversal
- type AdoptError
- type AdvanceReport
- type AffineTransformation3d
- type AnalysisArgs
- type AnalysisEvaluation
- type AnalysisResult
- type AnalysisVerdict
- type Array
- type AssertionKind
- type BindingConflictError
- type BindingCycleError
- type Bring
- type Budgets
- type Builtin
- type CalcFrameError
- type CalcOutputValue
- type Call
- type CheckBudget
- type CheckFinal
- type CheckMoveError
- type CheckOptions
- type CheckProperty
- type CheckReport
- type CheckResult
- type CheckStopped
- type CheckVerdict
- type ChoiceKind
- type ChoiceParseError
- type ChoicePoint
- type ChoiceTaken
- type Clock
- type ClockStepParseError
- type ClockWait
- type Condition
- type ConnectorEnd
- type ConnectorEndError
- type Context
- func (ctx *Context) ActionInputNames(sym *symbols.Symbol) []string
- func (ctx *Context) ActionInputs(scope *symbols.Scope, sym *symbols.Symbol, positional []Value, ...) (map[string]Value, error)
- func (ctx *Context) ActionOutcome(outputs map[string]Value) Outcome
- func (ctx *Context) ActionOutcomePerformedBy(action *symbols.Symbol, self *Instance, inputs map[string]Value) (Outcome, error)
- func (ctx *Context) Adopt(prev *Context, shapes *Shapes, obj *Instance) ([]string, error)
- func (ctx *Context) AdoptIdentities(prev *Context)
- func (ctx *Context) Advance(duration float64) (AdvanceReport, error)
- func (ctx *Context) AdvanceUntil(duration float64, halted func() bool) (AdvanceReport, error)
- func (ctx *Context) AnalysisOutcome(r AnalysisResult) Outcome
- func (ctx *Context) BehaviorNamed(inst *Instance, name string) (*ObjectBehavior, bool)
- func (ctx *Context) Budgets() Budgets
- func (ctx *Context) CalcCompile() bool
- func (ctx *Context) CalcUsageOutput(sym *symbols.Symbol, name string, scope *symbols.Scope, self *Instance) (Value, error)
- func (ctx *Context) CalcUsageOutputs(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) ([]CalcOutputValue, error)
- func (ctx *Context) Carry(v Value, bring Bring) (Value, error)
- func (ctx *Context) CaseConditionsOf(sym *symbols.Symbol, scope *symbols.Scope) []Condition
- func (ctx *Context) Changed(shapes *Shapes) (string, bool)
- func (ctx *Context) CheckConstraintOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (CheckResult, error)
- func (ctx *Context) CheckRequirementOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (CheckResult, error)
- func (ctx *Context) CheckSatisfactionOn(a *SatisfyAssertion, subject *Instance) (CheckResult, error)
- func (ctx *Context) Choices() []ChoicePoint
- func (ctx *Context) ChoicesTaken() []ChoiceTaken
- func (ctx *Context) ClearModelSeed()
- func (ctx *Context) Clock() *Clock
- func (ctx *Context) ClockMagnitude(val Value, what string) (float64, error)
- func (ctx *Context) ClockStep() float64
- func (ctx *Context) ClockStepTaken() float64
- func (ctx *Context) ClockValue() Value
- func (ctx *Context) CompositeTypeOf(feat *EffectiveFeature) *symbols.Symbol
- func (ctx *Context) ConditionCarrier(kind, element string, sym *symbols.Symbol, self *Instance) (*Instance, error)
- func (ctx *Context) ConditionsOf(sym *symbols.Symbol, scope *symbols.Scope) []Condition
- func (ctx *Context) CreateActionExecutor(action *symbols.Symbol) (*ActionExecutor, error)
- func (ctx *Context) CreateActionExecutorFor(action *symbols.Symbol, self *Instance) (*ActionExecutor, error)
- func (ctx *Context) CreateActionExecutorWithInputs(action *symbols.Symbol, self *Instance, inputs map[string]Value) (*ActionExecutor, error)
- func (ctx *Context) CreateStateExecutor(stateMachine *symbols.Symbol) (*StateExecutor, error)
- func (ctx *Context) CreateStateExecutorFor(stateMachine *symbols.Symbol, self *Instance) (*StateExecutor, error)
- func (ctx *Context) Destroyed(inst *Instance) (at int64, ok bool)
- func (ctx *Context) DrawPolicy() DrawPolicy
- func (ctx *Context) DrawPolicyTaken() DrawPolicy
- func (ctx *Context) DrawsTaken() []DrawTaken
- func (ctx *Context) EnumerationLiteralValue(sym *symbols.Symbol) (Value, bool, error)
- func (ctx *Context) Eval(node ast.Node) (Value, error)
- func (ctx *Context) EvalDeclaredValue(sym *symbols.Symbol) (Value, error)
- func (ctx *Context) EvalWithScope(node ast.Node, scope *symbols.Scope) (Value, error)
- func (ctx *Context) EvalWithScopeOn(node ast.Node, scope *symbols.Scope, self *Instance) (Value, error)
- func (ctx *Context) EvaluateConstraint(sym *symbols.Symbol, scope *symbols.Scope) (bool, error)
- func (ctx *Context) EvaluateConstraintOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (bool, error)
- func (ctx *Context) EvaluateRequirement(sym *symbols.Symbol, scope *symbols.Scope) (bool, error)
- func (ctx *Context) EvaluateRequirementOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (bool, error)
- func (ctx *Context) EvaluateSatisfaction(a *SatisfyAssertion) (bool, error)
- func (ctx *Context) EvaluateSatisfactionOn(a *SatisfyAssertion, subject *Instance) (bool, error)
- func (ctx *Context) ExecuteAction(action *symbols.Symbol) (map[string]Value, error)
- func (ctx *Context) ExecuteActionPerformedBy(action *symbols.Symbol, self *Instance, inputs map[string]Value) (map[string]Value, error)
- func (ctx *Context) ExecuteActionReportingPerformer(action *symbols.Symbol, self *Instance, inputs map[string]Value) (outputs, performer map[string]Value, err error)
- func (ctx *Context) ExecuteActionWithInputs(action *symbols.Symbol, inputs map[string]Value) (map[string]Value, error)
- func (ctx *Context) ExecuteState(stateMachine *symbols.Symbol) (map[string]Value, error)
- func (ctx *Context) ExecuteStatePerformedBy(stateMachine *symbols.Symbol, self *Instance, events []string) (map[string]Value, []string, error)
- func (ctx *Context) ExecuteStateWithEvents(stateMachine *symbols.Symbol, events []string) (map[string]Value, []string, error)
- func (ctx *Context) ExhibitsState(member, sym *symbols.Symbol) bool
- func (ctx *Context) FeaturesOf(typeSym *symbols.Symbol) []EffectiveFeature
- func (ctx *Context) FeaturesOfObject(inst *Instance) []ObjectFeature
- func (ctx *Context) FunctionValue(sym *symbols.Symbol) (Value, bool, error)
- func (ctx *Context) HeldObjects(inst *Instance) ([]HeldObject, error)
- func (ctx *Context) HoldsNoValue(val Value) bool
- func (ctx *Context) HoldsObject(val Value) bool
- func (ctx *Context) Image(objects ...*Instance) (*HeldImage, error)
- func (ctx *Context) ImpliedCollection(inst *Instance, name string) bool
- func (ctx *Context) ImpliedCollectionOfType(typ *symbols.Symbol, name string) bool
- func (ctx *Context) InputParameterNames(sym *symbols.Symbol) ([]string, error)
- func (ctx *Context) Instance(id int64) (*Instance, bool)
- func (ctx *Context) InstanceCount() int
- func (ctx *Context) InstanceIDs() []int64
- func (ctx *Context) InstantValue(t float64) Value
- func (ctx *Context) Instantiate(sym *symbols.Symbol) (*Instance, error)
- func (ctx *Context) InstantiateRead(sym *symbols.Symbol, read func(*Instance) error) (*Instance, error)
- func (ctx *Context) InvokeCalc(sym *symbols.Symbol, args []Value, scope *symbols.Scope) (Value, error)
- func (ctx *Context) InvokeCalcNamed(sym *symbols.Symbol, args map[string]Value, scope *symbols.Scope) (Value, error)
- func (ctx *Context) InvokeCalcWith(sym *symbols.Symbol, positional []Value, named map[string]Value, ...) (Value, error)
- func (ctx *Context) InvokeOperation(inst *Instance, name string, args map[string]Value) (map[string]Value, error)
- func (ctx *Context) InvokeOperationWith(inst *Instance, name string, args OperationArguments) (map[string]Value, error)
- func (ctx *Context) IsMonteCarloCase(sym *symbols.Symbol) bool
- func (ctx *Context) IsVariationFeature(feat *EffectiveFeature) bool
- func (ctx *Context) JointOutcome(names []string, outcomes []Outcome) Outcome
- func (ctx *Context) MaterializationErrors(inst *Instance) (errs []error, bounded bool)
- func (ctx *Context) MaxInstances() int
- func (ctx *Context) MeasurementUnitValue(sym *symbols.Symbol) (Value, bool, error)
- func (ctx *Context) Model() *Model
- func (ctx *Context) ModelSeed() (uint64, bool)
- func (ctx *Context) NoteCount() int
- func (ctx *Context) Notes() []RunNote
- func (ctx *Context) ObjectivesOf(sym *symbols.Symbol, scope *symbols.Scope) []Objective
- func (ctx *Context) ObserveMonteCarlo(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (*MonteCarloRun, error)
- func (ctx *Context) OccurrenceLife(id int64) (OccurrenceLife, bool)
- func (ctx *Context) OccurrenceUsage(inst *Instance) string
- func (ctx *Context) PendingMessages() []Message
- func (ctx *Context) PerformState(stateMachine *symbols.Symbol, self *Instance, events []QueuedEvent) (*StateExecutor, error)
- func (ctx *Context) PostMessage(msg Message)
- func (ctx *Context) Pristine(inst *Instance) error
- func (ctx *Context) ReadInSatisfaction(a *SatisfyAssertion, subject *Instance, scope *symbols.Scope, ref ast.Node) (Value, error)
- func (ctx *Context) RequireAnalysisCase(sym *symbols.Symbol) error
- func (ctx *Context) RequireMonteCarloCase(sym *symbols.Symbol) error
- func (ctx *Context) RequireVerificationCase(sym *symbols.Symbol) error
- func (ctx *Context) Reschedule(policy SchedulePolicy) error
- func (ctx *Context) ResolveSweepPlan(sym *symbols.Symbol, plan SweepPlan, positional int, named []string) (SweepPlan, error)
- func (ctx *Context) Resolver() *resolve.Resolver
- func (ctx *Context) RunAnalysis(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (AnalysisResult, error)
- func (ctx *Context) RunVerification(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (VerificationResult, error)
- func (ctx *Context) SatisfyAssertionOf(sym *symbols.Symbol) (*SatisfyAssertion, error)
- func (ctx *Context) SatisfyAssertionsIn(scope *symbols.Scope) []*SatisfyAssertion
- func (ctx *Context) SatisfySubject(a *SatisfyAssertion) (*Instance, error)
- func (ctx *Context) Schedule() SchedulePolicy
- func (ctx *Context) Semantics() *semantics.Model
- func (ctx *Context) SetBudgets(b Budgets) error
- func (ctx *Context) SetCalcCompile(on bool)
- func (ctx *Context) SetClockStep(step float64) error
- func (ctx *Context) SetDrawPolicy(policy DrawPolicy)
- func (ctx *Context) SetMaxInstances(n int)
- func (ctx *Context) SetModelSeed(seed uint64)
- func (ctx *Context) SetSchedule(policy SchedulePolicy) error
- func (ctx *Context) SetSharedDefaults(on bool)
- func (ctx *Context) SetToolRunner(runner ToolRunner)
- func (ctx *Context) SetTrace(tr *TraceRecorder)
- func (ctx *Context) ShapeDigest(sym *symbols.Symbol) string
- func (ctx *Context) ShapesOf(obj *Instance) *Shapes
- func (ctx *Context) ShapesOfType(sym *symbols.Symbol) *Shapes
- func (ctx *Context) ShareVerdicts() (done func())
- func (ctx *Context) SharedDefaults() bool
- func (ctx *Context) SharedDefaultsTaken() int64
- func (ctx *Context) SharedVerdictsTaken() int
- func (ctx *Context) SignalMessage(signal *symbols.Symbol, args map[string]Value, to *Instance) (Message, error)
- func (ctx *Context) Snapshot() (*Snapshot, error)
- func (ctx *Context) SourceLocation(file string, span source.Span) string
- func (ctx *Context) StateOutcomePerformedBy(stateMachine *symbols.Symbol, self *Instance, events []string) (Outcome, error)
- func (ctx *Context) StateOutcomeWithEvents(stateMachine *symbols.Symbol, events []string) (Outcome, error)
- func (ctx *Context) SubsettingFeatures(inst *Instance, typ *symbols.Symbol, name string) []EffectiveFeature
- func (ctx *Context) SweepRunBudget() int64
- func (ctx *Context) TakeMessage(match func(Message) bool) (Message, bool)
- func (ctx *Context) ToolRunner() ToolRunner
- func (ctx *Context) Trace() *TraceRecorder
- func (ctx *Context) UnevaluableGuards() []UnevaluableGuard
- func (ctx *Context) Unfollowed() error
- func (ctx *Context) UnitOf(scope *symbols.Scope, text string) (semantics.Unit, error)
- func (ctx *Context) ValidateObject(root *Instance, scopes []*symbols.Scope) (ValidationReport, error)
- func (ctx *Context) VerificationVerdicts(sym *symbols.Symbol) []VerificationVerdict
- func (ctx *Context) VerificationVerdictsIn(scopes []*symbols.Scope, req *symbols.Symbol) []VerificationVerdict
- func (ctx *Context) VerificationsOf(scope *symbols.Scope, req *symbols.Symbol) []*symbols.Symbol
- func (ctx *Context) VerifiedOutcome(result AnalysisResult, verdicts []VerificationVerdict) Outcome
- func (ctx *Context) VerifiedRequirements(sym *symbols.Symbol) []*symbols.Symbol
- func (ctx *Context) VerifyingCase(a *SatisfyAssertion) *symbols.Symbol
- type CoordinateFrame
- type CoordinateTransformation
- type Counted
- type CyclicBindingError
- type Decision
- type DeclaredReader
- func (r *DeclaredReader) CompareMagnitudes(left, right semantics.Quantity) (int, error)
- func (r *DeclaredReader) QuantityBinary(op ast.OperatorKind, left, right semantics.Quantity) (semantics.Quantity, error)
- func (r *DeclaredReader) QuantityUnary(op ast.OperatorKind, q semantics.Quantity) (semantics.Quantity, error)
- func (r *DeclaredReader) Read(sym *symbols.Symbol, name string) (Value, error)
- func (r *DeclaredReader) Validate(sym *symbols.Symbol, scopes []*symbols.Scope) (ValidationReport, error)
- func (r *DeclaredReader) VerificationVerdictsIn(scopes []*symbols.Scope, req *symbols.Symbol) []VerificationVerdict
- type DeliveryKind
- type Dispatch
- type Distribution
- type Divergence
- type DivergentValue
- type DrawParseError
- type DrawPoint
- type DrawPolicy
- type DrawTaken
- type DrawUnboundedError
- type EffectiveFeature
- type EvalContext
- type Event
- type EventQueue
- func (q *EventQueue) CompletionsOf(source ast.Node) []Event
- func (q *EventQueue) Events() []Event
- func (q *EventQueue) Len() int
- func (q *EventQueue) Peek() Event
- func (q *EventQueue) Pop() Event
- func (q *EventQueue) Push(e Event)
- func (q *EventQueue) Take(id int64) (Event, bool)
- func (q *EventQueue) Tied() []Event
- func (q *EventQueue) TimerOf(trans *lower.Transition) (Event, bool)
- func (q *EventQueue) With(e Event) *EventQueue
- func (q *EventQueue) Withdraw(drop func(Event) bool)
- type EventType
- type ExecutionState
- type Exploration
- type ExploreBudget
- type ExploredOutcome
- type ExpressionParser
- type FeatureOwner
- type FeatureValue
- type FeatureValueError
- type FiredTransition
- type FramePlacement
- type FrameStep
- type Held
- type HeldImage
- type HeldImageError
- type HeldObject
- type HeldObjectsError
- type HeldStateError
- type HistogramBin
- type Horizon
- type InputBinding
- type InputParseError
- type InputTaken
- type Instance
- func (inst *Instance) Behavior(name string) (*ObjectBehavior, bool)
- func (inst *Instance) Behaviors() []*ObjectBehavior
- func (inst *Instance) ExhibitedState() (*ObjectBehavior, bool)
- func (inst *Instance) ExhibitedStates() []*ObjectBehavior
- func (inst *Instance) ExhibitedStatesOf(sym *symbols.Symbol) []*ObjectBehavior
- func (inst *Instance) GetFeatureValue(ctx *Context, name string) (*FeatureValue, error)
- func (inst *Instance) HeldUnder() *symbols.Symbol
- func (inst *Instance) KeptConnectorIDs() []int64
- func (inst *Instance) MaterializedConnectors(ctx *Context) []*Instance
- func (inst *Instance) OwnedConnectors(ctx *Context) ([]*Instance, error)
- func (inst *Instance) Owner() (*Instance, string)
- func (inst *Instance) PerformedActionsOf(sym *symbols.Symbol) []*ObjectBehavior
- func (inst *Instance) RestoreConnector(ctx *Context, id int64) (*Instance, error)
- func (inst *Instance) SetFeatureValue(ctx *Context, name string, value Value) error
- func (inst *Instance) Types() []*symbols.Symbol
- type Invocation
- func (inv *Invocation) Completed() bool
- func (inv *Invocation) Context() *Context
- func (inv *Invocation) Outcome() Outcome
- func (inv *Invocation) Performer() *Instance
- func (inv *Invocation) PerformerAttributes() map[string]Value
- func (inv *Invocation) Performers() []*Instance
- func (inv *Invocation) Release()
- func (inv *Invocation) Snapshot() (*Snapshot, error)
- type MeasurementRef
- type MeasurementScale
- type Message
- type Model
- func (m *Model) RegisterScope(scope *symbols.Scope)
- func (m *Model) RegisterSource(sf *source.SourceFile)
- func (m *Model) Resolver() *resolve.Resolver
- func (m *Model) Semantics() *semantics.Model
- func (m *Model) SetExpressionParser(parse ExpressionParser)
- func (m *Model) Sources() []*source.SourceFile
- func (m *Model) Text() source.Lookup
- type MonteCarloRun
- type MonteCarloStatistics
- type NamedInput
- type NoValueError
- type NodeBreakpoint
- type NotPortableError
- type ObjectBehavior
- type ObjectFeature
- type ObjectNamed
- type ObjectParseError
- type ObjectVerdict
- type Objective
- type ObjectiveDirection
- type OccurrenceLife
- type OperandTypeError
- type OperationArguments
- type Outcome
- type OutcomeOutput
- type Quantity
- type QuantityValueMapping
- type QueuedEvent
- type ReplayDisagreement
- type ReplayError
- type Replayed
- func Replay(stop context.Context, fresh func() (*Context, error), start Starter, w Witness, ...) (*Replayed, error)
- func ReplayExecution(stop context.Context, fresh func() (*Context, error), start Starter, w Witness, ...) (*Replayed, error)
- func ReplaySchedule(stop context.Context, fresh func() (*Context, error), start Starter, w Witness, ...) (*Replayed, error)
- type RunNote
- type RunToCompletionValueError
- type SatisfyAssertion
- type SchedulePolicy
- type SchedulePolicyError
- type SendPortTypeMismatchError
- type SendReceiverValueError
- type SendTargetValueError
- type Sequence
- type Set
- type Shapes
- type Snapshot
- type Spread
- type Starter
- type StateConfiguration
- type StateExecutor
- func (e *StateExecutor) AcceptsMessage(m Message) (accepted bool, err error)
- func (e *StateExecutor) ActiveLeaves() []*ast.StateNode
- func (e *StateExecutor) ActiveStates() []*ast.StateNode
- func (e *StateExecutor) Call(operation string, args map[string]Value) (map[string]Value, error)
- func (e *StateExecutor) ChangeWaits() []string
- func (e *StateExecutor) ClearBreakpoints()
- func (e *StateExecutor) CompletionDue() bool
- func (e *StateExecutor) CurrentState() ast.Node
- func (e *StateExecutor) CurrentTime() float64
- func (e *StateExecutor) Decide(m Message) (decision Decision, err error)
- func (e *StateExecutor) DecideTransitions(m Message) (decision Decision, transitions []*lower.Transition, err error)
- func (e *StateExecutor) DeferredEvents() []Event
- func (e *StateExecutor) EnclosingStates(state *ast.StateNode) []*ast.StateNode
- func (e *StateExecutor) Enqueue(event QueuedEvent) error
- func (e *StateExecutor) EventQueue() *EventQueue
- func (e *StateExecutor) FinalStateName() string
- func (e *StateExecutor) FiredCount() int
- func (e *StateExecutor) FiredSince(mark int) []FiredTransition
- func (e *StateExecutor) FiredTransitions() []FiredTransition
- func (e *StateExecutor) GetStateVisits() []string
- func (e *StateExecutor) Graph() *lower.StateGraph
- func (e *StateExecutor) HasDueEvent() bool
- func (e *StateExecutor) HasPendingDoWork() bool
- func (e *StateExecutor) HasPendingSignal() bool
- func (e *StateExecutor) HasPendingWork() bool
- func (e *StateExecutor) HoldsEntry() bool
- func (e *StateExecutor) InvokeOperation(operation string, args map[string]Value)
- func (e *StateExecutor) KeepFired(keep bool)
- func (e *StateExecutor) LastDispatch() (Dispatch, bool)
- func (e *StateExecutor) LastEventAt() float64
- func (e *StateExecutor) NextWait() (float64, bool)
- func (e *StateExecutor) NoteCount() int
- func (e *StateExecutor) Notes() []RunNote
- func (e *StateExecutor) NotesSince(mark int) []RunNote
- func (e *StateExecutor) Outcome() Outcome
- func (e *StateExecutor) OutgoingTransitions() []*lower.Transition
- func (e *StateExecutor) PausedAt() ast.Node
- func (e *StateExecutor) Performer() *Instance
- func (e *StateExecutor) PollChangeEvents() (dispatched bool, err error)
- func (e *StateExecutor) ProcessNextEvent() (err error)
- func (e *StateExecutor) Release()
- func (e *StateExecutor) Resume() bool
- func (e *StateExecutor) RunDoRound() (ran int, err error)
- func (e *StateExecutor) RunToCompletion() error
- func (e *StateExecutor) RunToQuiescence() error
- func (e *StateExecutor) SendSignal(signalType string, args map[string]Value)
- func (e *StateExecutor) SetBreakpointAt(vertex ast.Node)
- func (e *StateExecutor) SetTrace(trace *TraceRecorder)
- func (e *StateExecutor) Snapshot() (*Snapshot, error)
- func (e *StateExecutor) State() ExecutionState
- func (e *StateExecutor) StateData() map[string]Value
- func (e *StateExecutor) StateMachineSymbol() *symbols.Symbol
- func (e *StateExecutor) StatePath(state *ast.StateNode) string
- func (e *StateExecutor) StateStack() []*ast.StateNode
- func (e *StateExecutor) Suspend() bool
- func (e *StateExecutor) SuspendReason() string
- func (e *StateExecutor) TakesMessage(m Message) (takes bool, err error)
- func (e *StateExecutor) TriggeredBy(m Message) (triggered bool, err error)
- func (e *StateExecutor) WatchesChangeCondition() bool
- func (e *StateExecutor) WriteAttribute(name string, value Value) error
- type SweepBinding
- type SweepNumbers
- type SweepPlan
- type SweepRange
- type SweepRow
- type SweepRun
- type SweepRunResult
- type SweepTable
- type SweepType
- type SweepWorkers
- type TakingAccept
- type TensorQuantity
- type Token
- type ToolAnswer
- type ToolCall
- type ToolDivergence
- type ToolError
- type ToolErrorKind
- type ToolInput
- type ToolNotRegisteredError
- type ToolOutput
- type ToolRunner
- type ToolValue
- type TraceKind
- type TraceOrigin
- type TraceRecord
- type TraceRecorder
- func (tr *TraceRecorder) BeginEval()
- func (tr *TraceRecorder) Clear()
- func (tr *TraceRecorder) Disable()
- func (tr *TraceRecorder) Dropped() (count int, upTo float64)
- func (tr *TraceRecorder) Enable()
- func (tr *TraceRecorder) EndEval(label string, value Value, err error)
- func (tr *TraceRecorder) EndStatement()
- func (tr *TraceRecorder) Entries() []string
- func (tr *TraceRecorder) Mark() int
- func (tr *TraceRecorder) RecordAccept(origin TraceOrigin, event string, payload map[string]Value)
- func (tr *TraceRecorder) RecordAcceptAt(mark int, origin TraceOrigin, event string, payload map[string]Value)
- func (tr *TraceRecorder) RecordActionNodeEnter(node string)
- func (tr *TraceRecorder) RecordActionNodeExit(node string)
- func (tr *TraceRecorder) RecordActionStep(step int, tokens []Token)
- func (tr *TraceRecorder) RecordActionTerminate(perf string, dropped []Token)
- func (tr *TraceRecorder) RecordActionTerminatePending(perf string, waiting bool)
- func (tr *TraceRecorder) RecordBehaviorRun(kind, name string, id int64)
- func (tr *TraceRecorder) RecordBehaviorStart(kind, name string, id int64)
- func (tr *TraceRecorder) RecordCalcBind(param string, value Value, source string)
- func (tr *TraceRecorder) RecordCalcEnter(name string)
- func (tr *TraceRecorder) RecordCalcExit(name string, result Value)
- func (tr *TraceRecorder) RecordCalcExitError(name string, err error)
- func (tr *TraceRecorder) RecordCalcOutput(calc, output string, value Value)
- func (tr *TraceRecorder) RecordCalcUsageExit(kind, name string)
- func (tr *TraceRecorder) RecordCalcUsageReuse(kind, name string)
- func (tr *TraceRecorder) RecordCalculationEnter(kind, name string)
- func (tr *TraceRecorder) RecordCalculationExit(kind, name string, result Value)
- func (tr *TraceRecorder) RecordCalculationExitError(kind, name string, err error)
- func (tr *TraceRecorder) RecordDoStep(origin TraceOrigin, state string)
- func (tr *TraceRecorder) RecordEvent(event string, time float64)
- func (tr *TraceRecorder) RecordLoopIteration(iteration int)
- func (tr *TraceRecorder) RecordNote(origin TraceOrigin, n RunNote)
- func (tr *TraceRecorder) RecordObjectMaterialized(typeName string, id int64)
- func (tr *TraceRecorder) RecordOccurrenceCreated(typeName string, id int64)
- func (tr *TraceRecorder) RecordOccurrenceDestroyed(typeName string, id int64)
- func (tr *TraceRecorder) RecordOccurrenceTerminated(typeName string, id int64)
- func (tr *TraceRecorder) RecordSend(origin TraceOrigin, msg Message, target *Instance)
- func (tr *TraceRecorder) RecordStateEndedWithOccurrence(machine string, abandoned []string)
- func (tr *TraceRecorder) RecordStateEntry(origin TraceOrigin, state string, hasEntryAction bool)
- func (tr *TraceRecorder) RecordStateExit(origin TraceOrigin, state string, hasExitAction bool)
- func (tr *TraceRecorder) RecordStateSpaceStep(action string, time float64, state, output Value)
- func (tr *TraceRecorder) RecordStateTerminate(stop string, abandoned []string)
- func (tr *TraceRecorder) RecordStateTransition(origin TraceOrigin, fromState, toState string, event string)
- func (tr *TraceRecorder) RecordStatement(label string)
- func (tr *TraceRecorder) Records() []TraceRecord
- func (tr *TraceRecorder) String() string
- type Traversal
- type UnassignedOutputError
- type UnboundSubjectError
- type Undetermined
- type UndeterminedBindingError
- type UnevaluableGuard
- type Unit
- type UnknownCheckFeatureError
- type UnknownSendPortError
- type UnreachableSendReceiverError
- type UnroutableSendError
- type UnseededDrawError
- type ValidationReport
- type ValidationStatus
- type Value
- func DeclaredMeasurementRef(sem *semantics.Model, sym *symbols.Symbol, text string, ...) Value
- func EnumeratedValue(sym *symbols.Symbol, scalar Value) Value
- func NewArrayValue(dimensions []int64, elements []Value) Value
- func NewComplex(z complex128) Value
- func NewCoordinateFrameValue(frame *CoordinateFrame) Value
- func NewCoordinateTransformationValue(t *CoordinateTransformation) Value
- func NewEmptySequenceOf(unit Unit) Value
- func NewEnumLiteral(sym *symbols.Symbol) Value
- func NewExprValue(node ast.Node, env *EvalContext) Value
- func NewFramedVectorQuantityValue(num []semantics.Value, frame *CoordinateFrame) Value
- func NewMeasurementRefValue(unit Unit) Value
- func NewMetaobject(element, metaclass *symbols.Symbol) Value
- func NewQuantityValue(q *Quantity) Value
- func NewSequenceValue(seq *Sequence) Value
- func NewSetValue(set *Set) Value
- func NewStringValue(s string) Value
- func NewTensorQuantityValue(dimensions []int64, num []semantics.Value, units []Unit) Value
- func NewUndeterminedValue(reason string, count semantics.Range) Value
- func NewVariantValue(variant *symbols.Symbol, instance int64) Value
- func NewVectorQuantityValue(num []semantics.Value, units []Unit) Value
- func NewVectorValue(elements []semantics.Value) Value
- func (v Value) Array() *Array
- func (v Value) Complex() complex128
- func (v Value) CoordinateFrame() *CoordinateFrame
- func (v Value) CoordinateTransformation() *CoordinateTransformation
- func (v Value) EnumerationLiteral() *symbols.Symbol
- func (v Value) Expr() ast.Node
- func (v Value) Function() *symbols.Symbol
- func (v Value) FunctionClosesOverBody() bool
- func (v Value) FunctionName() string
- func (v Value) FunctionSelf() *Instance
- func (v Value) Literal() *symbols.Symbol
- func (v Value) LiteralText() string
- func (v Value) MeasurementRef() *MeasurementRef
- func (v Value) MetaobjectClass() *symbols.Symbol
- func (v Value) MetaobjectElement() *symbols.Symbol
- func (v Value) MetaobjectText() string
- func (v Value) Object() (int64, bool)
- func (v Value) Quantity() *Quantity
- func (v Value) Scalar() Value
- func (v Value) Sequence() *Sequence
- func (v Value) Set() *Set
- func (v Value) Str() string
- func (v Value) TensorQuantity() *TensorQuantity
- func (v Value) Undetermined() *Undetermined
- func (v Value) Variant() *symbols.Symbol
- func (v Value) Vector() *Vector
- func (v Value) VectorQuantity() *VectorQuantity
- type ValueKind
- type Vector
- type VectorQuantity
- type VerdictKind
- type VerdictStatus
- type VerificationResult
- type VerificationVerdict
- type ViaNotPortError
- type Violation
- type ViolationError
- type ViolationKind
- type Witness
- type WitnessDrawError
- type WitnessInputError
- type WitnessObjectError
Constants ¶
const ( // DefaultMaxSteps bounds expression evaluations. DefaultMaxSteps int64 = 10000000 // DefaultMaxActionSteps bounds the token-flow steps one action run performs. DefaultMaxActionSteps int64 = 1000000 // DefaultMaxStateEvents bounds the events one state machine run dispatches. DefaultMaxStateEvents int64 = 1000000 // DefaultMaxDoSteps bounds the do actions one state machine run // performs. DefaultMaxDoSteps int64 = 5000000 // DefaultMaxElements bounds the collection elements one evaluation holds, // ~104MB of Values. DefaultMaxElements int64 = 1000000 // DefaultMaxCalcDepth bounds the nested calc invocations one evaluation holds // on the stack, ~10KB each. DefaultMaxCalcDepth int64 = 10000 // DefaultMaxSweepRuns bounds the runs one parameter sweep or sample makes, // each of which is a whole analysis or calc run of its own. DefaultMaxSweepRuns int64 = 1000 )
Default bounds on one run. Each one stops a different kind of runaway, so each counts a different thing and has its own variable.
The step and event bounds are sized by how long a runaway takes to report rather than by memory: those steps allocate nothing that outlives them, and the only thing they make grow is a %trace, at 34-83 bytes an entry. Measured rates are ~13.6M evaluation steps/s and ~1.9M events/s, so each default reports a runaway within about a second, and a fully traced run at those four ceilings holds ~320MB.
Collection elements are the exception, and MaxElements is the bound that reads as memory: a materialized element is a 104-byte Value living as long as the collection holding it, and `1..10000000` conjures one per step. It counts the elements one evaluation holds, not the elements a run produced in total, so a loop or a state machine building a small collection each step is not stopped by the steps before it.
const ( MaxStepsEnvVar = "OPENSYSML_MAX_STEPS" MaxActionStepsEnvVar = "OPENSYSML_MAX_ACTION_STEPS" MaxStateEventsEnvVar = "OPENSYSML_MAX_EVENTS" MaxDoStepsEnvVar = "OPENSYSML_MAX_DO_STEPS" MaxElementsEnvVar = "OPENSYSML_MAX_ELEMENTS" MaxCalcDepthEnvVar = "OPENSYSML_MAX_CALC_DEPTH" MaxSweepRunsEnvVar = "OPENSYSML_MAX_SWEEP_RUNS" )
Environment variables overriding the defaults above, following the OPENSYSML_LIBRARY_PATH convention. The legacy SYSML_-prefixed names remain accepted via envvar.Lookup, with the OPENSYSML_ name winning when both are set.
const ( BoundSteps = "steps" BoundActionSteps = "actionSteps" BoundEvents = "events" BoundDoSteps = "doSteps" BoundElements = "elements" BoundBehaviors = "behaviors" )
The executor budgets a search runs under, by the name a bound hit reports; each names one field of Budgets, so a report spells the limit that stopped it.
const ( MonteCarloRunsOutput = "runs" MonteCarloMeanOutput = "mean" MonteCarloDeviationOutput = "deviation" MonteCarloOutOfSpecOutput = "outOfSpec" )
The features Simulation::MonteCarlo declares, by the name each is declared under; the outputs are exported for the comparison of a case's statistics with a tool's.
const CalcCompileEnvVar = "OPENSYSML_CALC_COMPILE"
CalcCompileEnvVar switches the compiled tier for pure calc bodies off when set to 0 (or false/off/no), leaving every calc to the reference evaluator.
const ChoiceDiagnosticCode = "choice-point"
ChoiceDiagnosticCode is the code every choice-point diagnostic carries.
const DrawDiagnosticCode = "random-draw"
DrawDiagnosticCode is the code a diagnostic about a random draw carries.
const HistogramBins = 8
HistogramBins is the most bins a histogram has.
const MaxCalcDepthCeiling int64 = 25000
MaxCalcDepthCeiling is the highest calc depth budget a run may be given: past it the goroutine stack, whose exhaustion is fatal, would stop a runaway first.
const MonteCarloCaseFQN = "Simulation::MonteCarlo"
MonteCarloCaseFQN names the library analysis of repeated runs.
const RandomFunctionsFQN = "RandomFunctions"
RandomFunctionsFQN names the OpenSysML library of random functions.
const RunParam = "run"
RunParam names the column a Monte Carlo table numbers its runs in.
const ScheduleEnd = -1
ScheduleEnd asks ReplaySchedule for the run's end, every move followed.
SharedDefaultsEnvVar switches the sharing of derived defaults between occurrences of one shape off when set to 0 (or false/off/no).
const ToolDivergenceCode = "tool-divergence"
ToolDivergenceCode is the diagnostic code of a ToolDivergence note.
const UndeterminedText = "<undetermined>"
UndeterminedText is how every surface spells a result the model does not determine: a model-level read of a valueless or open-count feature, or over one.
const UnevaluableGuardCode = "guard-unevaluable"
UnevaluableGuardCode is the code a diagnostic about a guard the run could not evaluate carries.
const UnsetText = "<unset>"
UnsetText is how every surface spells a feature value that holds no value: a valueless feature of a value type, whose instances are values rather than objects.
Variables ¶
var ( // ErrStepLimitExceeded is returned when the evaluation step counter exceeds maxSteps. ErrStepLimitExceeded = errors.New("evaluation step limit exceeded") // ErrElementLimitExceeded is returned when the collection elements one run // materializes exceed maxElements. It is a bound on memory rather than on // work, so it is its own error and its own budget. ErrElementLimitExceeded = errors.New("collection element limit exceeded") // ErrInstanceLimitExceeded is returned when materializing one more object // would take the context past the bound SetMaxInstances set. ErrInstanceLimitExceeded = errors.New("object limit exceeded") // ErrUnresolvedReference is returned when a feature reference cannot be resolved. ErrUnresolvedReference = errors.New("unresolved reference") // ErrAmbiguousReference is returned when a qualified name names several elements. ErrAmbiguousReference = errors.New("ambiguous reference") // ErrTypeMismatch is returned when an operation receives a value of unexpected type. ErrTypeMismatch = errors.New("type mismatch") // ErrDivisionByZero is returned when a division or remainder has a zero // divisor. It is the answer to the expression, not a missing declaration. ErrDivisionByZero = semantics.ErrDivisionByZero // ErrMultiplicityViolation is returned when a feature value access/assignment violates multiplicity bounds. ErrMultiplicityViolation = errors.New("multiplicity violation") // ErrUniquenessViolation is returned when a value written to a unique feature repeats one of its values. ErrUniquenessViolation = errors.New("uniqueness violation") // ErrUninitializedFeatureValue is returned when accessing a feature value that has no value and no default. ErrUninitializedFeatureValue = errors.New("uninitialized feature value") // ErrBindingConflict is returned when two binding ends hold unequal values. ErrBindingConflict = errors.New("binding conflict") // ErrBindingCycle is returned when a binding component has no value. ErrBindingCycle = errors.New("binding cycle") // ErrBindingEnd is returned when a binding endpoint cannot be resolved to a feature. ErrBindingEnd = errors.New("binding end cannot be resolved") // ErrNotACalc is returned when a calc invocation targets a symbol that is // not a calc definition or usage. ErrNotACalc = errors.New("not a calc") // ErrNotAFunction is returned when a value that is no function is called, // or is bound where a calc-typed feature needs one. ErrNotAFunction = errors.New("not a function") // ErrNotAConstraint is returned when a symbol asked to be evaluated as a // constraint declares something else. It is a usage error about the request, // not a verdict about the model, so callers can tell the two apart. ErrNotAConstraint = errors.New("not a constraint") // ErrNotARequirement is returned when a symbol asked to be evaluated as a // requirement declares something else. Like ErrNotAConstraint it reports the // request, not the model. ErrNotARequirement = errors.New("not a requirement") // ErrNotAnObject is returned when a symbol asked to be validated as an object // has no objects: a package, an attribute, a comment. It reports the request. ErrNotAnObject = errors.New("not an object") // ErrNotAnAnalysis is returned when a symbol asked for its objectives or // asked to be run is not a case whose body runs. Like ErrNotAConstraint it // reports the request, not the model. ErrNotAnAnalysis = errors.New("not an analysis case") // ErrNotAVerification is returned when a symbol asked for a verification // verdict is not a verification case definition or usage. ErrNotAVerification = errors.New("not a verification case") // ErrCalcArity is returned when a calc invocation passes more arguments than // the calc declares input parameters. ErrCalcArity = errors.New("calc argument count mismatch") // ErrUnboundParameter is returned when a calc input parameter receives // neither an argument nor a declared default. ErrUnboundParameter = errors.New("unbound parameter") // ErrPerformerNotObject is returned when the operand of a `part.callee` performance // denotes no single object for the callee to run as. ErrPerformerNotObject = errors.New("performer is not an object") // ErrUnknownParameter is returned when a named argument does not name any // input parameter of the invoked calc. ErrUnknownParameter = errors.New("unknown parameter") // ErrUnknownActionInput is returned when a supplied input names no parameter // or attribute of the action performed. ErrUnknownActionInput = errors.New("unknown action input") // ErrOutputActionInput is returned when a supplied input names a parameter // the action only writes back (`out`), which a caller does not seed. ErrOutputActionInput = errors.New("output action parameter given as input") // ErrNoResultExpression is returned when a calc body declares no return // expression, directly or by inheritance. ErrNoResultExpression = errors.New("no result expression") // ErrConflictingResultExpressions is returned when a calc or constraint owns or // inherits more than one result expression (KerML 8.3.4.8); no body is chosen. ErrConflictingResultExpressions = errors.New("more than one result expression, owned or inherited") // ErrUnsupportedOperator is returned when an operator has no runtime // evaluation, so an expression naming it fails rather than yielding nothing. ErrUnsupportedOperator = errors.New("unsupported operator") // ErrUnresolvedType is returned when a type classification operand names no // resolvable type. ErrUnresolvedType = errors.New("unresolved type") // ErrUnboundedExtent is returned when `all T` names a type whose instances no // run enumerates: a data type that is not an enumeration (`all Integer`, `all Point`). ErrUnboundedExtent = errors.New("unbounded extent") // denote (a namespace-level usage of several occurrences) or cannot make without recursing. ErrExtentUnavailable = errors.New("extent unavailable") // ErrUndeterminedValueType is returned when a value classification has no // direct runtime type to compare. ErrUndeterminedValueType = errors.New("value type cannot be determined") // ErrUndecidedClassification is returned when a cast reaches a value whose // classification by a type narrower than the value's own the value does not // settle, so the cast fails rather than dropping a value that may be one. ErrUndecidedClassification = errors.New("classification of a value cannot be decided") // ErrCalcNoReturn is returned when a calc body runs to its end without // returning: it computed no result, which is not the same as a null one. ErrCalcNoReturn = errors.New("calculation returned no value") // ErrCalcSideEffect is returned when a calc body states an effect on the // world outside it — send, perform, accept, terminate. A calculation // computes a value, so an effect is rejected rather than performed. ErrCalcSideEffect = errors.New("side effect in a calculation body") // ErrCalcExternalAssignment is returned when a calc body assigns to a name it // does not declare itself, which would make the calculation impure. ErrCalcExternalAssignment = errors.New("assignment outside the calculation body") // ErrStatementNotExecutable is returned when a body reaches a member the // lowering marked as not executable in that kind of body (lower.Unsupported). ErrStatementNotExecutable = errors.New("statement not executable") // ErrCalcUsageRecursion is returned when a calc or analysis usage's body reads // the usage itself: bound once, it would run itself without end. ErrCalcUsageRecursion = errors.New("a calc usage runs itself") // ErrCaseReadWaits is returned when an analysis or verification case whose // outputs an expression reads waits on the clock or for a message: the read // takes the case whole, and only a case performed as a step pauses the body. ErrCaseReadWaits = errors.New("a case read as a feature waits") // ErrReturnOutsideCalc is returned when a `return` is executed by a host that // has no result to return, an action node's body. ErrReturnOutsideCalc = errors.New("'return' outside a calculation body") // ErrAcceptDeadlock is returned when an action can no longer progress // because every token it has left is parked at an accept, so no token can // post the message any of them waits for. An accept suspends the action // rather than failing, so this is how a suspension that can never end is // reported instead of hanging. ErrAcceptDeadlock = errors.New("accept deadlock") // ErrActionDeadlock is returned when action tokens cannot make progress. ErrActionDeadlock = errors.New("action deadlock") // ErrTerminateTarget is returned when a `terminate` names no ongoing performance // of an action node in a flow enclosing it, and no occurrence either. ErrTerminateTarget = errors.New("terminate names nothing to end") // ErrPerformanceEnded is returned when a `terminate` names a performance that // has already ended, by completing or by an earlier terminate. ErrPerformanceEnded = errors.New("performance already ended") // ErrTerminateOccurrence is returned when a `terminate` names a value that is no // occurrence, or an occurrence that is not ongoing; it wraps the lifetime error. ErrTerminateOccurrence = errors.New("occurrence cannot be terminated") // ErrExecutorReleased is returned when a released executor is stepped. ErrExecutorReleased = errors.New("executor released") // ErrInvalidActionFlow is returned for a structurally invalid action graph. ErrInvalidActionFlow = errors.New("invalid action flow") // ErrNoEnabledSuccession is returned when a decision can select no branch. ErrNoEnabledSuccession = errors.New("no enabled succession") // ErrNegativeDuration is returned when a delay — an `accept after`, a time // transition's or an advance of the clock — is negative, infinite, no number // at all, or leads past the last instant the clock can hold: the clock never // runs backwards and always reads a finite instant. ErrNegativeDuration = errors.New("negative duration") // ErrNothingDue is returned when one step is asked of an executor whose only // remaining work waits on the clock for an instant it has not reached. ErrNothingDue = errors.New("nothing due at the current instant") // ErrTimeTriggerType is returned when a time trigger's argument is declared as // no value of the type the trigger takes — the judgement validation makes of it. ErrTimeTriggerType = errors.New("time trigger argument of the wrong type") // ErrActionResultParameter is returned when an action to perform declares a // `return` parameter, which only a function or expression owns. ErrActionResultParameter = errors.New("action declares a return parameter") // ErrCalcRecursionLimit is returned when calc invocation nests deeper than // the run's calc depth budget, which an unbounded recursion would otherwise // do until the process ran out of stack. ErrCalcRecursionLimit = errors.New("calc recursion limit exceeded") // ErrActionStepLimitExceeded is returned when an action executor exceeds // its token-flow step budget. ErrActionStepLimitExceeded = errors.New("action step limit exceeded") // ErrStateEventLimitExceeded is returned when state processing exceeds its // event budget. ErrStateEventLimitExceeded = errors.New("state event limit exceeded") // ErrNoInitialState is returned when a state machine initializes with no // entry into its states: it states no `entry; then <state>;`. ErrNoInitialState = errors.New("no initial state found") // ErrNoEntryTransitionHolds is returned when a body's guarded entry transitions // (`entry; if c then s;`) all have false guards, so it has no state to start in. ErrNoEntryTransitionHolds = errors.New("no entry transition holds") // ErrHistoryWithoutEntry is returned when a transition reaches a history // pseudostate that has nothing to restore and nothing to enter instead: its // owner was never left, the history has no default transition, and the owner // declares no entry transition of its own. ErrHistoryWithoutEntry = errors.New("history has no configuration to restore and no entry to fall back on") // ErrChoiceWithoutBranch is returned when a compound transition reaches a // choice pseudostate none of whose outgoing guards holds against the data as // the segments into it left it. ErrChoiceWithoutBranch = errors.New("choice has no enabled outgoing transition") // ErrStatePerformanceOccurrence is returned when an exhibited machine cannot // read or write the occurrence of its state usage. ErrStatePerformanceOccurrence = errors.New("state performance occurrence unavailable") // ErrActionPerformanceOccurrence is returned when a performed action cannot // read or write the occurrence of its action usage. ErrActionPerformanceOccurrence = errors.New("action performance occurrence unavailable") // ErrDoStepLimitExceeded is returned when a state do behavior exceeds its // action-step budget. ErrDoStepLimitExceeded = errors.New("state do-step limit exceeded") // ErrStateBehaviorWaits is returned when an entry or exit behavior, or a // transition effect, waits for the clock: those are performed whole at the // instant they are triggered, and only a do behavior pauses on the clock. ErrStateBehaviorWaits = errors.New("state behavior waits for the clock") // ErrActionArity is returned when an action invocation passes more // positional arguments than the action declares input parameters. ErrActionArity = errors.New("action argument count mismatch") // ErrDuplicateArgument is returned when an action invocation binds one input // parameter twice: by two named arguments, or by a positional and a named one. ErrDuplicateArgument = errors.New("argument bound more than once") // ErrOperationArity is returned when an operation invocation passes more // positional arguments than the operation declares input parameters. ErrOperationArity = errors.New("operation argument count mismatch") // ErrMixedArguments is returned when an operation invocation gives positional and // named arguments together: an argument list is one form or the other (KerML 8.2.5.8.3). ErrMixedArguments = errors.New("positional and named arguments mixed") // ErrNodeNotPerformed is returned when a pin of an action node is read before // any performance of the node has started. ErrNodeNotPerformed = errors.New("action node read before it is performed") // ErrNodePin is returned when a pin read, flow, or binding names a feature the // action node does not declare, or the node's result where it has none. ErrNodePin = errors.New("action node pin not declared") // ErrFlowSource is returned when a flow's source completes with its pin holding // no value to carry: a streaming source that never wrote, a succession source that produced nothing. ErrFlowSource = errors.New("flow source produced no value") // ErrStreamUnreceived is returned when a streaming flow carried a value after its // target's last performance ended, so no performance of the target ever received it. ErrStreamUnreceived = errors.New("streamed value reached no performance of its target") // ErrStreamCycle is returned when streaming flows lead a value written to a pin back // to that pin while the write is still being carried on. ErrStreamCycle = errors.New("streaming flows form a cycle") // ErrViolated is returned when an asserted constraint or a required // condition evaluates to false. It is a verdict about the model, not a // failure to evaluate, so callers can tell the two apart. ErrViolated = errors.New("evaluated to false") // ErrNoValue is returned when a feature a condition names carries no value: // neither a feature value on the object being checked nor a declared default. ErrNoValue = errors.New("no value") // ErrNoConditions is returned when a constraint or requirement carries no // condition to evaluate: reporting a verdict would claim a check that never ran. ErrNoConditions = errors.New("no condition to evaluate") // ErrStatementNotExecuted is returned when a constraint body states an action // statement: the evaluator does not run it, so a verdict would ignore it. ErrStatementNotExecuted = errors.New("statement in a constraint body is not executed by OpenSysML") // ErrUnboundSubject is returned when a condition reads a subject nothing // supplied: the check is about no object, so it reaches no verdict. ErrUnboundSubject = errors.New("subject is unbound") // ErrCyclicFeatureValue is returned when a feature value's default value depends, directly or // through other feature values, on the one being computed. ErrCyclicFeatureValue = errors.New("cyclic feature value dependency") // ErrConnectorEnd is returned when a connector cannot be attached to the // features its ends name: an end naming nothing reachable from the object // owning the connector, or one carrying no value. A connector whose ends // cannot be attached relates nothing, so it is an error rather than an object // with defaults at its ends. ErrConnectorEnd = errors.New("connector end cannot be attached") // ErrNotAQuantity is returned when `x [y]` is not a quantity expression: // y names no measurement unit, or x is no magnitude. ErrNotAQuantity = errors.New("not a quantity expression") // ErrIncommensurableUnits is returned when an operation combines quantities // whose units measure different things; see semantics.ErrIncommensurableUnits. ErrIncommensurableUnits = semantics.ErrIncommensurableUnits // ErrUnitRoot is returned when the root of a quantity is taken whose unit // has none: `sqrt(9 [m])`, since no unit squares to a metre. ErrUnitRoot = errors.New("unit has no root") // ErrScalePoint is returned when an operation is asked of a point on a // measurement scale that has no meaning for a point (its multiple, the sum of two). ErrScalePoint = errors.New("operation is not defined on a point of a measurement scale") // ErrNotASatisfaction is returned when a satisfaction assertion is asked of // an element that states none. ErrNotASatisfaction = errors.New("not a satisfaction assertion") // ErrNoRequirement is returned when a satisfaction assertion states no // requirement to evaluate: it references none, or references one that // resolves to nothing. ErrNoRequirement = errors.New("no requirement to satisfy") // ErrUnresolvedClassifierBehavior is returned when a type exhibits or // performs a behavior that names an element no element states a body for, // so the objects of that type have nothing to run. An exhibit or perform // declaration naming nothing is its own body and never fails here. ErrUnresolvedClassifierBehavior = errors.New("classifier behavior names no body") // ErrUnsupportedClassifierBehavior is returned when a type binds a behavior // the runtime does not execute on an object. ErrUnsupportedClassifierBehavior = errors.New("unsupported classifier behavior") // ErrNoSuchBehavior is returned when a behavior asked of an object is none // the object's type owns, exhibits or performs. ErrNoSuchBehavior = errors.New("object has no such behavior") // ErrNotABehavior is returned when a name invoked on an object resolves to an // element that states no behavior to run. ErrNotABehavior = errors.New("not a behavior") // ErrNotASignal is returned when a message injected from outside the model // names an element that is no definition, so no accept could be typed by it. ErrNotASignal = errors.New("not a signal definition") // ErrSignalArgument is returned when a message injected from outside the // model carries an argument its signal definition has no feature for. ErrSignalArgument = errors.New("signal argument") // ErrBehaviorBudget is returned when the behaviors of materialized objects // never reach quiescence within the event budget. ErrBehaviorBudget = errors.New("object behaviors exceeded their budget") // ErrNotACalcUsage is returned when an output feature is read from a symbol // that is not a calc usage: only a usage carries an evaluation whose outputs // are features. ErrNotACalcUsage = errors.New("not a calc usage") // ErrUnknownOutput is returned when a name read from a calc usage is not one // of the output features its calc declares. ErrUnknownOutput = errors.New("unknown output") // ErrOutputNotAssigned is returned when a declared output carries no value // because the activation never assigned it. It is a kind of ErrNoValue. ErrOutputNotAssigned = fmt.Errorf("%w: output never assigned", ErrNoValue) // ErrConflictingOutput is returned when one activation would bind an output // twice: by its declaration and by an assignment, or by two assignments. ErrConflictingOutput = errors.New("output bound more than once") // ErrCyclicOutput is returned when an output feature's binding depends, // directly or through other outputs, on the output being computed. ErrCyclicOutput = errors.New("cyclic output dependency") // ErrAmbiguousResult is returned when a calc declaring several output // features is invoked as an expression. A function invocation has exactly // one result (KerML 7.4.9), so a calc that designates none has no value to // hand back and is read through a calc usage's output features instead. ErrAmbiguousResult = errors.New("calculation has no single result") // ErrIndexOutOfRange is returned when an index names no position of the // sequence or string it indexes; indices are 1-based, so 0 is out of range // as much as size+1 is, and each operation names what it indexed. ErrIndexOutOfRange = errors.New("index out of range") // ErrBodyArity is returned when the body expression a collection operation // is given declares a number of parameters the operation cannot call it // with: `select` calls its selector with one element, so a selector // declaring two parameters has no second argument to receive. ErrBodyArity = errors.New("body parameter count mismatch") // ErrUnsupportedBodyDeclaration is returned when a body expression declares // features of its own: the evaluator binds its parameters, not its // declarations, so applying it would read them as unresolved. ErrUnsupportedBodyDeclaration = errors.New("unsupported declaration in a body expression") // ErrReceiverWithNamedArgs is returned when a receiver is written before a // call whose arguments are named, `x->f(a = 1)`. The receiver binds by // position and the arguments by name, so which parameter the receiver binds // to is unstated; it is reported rather than dropped. ErrReceiverWithNamedArgs = errors.New("receiver combined with named arguments") // ErrVariationUnselected is returned when a variation is read without having // been bound to one of its variants: it classifies its variants abstractly, // so it stands for no one value until a variant is selected. ErrVariationUnselected = errors.New("variation has no variant selected") // ErrNotAVariant is returned when a variation is bound to something that is // not one of the variants it offers. ErrNotAVariant = errors.New("not a variant of the variation") // ErrMultipleVariants is returned when a variation is bound to more than one // variant, which selects no single configuration. ErrMultipleVariants = errors.New("more than one variant selected") // ErrNotALiteral is returned when a name qualified by an enumeration // definition names something the enumeration does not declare as a literal. ErrNotALiteral = errors.New("not a literal of the enumeration") // ErrConflictingRedefinition is returned when one declaration values the // same feature under two of its names: a redefinition renames one feature, // so which of the two values it holds would be a silent pick. ErrConflictingRedefinition = errors.New("one feature valued under two names") // ErrValuedFeatureRestated is returned when a feature is both bound to a // value and given a body restating features of it: the bound value supplies // those features, so the restatement could only be silently dropped. ErrValuedFeatureRestated = errors.New("feature both valued and restated in a body") // ErrFeatureValueMaterialization marks an error as a feature value that could not be // materialized, whatever kept it from materializing. Reading a feature value is what // finds such a failure, so a surface reporting one answered nothing about // that feature value rather than deciding anything about the model. ErrFeatureValueMaterialization = errors.New("feature value could not be materialized") // ErrNoSuchFeature is returned when a member read, a write, or a chained // assignment reaches an object whose type declares no feature of that name: // the object has nothing to answer with and nowhere to hold the value. ErrNoSuchFeature = errors.New("object has no such feature") // ErrClockNotAssignable is returned when an assignment targets a Clock's // currentTime: the run advances it, so no statement writes it. ErrClockNotAssignable = errors.New("a clock's currentTime advances with the run and is not assigned") // ErrNoSubject is returned when the feature a satisfaction assertion names // with `by` cannot supply a subject: it resolves to nothing, or no object of // it can be created. ErrNoSubject = errors.New("no subject to satisfy the requirement") // ErrPerformerFeatureNotInScope is returned when a behavior body names a // feature only the object performing it declares: the performing object is // not a namespace the body's names resolve in, so the name has no referent. ErrPerformerFeatureNotInScope = errors.New("name is not in scope of the behavior body") // ErrThisNotAnObject is returned when `this` is read where no object owns // what is being evaluated: the context occurrence is the performance itself, // whose features a name written in its body does not reach. ErrThisNotAnObject = errors.New("this names no object here") )
var ( // ErrOccurrenceDestroyed is returned when a destroyed occurrence is read or // written: its features hold nothing after its end, and it cannot end twice. ErrOccurrenceDestroyed = errors.New("occurrence was destroyed") // ErrNotAnOccurrence is returned when a value that denotes no object of the // model is passed where OccurrenceFunctions takes an Occurrence. ErrNotAnOccurrence = errors.New("value is not an occurrence") // ErrOccurrenceLifetime is returned when an occurrence's lifetime admits no // such change: `create` of one begun before the call, `destroy` of one ended. ErrOccurrenceLifetime = errors.New("occurrence lifetime does not admit the change") )
var ( // ErrStateSpaceValue reports a state, input, derivative, difference or output // that is not the vector the protocol asks for, or one the action does not bind. ErrStateSpaceValue = errors.New("state-space value") // ErrStateSpaceStep reports a time step the dynamics cannot advance by: none // stated, not a duration, or not positive. ErrStateSpaceStep = errors.New("state-space time step") // ErrStateSpaceDiverged reports a step that left the state with a component // that is no longer a finite number. ErrStateSpaceDiverged = errors.New("state-space dynamics diverged") )
Errors a state-space run reports, each wrapping the detail of what went wrong.
var ( // ErrSweepRange reports a range no sequence of values follows from: a // non-numeric endpoint, endpoints measuring different things, a zero step, a // step whose sign never reaches the endpoint, a real range stating none, or an // endpoint or step that is no value of the swept parameter's type. ErrSweepRange = errors.New("invalid sweep range") // ErrSweepParameter reports a parameter the target declares none of, or one // the invocation already binds. ErrSweepParameter = errors.New("invalid sweep parameter") // ErrSweepSamples reports a sample request that draws nothing, states a step, // or asks for a distribution no library in this build states. ErrSweepSamples = errors.New("invalid sample request") // ErrSweepBudget reports a sweep asking for more runs than its budget allows. ErrSweepBudget = errors.New("sweep run budget exceeded") // ErrSweepEmpty reports a sweep or sample naming no range at all. ErrSweepEmpty = errors.New("no sweep range") // ErrSweepDistribution reports a distribution asked for by name. Sampling is // uniform over a range: the bundled library states no probability // distributions, so nothing in the model gives a named one a meaning. ErrSweepDistribution = errors.New("no distribution library") )
Typed refusals a sweep reports rather than running anything.
var DefaultExploreBudget = ExploreBudget{Runs: 1024, Depth: 64}
DefaultExploreBudget is the budget `explore` has when its spelling names none.
var DefaultExploreSchedulePolicy = SchedulePolicy{/* contains filtered or unexported fields */}
DefaultExploreSchedulePolicy is `explore` with no options: every linearization within the default budget.
var DefaultSchedulePolicy = SchedulePolicy{/* contains filtered or unexported fields */}
DefaultSchedulePolicy is the policy runs use unless one is set: `reverse`.
var DrawPolicyNames = []string{"random", "min", "max", "average"}
DrawPolicyNames lists the spellings ParseDrawPolicy accepts, for usage text.
var ErrAmbiguousAction = errors.New("ambiguous action")
ErrAmbiguousAction is the typed error an action named on an object performing it under several usages wraps.
var ErrAmbiguousInvocation = errors.New("ambiguous invocation")
ErrAmbiguousInvocation is returned for a call whose name denotes several declarations the arguments fit equally well, none more specific than the rest.
var ErrAmbiguousMachine = errors.New("ambiguous state machine")
ErrAmbiguousMachine is the typed error a machine named on an object exhibiting it under several usages wraps.
var ErrAmbiguousSubject = errors.New("ambiguous subject")
ErrAmbiguousSubject is returned when more than one object carries the checked element, so which one the verdict would be about is a question, not an answer.
var ErrAmbiguousSuccession = errors.New("more than one succession is enabled")
ErrAmbiguousSuccession reports a node whose flow could continue along more than one succession, which the token semantics do not resolve.
var ErrBranchWeights = errors.New("invalid branch weights")
ErrBranchWeights is the typed error a weighted decision raises when the weights its branches draw, once evaluated, are no probabilities.
var ErrCallNotReturned = errors.New("call not returned")
ErrCallNotReturned reports a call the run left queued or deferred, so a synchronous caller would still be waiting on it.
var ErrCheckRefused = errors.New("check refused")
ErrCheckRefused is the typed error every move the run could not make as the checker selected it wraps.
var ErrClockStep = errors.New("invalid clock step")
ErrClockStep is the typed error a clock step that is not a finite, non-negative number is refused with.
var ErrDrawPolicy = errors.New("invalid draw policy")
ErrDrawPolicy is the typed error every unreadable draw policy spelling wraps.
var ErrDrawUnbounded = errors.New("draw policy has no value for the call")
ErrDrawUnbounded is the typed error a fixed policy raises at a call whose distribution has no such point: a normal has neither a least nor a greatest value.
var ErrExplorationDiverged = errors.New("exploration diverged")
ErrExplorationDiverged is the typed error for a replay that did not meet the choice points its prefix recorded, so no outcome set can be trusted.
var ErrExploreUndriven = errors.New("explore is not a policy one context runs under")
ErrExploreUndriven is the typed error SetSchedule returns for `explore`, which Explore drives over fresh contexts rather than one.
var ErrImageBindingTaken = errors.New("declaration already denotes an object of the destination context")
ErrImageBindingTaken is the typed error for a declaration the image has denote an object of its own that already denotes another live object of the destination.
var ErrImageBound = errors.New("execution state bound to its context")
ErrImageBound is the typed error for execution state bound to the context that made it, which no image carries: an evaluation under way, or a frame of a calc.
var ErrImageClock = errors.New("destination clock cannot stand at the image's instant")
ErrImageClock is the typed error for a destination clock that cannot stand at the instant the image was taken at: already past it, or with a wait due before it.
var ErrImageIdentityTaken = errors.New("identity already held by the destination context")
ErrImageIdentityTaken is the typed error for an image whose object's identity the destination context already holds an object under.
var ErrImageRoot = errors.New("object is not of the context imaged")
ErrImageRoot is the typed error for an object asked of an image that was not taken in the context of the object.
var ErrInvalidChoice = errors.New("invalid choice")
ErrInvalidChoice is the typed error every unparseable choice line wraps.
var ErrInvalidDraw = errors.New("invalid draw")
ErrInvalidDraw is the typed error every unreadable draw line wraps.
var ErrInvalidInput = errors.New("invalid input")
ErrInvalidInput is the typed error every unparseable input line wraps.
var ErrInvalidNotation = errors.New("string is not a valid notation")
ErrInvalidNotation reports a String a conversion function cannot read as a value of the type it converts to.
var ErrInvalidObject = errors.New("invalid object")
ErrInvalidObject is the typed error every unparseable object line wraps.
var ErrInvalidSchedulePolicy = errors.New("invalid scheduling policy")
ErrInvalidSchedulePolicy is the typed error every unparseable policy spelling wraps.
var ErrMalformedEvent = errors.New("malformed queued event")
ErrMalformedEvent is the typed error Enqueue returns for an event that is not exactly one signal or one call.
var ErrMonteCarloObserved = errors.New("invalid observation")
ErrMonteCarloObserved reports a run whose `observed` the statistics cannot be taken of.
var ErrNoArgumentTyper = errors.New("no argument typing installed on the semantic model")
ErrNoArgumentTyper reports a call reached on a semantic model with no argument typing installed: the run would select among overloads by arity alone, weaker than the checker did, so it selects nothing.
var ErrNoExpressionParser = errors.New("no expression parser installed on the runtime model")
ErrNoExpressionParser is the typed error a run returns on reaching notation text to read with no ExpressionParser installed on its Model.
var ErrNoMetaclass = errors.New("no reflective metaclass classifies the element")
ErrNoMetaclass is returned when an element's declaration is classified by no reflective metaclass the loaded libraries declare, so it has no metaobject.
var ErrNoSuchAttribute = errors.New("no such attribute")
ErrNoSuchAttribute is the typed error WriteAttribute returns for a name the machine declares no attribute for.
var ErrNotExploring = errors.New("scheduling policy does not explore")
ErrNotExploring is the typed error Explore returns for a policy that is not `explore`.
var ErrNotMonteCarlo = errors.New("not a Simulation::MonteCarlo analysis")
ErrNotMonteCarlo reports repeating a case that is no Simulation::MonteCarlo analysis.
var ErrNothingStarted = errors.New("the invocation started nothing to check")
ErrNothingStarted is the typed error a check whose starter started no behavior, or one in another context, wraps.
var ErrPerformedInputs = errors.New("inputs for a performed action")
ErrPerformedInputs is the typed error inputs given for an action the object performs already wrap: its performance took the arguments its declaration binds.
var ErrRandomDomain = errors.New("random function arguments bound no distribution")
ErrRandomDomain is the typed error a random function raises on arguments that bound no distribution: `uniform(hi, lo)`, a negative standard deviation.
var ErrReflectiveFeatureUnsupported = errors.New("reflective feature is not derived")
ErrReflectiveFeatureUnsupported is returned when a metaclass declares the feature read from a metaobject but the runtime derives no value for it.
var ErrReplayDisagrees = errors.New("replay disagrees with the witness")
ErrReplayDisagrees is the typed error every replay that reaches another state wraps.
var ErrReplayRefused = errors.New("replay refused")
ErrReplayRefused is the typed error every refused replay move wraps.
var ErrRescheduleMidRun = errors.New("reschedule inside a step")
ErrRescheduleMidRun is Reschedule from inside a step.
var ErrSendPortTypeMismatch = errors.New("send message type is not carried by the receiving port")
ErrSendPortTypeMismatch reports a typed receiving port rejecting a message.
var ErrSendTargetNotObject = errors.New("send target holds no object")
ErrSendTargetNotObject reports an addressed send whose target holds no object: a binding of the sending behavior holding none, or a receiver expression yielding none.
var ErrSendViaNotPort = errors.New("send via holds no port")
ErrSendViaNotPort reports a via path that is a binding of the sending behavior holding an object which is no port.
var ErrSendViaUnknownPort = errors.New("send via names no port of the sender")
ErrSendViaUnknownPort reports a routed send naming no sender port.
var ErrSnapshotMidRun = errors.New("snapshot inside a step")
ErrSnapshotMidRun reports a snapshot asked for from inside a step: a snapshot is taken between steps, where no run, body or evaluation is on the stack.
var ErrSnapshotPausedBody = errors.New("snapshot of a body paused mid-statement")
ErrSnapshotPausedBody reports a body paused mid-statement — a token's step a breakpoint or a wait on the clock suspended, or a do behavior waiting — whose continuation points into its model's lowered statements: a Snapshot of the same context captures it, a portable image (HeldImage) does not.
var ErrSweepRuns = errors.New("invalid run request")
ErrSweepRuns reports a Monte Carlo that runs nothing or states a range too.
var ErrTool = errors.New("tool failed")
ErrTool is the typed error every failure of a tool invocation unwraps to.
var ErrToolDryRun = errors.New("tool dry run")
ErrToolDryRun is the error a dry run stops the performance with at its first tool call; it passes through unchanged.
var ErrToolNotRegistered = errors.New("tool is not registered")
ErrToolNotRegistered is the typed error for a ToolExecution naming a tool no manifest entry registers.
var ErrUnevaluableLibraryFunction = errors.New("library function is not evaluable")
ErrUnevaluableLibraryFunction is returned for a function library declaration this runtime has no representation for the values of. It names the function, so a model is told which declaration it is rather than answered wrongly.
var ErrUnknownCheckFeature = errors.New("no such feature to check divergence of")
ErrUnknownCheckFeature is the typed error a check whose Diverge names no feature wraps.
var ErrUnreachableSendReceiver = errors.New("send receiver is unreachable")
ErrUnreachableSendReceiver reports a routed receiver that cannot be resolved.
var ErrUnroutableSend = errors.New("send reaches no receiving port")
ErrUnroutableSend is returned when a `send … via p` reaches no end able to receive it: p is joined to nothing, or only to ends whose flow features carry outward. It lives here rather than in errors.go because routing is the only thing that raises it.
var ErrUnseededDraw = errors.New("modeled randomness needs a seed")
ErrUnseededDraw is the typed error a modeled draw raises when no seed fixes it.
var ErrWitnessDraw = errors.New("witness draw not consumable")
ErrWitnessDraw is the typed error a replay raises at a draw the run cannot consume: one the witness records that the run does not make, or one the run makes that the witness does not record.
var ErrWitnessInput = errors.New("witness input refused")
ErrWitnessInput is the typed error every witness input the run cannot fix wraps.
var ErrWitnessObject = errors.New("witness object")
ErrWitnessObject is the typed error for an object a witness names that the replaying run has no object at the path of.
var ExecutorBounds = []string{BoundSteps, BoundActionSteps, BoundEvents, BoundDoSteps, BoundElements, BoundBehaviors}
ExecutorBounds lists the executor budgets a bound hit may name, in report order.
var SchedulePolicyNames = []string{"declared", "reverse", "seed:<n>", "explore[:runs=<n>,depth=<d>]", "replay:<file>"}
SchedulePolicyNames lists the policy spellings ParseSchedulePolicy accepts, for usage text; `seed:<n>` stands for any non-negative decimal seed and the bracketed options of `explore` are each optional; `replay:<file>` names a file of choice lines.
var SignalDefinitionKinds = []symbols.SymbolKind{ symbols.SymbolAttributeDef, symbols.SymbolItemDef, symbols.SymbolOccurrenceDef, symbols.SymbolPartDef, symbols.SymbolIndividualDef, symbols.SymbolEnumerationDef, symbols.SymbolMetadataDef, }
SignalDefinitionKinds are the definitions a signal is declared as: what an accept may be typed by and a send may carry. A behavior definition is neither.
Functions ¶
func ActionNodeName ¶
ActionNodeName returns the declared name of an action graph node, or "" when the node is anonymous or not a named node kind.
func ActionNodeNames ¶
ActionNodeNames returns every name a node answers to: its name and, for a usage, its declared short name, which is a name of its own.
func BranchLabel ¶
BranchLabel names a decision's succession as a choice line does: its declared position, counted from 1, and its target.
func CalcCompileFromEnv ¶
func CalcCompileFromEnv() bool
CalcCompileFromEnv reports whether the environment leaves the compiled calc tier on, which it does unless CalcCompileEnvVar (or its legacy SYSML_ name) switches it off.
func CheckClockStep ¶
CheckClockStep is ErrClockStep unless step is a finite, non-negative number of seconds.
func DecisionPlace ¶
DecisionPlace is where a choice line places a decision node's branch choice.
func DeclScope ¶
DeclScope returns the scope a declaration's body was written in: the scope the declaration owns, in which its own members are visible to each other, falling back to the scope it was declared in when it owns none. It is the scope an expression written among its members resolves its names against — an attribute default, a guard, an assignment in a nested action body — and the scope the runtime lowers the declaration in.
func ExecutorBound ¶
ExecutorBound is the limit the named executor bound has under the budgets, false for a name that is no executor bound's. The object behaviors' rounds are counted in events, so both names spell the events limit.
func FormatChoices ¶
func FormatChoices(choices []ChoiceTaken) string
FormatChoices renders a witness as one line, its choices in run order.
func FormatComplex ¶
func FormatComplex(z complex128) string
FormatComplex renders a complex number as its parts read, `1.0 + 2.0i`, with the imaginary part's sign as the operator: `1.0 - 2.0i`.
func FormatTraceValue ¶
FormatTraceValue renders a runtime value canonically for a trace. Set elements are sorted by their rendering, since a set has no order of its own and its backing map does not iterate in a stable one.
func FormatValue ¶
FormatValue renders a value with the notation used by user-facing runtime results and diagnostics.
func FormatWeight ¶
FormatWeight spells a weight as a trace reports it.
func IsRunnableCaseSymbol ¶
IsRunnableCaseSymbol reports whether sym declares a case whose body runs as steps: an analysis case or a verification case, definition or usage.
func IsSignalDefinition ¶
IsSignalDefinition reports whether a symbol declares a definition a signal may be typed by, one of SignalDefinitionKinds.
func IsVerificationCaseSymbol ¶
IsVerificationCaseSymbol reports whether sym declares a verification case definition or usage.
func LibraryFunctionParams ¶
LibraryFunctionParams is the declared parameter names of the library function fqn in declared order, an anonymous parameter as "".
func Magnitude ¶
Magnitude is the number a value is, a quantity's magnitude included, and whether it is one.
func MagnitudeValue ¶
MagnitudeValue is the number a value is as written, Integer or Real, a quantity's magnitude included, and whether it is one.
func NegatedDecl ¶
NegatedDecl reports whether sym's declaration asserts that its conditions do not hold (`assert not constraint { … }`, `assert not satisfy … by …`).
func NewSampleSource ¶
NewSampleSource is the generator a sampled sweep draws from: math/rand/v2's PCG seeded from the given seed alone, so one seed draws one sequence of values on every platform and every build.
func ParseClockStep ¶
ParseClockStep reads a clock step as `-clock-step` and a witness spell it: a finite, non-negative number of seconds, else ErrClockStep.
func PooledDeviation ¶
PooledDeviation is the root of the weighted squares of spreads, those About the mean taken from it, over dof degrees of freedom, 0 for none. Values and mean are scaled by the power of two below the largest before differencing and squaring, which rounds nothing, so finite values however large or far apart pool to a finite deviation.
func ReplaySpelling ¶
ReplaySpelling reports whether the spelling asks for a replay, whose file ParseSchedulePolicy reads; a surface with no files of the caller's refuses it before parsing.
func RequireAnalysis ¶
RequireAnalysis returns an ErrNotAnAnalysis usage error unless sym declares an analysis case, so a caller can settle the kind before asking for objectives.
func RequireConstraint ¶
RequireConstraint returns an ErrNotAConstraint usage error unless sym declares a constraint, so a caller can settle the kind before evaluating.
func RequireObject ¶
RequireObject is ErrNotAnObject unless sym has objects to validate: a definition or usage that is neither a namespace nor a data value (attribute, enumeration).
func RequireRequirement ¶
RequireRequirement returns an ErrNotARequirement usage error unless sym declares a requirement.
func ResolveCheckFeatures ¶
func ResolveCheckFeatures(exec *ActionExecutor, names []string) (map[string]FeatureOwner, error)
ResolveCheckFeatures resolves the names a check compares as Check does over an invocation of the started action exec alone, telling whose feature each is; a name nothing answers to is an UnknownCheckFeatureError.
func RunNumber ¶
func RunNumber(bindings []SweepBinding) (int64, bool)
RunNumber is the number of the run a Monte Carlo row is, from its bindings.
func RunSeed ¶
RunSeed is the model seed run i (from 1) of a Monte Carlo seeded from seed draws under: SplitMix64's finalizer over seed + i·stride, a bijection, so two runs of one Monte Carlo never share a seed, and run i is the same on every platform.
func SettleMonteCarloRuns ¶ added in v0.9.2
func SettleMonteCarloRuns(runs []*MonteCarloRun, stats *MonteCarloStatistics) ([]bool, error)
SettleMonteCarloRuns settles every run's checks over the sample's statistics and counts outOfSpec into stats, returning the checks that are the sample's. The point between it and the last run's Conclude is where a call boundary before the conclusion is taken.
func SharedDefaultsFromEnv ¶ added in v0.9.2
func SharedDefaultsFromEnv() bool
SharedDefaultsFromEnv reports whether the environment leaves derived-default sharing on, which it does unless SharedDefaultsEnvVar switches it off.
func StateVertexName ¶
StateVertexName returns the name of a StateNode or PseudostateNode, "" for any other node.
func TokenLabel ¶
TokenLabel names a token as a choice line does: its ID at the node it sits at.
func TraceLabel ¶
TraceLabel names an expression node for a trace: its kind plus the token that identifies it, which is stable across reformatting of the source.
func WeightedMean ¶
WeightedMean is the mean of the values weighted by their counts, exact until it rounds to a Real, with the exact total count; a value that is no finite number carries into the mean as Real arithmetic would carry it.
Types ¶
type AcceptWait ¶
type AcceptWait struct {
ParamName string // the accept parameter the message will bind to
SignalType string // the type awaited, empty when the accept named none
ViaPort string // the port awaited on, empty when the accept named none
Since int // the step during which the token parked, numbered as the trace numbers steps
// Trigger describes the time or change event awaited instead of a message
// (`accept when x > 1`), empty when the accept waits for a message.
Trigger string
// Timed is set for a wait on the context's clock, Due the instant it ends.
Timed bool
Due float64
}
AcceptWait describes the message a parked token is waiting for. It is the accept's lowered shape plus the step the token parked at, which is what lets a blocked run report which accept is waiting for what rather than only that it is stuck.
func (AcceptWait) String ¶
func (w AcceptWait) String() string
String describes what a parked token is waiting for, and since when, for error messages and for the REPL's view of a suspended executor.
type ActionExecutor ¶
type ActionExecutor struct {
// contains filtered or unexported fields
}
ActionExecutor executes action bodies using token-flow semantics.
func (*ActionExecutor) AcceptTaking ¶
func (e *ActionExecutor) AcceptTaking(m Message) (taking []TakingAccept, err error)
AcceptTaking lists the accepts parked for m, in the action's own flow and in the work it performs, in the order their tokens are held; the step dispatching m lets one go on.
func (*ActionExecutor) AcceptsMessage ¶
func (e *ActionExecutor) AcceptsMessage(m Message) (accepted bool, err error)
AcceptsMessage reports whether a token parked at a signal accept, or an action performed for a paused token, would take m; a port failing to resolve is the error.
func (*ActionExecutor) ActionSymbol ¶
func (e *ActionExecutor) ActionSymbol() *symbols.Symbol
ActionSymbol returns the action being executed.
func (*ActionExecutor) Awaiting ¶
func (e *ActionExecutor) Awaiting(token Token) []lower.ActionEdge
Awaiting returns the successions into the node token is held at that no token has arrived over yet, nil for a token not held there.
func (*ActionExecutor) ClearBreakpoints ¶
func (e *ActionExecutor) ClearBreakpoints()
ClearBreakpoints removes all breakpoints.
func (*ActionExecutor) Data ¶
func (e *ActionExecutor) Data() map[string]Value
Data returns the live feature space of the action's own performance; a nested node's features live in its own performance and are reported by Results.
func (*ActionExecutor) Graph ¶
func (e *ActionExecutor) Graph() *lower.ActionGraph
Graph is the lowered flow the run performs, the one every step of it consumes.
func (*ActionExecutor) HasPendingSignal ¶
func (e *ActionExecutor) HasPendingSignal() bool
HasPendingSignal reports whether a message in flight would let a parked token proceed, without consuming it.
func (*ActionExecutor) Held ¶
func (e *ActionExecutor) Held() Held
Held copies what the action's own performance holds now.
func (*ActionExecutor) Holds ¶
Holds evaluates a requirement or constraint against the run's state as the executor now holds it: a feature the condition names resolves to the performance's value first, then to the performer's, then to the declaration. It reports whether the conditions hold as CheckRequirementOn and CheckConstraintOn decide, the condition that failed carried as a ViolationError, and a runtime failure of the evaluation as its own error.
func (*ActionExecutor) KeepTraversals ¶
func (e *ActionExecutor) KeepTraversals(keep bool)
KeepTraversals has the run keep the successions its tokens take until TraversalsSince releases them, for a debugger; off (the default), it keeps none.
func (*ActionExecutor) NextWait ¶
func (e *ActionExecutor) NextWait() (float64, bool)
NextWait returns the instant the earliest token parked on the clock proceeds at, false when none is; one already due is not a wait.
func (*ActionExecutor) NodeNames ¶
func (e *ActionExecutor) NodeNames() []string
NodeNames returns the names of the action's graph nodes, in declaration order, then those of the flows nested under it: the flows its nodes own and the block flows their bodies state. Anonymous nodes are omitted; a debugger uses it to check that a breakpoint names a node that exists.
func (*ActionExecutor) NoteCount ¶
func (e *ActionExecutor) NoteCount() int
NoteCount is how many notes the executor's run has made so far.
func (*ActionExecutor) Notes ¶
func (e *ActionExecutor) Notes() []RunNote
Notes returns what the executor's run noted so far, in order; see Context.Notes.
func (*ActionExecutor) NotesSince ¶
func (e *ActionExecutor) NotesSince(mark int) []RunNote
NotesSince returns what the executor's run noted since mark, a NoteCount read earlier.
func (*ActionExecutor) Outcome ¶
func (e *ActionExecutor) Outcome() Outcome
Outcome is the outcome of the run so far: the values its features hold, and whether a `terminate` ended it short of its own end.
func (*ActionExecutor) PausedAt ¶
func (e *ActionExecutor) PausedAt() string
PausedAt returns the breakpoint node the last run stopped at, or "" when the run was not stopped by a breakpoint.
func (*ActionExecutor) PausedBreakpoint ¶
func (e *ActionExecutor) PausedBreakpoint() (NodeBreakpoint, bool)
PausedBreakpoint identifies the node the last run stopped at, in its nested flow: a node a body performs is identified even as its token stays on the enclosing action. False when the run was not stopped by a breakpoint. The path is the caller's own.
func (*ActionExecutor) Performer ¶
func (e *ActionExecutor) Performer() *Instance
Performer returns the object performing the action, nil for an action performed outside any object.
func (*ActionExecutor) PerformerAttributes ¶
func (e *ActionExecutor) PerformerAttributes() []string
PerformerAttributes names, in name order, the attributes of the object performing the action: the features a check compares for it absent names; none without one.
func (*ActionExecutor) Release ¶
func (e *ActionExecutor) Release()
Release ends the run for good: the work of every token a breakpoint left paused is ended, so an executor abandoned mid-run holds no suspended run, the clock drives it no further, and a later Step or RunToCompletion returns ErrExecutorReleased, completed or not. Safe to call more than once.
func (*ActionExecutor) ReplaceBreakpointsAt ¶
func (e *ActionExecutor) ReplaceBreakpointsAt(bps []NodeBreakpoint)
ReplaceBreakpointsAt makes bps the breakpoints set by identity, named or not, one occurrence of a node each: a debugger holding the graph (Graph, Token.Within) sets breakpoints this way. A stop already made at one kept stands, so a resumed run passes it; one removed stops again once re-set.
func (*ActionExecutor) Results ¶
func (e *ActionExecutor) Results() map[string]Value
Results returns the values the action's features hold, under `node.pin` those of each nested node's latest performance and under `part.attribute` what the one object each of its own parts denotes holds; a performed usage's mirror its occurrence.
func (*ActionExecutor) Resume ¶
func (e *ActionExecutor) Resume() bool
Resume returns a run a breakpoint suspended to running, for a driver that moves it by other means than a step: the clock, say. Any other state is left as it is.
func (*ActionExecutor) RunToCompletion ¶
func (e *ActionExecutor) RunToCompletion() error
RunToCompletion executes until StateCompleted, a breakpoint, or error. Includes infinite loop protection.
A run stops as soon as a token sits on a node a breakpoint was set on (see SetBreakpoint), or a body a token runs is about to perform one, leaving the tokens where they are so the run can be resumed by calling RunToCompletion again or stepped with Step; PausedAt names the node it stopped at. With no breakpoints set the run is unconditional.
Nothing outside the action can post a message while this runs, so an action whose every remaining token is parked at an accept for a message can never be resumed: the suspension is a deadlock and is reported as ErrAcceptDeadlock at the first step that makes no progress. A token parked on the clock is resumed by advancing it to its instant, running whatever else is due there too.
func (*ActionExecutor) RunToQuiescence ¶
func (e *ActionExecutor) RunToQuiescence() error
RunToQuiescence runs the action until it completes, stops at a breakpoint, or parks every remaining token at an accept, holding the clock where it is: for an object's action a parked token is quiescence, not a deadlock.
func (*ActionExecutor) SetBreakpoint ¶
func (e *ActionExecutor) SetBreakpoint(nodeName string)
SetBreakpoint adds a breakpoint at the given node name.
func (*ActionExecutor) SetInputs ¶
func (e *ActionExecutor) SetInputs(inputs map[string]Value)
SetInputs binds input parameter values into the action's feature space. Inputs are applied after attribute defaults, so they override defaults with the same name. Must be called before initialize().
func (*ActionExecutor) SetTrace ¶
func (e *ActionExecutor) SetTrace(trace *TraceRecorder)
SetTrace sets the trace recorder for this executor and the context it evaluates in.
func (*ActionExecutor) Snapshot ¶
func (e *ActionExecutor) Snapshot() (*Snapshot, error)
Snapshot captures the executor's state along with its context's (Context.Snapshot).
func (*ActionExecutor) State ¶
func (e *ActionExecutor) State() ExecutionState
State returns current execution state.
func (*ActionExecutor) Step ¶
func (e *ActionExecutor) Step() error
Step advances execution by one step for all active tokens. Safely handles token slice modifications (fork/join) by collecting indices first.
A step moves each token at most once: a token the step created or moved — a fork's branch, the one a synchronized node performs with — has its first step in the next, so the tokens held at a node are all in before it performs.
A token that reaches an accept with no message it can consume parks there rather than failing: the action is suspended until a matching message arrives. When a step moves nothing and at least one token is parked, the executor enters StateWaiting instead of reporting a deadlock — a caller driving Step itself (the REPL, or a state machine running in the same context) may still post the awaited message and step again, which resumes the parked token. RunToCompletion has no such caller, so it turns a step that leaves the executor waiting into ErrAcceptDeadlock.
A step ends early, with the executor suspended, when a body a token runs is about to perform a node a breakpoint is set on (see SetBreakpoint): the token stays at its node with its work half done and no further token steps. The next step steps the other tokens first, then resumes it.
Returns an error if a deadlock unrelated to accepts is detected (no progress made and nothing is waiting for a message).
func (*ActionExecutor) StepToBreakpoint ¶
func (e *ActionExecutor) StepToBreakpoint() error
StepToBreakpoint is Step with the breakpoints a run stops at: a token sitting on one the run has not yet stopped at suspends the run before any token moves, and one a step lands on suspends it after, so the next step resumes past it.
func (*ActionExecutor) TimeWaits ¶
func (e *ActionExecutor) TimeWaits() []string
TimeWaits describes the tokens parked on the clock, in token-ID order, then those of the executors the paused work of its tokens waits on.
func (*ActionExecutor) Tokens ¶
func (e *ActionExecutor) Tokens() []Token
Tokens returns a copy of active tokens.
func (*ActionExecutor) TraversalCount ¶
func (e *ActionExecutor) TraversalCount() int
TraversalCount counts the successions taken so far, released ones included: a mark to read what a later step took from.
func (*ActionExecutor) Traversals ¶
func (e *ActionExecutor) Traversals() []Traversal
Traversals returns the successions kept, in order: a fork's branches as the tokens they spawned, a join as the one token that passes on.
func (*ActionExecutor) TraversalsSince ¶
func (e *ActionExecutor) TraversalsSince(mark int) []Traversal
TraversalsSince returns the kept successions taken since mark, a TraversalCount read earlier, and releases those before it: the run keeps only from the last mark.
type AdoptError ¶
type AdoptError struct {
Type string // qualified name of the object's type, as far as it is known
Reason string
}
AdoptError says which object could not be carried over into a new context, and why, so the loss is reported rather than silently absorbed.
func (*AdoptError) Error ¶
func (e *AdoptError) Error() string
type AdvanceReport ¶
type AdvanceReport struct {
// From and To are the instants the clock moved between, in seconds.
From, To float64
// Events, DoSteps and Steps count the state events dispatched, the do
// actions run and the action steps taken along the way.
Events, DoSteps, Steps int64
// Dropped are the signals dispatched along the way that no transition
// consumed and no do behavior went on with: deferred by the active state, or dropped.
Dropped []Dispatch
// Notes are what the advance noted: the choice points it drew and the
// guards it could not evaluate, in order.
Notes []RunNote
}
AdvanceReport is what one advance of the clock did.
type AffineTransformation3d ¶
AffineTransformation3d is an AffineTransformationMatrix3d: the 3x3 rotation in row-major order and the translation, both bare numbers.
type AnalysisArgs ¶
type AnalysisArgs struct {
// Subject is the object the case is run on; nil leaves the case's own
// subject binding, or the enclosing case's subject, to supply it.
Subject *Instance
// Positional bind the input parameters the case does not bind itself, in
// declaration order; the subject is never among them.
Positional []Value
// Named bind parameters by name.
Named map[string]Value
}
AnalysisArgs are the values a run of an analysis case supplies: an object as its subject, and arguments for its input parameters by position or by name.
type AnalysisEvaluation ¶
type AnalysisEvaluation struct {
// Function is the qualified name of the calc applied.
Function string
// Arguments are what the calc was applied to, by parameter position, a named
// one at its parameter's; null where none was given before a later one.
Arguments []Value
// Result is what the calc computed; unset when Error says why it computed nothing.
Result Value
Error error
// Selected marks the evaluation of the value `selectOne` picked and the case
// returned. Tied marks one computing what the selected did, passed over for it.
Selected bool
Tied bool
}
AnalysisEvaluation is one application, during a case's run, of a calc held as a function value: a trade study's evaluation of one alternative.
type AnalysisResult ¶
type AnalysisResult struct {
// Case is the qualified name of the case that ran.
Case string
// Subject is the object the case ran on — supplied, bound by the usage or
// taken from the enclosing case; nil for a case declaring no subject.
Subject *Instance
// Inputs are the values the run bound the case's input parameters to, in
// declaration order, the subject parameter excluded: what the body ran with.
Inputs []InputBinding
// Outputs are the case's out and return parameters, in declaration order;
// a value the body returned into an unnamed result is named "result".
Outputs []CalcOutputValue
// Verdicts are the case's objectives, in order, then its assertions.
Verdicts []AnalysisVerdict
// Evaluations are the applications of the case's own calcs as function values
// the run made, in the order first made, once per distinct argument list.
Evaluations []AnalysisEvaluation
}
AnalysisResult is what one run of an analysis case produced: its output values in declaration order, and the verdict of each objective and assertion.
func ConcludeMonteCarlo ¶
func ConcludeMonteCarlo(runs []*MonteCarloRun, stats MonteCarloStatistics) (AnalysisResult, error)
ConcludeMonteCarlo settles every run's checks over the sample's runs, mean and deviation, counts outOfSpec over them, and concludes the case in the last run with the sample's checks.
type AnalysisVerdict ¶
type AnalysisVerdict struct {
// Kind is "objective" or "assertion".
Kind string
// Name names the objective or the asserted constraint usage, or spells an
// anonymous assertion's condition as written.
Name string
// Symbol declares the objective or the named constraint asserted; nil for an
// anonymous assertion.
Symbol *symbols.Symbol
// Status is what the check decided.
Status VerdictStatus
// Detail is the violated condition of a failed check, or why an undecided
// one could not be evaluated; empty for a satisfied one.
Detail string
}
AnalysisVerdict is what one check of an analysis case decided after its body ran: an objective's required conditions, or an assertion in its body.
type Array ¶
type Array struct {
Dimensions []int64
Elements []Value
// Object is the Collections::Array object the value was read from, which keeps
// answering the members a specialization adds; 0 for an array made by value.
Object int64
}
Array is a Collections::Array: its `dimensions` and its `elements` flattened in row-major order. `rank` and `flattenedSize` derive from the dimensions.
func (*Array) FlattenedSize ¶
FlattenedSize is the product of the dimensions, one for an array of none.
type AssertionKind ¶
type AssertionKind string
AssertionKind is the kind of assertion an object verdict is about.
const ( AssertionConstraint AssertionKind = "constraint" AssertionRequirement AssertionKind = "requirement" AssertionSatisfaction AssertionKind = "satisfaction" )
type BindingConflictError ¶
type BindingConflictError struct {
Target string
Left string
Right string
LeftValue Value
RightValue Value
}
BindingConflictError reports unequal values held by the two ends of a binding connector.
func (*BindingConflictError) Error ¶
func (e *BindingConflictError) Error() string
func (*BindingConflictError) Unwrap ¶
func (e *BindingConflictError) Unwrap() error
type BindingCycleError ¶
type BindingCycleError struct {
Features []string
}
BindingCycleError reports a binding component that has no valued end.
func (*BindingCycleError) Error ¶
func (e *BindingCycleError) Error() string
func (*BindingCycleError) Unwrap ¶
func (e *BindingCycleError) Unwrap() error
type Bring ¶
Bring answers, for an object of another context, the object of this one that stands for it; an error when none does.
type Budgets ¶
type Budgets struct {
MaxSteps int64
MaxActionSteps int64
MaxStateEvents int64
MaxDoSteps int64
MaxElements int64
MaxCalcDepth int64
MaxSweepRuns int64
}
Budgets bounds one run of the runtime, and how many runs one sweep asks for. The bounds count incommensurable things — expression evaluations, action token-flow steps, state machine events, do actions, materialized collection elements, nested calc invocations and swept runs — so raising one says nothing about the others.
func BudgetsFromEnv ¶
BudgetsFromEnv returns the bounds the environment asks for: for each variable the positive integer it holds, or the default when it is unset or empty. Every unusable value is reported, naming its variable and the value, so a typo is reported instead of silently leaving the default in place.
func DefaultBudgets ¶
func DefaultBudgets() Budgets
DefaultBudgets returns the bounds a run uses when the environment names no override.
type Builtin ¶
type Builtin struct {
Name string
FQN string
Params []string
// Collection is true for the operations over sequences, collections and
// bodies, which are the ones written in the postfix `x->name()` form.
Collection bool
// Package is the library package that declares the function, which a model
// imports for a call by the unqualified name to be legal: the name resolves
// as any other does, so `import RealFunctions::*;` is what makes a bare
// `sqrt(x)` denote RealFunctions::sqrt.
Package string
}
Builtin is one library function this runtime implements directly, described for a caller that lists them: the unqualified name a call may use, the library declaration that name denotes, and the parameter names of that declaration when the registry knows them.
func Builtins ¶
func Builtins() []Builtin
Builtins returns every library function this build implements that a model calls by name, in name order, each with the package a call by that name needs imported. It is the registry behind the REPL's %builtins listing, so what the REPL advertises is what this build implements. A declaration registered only to report itself as not evaluable is left out, as is one named as an operator, which a model writes as that operator rather than as a call.
type CalcFrameError ¶
type CalcFrameError struct {
Kind string // the notation keyword of the calc: `calc` or `analysis`
Calc string // the calc the error surfaced from
Frames int // calc frames the error propagated through
Err error
// contains filtered or unexported fields
}
CalcFrameError reports an error raised inside a calc invocation, counting the calc frames it propagated through so a recursion reports a depth rather than one wrapped line per frame.
func (*CalcFrameError) Error ¶
func (e *CalcFrameError) Error() string
func (*CalcFrameError) Unwrap ¶
func (e *CalcFrameError) Unwrap() error
type CalcOutputValue ¶
CalcOutputValue is the value one output feature of a calc usage took, in the order the calc declares its outputs.
type Call ¶
Call is the payload of an EventCall: the operation invoked, its declaration as a behavior member of the machine's owner (nil when it declares none) and the arguments.
type CheckBudget ¶
CheckBudget bounds a check: the moves one schedule may make and the distinct states the search may visit; 0 leaves either unbounded.
type CheckFinal ¶
type CheckFinal struct {
Outcome string
Values map[string]string
Witness Witness
// contains filtered or unexported fields
}
CheckFinal is one distinct outcome of the complete schedules and a schedule reaching it; Values spells every feature divergence is reported over, the performing object's as `this.<name>`, and Outcome spells the action's outputs with the object's values after them.
type CheckMoveError ¶
CheckMoveError reports a move the checker selected that the run did not make: the move, as the checker spells it, and what the run faced instead.
func (*CheckMoveError) Error ¶
func (e *CheckMoveError) Error() string
func (*CheckMoveError) Is ¶
func (e *CheckMoveError) Is(target error) bool
Is makes every CheckMoveError match ErrCheckRefused.
type CheckOptions ¶
type CheckOptions struct {
// Diverge names the features whose divergence is reported: the action's own
// bare, a performed node's as `node.pin`, the performing object's as `this.<name>`;
// none names the action's own features and the object's attributes. A name
// no feature answers to fails the check (ErrUnknownCheckFeature).
Diverge []string
// Reduce explores one representative of each class of equivalent schedules;
// off, every schedule. It is off only to test that the reduction loses nothing.
// A check with properties searches unreduced: what a property reads is not
// in the footprints the reduction is sound for.
Reduce bool
}
CheckOptions selects what a check reports and how it searches.
type CheckProperty ¶
type CheckProperty struct {
Name string
Holds func(*Context, *Invocation) (bool, error)
}
CheckProperty is a property evaluated at every stable state of a check: a requirement or constraint, false at a state being a violation. Holds is asked in the check's context of the invocation the check runs, and again of a replay of the witness that claims it false or failing to evaluate.
type CheckReport ¶
type CheckReport struct {
Verdict CheckVerdict
// States counts the distinct states visited; Moves the moves made; MaxDepth
// the longest schedule searched.
States int
Moves int
MaxDepth int
// BoundsHit names the bounds the search ran into: `depth`, `states`, and the
// executor's budgets by name (ExecutorBounds); none when exhaustive.
BoundsHit []string
// Limits are the executor's budgets the search ran under.
Limits Budgets
// Horizon is the instant the search stopped the clock at: no schedule was
// followed past it, and a state there is final.
Horizon Horizon
Violations []Violation
Divergent []Divergence
// Finals are the distinct outcomes of the complete schedules, in canonical order.
Finals []CheckFinal
// MassBounded reports the violations' masses are lower bounds: they are when a
// bound kept schedules out, moves left an interleaving out, a state was reached
// again, or the reduction left a move unexplored at a state.
MassBounded bool
}
CheckReport is what a check of the schedules of an action found.
func Check ¶
func Check(stop context.Context, fresh func() (*Context, error), start Starter, budget CheckBudget, opts CheckOptions, props []CheckProperty) (*CheckReport, error)
Check searches the schedules of the invocation start begins in the context fresh makes. Every violation and every final value carries the witness a replay of the same starter follows (Replay). It stops with a CheckStopped when stop ends first; it fails when the run refused a move it selected. The start draws choice points itself (region entry order), so it is begun once per way of resolving them and the search runs from every state a start reaches.
func (*CheckReport) Status ¶
func (r *CheckReport) Status() string
Status renders how the check ended for a report.
type CheckResult ¶
CheckResult is the outcome of one check: whether it holds, the object its conditions were evaluated against — nil when they were evaluated against the declaration because no object carries the checked element — and, for a nested subject, the object the search started from plus the features walked from it, one name a segment — ending in the declaration the object materializes, as an ambiguity names it — which are how a caller names an object holding no name of its own.
type CheckStopped ¶
CheckStopped is a check the caller stopped before it ended, with what it had searched so far; it unwraps to the caller's reason.
func (*CheckStopped) Error ¶
func (e *CheckStopped) Error() string
func (*CheckStopped) Unwrap ¶
func (e *CheckStopped) Unwrap() error
type CheckVerdict ¶
type CheckVerdict int
CheckVerdict is how a check ended.
const ( // CheckExhaustive found no violation and every schedule, up to equivalence, was searched. CheckExhaustive CheckVerdict = iota // CheckWithinBounds found no violation among the schedules the bounds let it search. CheckWithinBounds // CheckViolation found a violation. CheckViolation // CheckDivergent found no violation and a feature whose final value the schedule decides. CheckDivergent )
func (CheckVerdict) String ¶
func (v CheckVerdict) String() string
type ChoiceKind ¶
type ChoiceKind int
ChoiceKind names what an executor chose among at a choice point.
const ( // ChoiceTokenOrder: several tokens were steppable in one step, and the step // advanced them in an order the library does not fix. ChoiceTokenOrder ChoiceKind = iota // ChoiceDecisionBranch: several guards of one decision node held. ChoiceDecisionBranch // ChoiceWriteOrder: two tokens wrote one feature within one step, so which // value the feature holds afterwards is the order the writes were applied in. ChoiceWriteOrder // ChoiceTransition: several transitions out of one state were enabled for // one event. ChoiceTransition // ChoiceRegionOrder: one event enabled transitions in several regions, which // fired in an order the library does not fix. ChoiceRegionOrder // ChoiceDueOrder: several executors had work due at one instant of the // shared clock, and one of them ran first. ChoiceDueOrder // ChoiceDispatchOrder: several events the library leaves unordered — time // triggers, or a time trigger and a pool event — were due at one instant, and // one of them was dispatched first. ChoiceDispatchOrder // ChoiceEntryOrder: several orthogonal regions, or a fork's branches, each had // a unit of their entry left, and one of them advanced first. ChoiceEntryOrder // ChoiceExitOrder: several orthogonal regions each had a state left to exit, // and one of them exited first. ChoiceExitOrder // ChoiceStepOrder: a do behavior had a step due while an event was due for // dispatch, and one of them went first. ChoiceStepOrder // ChoiceEntryStep: an event due for dispatch and a held entry could proceed, // and one of them went first. ChoiceEntryStep )
func (ChoiceKind) String ¶
func (k ChoiceKind) String() string
String is the kind as a trace or diagnostic names it.
type ChoiceParseError ¶
type ChoiceParseError struct {
// Line is the 1-based line of the witness, 0 for a line parsed on its own.
Line int
Text string
Reason string
}
ChoiceParseError reports a line of a witness that spells no choice, with why.
func (*ChoiceParseError) Error ¶
func (e *ChoiceParseError) Error() string
func (*ChoiceParseError) Is ¶
func (e *ChoiceParseError) Is(target error) bool
Is makes every ChoiceParseError match ErrInvalidChoice.
type ChoicePoint ¶
type ChoicePoint struct {
Kind ChoiceKind
// Step is the action step the choice was made in, 0 for a state machine.
Step int
// Where names the decision node, the state and event, or the instant of a
// due order; empty for a token order.
Where string
// Alternatives are canonical: tokens by ID, branches and transitions by
// declaration position, writes by writing token, reacting states by name in
// declaration order, executors due at one instant in the order they were
// created, tied events in arrival order. Taken indexes the one taken.
Alternatives []string
Taken int
// Weights are the probabilities the model states for the alternatives of a
// weighted decision, one per alternative; nil for a choice the model does not weight.
Weights []float64
// Drew is the unit draw that selected Taken among the Weights, when Drawn.
Drew float64
Drawn bool
// File and Span locate the declaration the choice was made at; File is ""
// when the runtime could not name one.
File string
Span source.Span
}
ChoicePoint is one point where an executor had several enabled alternatives the Kernel Semantic Library leaves unordered and took one by its own scheduling rule.
func (ChoicePoint) Choice ¶
func (c ChoicePoint) Choice() ChoiceTaken
Choice is the choice point as a witness lists it: what ChoiceTaken.String spells and ParseChoice reads back.
func (ChoicePoint) Describe ¶
func (c ChoicePoint) Describe() string
Describe renders the choice for a diagnostic: the alternatives in canonical order and which one the executor took; a weighted decision's alternatives carry their weights and how the branch was selected.
func (ChoicePoint) Diagnostic ¶
func (c ChoicePoint) Diagnostic() diag.Diagnostic
Diagnostic is the choice as a finding about the run: informational, since a model is not wrong for admitting several orders and the run took one of them.
func (ChoicePoint) Location ¶
func (c ChoicePoint) Location() (string, source.Span)
Location is where the choice was made.
func (ChoicePoint) String ¶
func (c ChoicePoint) String() string
String is the trace line the choice is recorded as.
func (ChoicePoint) Weighted ¶
func (c ChoicePoint) Weighted() bool
Weighted reports whether the model weights the alternatives.
type ChoiceTaken ¶
type ChoiceTaken struct {
Kind ChoiceKind
// Step is the action step the choice was made in, 0 for a state machine.
Step int
// Where names the decision node or the state and event; empty for a token order.
Where string
// Alternatives is how many the point had; Taken indexes the one taken.
Alternatives int
Taken int
// Among names the alternatives as a trace does; Took is the one taken: the
// token tried next, a branch or a transition by declared position and target,
// or the state whose transition fired first.
Among []string
Took string
// Weights are the probabilities the model states for the alternatives, one
// per alternative, for a weighted decision; nil for a choice it does not weight.
Weights []float64
// Drew is the unit draw that selected Taken among the Weights, when Drawn.
Drew float64
Drawn bool
}
ChoiceTaken is one choice point of a run and the alternative it took, as the witness of an outcome lists them.
func ParseChoice ¶
func ParseChoice(text string) (ChoiceTaken, error)
ParseChoice reads one choice as ChoiceTaken.String spells it: `step N: T first of A, B`, `step N: decision D -> B`, `S -> T`, `W: X first of A, B` (a region order, a due order at `t=…`, or a dispatch order among `events at t=…`).
func ParseChoices ¶
func ParseChoices(text string) ([]ChoiceTaken, error)
ParseChoices reads the choices of a witness header naming no object and spelling no input: as ChoiceTaken.String spells them, one per line or joined by `; `, ending at the first blank line after it; what follows is ignored.
func (ChoiceTaken) String ¶
func (c ChoiceTaken) String() string
String renders the choice for a table or a failure message, as ParseChoice reads it back: a name the line's own punctuation occurs in is quoted, and a weighted branch carries the alternatives with their weights and the draw.
func (ChoiceTaken) Weighted ¶
func (c ChoiceTaken) Weighted() bool
Weighted reports whether the model weights the alternatives.
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock is the simulation time every executor of one context shares: the current instant in seconds and the executors whose waits it reads in due order.
func (*Clock) NextDue ¶
NextDue returns the earliest instant a wait comes due at past the current one, false when nothing waits on the clock.
type ClockStepParseError ¶
ClockStepParseError is a witness's clock step line that does not read as one.
func (*ClockStepParseError) Error ¶
func (e *ClockStepParseError) Error() string
func (*ClockStepParseError) Unwrap ¶
func (e *ClockStepParseError) Unwrap() error
type ClockWait ¶
type ClockWait struct {
// Due is the instant the wait comes due at, in seconds.
Due float64
// contains filtered or unexported fields
}
ClockWait describes one wait on the clock for a view of the run.
type Condition ¶
type Condition struct {
// Expr is the condition's expression, nil for a group.
Expr ast.Node
// Scope is where Expr's names resolve, or the type a Conflict is found on;
// nil for a group.
Scope *symbols.Scope
// Group is the conditions a body states, all of which must hold; nil for a
// condition stating an expression.
Group []Condition
// Statement is an action statement the body states before its conditions,
// which the evaluator does not execute; nil for a condition or a group.
Statement ast.Node
// Conflict is a second result expression, stated or inherited (KerML
// 8.3.4.8); no verdict is reached. Nil otherwise.
Conflict *semantics.ResultExpressionConflict
// Negated is the negation the declaration wrote, applied to Expr or to the
// whole conjunction Group stands for.
Negated bool
// Required distinguishes a required condition from an assumption, which is
// trusted rather than required to hold.
Required bool
// Constraints are the named constraint usages stating the condition through
// their types, outermost first: each one's parameter values mask the
// enclosing ones', which mask the checked element's. Empty reads the latter alone.
Constraints []*symbols.Symbol
}
Condition is one boolean check a constraint or requirement states, with the scope its expression resolves names in. A condition states either an expression or a group, which holds when all of its conditions hold.
type ConnectorEnd ¶
ConnectorEnd is one end of a materialized connector: the name of the end feature it occupies, empty for an end the model leaves unnamed, and the value the end attaches to. The value is the connected feature itself — an object held at an end is the very object the connected feature holds, not a copy of it (KerML 1.0 §7.4.6) — so writing through one is read through the other.
type ConnectorEndError ¶
type ConnectorEndError struct {
Connector string // the connector as declared
End string // the feature the end names, as written
Location string // file and position of the end
Err error // why the end could not be attached
}
ConnectorEndError reports a connector end that cannot be attached to what it names, carrying where the end was written so the model can be corrected.
func (*ConnectorEndError) Error ¶
func (e *ConnectorEndError) Error() string
func (*ConnectorEndError) Is ¶
func (e *ConnectorEndError) Is(target error) bool
Is reports that this error is an ErrConnectorEnd, so a caller can test for the condition without knowing which end of which connector failed.
func (*ConnectorEndError) Unwrap ¶
func (e *ConnectorEndError) Unwrap() error
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is the run-derived state of one execution over a Model: the objects it created, their values and lifetimes, the messages in flight, the clock, the executors' progress. A snapshot captures it; the Model it runs over is shared with every other run of the same model and is not part of it.
func NewContext ¶
NewContext creates a run's context over the model-derived part model. maxSteps sets the runaway guard (step counter limit); the executor bounds take their defaults, which SetBudgets replaces. It panics if maxSteps <= 0: the limit is a programmer-supplied invariant, not user input, so callers must pass a positive value.
func (*Context) ActionInputNames ¶ added in v0.9.2
ActionInputNames is the action's `in` and `inout` parameter names in declaration order — the parameters an invocation's arguments bind.
func (*Context) ActionInputs ¶ added in v0.9.2
func (ctx *Context) ActionInputs(scope *symbols.Scope, sym *symbols.Symbol, positional []Value, named []NamedInput) (map[string]Value, error)
ActionInputs is the inputs an invocation of sym binds, as bindArgumentList binds them: the positional arguments to the first `in` parameters in declaration order, then the named ones in their order — each written name resolved through BoundParameter as an invocation's is. More positional arguments than parameters is ErrActionArity, a name no `in` parameter carries is ErrUnknownParameter, and one already bound is ErrDuplicateArgument.
func (*Context) ActionOutcome ¶
ActionOutcome is the outcome of an action run: the values its features hold.
func (*Context) ActionOutcomePerformedBy ¶
func (ctx *Context) ActionOutcomePerformedBy(action *symbols.Symbol, self *Instance, inputs map[string]Value) (Outcome, error)
ActionOutcomePerformedBy runs an action as ExecuteActionPerformedBy does and reports the outcome an exploration compares: its features and, under `this.`, the performer's attributes.
func (*Context) Adopt ¶
Adopt takes obj — and every object it holds — over from prev into this context, keeping the identity and the values they carry across a re-analysis of the document they were materialized from. Each object is rebound to the declaration of the same qualified name here, which must resolve to the shape recorded in shapes; anything else is refused with the context left untouched. The objects are moved rather than copied, so prev holds them too afterwards and this context takes over its identity sequence; nothing new should be materialized through prev, which registers it there alone.
A behavior a carried object ran belongs to the analysis it started in, so it is started again here from its initial state rather than continued. The behaviors restarted are returned, so the carry-over reports what it cost.
func (*Context) AdoptIdentities ¶
AdoptIdentities takes over the identity sequence of a context this one replaces, without carrying any object over: objects a run started before still materializes through it, so neither context may hand out the other's.
func (*Context) Advance ¶
func (ctx *Context) Advance(duration float64) (AdvanceReport, error)
Advance moves the clock by duration seconds, running everything due on the way instant by instant; a wait due later stays queued and nothing waiting is no error. The duration and the instant it leads to must be finite.
func (*Context) AdvanceUntil ¶
func (ctx *Context) AdvanceUntil(duration float64, halted func() bool) (AdvanceReport, error)
AdvanceUntil is Advance stopping early, the clock held at the instant whose due work made halted true — a debugger's breakpoint — before moving on.
func (*Context) AnalysisOutcome ¶
func (ctx *Context) AnalysisOutcome(r AnalysisResult) Outcome
AnalysisOutcome is the outcome of a case's run: its outputs, and each verdict as a value named by the objective or assertion it decided.
func (*Context) BehaviorNamed ¶
func (ctx *Context) BehaviorNamed(inst *Instance, name string) (*ObjectBehavior, bool)
BehaviorNamed returns the behavior the object runs under the given name or under another name of the same feature: a redefinition renames the behavior it redefines (KerML 1.0 §7.3.4.5), so both names denote one execution. The renaming may come from any type of the object, a classifier included.
func (*Context) CalcCompile ¶
CalcCompile reports whether this context runs eligible calc bodies compiled.
func (*Context) CalcUsageOutput ¶
func (ctx *Context) CalcUsageOutput(sym *symbols.Symbol, name string, scope *symbols.Scope, self *Instance) (Value, error)
CalcUsageOutput evaluates a calc usage and returns the value of one of its output features. The usage's inputs bind from its own member values, falling back to the defaults declared along its specialization chain; self, when non-null, is the object the usage is a feature of, whose feature values the inputs may name. Reading several outputs of the same usage runs its body once.
func (*Context) CalcUsageOutputs ¶
func (ctx *Context) CalcUsageOutputs(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) ([]CalcOutputValue, error)
CalcUsageOutputs evaluates a calc usage and returns the value of every output feature it declares, in declaration order, from one run of its body.
func (*Context) Carry ¶
Carry is v as a value of ctx: a number, string, quantity or the like as it is; every object it names is the one bring answers for it; a function is read again here, bound to what bring answers for its self. A deferred expression closed over its environment, or a function over a behavior body, cannot be carried.
func (*Context) CaseConditionsOf ¶
CaseConditionsOf returns the conditions a case states as what it holds true of its parameters: the conditions its own members state, and the ones stated by the constraints it requires, assumes or asserts in its body. A constraint declared without one of those keywords states nothing the case checks, so it is left out.
func (*Context) Changed ¶
Changed returns the declaration this context no longer resolves the way shapes recorded it, so a caller can name what invalidated the state it took those shapes for. They were recorded outwards, so reading them back names the one that changed rather than one that only holds it.
func (*Context) CheckConstraintOn ¶
func (ctx *Context) CheckConstraintOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (CheckResult, error)
CheckConstraintOn evaluates a constraint as EvaluateConstraintOn does and also reports the object it turned out to be about, which a caller labelling the verdict needs: it is not always the instance supplied.
func (*Context) CheckRequirementOn ¶
func (ctx *Context) CheckRequirementOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (CheckResult, error)
CheckRequirementOn evaluates a requirement as EvaluateRequirementOn does and also reports the object it turned out to be about.
func (*Context) CheckSatisfactionOn ¶
func (ctx *Context) CheckSatisfactionOn(a *SatisfyAssertion, subject *Instance) (CheckResult, error)
CheckSatisfactionOn evaluates a satisfaction assertion as EvaluateSatisfactionOn does and also reports the object it turned out to be about.
func (*Context) Choices ¶
func (ctx *Context) Choices() []ChoicePoint
Choices returns the choice points made since the latest run began, in order.
func (*Context) ChoicesTaken ¶
func (ctx *Context) ChoicesTaken() []ChoiceTaken
ChoicesTaken returns the choices every run of the context took, in order, as a witness lists them: what a `replay` policy over them follows run by run.
func (*Context) ClearModelSeed ¶
func (ctx *Context) ClearModelSeed()
ClearModelSeed leaves modeled draws to the scheduling policy's seed, if any.
func (*Context) ClockMagnitude ¶
ClockMagnitude reads a value as a number of clock units: a bare number is one already, a quantity is converted from its unit; what names it in errors.
func (*Context) ClockStep ¶
ClockStep is the step the clock's waits come due on, 0 for a continuous clock.
func (*Context) ClockStepTaken ¶
ClockStepTaken is the step the run's waits come due on: the witness's under a `replay` policy, which follows the clock the witness ran on, else the clock's own.
func (*Context) ClockValue ¶
ClockValue is the clock's instant now as a value: a duration in seconds, or a bare number where no library reduces the second.
func (*Context) CompositeTypeOf ¶
func (ctx *Context) CompositeTypeOf(feat *EffectiveFeature) *symbols.Symbol
CompositeTypeOf returns what a feature is materialized from, or nil for one that holds a value rather than an object — a default that binds takes precedence over instantiation, as in GetFeatureValue above. A usage with features of its own is instantiated as itself, so its body governs and an untyped nested part materializes at all. Answering costs no allocation, so a caller walking an object graph can decide whether to descend before descending.
func (*Context) ConditionCarrier ¶ added in v0.9.2
func (ctx *Context) ConditionCarrier(kind, element string, sym *symbols.Symbol, self *Instance) (*Instance, error)
ConditionCarrier is the object a check of sym is about, resolved as evaluation resolves it — self when it carries the element, else the single object of this runtime that does — with the same error, ambiguity included, an evaluation reports.
func (*Context) ConditionsOf ¶
ConditionsOf returns the conditions sym states, its inherited ones first: the same collection, in the same order, that evaluating sym checks. scope stands in for sym's own scope when sym declares none.
func (*Context) CreateActionExecutor ¶
func (ctx *Context) CreateActionExecutor(action *symbols.Symbol) (*ActionExecutor, error)
CreateActionExecutor creates an action executor without starting execution. For REPL debugging - allows step-by-step execution control.
func (*Context) CreateActionExecutorFor ¶
func (ctx *Context) CreateActionExecutorFor(action *symbols.Symbol, self *Instance) (*ActionExecutor, error)
CreateActionExecutorFor creates an action executor for an action performed by self, without starting execution. An action a ToolExecution annotates has no flow to step: its tool is invoked once and the executor returned completed with its outputs.
func (*Context) CreateActionExecutorWithInputs ¶
func (ctx *Context) CreateActionExecutorWithInputs(action *symbols.Symbol, self *Instance, inputs map[string]Value) (*ActionExecutor, error)
CreateActionExecutorWithInputs creates an action executor for an action performed by self with its inputs bound ahead of its defaults, without starting execution.
func (*Context) CreateStateExecutor ¶
func (ctx *Context) CreateStateExecutor(stateMachine *symbols.Symbol) (*StateExecutor, error)
CreateStateExecutor creates a state executor without starting execution. For REPL debugging - allows step-by-step execution control.
func (*Context) CreateStateExecutorFor ¶
func (ctx *Context) CreateStateExecutorFor(stateMachine *symbols.Symbol, self *Instance) (*StateExecutor, error)
CreateStateExecutorFor creates a state executor for a machine performed by self, without starting execution.
func (*Context) Destroyed ¶
Destroyed reports the activation at which inst was destroyed, and whether it was; an object the context holds without a lifetime or one merely ended is not.
func (*Context) DrawPolicy ¶
func (ctx *Context) DrawPolicy() DrawPolicy
DrawPolicy is the policy the runs started from now on resolve their random draws under.
func (*Context) DrawPolicyTaken ¶
func (ctx *Context) DrawPolicyTaken() DrawPolicy
DrawPolicyTaken is the policy the last run's draws were resolved under: the witness's under a `replay` policy, whose recorded draws the run consumed, else the one the run started under, else the context's own before any run.
func (*Context) DrawsTaken ¶
DrawsTaken returns the random draws every run of the context made, in order, as a witness lists them: what a `replay` policy over them hands the same calls.
func (*Context) EnumerationLiteralValue ¶
EnumerationLiteralValue is the value sym has when it is an enumeration literal, reported as such so a caller holding only a symbol — an `%eval` of a literal — answers with the value rather than "no value".
func (*Context) Eval ¶
Eval is the top-level entry point for evaluating an expression in an empty environment. Resolves names from the root scope.
func (*Context) EvalDeclaredValue ¶
EvalDeclaredValue evaluates the value a usage declaration binds, as a read of the declaration does: in its own scope, and answering to its declared type. A usage binding none but shaped as an Array by its own features is that Array.
func (*Context) EvalWithScope ¶
EvalWithScope evaluates an expression with a given scope context for name resolution.
func (*Context) EvalWithScopeOn ¶
func (ctx *Context) EvalWithScopeOn(node ast.Node, scope *symbols.Scope, self *Instance) (Value, error)
EvalWithScopeOn evaluates an expression against a concrete instance, so a feature it names reads that object's feature value. It brackets one run, as EvalWithScope does, which is what bounds the evaluation by the step budget.
func (*Context) EvaluateConstraint ¶
EvaluateConstraint evaluates a constraint definition/usage naming no object: against the single object of this runtime carrying it, the declared defaults when there is none, ErrAmbiguousSubject when there are several. Returns (satisfied, error). If IsAssert=true, violation is an error. If IsAssert=false (assume), always returns (true, nil) but logs assumptions.
func (*Context) EvaluateConstraintOn ¶
func (ctx *Context) EvaluateConstraintOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (bool, error)
EvaluateConstraintOn evaluates a constraint against a concrete instance: a feature the constraint names resolves to that instance's feature value, so the same constraint can pass for one instance and fail for another. An instance that does not carry the constraint itself is searched for the nested object that does; a nil instance leaves the subject to EvaluateConstraint's rule.
func (*Context) EvaluateRequirement ¶
EvaluateRequirement evaluates a requirement definition/usage naming no object, choosing its subject as EvaluateConstraint does. Returns (satisfied, error). Validates subject/actor types and evaluates assume/require expressions. Assume members always pass (trusted), require members must evaluate to true.
func (*Context) EvaluateRequirementOn ¶
func (ctx *Context) EvaluateRequirementOn(sym *symbols.Symbol, scope *symbols.Scope, self *Instance) (bool, error)
EvaluateRequirementOn evaluates a requirement against a concrete instance, binding the features it names to that instance's feature values. The subject is chosen as EvaluateConstraintOn chooses it, and the subject/actor bindings are evaluated against that same object.
func (*Context) EvaluateSatisfaction ¶
func (ctx *Context) EvaluateSatisfaction(a *SatisfyAssertion) (bool, error)
EvaluateSatisfaction evaluates a satisfaction assertion against a fresh instance of its subject, so that the values the subject declares supply the requirement's own.
func (*Context) EvaluateSatisfactionOn ¶
func (ctx *Context) EvaluateSatisfactionOn(a *SatisfyAssertion, subject *Instance) (bool, error)
EvaluateSatisfactionOn evaluates a satisfaction assertion against a given object as its subject: the requirement's subject parameter is bound to that object, so a feature the requirement's conditions reach through the subject reads the value that object holds. A nil subject instantiates the feature the assertion names with `by`.
A false verdict is returned as a *ViolationError, which unwraps to ErrViolated: it is an answer about the model, not a failure to evaluate.
func (*Context) ExecuteAction ¶
ExecuteAction executes an action definition/usage to completion. Returns the values the action's features hold when it completed.
func (*Context) ExecuteActionPerformedBy ¶
func (ctx *Context) ExecuteActionPerformedBy(action *symbols.Symbol, self *Instance, inputs map[string]Value) (map[string]Value, error)
ExecuteActionPerformedBy executes an action performed by self, whose connections route what the action sends and whose variant selections decide which of them are realized. A nil self performs the action outside any object.
func (*Context) ExecuteActionReportingPerformer ¶ added in v0.9.2
func (ctx *Context) ExecuteActionReportingPerformer(action *symbols.Symbol, self *Instance, inputs map[string]Value) (outputs, performer map[string]Value, err error)
ExecuteActionReportingPerformer runs an action as ExecuteActionPerformedBy does and also reports its performer's attributes, keyed as ActionOutcomePerformedBy keys them.
func (*Context) ExecuteActionWithInputs ¶
func (ctx *Context) ExecuteActionWithInputs(action *symbols.Symbol, inputs map[string]Value) (map[string]Value, error)
ExecuteActionWithInputs executes an action, seeding its feature space with the provided input parameter bindings (keyed by parameter name). Inputs override action attribute defaults of the same name. Returns the final feature values.
func (*Context) ExecuteState ¶
ExecuteState executes a state machine, processing events until completion or suspension. Returns final state data from the state machine's execution. Execution stops when: - A final state is reached (StateCompleted) - Event queue is empty (StateSuspended) - Max event processing steps exceeded (error)
func (*Context) ExecuteStatePerformedBy ¶
func (ctx *Context) ExecuteStatePerformedBy(stateMachine *symbols.Symbol, self *Instance, events []string) (map[string]Value, []string, error)
ExecuteStatePerformedBy executes a state machine performed by self, whose connections route what the machine sends and whose variant selections decide which of them are realized. A nil self performs it outside any object.
func (*Context) ExecuteStateWithEvents ¶
func (ctx *Context) ExecuteStateWithEvents(stateMachine *symbols.Symbol, events []string) (map[string]Value, []string, error)
ExecuteStateWithEvents executes a state machine, first injecting the provided signal events (by signal-type name) into the event queue, then processing all events until completion or suspension. Returns the final state data and the ordered list of visited state names.
func (*Context) ExhibitsState ¶
ExhibitsState reports whether member is an exhibit declaration whose objects run sym's machine: member itself, anything its bindings reach, or a type they conform to. Declarations are compared.
func (*Context) FeaturesOf ¶
func (ctx *Context) FeaturesOf(typeSym *symbols.Symbol) []EffectiveFeature
FeaturesOf returns the ordered, deduplicated effective-feature list for the given type symbol. Result: own + inherited − redefined/masked, memoized per symbol.
func (*Context) FeaturesOfObject ¶
func (ctx *Context) FeaturesOfObject(inst *Instance) []ObjectFeature
FeaturesOfObject returns the features of an object under every type of it: the declared type's, then those each classifier adds, in declaration order, each name once.
func (*Context) FunctionValue ¶
FunctionValue is the function a read of the declaration sym denotes — a calc definition, or a calc usage with an input no read could supply — closed over its own scope and no object; false when sym is no calc read as one.
func (*Context) HeldObjects ¶
func (ctx *Context) HeldObjects(inst *Instance) ([]HeldObject, error)
HeldObjects returns the objects inst's object-valued features hold — occurrence usages and structured attributes alike — in feature order then collection order, materializing lazy ones as reading them does. An object reached through several features is listed once, under a scalar feature when it has one. A feature that cannot be read is a HeldObjectsError.
func (*Context) HoldsNoValue ¶
HoldsNoValue reports whether a value is an object materialized for a valueless feature of a value type. Such an object has no feature that could hold a value and is no value itself (KerML: a DataType classifies values), so it reads as unset rather than as an object.
func (*Context) HoldsObject ¶
HoldsObject reports whether the value is, or carries, an object of this context: one a reader can inspect, so the value is only meaningful in the context it came from.
func (*Context) Image ¶
Image takes the objects and everything they hold, own or name by value. It refuses, in a HeldImageError, a destroyed root (ErrOccurrenceDestroyed), ErrSnapshotMidRun, ErrSnapshotPausedBody, NotPortableError and ErrImageBound.
func (*Context) ImpliedCollection ¶ added in v0.9.2
ImpliedCollection reports whether the feature of inst named name is reached only through subsetting implied by nesting: enumeration surfaces skip it, an object it holds being listed under the declared feature that holds it.
func (*Context) ImpliedCollectionOfType ¶ added in v0.9.2
ImpliedCollectionOfType is ImpliedCollection for a type alone, over the features its instances would hold.
func (*Context) InputParameterNames ¶
InputParameterNames reports the input parameters a calc or analysis case declares, in the order an invocation's positional arguments bind them.
func (*Context) Instance ¶
Instance retrieves an instance by ID, so a caller holding a ValInstance can reach the object it names.
func (*Context) InstanceCount ¶
InstanceCount is how many objects this context holds, nested ones counted.
func (*Context) InstanceIDs ¶
InstanceIDs lists the identities of every object this context holds, in ascending order, so a caller can say which ids an unknown one is not among.
func (*Context) InstantValue ¶
InstantValue is instant t as the runtime reports the clock: a quantity in seconds when the library defines them, otherwise a bare real.
func (*Context) Instantiate ¶
Instantiate materializes an instance of the given usage/definition symbol. Allocates ID, creates feature values per FeaturesOf(sym), evaluates default values, leaves composite features lazy, then starts the behaviors the type exhibits or performs and runs them to quiescence. Returns the instance or an error.
Each call materializes a distinct object with an identity and behaviors of its own. The object becomes what the usage denotes from then on, so an expression naming the usage or a feature path under it reads this object as it was run.
func (*Context) InstantiateRead ¶
func (ctx *Context) InstantiateRead(sym *symbols.Symbol, read func(*Instance) error) (*Instance, error)
InstantiateRead is Instantiate with read run over the new object before it is returned, as one creation: a read that fails abandons the object with all it materialized, so a context under a bound is left as it was.
func (*Context) InvokeCalc ¶
func (ctx *Context) InvokeCalc(sym *symbols.Symbol, args []Value, scope *symbols.Scope) (Value, error)
InvokeCalc invokes a calculation with the given positional arguments and returns its result. Arguments bind to the calc's input parameters in declaration order; a parameter with no argument falls back to its declared default. The body is evaluated in the calc's own scope, so scope is used only as a fallback for a symbol that owns no scope. A library function's `expr` parameter takes a body or expression value, applied only when selected, or the operand's value itself.
func (*Context) InvokeCalcNamed ¶
func (ctx *Context) InvokeCalcNamed(sym *symbols.Symbol, args map[string]Value, scope *symbols.Scope) (Value, error)
InvokeCalcNamed invokes a calculation with arguments bound by parameter name. A parameter with no argument falls back to its declared default.
func (*Context) InvokeCalcWith ¶
func (ctx *Context) InvokeCalcWith(sym *symbols.Symbol, positional []Value, named map[string]Value, scope *symbols.Scope) (Value, error)
InvokeCalcWith invokes a calculation with positional arguments and arguments bound by parameter name together, which is what an argument list plus a swept parameter binds. Arguments bind exactly as InvokeCalc and InvokeCalcNamed bind them: by position first, then by name.
func (*Context) InvokeOperation ¶
func (ctx *Context) InvokeOperation(inst *Instance, name string, args map[string]Value) (map[string]Value, error)
InvokeOperation runs a behavior the object's type owns with the object as the performer: what the body reads and writes is that object's feature values, and what it sends and accepts carries that object's identity. Arguments bind to the operation's `in` and `inout` parameters by name.
func (*Context) InvokeOperationWith ¶
func (ctx *Context) InvokeOperationWith(inst *Instance, name string, args OperationArguments) (map[string]Value, error)
InvokeOperationWith is InvokeOperation taking either argument list form.
func (*Context) IsMonteCarloCase ¶
IsMonteCarloCase reports whether sym declares an analysis case specializing Simulation::MonteCarlo, matched by identity so a case merely named alike is none.
func (*Context) IsVariationFeature ¶
func (ctx *Context) IsVariationFeature(feat *EffectiveFeature) bool
IsVariationFeature reports whether a feature is a variation point, whose feature value holds the variant it is bound to rather than an object of itself.
func (*Context) JointOutcome ¶
JointOutcome is the outcome of several behaviors run on one clock: each one's observables under its name — a machine's `<name> finalState` and `<name> visits`, the values it holds and an action's outputs as `<name>.<feature>`.
func (*Context) MaterializationErrors ¶
MaterializationErrors reads every feature value of an object, and of the objects its feature values hold, and returns what materializing them reported, in the order the feature values were read. Feature values are lazy, so a default that does not conform to its feature's multiplicity is only found by reading it: a caller reporting on an object it created calls this rather than leaving those diagnostics to whoever reads a feature value next. bounded is true when the walk did not read every feature value — its budget was spent, or nesting it does not descend into was elided — so what it did not reach is unreported rather than clean.
func (*Context) MaxInstances ¶
MaxInstances is the bound SetMaxInstances set, zero when there is none.
func (*Context) MeasurementUnitValue ¶
MeasurementUnitValue is the reference a measurement-unit declaration names (true for one). A library unit is the declaration whatever defines it (`'m/s' = m/s`); a model feature typed by a unit and given a value holds that value instead (false). A measurement scale (`UTC`, `'°C_abs'`) is the one-axis frame its declaration describes.
func (*Context) Notes ¶
Notes returns what the latest run noted about itself, in order: its choice points and the guards it could not evaluate.
func (*Context) ObjectivesOf ¶
ObjectivesOf returns the objectives sym states, its inherited ones first and in declaration order. An objective restating an inherited one, by name or by redefinition, is the same objective declared again and keeps its place.
func (*Context) ObserveMonteCarlo ¶
func (ctx *Context) ObserveMonteCarlo(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (*MonteCarloRun, error)
ObserveMonteCarlo makes one run of a Simulation::MonteCarlo case as RunAnalysis would, reading `observed` and the checks in place of the outputs, which ConcludeMonteCarlo evaluates.
func (*Context) OccurrenceLife ¶
func (ctx *Context) OccurrenceLife(id int64) (OccurrenceLife, bool)
OccurrenceLife answers the lifetime of the occurrence an instance identity denotes, and false for an identity the context never registered.
func (*Context) OccurrenceUsage ¶
OccurrenceUsage is the qualified name of the declared usage inst is an occurrence of, or "" for an object materialized any other way.
func (*Context) PendingMessages ¶
PendingMessages returns the messages still in flight, oldest first.
func (*Context) PerformState ¶
func (ctx *Context) PerformState(stateMachine *symbols.Symbol, self *Instance, events []QueuedEvent) (*StateExecutor, error)
PerformState drives one performance of a state machine, by self or by no object: it enters the initial state, queues the events, and runs through the executor's own loop to completion or suspension, returning the executor for its outcome. The conformance harness and the referees drive machines this way.
func (*Context) PostMessage ¶
PostMessage puts a message on the context-wide bus, where every executor sharing this context can see it. Actions and state machines communicate through this bus rather than through per-executor queues, so a message a state machine's entry action sends can be accepted by one of its transitions.
A message posted with a destination but no Delivery — one injected from outside the model — is held to the destination it names.
func (*Context) Pristine ¶
Pristine reports whether inst is as its declaration materializes it in a fresh context: nothing written, no behavior moved nor waiting on a clock past zero, no message awaiting it or open to it, not destroyed. Else a HeldStateError names the reason.
func (*Context) ReadInSatisfaction ¶ added in v0.9.2
func (ctx *Context) ReadInSatisfaction(a *SatisfyAssertion, subject *Instance, scope *symbols.Scope, ref ast.Node) (Value, error)
ReadInSatisfaction evaluates ref, written in scope, as a's require conditions read it on subject: with the requirement's subject and other members bound as checkSatisfactionOn binds them.
func (*Context) RequireAnalysisCase ¶
RequireAnalysisCase reports ErrNotAnAnalysis for a symbol that is not a case whose body runs — an analysis or verification case definition or usage — describing what it is instead.
func (*Context) RequireMonteCarloCase ¶
RequireMonteCarloCase reports ErrNotMonteCarlo for a symbol that is not an analysis case specializing Simulation::MonteCarlo, describing what it is instead.
func (*Context) RequireVerificationCase ¶
RequireVerificationCase reports ErrNotAVerification for a symbol that is not a verification case definition or usage, describing what it is instead.
func (*Context) Reschedule ¶
func (ctx *Context) Reschedule(policy SchedulePolicy) error
Reschedule is SetSchedule reaching the runs driven call by call as well — the clock and the behaviors the objects run — which resolve their choice points under the policy from their next step on, as a run started under it would from its first: their configurations, pending events, clock and choices so far are kept, and the draws of a seeded policy start over. It fails with ErrRescheduleMidRun from inside a step.
func (*Context) ResolveSweepPlan ¶
func (ctx *Context) ResolveSweepPlan(sym *symbols.Symbol, plan SweepPlan, positional int, named []string) (SweepPlan, error)
ResolveSweepPlan refuses a range over a parameter the target does not declare, its subject or one the invocation binds, and types each range by its parameter.
func (*Context) Resolver ¶
Resolver returns the name resolver this context resolves references with.
func (*Context) RunAnalysis ¶
func (ctx *Context) RunAnalysis(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (AnalysisResult, error)
RunAnalysis runs an analysis case — a definition or a usage — binding its subject and input parameters from args and its own declarations, and reports every output it declares together with the verdict of each objective and assertion. self, when non-null, is the object a usage is a feature of. A usage run with no arguments answers from the same evaluation a read of its outputs does, so both report the same values. A run whose output could not be evaluated fails, and reports beside the error what it did establish: the evaluations it made and the verdicts, undecided where they read that output.
func (*Context) RunVerification ¶
func (ctx *Context) RunVerification(sym *symbols.Symbol, args AnalysisArgs, scope *symbols.Scope, self *Instance) (VerificationResult, error)
RunVerification runs a verification case's body as RunAnalysis runs an analysis case's — same lowering, same subject and input binding, same step execution — and reports the verdict the body produced together with the objective and assertion verdicts of the same run.
A body that cannot run is the case's error verdict carrying the message, not an error of the call: a verdict is what a verification case answers. An error is returned only for a request that cannot be made at all — a symbol that is not a verification case, or arguments the case does not take.
func (*Context) SatisfyAssertionOf ¶
func (ctx *Context) SatisfyAssertionOf(sym *symbols.Symbol) (*SatisfyAssertion, error)
SatisfyAssertionOf returns the assertion sym declares, or an error when sym is not a satisfaction assertion. It names the one a `satisfy requirement r by p` form declares under a name.
func (*Context) SatisfyAssertionsIn ¶
func (ctx *Context) SatisfyAssertionsIn(scope *symbols.Scope) []*SatisfyAssertion
SatisfyAssertionsIn returns the satisfaction assertions stated in scope and, recursively, in the scopes nested within it, in declaration order. An assertion is anonymous in its usual form, so it is reached through the element that states it rather than by name.
func (*Context) SatisfySubject ¶
func (ctx *Context) SatisfySubject(a *SatisfyAssertion) (*Instance, error)
SatisfySubject returns an object of the feature a satisfaction assertion names with `by`: the object its requirement is evaluated against when the caller supplies none. A plain name is instantiated afresh; a feature chain is read as the expression it is, so `config.child` materializes the occurrence `config` and answers the object its `child` holds.
func (*Context) Schedule ¶
func (ctx *Context) Schedule() SchedulePolicy
Schedule returns the policy the next run resolves its choice points under.
func (*Context) SetBudgets ¶
SetBudgets replaces the bounds this context runs under, rejecting a set that holds a non-positive bound. The evaluation step counter already spent is left alone: the budget is a bound on the run, not a reset of it.
func (*Context) SetCalcCompile ¶
SetCalcCompile turns the compiled tier on or off for this context.
func (*Context) SetClockStep ¶
SetClockStep makes the waits set from now on come due at multiples of step seconds, as a simulation clock ticking by step does: a wait ending between two ticks comes due at the later. 0 restores the continuous clock.
func (*Context) SetDrawPolicy ¶
func (ctx *Context) SetDrawPolicy(policy DrawPolicy)
SetDrawPolicy fixes how the runs started from now on resolve their random draws; a run under way, paused or not, keeps the policy it started under.
func (*Context) SetMaxInstances ¶
SetMaxInstances bounds the objects this context holds at once, nested ones counted, zero lifting it; the materialization past it is ErrInstanceLimitExceeded.
func (*Context) SetModelSeed ¶
SetModelSeed fixes the seed the modeled draws of the runs started from now on come from, independent of the scheduling policy; ClearModelSeed unsets it.
func (*Context) SetSchedule ¶
func (ctx *Context) SetSchedule(policy SchedulePolicy) error
SetSchedule sets the policy the runs started from now on resolve their choice points under; a run already under way keeps the one it started with. An `explore` policy is ErrExploreUndriven: it is driven by Explore. A `replay` policy starts its witness over, which the runs then follow in turn.
func (*Context) SetSharedDefaults ¶ added in v0.9.2
SetSharedDefaults turns derived-default sharing between occurrences on or off.
func (*Context) SetToolRunner ¶
func (ctx *Context) SetToolRunner(runner ToolRunner)
SetToolRunner attaches the runner tool-computed actions and calcs of this context's runs invoke.
func (*Context) SetTrace ¶
func (ctx *Context) SetTrace(tr *TraceRecorder)
SetTrace attaches a trace recorder to this context, so that every expression and calc evaluated through it is recorded. Pass nil to stop tracing.
func (*Context) ShapeDigest ¶
ShapeDigest renders what instantiating a type produces as this context resolves it now: the features an object of it gets, with the type, multiplicity and default of each, and the shapes of the types those features hold. Two contexts that agree on the digest agree on the object.
func (*Context) ShapesOf ¶
ShapesOf records the shapes obj and everything it holds were materialized against: the objects reachable through its feature values and connector ends, plus the variants its values selected. A connector no name reaches is materialized again rather than carried, so it is no part of this.
func (*Context) ShapesOfType ¶
ShapesOfType records the shape of one declaration as this context resolves it, which is what state held over a declaration rather than an object — a debugging session over an action — is invalidated by a change to.
func (*Context) ShareVerdicts ¶ added in v0.9.2
func (ctx *Context) ShareVerdicts() (done func())
ShareVerdicts opens a span over which checks on objects of one shape share their verdicts; the function returned closes it. A span opened within another continues it.
func (*Context) SharedDefaults ¶ added in v0.9.2
SharedDefaults reports whether this context shares derived defaults between occurrences.
func (*Context) SharedDefaultsTaken ¶ added in v0.9.2
SharedDefaultsTaken counts the derived values occurrences took from the shared table rather than deriving; a measure of what the sharing saved.
func (*Context) SharedVerdictsTaken ¶ added in v0.9.2
SharedVerdictsTaken counts the verdicts taken from the open span rather than decided by evaluating; zero outside a span.
func (*Context) SignalMessage ¶
func (ctx *Context) SignalMessage(signal *symbols.Symbol, args map[string]Value, to *Instance) (Message, error)
SignalMessage builds the message `send Signal(args) to <object>` posts, for PostMessage; a nil object is one anyone may take, an argument no feature of the signal admits is refused. An element that is no signal definition (see SignalDefinitionKinds) is refused with ErrNotASignal.
func (*Context) Snapshot ¶
Snapshot captures the run-derived state of the context between steps: its objects and their values, the bus, the clock, its run bookkeeping and the state of every behavior an object of it runs. An executor driven over the context is captured through its own Snapshot. It fails with ErrSnapshotMidRun from inside a step; a body paused mid-statement is captured where it paused.
func (*Context) SourceLocation ¶
SourceLocation renders where a span in a file was written, as `file:line:col`, falling back to a byte offset for a file whose text was not registered.
func (*Context) StateOutcomePerformedBy ¶
func (ctx *Context) StateOutcomePerformedBy(stateMachine *symbols.Symbol, self *Instance, events []string) (Outcome, error)
StateOutcomePerformedBy runs a state machine as ExecuteStatePerformedBy does and reports the outcome an exploration compares: its own and, under `this.`, the performer's attributes.
func (*Context) StateOutcomeWithEvents ¶
func (ctx *Context) StateOutcomeWithEvents(stateMachine *symbols.Symbol, events []string) (Outcome, error)
StateOutcomeWithEvents runs a state machine as ExecuteStateWithEvents does and reports where it came to as the outcome an exploration compares.
func (*Context) SubsettingFeatures ¶
func (ctx *Context) SubsettingFeatures(inst *Instance, typ *symbols.Symbol, name string) []EffectiveFeature
SubsettingFeatures returns the features of typ subsetting the named feature under any of its redefinition names, in declaration order, reading nothing; inst is nil for a type alone.
func (*Context) SweepRunBudget ¶
SweepRunBudget is the number of runs one sweep may ask for when none is stated.
func (*Context) TakeMessage ¶
TakeMessage removes and returns the oldest message satisfying match. Messages that do not match keep their place in the queue, so a consumer looking for one type does not consume or reorder another's. A match probing the machines may post and drop messages behind the one it examines; those are visited too.
func (*Context) ToolRunner ¶
func (ctx *Context) ToolRunner() ToolRunner
ToolRunner is the runner attached, nil when none is.
func (*Context) Trace ¶
func (ctx *Context) Trace() *TraceRecorder
Trace is the recorder attached to this context, nil when not tracing.
func (*Context) UnevaluableGuards ¶
func (ctx *Context) UnevaluableGuards() []UnevaluableGuard
UnevaluableGuards returns the guards the latest run could not evaluate, in order.
func (*Context) Unfollowed ¶
Unfollowed is the first witness move the last run under a `replay` policy could not make — one refused, or one left over when the run ended — as a ReplayError; nil when the run followed its witness whole or ran under another policy.
func (*Context) UnitOf ¶
UnitOf reads a unit spelled as expression text in scope, else in the library's SI package, which a nil scope reads alone; the reading is memoized per scope.
func (*Context) ValidateObject ¶
func (ctx *Context) ValidateObject(root *Instance, scopes []*symbols.Scope) (ValidationReport, error)
ValidateObject checks every assertion about root and the objects it holds: asserted constraints, carried requirements, and satisfactions (in scopes or the types) about them.
func (*Context) VerificationVerdicts ¶
func (ctx *Context) VerificationVerdicts(sym *symbols.Symbol) []VerificationVerdict
VerificationVerdicts runs one verification case and reports its body verdict followed by the verdict of each subcase it performs.
func (*Context) VerificationVerdictsIn ¶
func (ctx *Context) VerificationVerdictsIn(scopes []*symbols.Scope, req *symbols.Symbol) []VerificationVerdict
VerificationVerdictsIn runs the verification cases of every scope whose objective verifies req, each once, and reports its body verdict and the verdict of every subcase it performs. A nested case answers only as a subcase.
func (*Context) VerificationsOf ¶
VerificationsOf returns the verification cases declared in scope, and in the scopes nested within it, whose objective verifies req (SysML v2 §8.3.24), in declaration order. A nil requirement matches every verification case.
func (*Context) VerifiedOutcome ¶
func (ctx *Context) VerifiedOutcome(result AnalysisResult, verdicts []VerificationVerdict) Outcome
VerifiedOutcome is the outcome of a verification case's run: the case's outcome, and what each body answered as a value named by the case that ran.
func (*Context) VerifiedRequirements ¶
VerifiedRequirements returns the requirements the objectives of a verification case verify, in declaration order. The objectives are the ones the case states as it runs them, so an objective a case redeclares verifies what the redeclaration says and not also what the inherited one said.
func (*Context) VerifyingCase ¶
func (ctx *Context) VerifyingCase(a *SatisfyAssertion) *symbols.Symbol
VerifyingCase returns the verification case whose objective states a `verify requirement` assertion, and nil for an assertion stated elsewhere: a `satisfy`, or a `verify` outside an objective.
type CoordinateFrame ¶
type CoordinateFrame struct {
Decl *symbols.Symbol // the usage declaring the frame; nil for one composed by arithmetic
Type *symbols.Symbol // the type the frame is a value of
Dimensions []int64 // `dimensions`: (3) for a 3-D frame, () for a scale
Axes []Unit // `mRefs`, one per element the dimensions shape
Transformation *CoordinateTransformation // `transformation`, whose target is this frame; nil for none
Scale *MeasurementScale // what a MeasurementScale adds; nil for a frame
Object int64 // the object the frame was read from; 0 for one composed
Text string // the frame as written: `spatialCF`, `spatialCF / s`
}
CoordinateFrame is a VectorMeasurementReference held as a value: the axes of a coordinate frame, or the one axis a measurement scale is, with the placement relating it to another reference where the model states one.
func (*CoordinateFrame) FlattenedSize ¶
func (f *CoordinateFrame) FlattenedSize() (int64, bool)
FlattenedSize is the number of axes the dimensions shape: their product, 1 for a scalar reference's empty dimensions; false when it does not fit an Integer.
func (*CoordinateFrame) IsScale ¶
func (f *CoordinateFrame) IsScale() bool
IsScale reports whether the frame is a measurement scale.
func (*CoordinateFrame) Name ¶
func (f *CoordinateFrame) Name() string
Name is how the frame is referred to in diagnostics: its declared name, else how it was composed.
func (*CoordinateFrame) String ¶
func (f *CoordinateFrame) String() string
String renders the frame as its name over its axes: `spatialCF [m, m, m]`; a scale over the unit its magnitudes are in: `°C_abs [°C]`.
type CoordinateTransformation ¶
type CoordinateTransformation struct {
Decl *symbols.Symbol // the usage declaring the transformation; nil for a constructed one
Type *symbols.Symbol // the type the transformation is a value of
Source *CoordinateFrame // `source`; nil when the model states none
Target *CoordinateFrame // `target`; nil for a frame's own transformation, whose target it is
Placement *FramePlacement
Sequence []FrameStep
Affine *AffineTransformation3d
Object int64
}
CoordinateTransformation is a CoordinateTransformation held as a value: the placement of the target in the source by at most one of Placement, Sequence and Affine; a subtype of no library shape holds none and cannot be applied.
func (*CoordinateTransformation) Name ¶
func (t *CoordinateTransformation) Name() string
Name is how the transformation is referred to in diagnostics.
func (*CoordinateTransformation) String ¶
func (t *CoordinateTransformation) String() string
String renders the transformation as its name over the frames it relates: `trs (datum → lbcf)`.
type Counted ¶
Counted is one term of a weighted mean: Value, over Count runs; the count is exact, as the runs a tool summarises are.
type CyclicBindingError ¶
CyclicBindingError reports a namespace-level usage whose value reaches back to the usage itself while it is being bound, naming that usage.
func (*CyclicBindingError) Error ¶
func (e *CyclicBindingError) Error() string
func (*CyclicBindingError) Unwrap ¶
func (e *CyclicBindingError) Unwrap() error
type Decision ¶
Decision is what dispatching a message now would do: the transitions that would fire on it, that the active state would defer it, or the do behaviors parked at an accept it lets go on.
type DeclaredReader ¶
type DeclaredReader struct {
// contains filtered or unexported fields
}
DeclaredReader reads feature values as the model declares them for a concrete carrier, materializing each element once and starting no behavior.
func NewDeclaredReader ¶
func NewDeclaredReader(model *semantics.Model, resolver *resolve.Resolver) *DeclaredReader
NewDeclaredReader creates a reader over a fresh, behavior-free runtime context. model carries the checker's argument typing, as NewModel requires: a feature valued by a call is read through it, and fails with ErrNoArgumentTyper without one.
func NewDeclaredReaderIn ¶ added in v0.9.2
func NewDeclaredReaderIn(held *Context) *DeclaredReader
NewDeclaredReaderIn creates a reader on a fresh declarative context seeded from held: its tool runner, so tool-computed calcs a derived feature calls answer through the same runner, the parser reading the units they answer in, the budgets it runs under, and the notes a run makes, which held's own Notes report.
func (*DeclaredReader) CompareMagnitudes ¶
func (r *DeclaredReader) CompareMagnitudes(left, right semantics.Quantity) (int, error)
CompareMagnitudes orders two quantities on the left one's reference, a point on a measurement scale carried through its anchor.
func (*DeclaredReader) QuantityBinary ¶
func (r *DeclaredReader) QuantityBinary(op ast.OperatorKind, left, right semantics.Quantity) (semantics.Quantity, error)
QuantityBinary applies a binary operator to two quantities as evaluation does, the affine cases of a point on a measurement scale included.
func (*DeclaredReader) QuantityUnary ¶
func (r *DeclaredReader) QuantityUnary(op ast.OperatorKind, q semantics.Quantity) (semantics.Quantity, error)
QuantityUnary applies a unary operator to a quantity as evaluation does: a point on a measurement scale (`26.85 [SI::'°C_abs']`) has no negative.
func (*DeclaredReader) Read ¶
Read evaluates the named feature of the element sym denotes, resolving every leaf through that element's redefinitions. An unbound leaf is a *NoValueError.
func (*DeclaredReader) Validate ¶
func (r *DeclaredReader) Validate(sym *symbols.Symbol, scopes []*symbols.Scope) (ValidationReport, error)
Validate checks every assertion about the object the element declares, and the objects it holds, as the model declares them: ErrNotAnObject for an element with no object (a package, an attribute).
func (*DeclaredReader) VerificationVerdictsIn ¶
func (r *DeclaredReader) VerificationVerdictsIn(scopes []*symbols.Scope, req *symbols.Symbol) []VerificationVerdict
VerificationVerdictsIn runs the verification cases in scopes whose objective verifies req, in the reader's behavior-free context.
type DeliveryKind ¶
type DeliveryKind uint8
DeliveryKind is what a message's destination resolved to, and so what a consumer must match: an unaddressed message resolved nothing and any consumer may take it, while every addressed or routed one names a destination in full.
const ( // DeliverAnyone is a message no send addressed, such as one injected from // outside the model: it has no destination to hold a consumer to. DeliverAnyone DeliveryKind = iota // DeliverPort is the port of an object, reached by a connection or addressed. DeliverPort // DeliverPortReceiver is a receiver of an object reached through a port. DeliverPortReceiver // DeliverReceiver is the receiving node named within an object. DeliverReceiver // DeliverObject is an object itself, whichever of its consumers accepts. DeliverObject )
type Dispatch ¶
Dispatch is what became of an event a step took off the queue: a transition fired on it, a state deferred it, or nothing was enabled for it and it was dropped; Resumed names the states whose do behavior went on from an accept with it.
type Distribution ¶
type Distribution struct {
Count int
Integral bool
Min semantics.Value
Mean float64
// Deviation is the sample standard deviation about Mean, 0 for fewer than two runs.
Deviation float64
Max semantics.Value
P50 semantics.Value
P90 semantics.Value
Histogram []HistogramBin
}
Distribution summarises one observable over the runs of a Monte Carlo: extremes, mean, sample standard deviation, nearest-rank p50/p90 and a histogram, exact on Integers save the Real mean and deviation.
func Distribute ¶
func Distribute(numbers []semantics.Value) *Distribution
Distribute summarises numbers in any order, nil for none: all Integers make an integral distribution computed on int64, a Real among them one over Reals.
type Divergence ¶
type Divergence struct {
Feature string
Values []DivergentValue
}
Divergence is a feature whose final value the schedule decides: every value some complete schedule leaves it with, in canonical order.
func (Divergence) String ¶
func (d Divergence) String() string
String spells the divergence as `x ends as 1 or 2`.
type DivergentValue ¶
DivergentValue is one final value of a divergent feature and a schedule reaching it.
type DrawParseError ¶
DrawParseError reports a draw line ParseDraw could not read, with why.
func (*DrawParseError) Error ¶
func (e *DrawParseError) Error() string
func (*DrawParseError) Is ¶
func (e *DrawParseError) Is(target error) bool
Is makes every DrawParseError match ErrInvalidDraw.
type DrawPoint ¶
type DrawPoint struct {
Draw DrawTaken
}
DrawPoint is a random draw as a run notes it, in the trace where it was made.
func (DrawPoint) Diagnostic ¶
func (d DrawPoint) Diagnostic() diag.Diagnostic
Diagnostic is the draw as an informational finding about the run.
type DrawPolicy ¶
type DrawPolicy int
DrawPolicy is how a run resolves the draws of the RandomFunctions library: at random from the seeded stream, or at a fixed point of each call's distribution. Weighted decisions are not durations, so they draw the same under every policy.
const ( // DrawRandom draws from the seeded modeled stream, or a witness's recorded draws. DrawRandom DrawPolicy = iota // DrawMin yields the least value each call can draw. DrawMin // DrawMax yields the greatest value each call can draw. DrawMax // DrawAverage yields the mean of each call's distribution. DrawAverage )
func ParseDrawPolicy ¶
func ParseDrawPolicy(text string) (DrawPolicy, error)
ParseDrawPolicy reads a policy spelling: one of DrawPolicyNames.
func (DrawPolicy) Fixed ¶
func (p DrawPolicy) Fixed() bool
Fixed reports whether the policy resolves every draw without a random stream.
func (DrawPolicy) String ¶
func (p DrawPolicy) String() string
String is the policy's spelling, as ParseDrawPolicy reads it.
type DrawTaken ¶
DrawTaken is one random value a run drew: the call that drew it with its arguments as evaluated, and the value, spelt `draw uniform(1, 80) = 42.5`.
type DrawUnboundedError ¶
type DrawUnboundedError struct {
What string
Policy DrawPolicy
}
DrawUnboundedError names the call a fixed policy could not resolve.
func (*DrawUnboundedError) Error ¶
func (e *DrawUnboundedError) Error() string
func (*DrawUnboundedError) Is ¶
func (e *DrawUnboundedError) Is(target error) bool
Is makes every DrawUnboundedError match ErrDrawUnbounded.
type EffectiveFeature ¶
type EffectiveFeature struct {
Name string
Symbol *symbols.Symbol // the declaring feature symbol
OwnerType *symbols.Symbol // type that declares this feature (may be supertype)
Type *symbols.Symbol // resolved type (nil if untyped)
Multiplicity semantics.Range // declared or inherited (default 1..1)
DefaultValue ast.Node // value-binding expression (nil if none)
DefaultDecl *symbols.Symbol // feature the DefaultValue was written on (nil if none)
HoldsSet bool // values form a set: a Collection's unordered unique elements
Unique bool // holds no two equal values (KerML isUnique, the default)
// GovernedByChain marks a feature a valued nested chain from a more specific
// body reaches below, so its bound value does not govern, as with a
// redefining body.
GovernedByChain bool
}
EffectiveFeature represents one feature value in a type's flattened schema: own + inherited − redefined/masked, carrying type + multiplicity + default.
func (*EffectiveFeature) DeclScope ¶
func (f *EffectiveFeature) DeclScope() *symbols.Scope
DeclScope returns the scope the feature was declared in, which is the scope a default value written on it must be evaluated in: an inherited feature's default refers to names visible where the supertype was written, not where the instantiated type is.
func (*EffectiveFeature) DefaultIsFallback ¶
func (f *EffectiveFeature) DefaultIsFallback() bool
DefaultIsFallback reports whether DefaultValue was written with `default`: a value the feature holds only when nothing else populates it.
func (*EffectiveFeature) DefaultScope ¶
func (f *EffectiveFeature) DefaultScope() *symbols.Scope
DefaultScope returns the scope DefaultValue resolves its names in, which for an inherited default is where the redefined declaration wrote it.
func (*EffectiveFeature) HoldsOnlyContributions ¶
func (f *EffectiveFeature) HoldsOnlyContributions() bool
HoldsOnlyContributions reports whether a feature of known multiplicity materializes no object of its own: it is abstract, or a scalar whose lower bound demands none and whose own body describes none.
func (*EffectiveFeature) Scalar ¶
func (f *EffectiveFeature) Scalar() bool
Scalar reports whether the feature holds at most one value.
type EvalContext ¶
type EvalContext struct {
// contains filtered or unexported fields
}
EvalContext is the lexical environment during evaluation (Tier 3).
func NewEvalContext ¶
func NewEvalContext(ctx *Context, scope *symbols.Scope) *EvalContext
NewEvalContext creates an evaluation context with an empty frame stack. It inherits the runtime context's trace recorder, so every evaluation reached from a traced context is recorded, including nested calc invocations.
func NewEvalContextIn ¶
func NewEvalContextIn(ctx *Context, scope *symbols.Scope, self *Instance) *EvalContext
NewEvalContextIn creates an evaluation context bound to an instance, so that a feature name resolves to that instance's feature value rather than to the declared default of the same name.
func (*EvalContext) Eval ¶
func (ec *EvalContext) Eval(node ast.Node) (Value, error)
Eval evaluates an expression node. Returns a Value or an error. Increments the run's steps on each eval call; errors when they are >= ctx.maxSteps. When the context is traced, the evaluation is recorded after its sub-expressions, which makes sub-expression order part of the trace.
func (*EvalContext) Lookup ¶
func (ec *EvalContext) Lookup(name string) (Value, bool)
Lookup searches for a name in the frame stack (innermost first).
func (*EvalContext) Pop ¶
func (ec *EvalContext) Pop()
Pop removes the top frame from the stack (on return, lambda exit).
func (*EvalContext) Push ¶
func (ec *EvalContext) Push(bindings map[string]Value)
Push adds a new frame to the stack (on calc invocation, lambda entry).
type Event ¶
type Event struct {
ID int64 // Unique event ID
Type EventType // Event type
Timestamp float64 // Virtual time when event fires
Payload interface{} // Event-specific data
}
Event represents a state machine event.
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
EventQueue is a priority queue of events sorted by timestamp (min-heap).
func (*EventQueue) CompletionsOf ¶
func (q *EventQueue) CompletionsOf(source ast.Node) []Event
CompletionsOf lists the queued completion events carrying a transition out of source, in arrival order.
func (*EventQueue) Events ¶
func (q *EventQueue) Events() []Event
Events lists the pending events in dispatch order.
func (*EventQueue) Peek ¶
func (q *EventQueue) Peek() Event
Peek returns the earliest event without removing it.
func (*EventQueue) Pop ¶
func (q *EventQueue) Pop() Event
Pop removes and returns the earliest event.
func (*EventQueue) Take ¶
func (q *EventQueue) Take(id int64) (Event, bool)
Take removes and returns the event with the given ID, false when none has it.
func (*EventQueue) Tied ¶
func (q *EventQueue) Tied() []Event
Tied lists the events the queue leaves unordered at its head, in arrival order: none when the head is a completion event or every event at its instant came from the pool, whose arrival order is fixed; else the time triggers due at that instant and the earliest pool event, when there are two or more of them.
func (*EventQueue) TimerOf ¶
func (q *EventQueue) TimerOf(trans *lower.Transition) (Event, bool)
TimerOf returns the queued time event carrying trans, false when its timer is not running.
func (*EventQueue) With ¶
func (q *EventQueue) With(e Event) *EventQueue
With is a copy of the queue with the event pushed; the queue itself is untouched.
func (*EventQueue) Withdraw ¶
func (q *EventQueue) Withdraw(drop func(Event) bool)
Withdraw drops every pending event the predicate accepts, which cancels an occurrence a state no longer waits for.
type ExecutionState ¶
type ExecutionState int
ExecutionState tracks executor state.
const ( StateReady ExecutionState = iota // Not started StateRunning // In progress StateCompleted // Reached terminal state StateSuspended // Paused for debugging StateWaiting // Every remaining token is parked at an accept StateTerminated // Ended by a terminate before reaching a terminal state )
func (ExecutionState) Ended ¶
func (s ExecutionState) Ended() bool
Ended reports an execution over for good: completed, or ended by a terminate.
func (ExecutionState) String ¶
func (s ExecutionState) String() string
type Exploration ¶
type Exploration struct {
Budget ExploreBudget
Runs int
Outcomes []ExploredOutcome
// BudgetsHit names the budgets the exploration ran into, `runs` before
// `depth`; none when it is complete.
BudgetsHit []string
}
Exploration is what exploring a behavior found: its distinct outcomes, in canonical order, and whether every linearization within the budget was run.
func Explore ¶
func Explore(stop context.Context, policy SchedulePolicy, fresh func() (*Context, error), run func(*Context) (Outcome, error)) (*Exploration, error)
Explore runs a behavior once per linearization within the policy's budget, one run at a time in plan order: fresh builds each run's context, run performs it and reports the outcome. A run that failed is an outcome; a caller that goes away between runs takes the exploration with it, its error being stop's. It is ExploreWith on one job.
func ExploreWith ¶
func ExploreWith(stop context.Context, policy SchedulePolicy, jobs int, fresh func(job int) (*Context, error), run func(*Context) (Outcome, error)) (*Exploration, error)
ExploreWith explores as Explore does with up to jobs runs going concurrently, fresh building each run's context for the job making it; the result does not depend on jobs.
The prefixes form a work queue in plan order, the order one job visits them, and the runs budget is a cut in that order. Plan order is by departures first — every prefix departing from the first run at one choice before any departing at two — so a budget of one more run than the first run's choice points varies each of them at least once, then by the position of the choice varied, earliest first. A run is committed once every prefix before it has completed; one started earlier is speculative, and at most jobs of those are discarded in all. The queue never holds more than runs prefixes, so no more than runs jobs are ever put to work.
func (*Exploration) Complete ¶
func (x *Exploration) Complete() bool
Complete reports whether every linearization was run.
func (*Exploration) ProbabilitiesBounded ¶
func (x *Exploration) ProbabilitiesBounded() bool
ProbabilitiesBounded reports whether the outcomes' probabilities are lower bounds: they are while a budget kept some linearizations unexplored.
func (*Exploration) Probability ¶
func (x *Exploration) Probability() float64
Probability is the share of the schedule space the exploration covered: the sum of its outcomes' probabilities, 1 for a complete one.
func (*Exploration) Status ¶
func (x *Exploration) Status() string
Status renders how the exploration ended: `complete (N runs)`, or which budget was hit after how many runs.
type ExploreBudget ¶
ExploreBudget bounds an exploration: how many runs it may make and how many choice points one run may resolve before the rest take their first alternative.
type ExploredOutcome ¶
type ExploredOutcome struct {
Outcome Outcome
Linearizations int
// Probability is the share of the schedule space reaching this outcome: the
// sum of its linearizations' probabilities, each the product of its choice
// points' shares — a weighted point's stated weight, an unweighted one's
// uniform share. It is the model's own probability when every point is
// weighted, and a lower bound while the exploration is incomplete.
Probability float64
Witness []ChoiceTaken
// WitnessRun is the 1-based number of the run the witness is.
WitnessRun int
}
ExploredOutcome is one distinct outcome an exploration reached: how many linearizations reached it, the probability they carry, and the choices of the first run that did.
type ExpressionParser ¶
ExpressionParser parses text, read from origin, as exactly one expression; false for anything else. The caller that builds a Model supplies it; the runtime parses nothing itself.
type FeatureOwner ¶
type FeatureOwner int
FeatureOwner tells whose feature a name a check compares resolves to.
const ( // OwnedByAction: a feature the action holds itself. OwnedByAction FeatureOwner = iota // OwnedByPerformer: `this.<name>`, a feature of the object performing the action. OwnedByPerformer // OwnedByNode: `node.path`, a feature a performance of one of the action's nodes holds. OwnedByNode )
type FeatureValue ¶
type FeatureValue struct {
Feature *EffectiveFeature
Value Value // scalar feature value (multiplicity [1])
Values Value // collection feature value (Sequence or Set)
Materialized bool // lazy flag: has this feature value been instantiated?
Written bool // a run assigned this value, so no default derives it again
BindingDerived bool // value came from binding propagation rather than a write
// Assumed marks a value fixed by nothing but the feature's multiplicity: its
// minimum materialized, or contributions short of its maximum.
Assumed bool
// contains filtered or unexported fields
}
Feature value holds the runtime value(s) for one feature.
func (*FeatureValue) HeldValue ¶
func (s *FeatureValue) HeldValue() Value
HeldValue is the value the feature value reads as: its collection when the feature is multi-valued, otherwise its scalar.
func (*FeatureValue) ReadValue ¶
func (s *FeatureValue) ReadValue(name string) (Value, error)
ReadValue is what the feature value reads as in an expression: what it holds, or the empty sequence when it holds nothing and its multiplicity admits that. A required feature holding nothing is uninitialized.
type FeatureValueError ¶
type FeatureValueError struct {
Err error
}
FeatureValueError marks a feature value that could not be materialized. It reads as the error that kept the feature value from materializing and unwraps to it as well as to ErrFeatureValueMaterialization, so a caller tests either.
func (*FeatureValueError) Error ¶
func (e *FeatureValueError) Error() string
func (*FeatureValueError) Unwrap ¶
func (e *FeatureValueError) Unwrap() []error
type FiredTransition ¶
FiredTransition is one transition taken: where it was written and the vertices it joined. An entry transition has no Source; it leaves the start of Owner's body, the one keying it in the graph's EntryTransitions (nil: the machine's own).
type FramePlacement ¶
type FramePlacement struct {
Origin Value // a vector quantity, or a scalar quantity for a one-dimensional frame
BasisDirections []Value // vector quantities, one per target axis
}
FramePlacement is a CoordinateFramePlacement: the target frame's origin as a vector in the source frame, and its basis directions there; none for the source's own orientation.
type FrameStep ¶
type FrameStep struct {
Translation *Value // Translation::translationVector, a vector quantity
Axis *Value // Rotation::axisDirection, a vector quantity
Angle *Quantity // Rotation::angle, an angular measure
Intrinsic bool // Rotation::isIntrinsic
Object int64
}
FrameStep is one TranslationOrRotation of a TranslationRotationSequence.
type Held ¶
type Held struct {
// contains filtered or unexported fields
}
Held is a copy of what a performance holds at one moment: the features it holds, and their values looked up under the names the performance keys them by.
func (Held) Features ¶
Features are the attributes and parameters the performance holds, the graph's own then the inherited ones it does not redefine, as the run initializes them.
func (Held) Unbound ¶
Unbound lists the inputs the performance holds no value for: the features it reads rather than writes back, declared with no default and bound by nothing. One marked Optional may also hold no value at all, which the run reads as the empty sequence, so absence is among the states it ranges over.
type HeldImage ¶
type HeldImage struct {
// contains filtered or unexported fields
}
HeldImage is a closure of held objects by value — objects, lifetimes, executions, messages in flight — that materializes into other contexts under the same identities (see Image).
func (*HeldImage) Materialize ¶
Materialize gives dst objects of its own for the image under the same identities, advancing dst's sequence past them and past the identities set aside for connectors not materialized yet; ErrImageIdentityTaken and ErrImageClock refuse, leaving dst as it was.
type HeldImageError ¶
HeldImageError reports what of an object kept an image from being taken or materialized: the object, and the typed reason.
func (*HeldImageError) Error ¶
func (e *HeldImageError) Error() string
Error names what was being done to the object and the reason it could not be.
func (*HeldImageError) Unwrap ¶
func (e *HeldImageError) Unwrap() error
Unwrap exposes the typed reason.
type HeldObject ¶
HeldObject is one object a feature of another object holds, under the segment a path names it by: the feature's name, indexed for a collection's element.
type HeldObjectsError ¶
HeldObjectsError reports the feature HeldObjects could not read, and why.
func (*HeldObjectsError) Error ¶
func (e *HeldObjectsError) Error() string
func (*HeldObjectsError) Unwrap ¶
func (e *HeldObjectsError) Unwrap() error
type HeldStateError ¶
HeldStateError reports an object that is no longer as its declaration materializes it, so a fresh object of the declaration would not stand for it: what it carries is the reason.
func (*HeldStateError) Error ¶
func (e *HeldStateError) Error() string
type HistogramBin ¶
HistogramBin is one bin of a histogram and how many runs fell in it: the numbers from Lo up to Hi, Hi included in the last bin and in every bin of an integral distribution.
type Horizon ¶
type Horizon struct {
// contains filtered or unexported fields
}
Horizon is the instant a check runs the clock to: the zero Horizon is none, and one at t=0 dispatches what is due at the start alone.
type InputBinding ¶
InputBinding is the value one input parameter of a case was bound to for a run: its argument, or the default its declaration evaluated to.
type InputParseError ¶
type InputParseError struct {
// Line is the 1-based line of the witness, 0 for a line parsed on its own.
Line int
Text string
Reason string
}
InputParseError reports a line of a witness that spells no input, with why.
func (*InputParseError) Error ¶
func (e *InputParseError) Error() string
func (*InputParseError) Is ¶
func (e *InputParseError) Is(target error) bool
Is makes every InputParseError match ErrInvalidInput.
type InputTaken ¶
type InputTaken struct {
Feature string
// Value is the value, when the witness was made in memory; ValInvalid for one
// read from a file, whose Written is evaluated where the action's defaults are.
Value Value
// Written is the value as the notation spells it: what a witness file holds.
Written string
}
InputTaken is one input a witness fixes before the run's first move: a feature of the action or its performer and its value, spelt `input <feature> = <value>`.
func InputOf ¶
func InputOf(feature string, value Value) InputTaken
InputOf is the input fixing feature at value, spelt as the value formats.
func ParseInput ¶
func ParseInput(text string) (InputTaken, error)
ParseInput reads one input as InputTaken.String spells it: `input <feature> = <value>`, the value any expression the notation reads, evaluated when the run begins.
func (InputTaken) String ¶
func (in InputTaken) String() string
String spells the input as a witness lists it and ParseInput reads it back.
type Instance ¶
type Instance struct {
ID int64 // unique identity
Type *symbols.Symbol // the def/usage symbol this instantiates
FeatureValues map[string]*FeatureValue // feature name → feature value
// Ends are the ends of the connector this object materializes, in declaration
// order, and nil for an object that is no connector. A named end also reads
// through the feature value of that name; the order is what an end with no name of its
// own is identified by.
Ends []ConnectorEnd
// contains filtered or unexported fields
}
Instance is a runtime-materialized object (Tier 2).
func (*Instance) Behavior ¶
func (inst *Instance) Behavior(name string) (*ObjectBehavior, bool)
Behavior returns the behavior of the given name the object runs. An unnamed behavior answers to no name and so is never returned.
func (*Instance) Behaviors ¶
func (inst *Instance) Behaviors() []*ObjectBehavior
Behaviors are the behaviors the object runs, in declaration order.
func (*Instance) ExhibitedState ¶
func (inst *Instance) ExhibitedState() (*ObjectBehavior, bool)
ExhibitedState returns the machine the object exhibits, and false when it exhibits none. With several, it returns the first declared.
func (*Instance) ExhibitedStates ¶
func (inst *Instance) ExhibitedStates() []*ObjectBehavior
ExhibitedStates returns every machine the object exhibits, in declaration order.
func (*Instance) ExhibitedStatesOf ¶
func (inst *Instance) ExhibitedStatesOf(sym *symbols.Symbol) []*ObjectBehavior
ExhibitedStatesOf returns the machines the object exhibits under sym's declaration: the one sym itself binds, or else every one reaching sym through its bindings (the usage it names, or the definition holding its body) or typed by it, since one definition can be the body or the kind of several exhibited usages. Declarations are compared.
func (*Instance) GetFeatureValue ¶
func (inst *Instance) GetFeatureValue(ctx *Context, name string) (*FeatureValue, error)
GetFeatureValue retrieves the feature value for the named feature, materializing it lazily if it's a composite feature that hasn't been accessed yet. A feature value that could not be materialized is marked as such — it unwraps to ErrFeatureValueMaterialization — so a caller can tell it from any other failure to evaluate, whatever the expression it surfaced through.
func (*Instance) HeldUnder ¶
HeldUnder returns the usage an object's owner holds it as (`Car::wheels` for `car.wheels[2]`), or nil for an object held by none.
func (*Instance) KeptConnectorIDs ¶
KeptConnectorIDs returns the identities of the connectors a carry-over set aside for the instance to materialize again, anonymous and named, ascending.
func (*Instance) MaterializedConnectors ¶
MaterializedConnectors returns the anonymous connectors the instance has already materialized, none when they were never asked for; it materializes nothing.
func (*Instance) OwnedConnectors ¶
OwnedConnectors returns the connectors the instance owns that no feature names — an anonymous `connect a.p to b.q` member — materializing each once, in declaration order. A named connector is reached through its feature value instead.
func (*Instance) Owner ¶
Owner answers the object holding this one and the feature of it that does, or nil and "" for an object no other holds.
func (*Instance) PerformedActionsOf ¶
func (inst *Instance) PerformedActionsOf(sym *symbols.Symbol) []*ObjectBehavior
PerformedActionsOf returns the actions the object performs under sym's declaration, matched as ExhibitedStatesOf matches machines.
func (*Instance) RestoreConnector ¶
RestoreConnector materializes again the connector a carry-over set aside under id, which takes that identity back; nil when the instance kept no such identity. A connector returned along with an error is kept: an older behavior failed answering it.
func (*Instance) SetFeatureValue ¶
SetFeatureValue writes a value to the named feature value of the object, which is how a behavior the object performs updates the object's own state. The value must conform to the multiplicity governing the feature; a feature the object does not have is reported rather than added.
type Invocation ¶
type Invocation struct {
Actions []*ActionExecutor
States []*StateExecutor
// Names are the names the behaviors' observables are reported under in a joint
// outcome, actions first; the behaviors' own names when absent.
Names []string
// PerformerNames spell, beside Names, the object each behavior performs on as the
// surface named it, "" for none; `object #<id>` when absent.
PerformerNames []string
Horizon Horizon
}
Invocation is what one check searches: the behaviors started on one clock, in the order started, and the horizon the clock runs to. The objects the started behaviors materialize bring their own behaviors onto the clock.
func (*Invocation) Completed ¶
func (inv *Invocation) Completed() bool
Completed reports whether every started action reached its end.
func (*Invocation) Context ¶
func (inv *Invocation) Context() *Context
Context is the context the started behaviors run in, nil for an empty invocation.
func (*Invocation) Outcome ¶
func (inv *Invocation) Outcome() Outcome
Outcome is what the started behaviors came to: one behavior's own outcome, or the joint outcome of several, plus what the performing objects hold (`this.` for one, `<object>.` else).
func (*Invocation) Performer ¶
func (inv *Invocation) Performer() *Instance
Performer is the one object the started behaviors perform on: nil when none performs on an object, or when they perform on different ones.
func (*Invocation) PerformerAttributes ¶ added in v0.9.2
func (inv *Invocation) PerformerAttributes() map[string]Value
PerformerAttributes are the attributes the behaviors' performers hold, as an outcome reports them: under `this.` for one performer, under its name for several.
func (*Invocation) Performers ¶
func (inv *Invocation) Performers() []*Instance
Performers lists the distinct objects the started behaviors perform on, in start order.
func (*Invocation) Release ¶
func (inv *Invocation) Release()
Release ends every started executor's run.
func (*Invocation) Snapshot ¶
func (inv *Invocation) Snapshot() (*Snapshot, error)
Snapshot captures every executor on the clock along with the context's state.
type MeasurementRef ¶
type MeasurementRef struct {
Unit Unit
}
MeasurementRef is a ScalarMeasurementReference held as a value: the Unit a quantity carries (named product = declarations, term = reduction), by itself.
func (*MeasurementRef) Declaration ¶
func (r *MeasurementRef) Declaration() *symbols.Symbol
Declaration is the one unit declaration the reference names at the first power (`SI::m`); nil for a unit composed of several (`m/s`, `m**2`).
func (*MeasurementRef) String ¶
func (r *MeasurementRef) String() string
String renders the reference as a quantity's unit is written: `m`, `km/h`, `m**2`.
type MeasurementScale ¶
type MeasurementScale struct {
Unit Unit
Mapping *QuantityValueMapping
}
MeasurementScale is what a scale states beyond its one axis: the unit a magnitude on it is in, and the point mapping it onto another reference.
type Message ¶
type Message struct {
SignalType string
// Signal is the definition SignalType resolved to when the send was built,
// nil where the message's type is known only as a name. An accept matches it
// by conformance, so a subtype message satisfies a supertype accept and
// same-named definitions of different packages stay apart.
Signal *symbols.Symbol
// Event is the feature the message was sent from (`send shutDown to x`), nil
// where none or unresolved; EventName is its written name, the fallback then.
// EventObject is the occurrence that feature held when sent, or the object
// performing a behavioral feature (`send alert()`), 0 for none: two parts of
// one type hold their own occurrences of the one declared event.
Event *symbols.Symbol
EventName string
EventObject int64
Target string
Port string
Object int64
PortID int64
Delivery DeliveryKind
// Payload binds features of the message's type by name, as the send's arguments did.
Payload map[string]Value
// Value is the one value a send of an expression carries (`send 7`, `send d`),
// the occurrence `send new T(…)` constructed, or the one an accept built from
// Payload; nil until any.
Value *Value
}
Message is a signal instance in flight.
SignalType names the message's type: the type the send statement named, or the scalar type of the value it evaluated to. An accept whose parameter is typed consumes only messages of that type, so two sends of different types reach different accepts regardless of the order they were posted in.
Target names the receiving node of the sending behavior a `send m to r` addressed; a consumer accepts a message addressed to itself or to no one.
Port names the port the message reached — the peer end a `via p` send routed to, or the port an addressed send resolved to — and only an accept on that port consumes it, keeping port-routed and addressed traffic separate.
Object identifies the object the message reached, 0 for none, and Delivery what of that destination a consumer must satisfy to take the message.
PortID identifies the port object the message reached, 0 where the run holds none. A binding connector makes a boundary port and an inner port one object, so an accept on either port takes a message that reached the other.
func NamedSignalMessage ¶
NamedSignalMessage builds the message a send of a signal no declaration types posts: matched by name alone, addressed to the object when there is one.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the model-derived part of execution: the semantic model and resolver a run reads, and what is memoized from them — calc shapes, write targets, invocation targets, literal values, effective features, the behaviors a type binds — which the model fixes and no run changes. Every context built over one Model reuses it, so a run pays for none of it again; the run-derived state, what a run creates and a snapshot captures, is the Context's.
The memo tables fill lazily into plain maps, as the resolver's and the semantic model's do, so a Model is for one goroutine at a time: one per analysis worker.
func NewModel ¶
NewModel builds the model-derived part of execution over a semantic model and the resolver it resolves names with; either may be nil for a context that evaluates literals alone. The caller installs the checker's argument typing on sem (semantics.Model.SetArgumentTyper) before any call is selected; a run that selects a call without one fails with ErrNoArgumentTyper. Contexts are built over it with NewContext.
func (*Model) RegisterScope ¶
RegisterScope gives the Model a scope tree the caller resolves references in, so a declaration carried over by Adopt is rebound to the symbol that tree declares for it rather than to the index's own.
func (*Model) RegisterSource ¶
func (m *Model) RegisterSource(sf *source.SourceFile)
RegisterSource gives the Model the text of a file it was read from, so an error about a declaration in it reports a line and column.
func (*Model) SetExpressionParser ¶
func (m *Model) SetExpressionParser(parse ExpressionParser)
SetExpressionParser installs the parser the Model reads witness input values and tool units with; units the previous parser read are forgotten, so every lookup goes through it.
func (*Model) Sources ¶
func (m *Model) Sources() []*source.SourceFile
Sources returns the registered files of the model, in name order.
type MonteCarloRun ¶
type MonteCarloRun struct {
// Case is the qualified name of the case that ran; Subject the object it ran on.
Case string
Subject *Instance
// Number is the run's number in its Monte Carlo, the row it was drawn as; a
// sample names a run by it, whatever earlier runs failed.
Number int64
// Observed is the value the run's `observed` came to, null when the run left it unbound.
Observed Value
// Inputs are the values the run bound the case's input parameters to, in
// declaration order. Outputs are every declared output of this iteration
// as the iteration established it — the sample's statistics excluded — with
// the observed feature appended when it declares no output of its own.
// Unread holds the outputs that could not be read, by name.
Inputs []InputBinding
Outputs []CalcOutputValue
Unread map[string]error
// Verdicts are the case's checks over this run: on its own until ConcludeMonteCarlo
// settles them over the sample, which keeps the checks that are the sample's alone.
Verdicts []AnalysisVerdict
// contains filtered or unexported fields
}
MonteCarloRun is one run of a Simulation::MonteCarlo case: its steps performed and `observed` read, its statistics unbound until ConcludeMonteCarlo binds the sample's.
func (*MonteCarloRun) Conclude ¶ added in v0.9.2
func (r *MonteCarloRun) Conclude(stats MonteCarloStatistics, sample []bool) (AnalysisResult, error)
Conclude binds outOfSpec over the settled run, then reports the case's outputs and the verdicts of the sample's checks, judged over the results and all four statistics.
func (*MonteCarloRun) Context ¶
func (r *MonteCarloRun) Context() *Context
Context is the context the run was made in, which its values are read through.
type MonteCarloStatistics ¶
type MonteCarloStatistics struct {
// Runs is the number of runs observed.
Runs int64
// Mean is the arithmetic mean of the observations.
Mean float64
// Deviation is their sample standard deviation, which under two runs there is none of.
Deviation float64
// OutOfSpec is the number of runs a check of the runs did not hold in, counted by
// ConcludeMonteCarlo once the runs' checks are settled; MonteCarloSample leaves it 0.
OutOfSpec int64
// Unit is the unit quantity observations were taken in, which Mean and Deviation
// are expressed in; nil when the observations were bare numbers.
Unit *Unit
}
MonteCarloStatistics are the statistics of a sample of runs, as Simulation::MonteCarlo declares them.
func MonteCarloSample ¶
func MonteCarloSample(runs []*MonteCarloRun) (MonteCarloStatistics, error)
MonteCarloSample is the statistics of runs, each of which observed a number or a quantity, the quantities expressed in the first run's unit; one observing none, no number, or a quantity of another dimension refuses the sample, named by its Number.
type NamedInput ¶ added in v0.9.2
NamedInput is one named argument of an action invocation: the parameter name as written and its value, given in the order the invocation wrote them.
type NoValueError ¶
type NoValueError struct {
Feature string
// Ref is the written name whose read found no value, so a caller can tell a
// read of its own expression from one made while evaluating a default.
Ref *ast.QualifiedName
// Symbol is the feature declaration the read reached, when it is known.
Symbol *symbols.Symbol
}
NoValueError reports a feature a condition names that carries no value, naming the feature so a caller can tell which one is uninitialized.
func (*NoValueError) Error ¶
func (e *NoValueError) Error() string
func (*NoValueError) Unwrap ¶
func (e *NoValueError) Unwrap() error
type NodeBreakpoint ¶
NodeBreakpoint is a breakpoint set by identity: on Node, in the flow of the nested action nodes Within (outermost first, as Token.Within lists them; none for the action's own).
type NotPortableError ¶
NotPortableError reports a value bound to the run that made it, which no other context can hold.
func (*NotPortableError) Error ¶
func (e *NotPortableError) Error() string
type ObjectBehavior ¶
type ObjectBehavior struct {
// Name is the name the behavior answers to on the object.
Name string
Kind lower.ClassifierBehaviorKind
// Symbol is the state machine or action holding the body being run, which is
// the binding declaration itself when it states one.
Symbol *symbols.Symbol
// Object is the object performing the behavior.
Object *Instance
// State is the machine the object exhibits, nil for a performed action.
State *StateExecutor
// Action is the action the object performs, nil for an exhibited machine.
Action *ActionExecutor
// Err is the error a performed action bound by the object's type failed with,
// recorded rather than failing the object's creation.
Err error
// contains filtered or unexported fields
}
ObjectBehavior is a behavior one object runs because its type exhibits or performs it: an execution of its own, bound to that object's identity.
func (*ObjectBehavior) Describe ¶
func (b *ObjectBehavior) Describe() string
Describe names the behavior and the object running it, for diagnostics.
func (*ObjectBehavior) Member ¶
func (b *ObjectBehavior) Member() *symbols.Symbol
Member is the declaration binding the behavior to the object's type: the exhibiting or performing usage, which is what addresses this behavior when several run the same body.
func (*ObjectBehavior) Moved ¶
func (b *ObjectBehavior) Moved() bool
Moved reports whether the execution has left the state its start put it in.
type ObjectFeature ¶
type ObjectFeature struct {
Name string
Feature *EffectiveFeature
}
ObjectFeature is a feature of an object under one of its names: the declaration its feature value reads, or its type's when it holds no value under the name.
type ObjectNamed ¶
ObjectNamed is an object the moves of a witness name by the number its run gave it, bound to its materialization path, `object #2 = Plant::spare#1`, so the run replaying the witness finds the object among its own.
func ParseObject ¶
func ParseObject(text string) (ObjectNamed, error)
ParseObject reads one object binding as ObjectNamed.String spells it.
func (ObjectNamed) Number ¶
func (o ObjectNamed) Number() string
Number is how the moves name the object: `object #<id>`.
func (ObjectNamed) String ¶
func (o ObjectNamed) String() string
String spells the binding as a witness lists it and ParseObject reads it back.
type ObjectParseError ¶
type ObjectParseError struct {
// Line is the 1-based line of the witness, 0 for a line parsed on its own.
Line int
Text string
Reason string
}
ObjectParseError reports a line of a witness that names no object, with why.
func (*ObjectParseError) Error ¶
func (e *ObjectParseError) Error() string
func (*ObjectParseError) Is ¶
func (e *ObjectParseError) Is(target error) bool
Is makes every ObjectParseError match ErrInvalidObject.
type ObjectVerdict ¶
type ObjectVerdict struct {
Kind AssertionKind
// Element is the asserting element: the constraint, requirement or satisfy usage.
Element *symbols.Symbol
// Requirement is the requirement a requirement or satisfaction verdict is
// about, whose verification cases a caller may report beside it.
Requirement *symbols.Symbol
// Text is the assertion as written, so an anonymous one can be named.
Text string
// Subject is the object evaluated against and Path the features walked to it
// from the root, a collection element indexed as wheels[2]; empty for the root.
Subject *Instance
Path []string
Status ValidationStatus
// Err is the violation, or what left the assertion undecided; nil when it holds.
Err error
}
ObjectVerdict is one assertion checked on one object of a validated tree.
type Objective ¶
type Objective struct {
// Name is the objective's name, empty for an anonymous one.
Name string
// Symbol is the objective usage's symbol.
Symbol *symbols.Symbol
// Type is the objective definition it is typed by, nil when untyped.
Type *symbols.Symbol
// Direction is the way its value is to be improved.
Direction ObjectiveDirection
// Value is the expression stating the value to improve, nil when the
// objective states none.
Value ast.Node
// Scope is where Value's names resolve.
Scope *symbols.Scope
// Eval is the calc redefining the library's `eval` that states Value, nil
// when the value is stated another way or not at all.
Eval *symbols.Symbol
// StepwiseEval reports an `eval` whose body computes in steps rather than
// stating one expression, so no Value is read from it.
StepwiseEval bool
// Evaluates is the calc `eval` is bound to hold (`in calc :>> eval =
// evaluationFunction;`), applied to each alternative the case's subject
// lists; nil when `eval` states an expression or nothing.
Evaluates *symbols.Symbol
// Best is the objective's `best` feature, derived by the library from Eval;
// nil when the objective is no trade-study objective.
Best *symbols.Symbol
// ReboundBest is a feature giving the library's bound `best` a value of its
// own (`attribute :>> best = expression;`), which validation rejects; or nil.
ReboundBest *symbols.Symbol
// Conditions are the conditions the objective states itself, its own body's
// and the ones it inherits from the model's own objective definitions: what
// values are feasible, which a solver translates.
Conditions []Condition
// LibraryConditions are the conditions the objective inherits from the
// trade-study library (`eval(selectedAlternative) == best`): about the
// choice among the listed alternatives, which the analysis run checks and
// no solver translates.
LibraryConditions []Condition
}
Objective is one objective an analysis case states: which way its value is to be improved, the expression stating that value, and the conditions it states itself.
type ObjectiveDirection ¶
type ObjectiveDirection int
ObjectiveDirection is the way an objective's value is to be improved, taken from the trade-study objective definition it is typed by.
const ( // NoDirection is an objective specializing neither MinimizeObjective nor // MaximizeObjective, whose direction the model therefore does not state. NoDirection ObjectiveDirection = iota // Minimize is an objective specializing TradeStudies::MinimizeObjective. Minimize // Maximize is an objective specializing TradeStudies::MaximizeObjective. Maximize )
func (ObjectiveDirection) String ¶
func (d ObjectiveDirection) String() string
String names the direction as the model states it.
type OccurrenceLife ¶
type OccurrenceLife struct {
Began int64
Ended int64
// Destroyed marks an end by `destroy`, after which the features hold nothing;
// a performance that completed keeps its final values.
Destroyed bool
}
OccurrenceLife is the lifetime of an occurrence as the describe API reports it: where in the execution order it began and ended, 0 for "not yet".
func (OccurrenceLife) Alive ¶
func (l OccurrenceLife) Alive() bool
Alive reports whether the occurrence has begun and not ended.
func (OccurrenceLife) String ¶
func (l OccurrenceLife) String() string
String renders the lifetime for a debugging surface.
type OperandTypeError ¶
type OperandTypeError struct {
Op string // the operator, as written
Left string // description of the left operand's type
Right string // description of the right operand's type
Library string // the library function that would have to declare it, if any
Span source.Span // span of the operator expression
}
OperandTypeError reports an operator applied to operand types it is not defined for, naming the operator and both operands and carrying the span of the expression so a surface holding the source can point at it.
func (*OperandTypeError) Error ¶
func (e *OperandTypeError) Error() string
func (*OperandTypeError) Unwrap ¶
func (e *OperandTypeError) Unwrap() error
type OperationArguments ¶
OperationArguments is an invocation's argument list (KerML 8.2.5.8.3): either positional, bound to the operation's `in` and `inout` parameters in declaration order, or named. A list giving both is refused.
type Outcome ¶
type Outcome struct {
Outputs map[string]Value
FinalState string
StateVisits []string
// Terminated is set when the performance was ended short of its own flow: a
// machine's transition to a terminate action, or a terminate of an occurrence
// it belongs to. An action's own `terminate` node completes it instead.
Terminated bool
Err error
// contains filtered or unexported fields
}
Outcome is what one run came to, in the observables a conformance case compares; a run that failed is an outcome of its own, Err.
func (Outcome) Context ¶
Context is the context of the run that came to this outcome, nil for an outcome built without one.
func (Outcome) RenderedOutputs ¶
func (o Outcome) RenderedOutputs() []OutcomeOutput
RenderedOutputs spells the outputs in name order; an object two outputs hold is spelled once, the second mention being its number in the outcome. A graph is opened to the bounds the wire serializes one to.
type OutcomeOutput ¶
OutcomeOutput is one output of an outcome as it renders: its name and its value spelled canonically, an object by its type and what it holds.
type Quantity ¶
Quantity is a scalar quantity value, the representation the semantic layer shares with the query engine: a magnitude in a measurement reference.
type QuantityValueMapping ¶
type QuantityValueMapping struct {
Mapped Quantity // the point on the scale, in the scale's unit
Reference Quantity // the same point on the reference
}
QuantityValueMapping is one point given on the scale and on the reference it is defined against, as `quantityValueMapping` states it.
type QueuedEvent ¶
QueuedEvent is one occurrence a driven state performance queues before it runs: a signal by type, carrying arguments or one bare payload, or an operation call carrying arguments.
type ReplayDisagreement ¶
ReplayDisagreement reports a replay that left another trace than its witness: how, and the two traces.
func (*ReplayDisagreement) Error ¶
func (e *ReplayDisagreement) Error() string
func (*ReplayDisagreement) Is ¶
func (e *ReplayDisagreement) Is(target error) bool
Is makes every ReplayDisagreement match ErrReplayDisagrees.
type ReplayError ¶
type ReplayError struct {
// Move is the 1-based position of the move in the witness.
Move int
Choice ChoiceTaken
Faced string
}
ReplayError reports a witness move the run could not follow: which move, the move itself, and what the run faced instead.
func (*ReplayError) Error ¶
func (e *ReplayError) Error() string
func (*ReplayError) Is ¶
func (e *ReplayError) Is(target error) bool
Is makes every ReplayError match ErrReplayRefused.
type Replayed ¶
type Replayed struct {
Ctx *Context
Inv *Invocation
// Err is the error the last move raised, nil when the state is one the run went on from.
Err error
}
Replayed is a witness re-run to the state it claims.
func Replay ¶
func Replay( stop context.Context, fresh func() (*Context, error), start Starter, w Witness, props []CheckProperty, ) (*Replayed, error)
Replay re-runs the witness: it starts the invocation start begins in the context fresh makes, under the `replay` policy over the witness (its inputs pinned, its choices followed), and moves it as the check did until its trace equals the witness's — or, for a witness ending in a failure, until a move raises it. A witness naming a property has that property, found among props, evaluated at the state reached: it must be false or fail as the witness says. The run failing to follow a choice, ending, failing otherwise or leaving another trace is a ReplayDisagreement; a caller that goes away mid-run takes the replay with it, its error being stop's.
func ReplayExecution ¶
func ReplayExecution( stop context.Context, fresh func() (*Context, error), start Starter, w Witness, visit func(r *Replayed, moves int) error, ) (*Replayed, error)
ReplayExecution re-runs the whole schedule as ReplaySchedule does at ScheduleEnd, calling visit at every stable state on the way, settled as a check settles, with the moves made so far. An error visit returns ends the replay with it.
func ReplaySchedule ¶
func ReplaySchedule( stop context.Context, fresh func() (*Context, error), start Starter, w Witness, at int, ) (*Replayed, error)
ReplaySchedule re-runs the schedule the witness fixes, start beginning the invocation in the context fresh makes under the `replay` policy with the witness's inputs fixed first, to the stable state after move at (1-based) or, at ScheduleEnd, until the run ends with every choice followed. A run that cannot follow a choice or fix an input, ends or fails before the move, or ends with choices left is a ReplayDisagreement; a failure at the move named, or ending the run, is the Replayed's Err, for the caller to judge against the claim.
func (*Replayed) Evaluate ¶
func (r *Replayed) Evaluate(p CheckProperty) (bool, error)
Evaluate asks the property of the replayed run's state under a readiness probe, as the check did.
func (*Replayed) FinalValue ¶
FinalValue spells the feature's value as the run left it, UnsetText for one holding none: `this.<name>` the performing object's, `<object>.<name>` one of several performing objects', a bare name the one behavior's own, `<behavior>.<name>` one of several's, `node.path` one under a node an action performed, `finalState` a machine's final configuration. A name nothing answers to is an UnknownCheckFeatureError.
type RunNote ¶
type RunNote interface {
// Describe renders the note for a diagnostic; String is its trace line.
Describe() string
String() string
// Diagnostic is the note as an informational finding about the run.
Diagnostic() diag.Diagnostic
// Location is the file and span of the declaration the note is about; file is
// "" when the runtime could not name one.
Location() (file string, span source.Span)
}
RunNote is a finding a run records about itself without changing it: a choice point it made, or a guard it read only to report one and could not evaluate.
type RunToCompletionValueError ¶
RunToCompletionValueError reports an unevaluable or non-Boolean RTC value.
func (*RunToCompletionValueError) Error ¶
func (e *RunToCompletionValueError) Error() string
func (*RunToCompletionValueError) Unwrap ¶
func (e *RunToCompletionValueError) Unwrap() error
type SatisfyAssertion ¶
type SatisfyAssertion struct {
// Symbol is the satisfy usage itself, which is anonymous in the usual
// `assert satisfy r by p;` form.
Symbol *symbols.Symbol
// Owner is the element stating the assertion (the enclosing part or
// package), or nil at the root of a document.
Owner *symbols.Symbol
// Requirement is the requirement the assertion satisfies: the target of the
// usage's reference subsetting. It is nil when the reference names nothing
// resolvable, and when the assertion declares the requirement itself
// (`satisfy requirement r by p { ... }`), which states its conditions.
Requirement *symbols.Symbol
// RequirementRef is the requirement reference as written, so an unresolved
// one can be reported by name.
RequirementRef string
// Subject is the feature named by `by`, whose values the requirement is
// evaluated against. It is nil when the assertion names no subject, and
// when the name resolves to nothing. For a feature chain (`config.child`)
// it is the chain's last feature.
Subject *symbols.Symbol
// SubjectRef is the `by` operand as written, a chain with its dots.
SubjectRef string
// SubjectChain is the `by` operand when it is a feature chain, whose object
// is reached through the objects of the features before its last; nil for a
// plain name.
SubjectChain *ast.FeatureChainExpr
// SubjectRoot is the feature a chained `by` operand starts from (`config`),
// and SubjectPath the features walked from its object to the subject's
// (`child`). Both are empty for a plain name.
SubjectRoot *symbols.Symbol
SubjectPath []string
// Negated is `assert not satisfy ...`: the assertion holds when the
// requirement is not satisfied.
Negated bool
}
SatisfyAssertion is one satisfaction assertion an element states: `assert satisfy <requirement> by <subject>` (SysML v2 §8.3.17.15). The assertion is a requirement usage of its own — it reference-subsets the requirement it satisfies and binds that requirement's subject parameter to the feature named by `by` — so it carries a verdict the requirement alone does not: one about the values that feature actually holds.
func (*SatisfyAssertion) AssertedRequirement ¶
func (a *SatisfyAssertion) AssertedRequirement() *symbols.Symbol
AssertedRequirement is the requirement the assertion is about: the one it references, or its own usage where the assertion declares the requirement (`satisfy requirement r by p { ... }`). It is nil for a reference naming nothing resolvable.
func (*SatisfyAssertion) Text ¶
func (a *SatisfyAssertion) Text() string
Text renders the assertion as it was written, so an anonymous one can be named in a verdict. A `satisfy requirement r by p` form declares the requirement rather than referencing one, so it is named by the usage itself.
type SchedulePolicy ¶
type SchedulePolicy struct {
// contains filtered or unexported fields
}
SchedulePolicy names how the executors resolve the choice points of a run. The zero value is the default policy, `reverse`.
func ExplorePolicy ¶
func ExplorePolicy(budget ExploreBudget) (SchedulePolicy, error)
ExplorePolicy is the `explore` policy under the given budget: at least one run, and a depth of at least zero.
func ParseSchedulePolicy ¶
func ParseSchedulePolicy(spelling string) (SchedulePolicy, error)
ParseSchedulePolicy reads `declared`, `reverse`, `seed:<n>`, `explore[:runs=<n>,depth=<d>]` (either option, either order) or `replay:<file>`, whose file is read here (see ParseChoices); "" is the default.
func ReplayOf ¶
func ReplayOf(w Witness) SchedulePolicy
ReplayOf is the `replay` policy over a witness held in memory: its inputs are fixed before the first move of the run, its choices followed move for move.
func ReplayPolicy ¶
func ReplayPolicy(choices []ChoiceTaken) SchedulePolicy
ReplayPolicy is the `replay` policy over choices held in memory, fixing no input. Its spelling names no file, so it does not read back; write the witness out to name it.
func (SchedulePolicy) Exploration ¶
func (p SchedulePolicy) Exploration() (ExploreBudget, bool)
Exploration returns the budget of an `explore` policy, and whether the policy is one: such a policy is driven by Explore rather than set on a context.
func (SchedulePolicy) IsDefault ¶
func (p SchedulePolicy) IsDefault() bool
IsDefault reports whether the policy is the one runs use unless told otherwise.
func (SchedulePolicy) Replay ¶
func (p SchedulePolicy) Replay() ([]ChoiceTaken, bool)
Replay returns the choices of a `replay` policy's witness, and whether the policy is one.
func (SchedulePolicy) String ¶
func (p SchedulePolicy) String() string
String returns the spelling ParseSchedulePolicy reads the policy back from; a replay of a witness held in memory names no file and spells `replay`.
func (SchedulePolicy) Witness ¶
func (p SchedulePolicy) Witness() (Witness, bool)
Witness returns the witness a `replay` policy follows, and whether the policy is one.
type SchedulePolicyError ¶
SchedulePolicyError reports a policy spelling that names no policy, with why.
func (*SchedulePolicyError) Error ¶
func (e *SchedulePolicyError) Error() string
func (*SchedulePolicyError) Is ¶
func (e *SchedulePolicyError) Is(target error) bool
Is makes every SchedulePolicyError match ErrInvalidSchedulePolicy.
type SendPortTypeMismatchError ¶
SendPortTypeMismatchError gives the routed send's incompatible type.
func (*SendPortTypeMismatchError) Error ¶
func (e *SendPortTypeMismatchError) Error() string
func (*SendPortTypeMismatchError) Unwrap ¶
func (e *SendPortTypeMismatchError) Unwrap() error
type SendReceiverValueError ¶
type SendReceiverValueError struct {
Receiver string // the expression as written
Value string // what it yielded, formatted
}
SendReceiverValueError gives a receiver expression that yields no object, and what it yielded.
func (*SendReceiverValueError) Error ¶
func (e *SendReceiverValueError) Error() string
func (*SendReceiverValueError) Unwrap ¶
func (e *SendReceiverValueError) Unwrap() error
type SendTargetValueError ¶
type SendTargetValueError struct {
Target string // the target as written
Name string // the binding leading it
Value string // what the binding holds, formatted
}
SendTargetValueError gives the bound target that holds no object, and what it holds.
func (*SendTargetValueError) Error ¶
func (e *SendTargetValueError) Error() string
func (*SendTargetValueError) Unwrap ¶
func (e *SendTargetValueError) Unwrap() error
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
Sequence is an ordered collection (slice-backed). One read empty from a quantity-typed declaration remembers the unit its elements would measure in.
func (*Sequence) ElementUnit ¶
ElementUnit is the unit an empty sequence's elements are declared in; false for a sequence holding elements or read from no quantity-typed declaration.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a unique collection backed by hash buckets and exact comparisons. A set has no inherent order, but enumerating one has to answer in some order, and the one it answers in is the canonical order (see canonicalLess): equal sets enumerate alike, whatever order their elements were added in.
func NewSetIn ¶
NewSetIn creates an empty Set judging membership in ctx: a point on a scale is the member its magnitude on the reference is. A nil ctx judges with no context.
type Shapes ¶
type Shapes struct {
// contains filtered or unexported fields
}
Shapes records the resolved shape of every type a set of objects was materialized against, taken while that resolution is still the current one. It is what a later context compares its own resolution against to decide whether those objects still mean the same thing.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is the run-derived state of a Context at one point between steps: a mark in its journal, which Restore brings the run back to as often as asked until Release. The Model the context runs over is not part of it, nor are the breakpoints set on its executors: those are the debugger's, not the run's, and stay as set across a restore (a HeldImage, a copy, carries them). Every object the run had made keeps its identity across a restore; what it made after the mark is abandoned, and the identities it took are handed out again.
func (*Snapshot) Release ¶
func (s *Snapshot) Release()
Release ends the snapshot: it is no longer restorable, and the journal keeps nothing for it. Releasing twice does nothing.
func (*Snapshot) Restore ¶
func (s *Snapshot) Restore()
Restore brings the run back to the snapshot: what was written since is undone, what was made since is abandoned, and every executor captured stands where it stood. Snapshots taken since are released. The snapshot stays live to be restored again. It panics on a released snapshot.
type Spread ¶
Spread is one term of a pooled sum of squares: Weight times the square of Value, or of Value's distance from the pool's mean when About it.
type Starter ¶
type Starter func(*Context) (*Invocation, error)
Starter builds and starts the behaviors a check runs, in the context given; a replay starts the same invocation the same way.
type StateConfiguration ¶
type StateConfiguration struct {
// contains filtered or unexported fields
}
StateConfiguration represents the active state configuration (simple or multi-region).
type StateExecutor ¶
type StateExecutor struct {
// contains filtered or unexported fields
}
StateExecutor executes state machines using event-driven semantics.
func (*StateExecutor) AcceptsMessage ¶
func (e *StateExecutor) AcceptsMessage(m Message) (accepted bool, err error)
AcceptsMessage reports whether the machine would take a message in flight: it reaches this machine and triggers a transition out of an active state, is deferred by one, or lets a do behavior parked at an accept go on. Whether a transition fires is decided by its guard; see Decide. Resolving the port a trigger accepts `via` may fail; a port it materializes on the way is discarded, as everything the preview builds.
func (*StateExecutor) ActiveLeaves ¶
func (e *StateExecutor) ActiveLeaves() []*ast.StateNode
ActiveLeaves returns the innermost active states, one per active region, in region order; the composite states enclosing them are active too.
func (*StateExecutor) ActiveStates ¶
func (e *StateExecutor) ActiveStates() []*ast.StateNode
ActiveStates returns the machine's active state configuration: the single active state, or one state per orthogonal region, in declaration order.
func (*StateExecutor) Call ¶
Call queues the call event, runs the machine through the run-to-completion step dispatching it and releases the caller with the outputs the behaviors that step fired returned, by name (PSSM 8.5.9): the operation's out and inout parameters when the machine's owner declares it, an inout unwritten by the step as the caller passed it, every output otherwise. Events that step queued and timers it armed stay for the machine's later runs; the clock does not move.
func (*StateExecutor) ChangeWaits ¶
func (e *StateExecutor) ChangeWaits() []string
ChangeWaits describes the change conditions the active configuration was waiting on as of the last poll, and nothing when it watches none.
func (*StateExecutor) ClearBreakpoints ¶
func (e *StateExecutor) ClearBreakpoints()
ClearBreakpoints removes every breakpoint; a pause already reached stands.
func (*StateExecutor) CompletionDue ¶
func (e *StateExecutor) CompletionDue() bool
CompletionDue reports a machine paused on its completion vertex by a breakpoint: entering it completed the machine, which the next step finishes.
func (*StateExecutor) CurrentState ¶
func (e *StateExecutor) CurrentState() ast.Node
CurrentState returns the current active state node.
func (*StateExecutor) CurrentTime ¶
func (e *StateExecutor) CurrentTime() float64
CurrentTime returns the current instant of the clock this machine shares with every executor of its context, in seconds.
func (*StateExecutor) Decide ¶
func (e *StateExecutor) Decide(m Message) (decision Decision, err error)
Decide decides a message as the step dispatching it would — the payload bound, the guards evaluated against the data as it stands — without taking it. The machine, its data, its budget and the message are left as they were found: a value a guard derives on the way is derived again when dispatch reads it, and an object materialized on the way — to bind the payload, or by a guard reaching an occurrence not yet built — starts its behaviors as under dispatch, so the guard reads what they make of it, then is discarded along with them and anything they sent. So is a port materialized to tell whether the message reaches the machine at all. A payload or guard error is returned. Among several enabled transitions it names the one this machine's own run would fire, its scheduler left in place. A do behavior parked at an accept the message would let go on is named too.
func (*StateExecutor) DecideTransitions ¶
func (e *StateExecutor) DecideTransitions(m Message) (decision Decision, transitions []*lower.Transition, err error)
DecideTransitions is Decide reporting alongside the decision the transitions its Fires describe, in the same order.
func (*StateExecutor) DeferredEvents ¶
func (e *StateExecutor) DeferredEvents() []Event
DeferredEvents returns the events the active configuration holds deferred, in the order they were deferred; they return to the queue once no active state defers them.
func (*StateExecutor) EnclosingStates ¶
func (e *StateExecutor) EnclosingStates(state *ast.StateNode) []*ast.StateNode
EnclosingStates returns the states written around state, outermost first; the owners lowering synthesizes for regions are not among them.
func (*StateExecutor) Enqueue ¶
func (e *StateExecutor) Enqueue(event QueuedEvent) error
Enqueue queues one event on the executor as a case declares it.
func (*StateExecutor) EventQueue ¶
func (e *StateExecutor) EventQueue() *EventQueue
EventQueue returns the event queue (not copied - read-only access).
func (*StateExecutor) FinalStateName ¶
func (e *StateExecutor) FinalStateName() string
FinalStateName is the active configuration as a conformance case writes it: the orthogonal regions' active states joined by "+" in region name order, regions of one name in declaration order.
func (*StateExecutor) FiredCount ¶
func (e *StateExecutor) FiredCount() int
FiredCount counts the transitions taken so far, released ones included: a mark to read what a later step fired from.
func (*StateExecutor) FiredSince ¶
func (e *StateExecutor) FiredSince(mark int) []FiredTransition
FiredSince returns the kept transitions taken since mark, a FiredCount read earlier, and releases those before it: the machine keeps only from the last mark.
func (*StateExecutor) FiredTransitions ¶
func (e *StateExecutor) FiredTransitions() []FiredTransition
FiredTransitions returns the transitions kept, in firing order: compound transitions by segment, fork and join branches, and entry transitions.
func (*StateExecutor) GetStateVisits ¶
func (e *StateExecutor) GetStateVisits() []string
GetStateVisits returns the ordered list of visited state names.
func (*StateExecutor) Graph ¶
func (e *StateExecutor) Graph() *lower.StateGraph
Graph is the lowered state graph the executor runs, which a debugger reads to place the active configuration and the transitions it fired in a rendering.
func (*StateExecutor) HasDueEvent ¶
func (e *StateExecutor) HasDueEvent() bool
HasDueEvent reports whether an event due at the current instant is queued, which a run holding time where it is dispatches.
func (*StateExecutor) HasPendingDoWork ¶
func (e *StateExecutor) HasPendingDoWork() bool
HasPendingDoWork reports whether some active state's do behavior still has an action to run. Such work is due now, unlike a queued event's timestamp.
func (*StateExecutor) HasPendingSignal ¶
func (e *StateExecutor) HasPendingSignal() bool
HasPendingSignal reports whether a signal this machine reacts to is in flight: one its configuration accepts or defers, or a do behavior under way is parked at an accept for. Such a signal is due now, unlike a queued event's timestamp: the next step delivers and dispatches it.
func (*StateExecutor) HasPendingWork ¶
func (e *StateExecutor) HasPendingWork() bool
HasPendingWork reports whether stepping the machine can still make progress: an event is queued, a signal this machine accepts is in flight, or a state's do behavior has actions left to run.
func (*StateExecutor) HoldsEntry ¶
func (e *StateExecutor) HoldsEntry() bool
HoldsEntry reports whether an entry cascade is waiting for its next step.
func (*StateExecutor) InvokeOperation ¶
func (e *StateExecutor) InvokeOperation(operation string, args map[string]Value)
InvokeOperation injects a call event for the named operation, as given and bound to no declaration. Transitions triggered by that operation fire; transitions triggered by another do not.
func (*StateExecutor) KeepFired ¶
func (e *StateExecutor) KeepFired(keep bool)
KeepFired has the machine keep its firings until FiredSince releases them, as a debugger reads them; off (the default), a dispatch keeps only its own.
func (*StateExecutor) LastDispatch ¶
func (e *StateExecutor) LastDispatch() (Dispatch, bool)
LastDispatch returns what became of the event the last ProcessNextEvent dispatched, false when it dispatched none.
func (*StateExecutor) LastEventAt ¶
func (e *StateExecutor) LastEventAt() float64
LastEventAt returns the instant the machine last dispatched an event at, zero before it dispatched any.
func (*StateExecutor) NextWait ¶
func (e *StateExecutor) NextWait() (float64, bool)
NextWait returns the instant the machine's earliest wait — a timer, or a do behavior paused on the clock — comes due at, false when none is set for later than the clock's instant.
func (*StateExecutor) NoteCount ¶
func (e *StateExecutor) NoteCount() int
NoteCount is how many notes the executor's run has made so far.
func (*StateExecutor) Notes ¶
func (e *StateExecutor) Notes() []RunNote
Notes returns what the executor's run noted so far, in order; see Context.Notes.
func (*StateExecutor) NotesSince ¶
func (e *StateExecutor) NotesSince(mark int) []RunNote
NotesSince returns what the executor's run noted since mark, a NoteCount read earlier.
func (*StateExecutor) Outcome ¶
func (e *StateExecutor) Outcome() Outcome
Outcome is the outcome of the performance so far: the configuration the machine rests in, the states it entered and the values it holds.
func (*StateExecutor) OutgoingTransitions ¶
func (e *StateExecutor) OutgoingTransitions() []*lower.Transition
OutgoingTransitions lists the transitions dispatch could select now: those out of each active leaf and then of each state enclosing it, innermost first as dispatch tries them, each in declaration order and a shared enclosing state's once.
func (*StateExecutor) PausedAt ¶
func (e *StateExecutor) PausedAt() ast.Node
PausedAt is the breakpoint state or pseudostate the last run paused at, nil when none did.
func (*StateExecutor) Performer ¶
func (e *StateExecutor) Performer() *Instance
Performer is the object this machine is performed by, nil for none.
func (*StateExecutor) PollChangeEvents ¶
func (e *StateExecutor) PollChangeEvents() (dispatched bool, err error)
PollChangeEvents re-tests the change conditions the active configuration watches and takes the transitions they enable, reporting whether a rise was dispatched: the step RunToCompletion takes, for a driver that steps the machine.
func (*StateExecutor) ProcessNextEvent ¶
func (e *StateExecutor) ProcessNextEvent() (err error)
ProcessNextEvent processes the next event from the queue (for REPL stepping). It is the same step RunToCompletion repeats: every active state's do behavior advances by one action, then the next event is dispatched. Advancing the do behaviors is progress in itself, so a step that ran one and found no event to dispatch succeeds — the completion transition it enables is queued next. With nothing due but a timer running, the shared clock advances to the earliest wait (running whatever else is due there) until this machine's next event is due.
func (*StateExecutor) Release ¶
func (e *StateExecutor) Release()
Release withdraws a machine its driver is done with from the clock, ending the do behaviors paused on it; safe to call more than once.
func (*StateExecutor) Resume ¶
func (e *StateExecutor) Resume() bool
Resume returns a machine suspended at quiescence to running, so a driver that makes work available — advancing time, or delivering an event — can step it again. A completed or failed machine is left as it is; one paused on its completion vertex completes as the next step.
func (*StateExecutor) RunDoRound ¶
func (e *StateExecutor) RunDoRound() (ran int, err error)
RunDoRound advances every active state's do behavior by one action, without dispatching any event, and reports how many actions ran.
func (*StateExecutor) RunToCompletion ¶
func (e *StateExecutor) RunToCompletion() error
RunToCompletion processes queued events until the machine completes or has no event or running do behavior left, at which point it suspends. A state's do behavior runs while the state is active: each run-to-completion step advances every active state's do behavior by one action and then dispatches one event, so concurrently active states interleave instead of one running to the end at entry, and leaving a state abandons the rest of its do behavior.
Change conditions are re-tested per micro-step — after the do round, before the next queued event, and again at quiescence — a tool-defined cadence, since KerML has no clock (docs/project/spec-compliance.md).
The run is bounded by the context's event and do action budgets (OPENSYSML_MAX_EVENTS, OPENSYSML_MAX_DO_STEPS), so a cyclic machine reports a typed error instead of spinning forever. A poll that fires nothing costs no budget; a change transition taken counts as one step, like a dispatched event.
func (*StateExecutor) RunToQuiescence ¶
func (e *StateExecutor) RunToQuiescence() error
RunToQuiescence runs the machine as RunToCompletion does, but leaves a timer set for later waiting on the clock rather than advancing to it: the configuration an object settles into is the one reached at the time it was materialized, and a timer it is waiting on is driven by advancing the clock.
func (*StateExecutor) SendSignal ¶
func (e *StateExecutor) SendSignal(signalType string, args map[string]Value)
SendSignal injects a signal event into the state machine. This is the primary API for driving state machines with external signals. The signal is enqueued and will be processed on the next ProcessNextEvent call.
func (*StateExecutor) SetBreakpointAt ¶
func (e *StateExecutor) SetBreakpointAt(vertex ast.Node)
SetBreakpointAt pauses a run once the dispatch entering the state, or passing through the pseudostate, completes, even one leaving the state again; what is still due then waits until the machine resumes. Other nodes are ignored.
func (*StateExecutor) SetTrace ¶
func (e *StateExecutor) SetTrace(trace *TraceRecorder)
SetTrace sets the trace recorder for this executor and the context it evaluates in.
func (*StateExecutor) Snapshot ¶
func (e *StateExecutor) Snapshot() (*Snapshot, error)
Snapshot captures the executor's state along with its context's (Context.Snapshot).
func (*StateExecutor) State ¶
func (e *StateExecutor) State() ExecutionState
State returns current execution state.
func (*StateExecutor) StateData ¶
func (e *StateExecutor) StateData() map[string]Value
StateData returns a copy of state machine local data, together with the attributes each state owns under that state's path (`nested.hits`), which two usages of one state definition hold separately.
func (*StateExecutor) StateMachineSymbol ¶
func (e *StateExecutor) StateMachineSymbol() *symbols.Symbol
StateMachineSymbol returns the state machine being executed.
func (*StateExecutor) StatePath ¶
func (e *StateExecutor) StatePath(state *ast.StateNode) string
StatePath is state's name qualified by the states written around it (`on.run`).
func (*StateExecutor) StateStack ¶
func (e *StateExecutor) StateStack() []*ast.StateNode
StateStack returns a copy of the state stack (active configuration).
func (*StateExecutor) Suspend ¶
func (e *StateExecutor) Suspend() bool
Suspend parks a running machine back at quiescence, for a driver that resumed it, found nothing to do and must not report it as running.
func (*StateExecutor) SuspendReason ¶
func (e *StateExecutor) SuspendReason() string
SuspendReason says why a machine that cannot progress cannot: the change conditions it waits on, or that nothing is left that could fire.
func (*StateExecutor) TakesMessage ¶
func (e *StateExecutor) TakesMessage(m Message) (takes bool, err error)
TakesMessage previews whether delivery would let this machine take the message: it reacts to it and does not yield it to a sibling machine that would fire or defer.
func (*StateExecutor) TriggeredBy ¶
func (e *StateExecutor) TriggeredBy(m Message) (triggered bool, err error)
TriggeredBy previews whether a transition out of an active or enclosing state is triggered by the message, whatever its guard; deferral and do behaviors aside.
func (*StateExecutor) WatchesChangeCondition ¶
func (e *StateExecutor) WatchesChangeCondition() bool
WatchesChangeCondition reports whether the active configuration watches a change condition, which data written outside the machine can make true.
func (*StateExecutor) WriteAttribute ¶
func (e *StateExecutor) WriteAttribute(name string, value Value) error
WriteAttribute assigns an attribute the machine declares from outside it, between its steps, with the checks an assignment in its behavior gets.
type SweepBinding ¶
SweepBinding is one parameter bound to the value one row runs with.
type SweepNumbers ¶
type SweepNumbers uint8
SweepNumbers is which numbers a swept parameter's type takes, which decides the values its range produces and how a sampled range draws them.
const ( // SweepAsWritten produces values as the endpoints are written — Integers // between Integers, reals otherwise — for a parameter that takes both or no type. SweepAsWritten SweepNumbers = iota // SweepIntegers produces Integers however the endpoints are written, and // refuses an endpoint or step that is not one. SweepIntegers // SweepReals produces reals however the endpoints are written. SweepReals )
type SweepPlan ¶
type SweepPlan struct {
Ranges []SweepRange
Sampled bool
Samples int64
Seed uint64
Runs int64
// MonteCarlo marks a plan made by MonteCarloPlan, whatever number of runs it asks for.
MonteCarlo bool
// Seedless marks a Monte Carlo whose runs derive no model seed: made by SeedlessMonteCarloPlan.
Seedless bool
}
SweepPlan is what a sweep asks for: the ranges its parameters take, for a sampled sweep the number of draws and the seed they are drawn from, and for a Monte Carlo the number of runs, each seeded by RunSeed of Seed, and no range.
func MonteCarloPlan ¶
MonteCarloPlan is the plan of runs runs seeded from seed: one row per run and no ranges.
func SeedlessMonteCarloPlan ¶
SeedlessMonteCarloPlan is the plan of runs runs seeded from nothing: a fixed draw policy resolves every RandomFunctions call, and a weighted decision is an unseeded draw.
func (SweepPlan) Drawn ¶
Drawn reports whether the plan's rows come from Seed: a sampled sweep or a seeded Monte Carlo; a swept table steps its ranges, a seedless Monte Carlo derives no seed.
func (SweepPlan) IsMonteCarlo ¶
IsMonteCarlo reports whether the plan runs one behavior repeatedly: made by MonteCarloPlan, or stating runs.
type SweepRange ¶
SweepRange is one parameter's range as values: its endpoints, the step a sampled range leaves unstated, and the type ResolveSweepPlan produces them in.
type SweepRow ¶
type SweepRow struct {
Bindings []SweepBinding
Outputs []CalcOutputValue
Verdicts []AnalysisVerdict
// The object this run's verdicts are about, where a case ran on one.
Subject *Instance
Evaluations []AnalysisEvaluation
Inputs []InputBinding
Elapsed time.Duration
Err error
// Context is the context the run was made in, which its outputs, subject and
// evaluations are read through: no other context knows the objects they name.
// It is nil for a run that released it (SweepRunResult.ReleaseContext).
Context *Context
// Trace is what the run recorded, nil when nothing was; a row keeps it
// whether or not it keeps its context.
Trace *TraceRecorder
}
SweepRow is one run of a sweep: what it was given, what it produced, how long it took, and what stopped it when it failed.
type SweepRun ¶
type SweepRun func(ctx *Context, bindings []SweepBinding) (SweepRunResult, error)
SweepRun makes one run of a sweep in ctx, the row's own context, with the parameters bound as the row states. An error is that row's failure, not the table's; what the run produced before failing may be returned beside it.
type SweepRunResult ¶
type SweepRunResult struct {
Outputs []CalcOutputValue
Verdicts []AnalysisVerdict
// Inputs are the values the run bound the case's input parameters to, in
// declaration order, the row's own binding included.
Inputs []InputBinding
// The object the run was about, where a case ran on one.
Subject *Instance
// Evaluations are the applications the run made of a calc held as a value,
// in the order made.
Evaluations []AnalysisEvaluation
// ReleaseContext marks a run whose outputs read without the context that made
// them: the row keeps the trace and lets the context, and the run's objects, go.
ReleaseContext bool
}
SweepRunResult is what one run of a sweep produced. A calc's returned value is reported as an output named "result", so a calc row and a case row read alike.
type SweepTable ¶
type SweepTable struct {
Target string
Params []string
// Types are the parameters' types as the plan resolved them, one per Param.
Types []SweepType
Sampled bool
Seed uint64
Runs int64
// Seedless marks a Monte Carlo whose runs derived no model seed from Seed.
Seedless bool
Rows []SweepRow
}
SweepTable is every run of one sweep, in the order they were made: a swept table runs lexicographically over its parameters in the order they were given, each from its first endpoint; a sampled table runs in draw order; a Monte Carlo in run order, its one parameter the run's number.
func NewSweepTable ¶
func NewSweepTable(target string, plan SweepPlan) SweepTable
NewSweepTable is the table of a plan before any row is run: the target, the parameters and their types in plan order, and how the rows are drawn.
func RunSweepWith ¶
func RunSweepWith(stop context.Context, workers SweepWorkers, target string, plan SweepPlan, runs int64, run SweepRun) (SweepTable, error)
RunSweepWith makes one run per row of the plan on the workers and reports the table in plan order whatever order the rows finish in; the table does not depend on the jobs. A run that failed is that row's typed error; the table is completed either way. A plan of more rows than runs allows (First's SweepRunBudget when runs is zero) is refused before any run is made. A caller that goes away starts no further row and takes the table with it: the rows in flight finish and are discarded, and the caller's error is the sweep's, as it is when one job meets it between two rows.
type SweepType ¶
type SweepType struct {
Numbers SweepNumbers
// Untyped reports a parameter declaring no type, whose range is read as written.
Untyped bool
// Positive excludes zero, which no scalar type's numbers alone rule out.
Positive bool
// contains filtered or unexported fields
}
SweepType is a swept parameter's declared type, which its range's values are produced in and each endpoint is admitted to as an argument is.
type SweepWorkers ¶
SweepWorkers is who makes a sweep's rows: up to Jobs going concurrently, each row in a context of its own — First for the first row, the one the rows are enumerated in, and Fresh building every other for the job making it.
type TakingAccept ¶
type TakingAccept struct {
Param string // the parameter the accept binds, "" where it binds none
Node string // the accept node's own name, "" for an anonymous one
Within string // the dotted path of the nested performance parked there, "" for the action's own flow
}
TakingAccept is the accept a message in flight would let a parked token go on from, and the performance it is parked in.
func (TakingAccept) String ¶
func (a TakingAccept) String() string
String names the accept as a report reads it: `accept g`, `accept g of inner`.
type TensorQuantity ¶
type TensorQuantity struct {
Dimensions []int64
Num []semantics.Value
Units []Unit
// IsBound is `isBound` when BoundKnown; a calculation the library gives no body
// leaves its result's boundness unstated.
IsBound bool
BoundKnown bool
// MRef is the TensorMeasurementReference object the tensor was built over, whose
// members `mRef` keeps answering; 0 for one known by its components only.
MRef int64
}
TensorQuantity is a Quantities::TensorQuantityValue of order two or more: row-major `num` over `dimensions`, each in its component's unit. Orders 0 and 1 are Quantity and VectorQuantity.
func (*TensorQuantity) FlattenedSize ¶
func (tq *TensorQuantity) FlattenedSize() int64
FlattenedSize is the number of components.
func (*TensorQuantity) Rank ¶
func (tq *TensorQuantity) Rank() int
Rank is the number of dimensions, the tensor's `order`.
type Token ¶
type Token struct {
ID int64 // Unique token ID
Location ast.Node // Current node position
// Via is the succession the token travelled to reach Location; the zero edge for a
// token no succession delivered (a flow's first, or the one a synchronized node performs with).
Via lower.ActionEdge
// Wait records that this token is parked at an accept node: the accept
// found no message it could consume, so the action is suspended there
// until one arrives. It is nil for every token that is free to advance.
Wait *AcceptWait
// contains filtered or unexported fields
}
Token represents a control token in action execution. It carries no values of its own: the action's features are one space every token shares (see ActionExecutor.Data).
type ToolAnswer ¶
ToolAnswer is what one invocation established: the values bound to the call's outputs by parameter name, and whether an earlier invocation with equal inputs answered differently.
type ToolCall ¶
type ToolCall struct {
// Action is the annotated action or calc the tool computes.
Action *symbols.Symbol
ToolName string
URI string
Inputs []ToolInput
Outputs []ToolOutput
// contains filtered or unexported fields
}
ToolCall is one performance or calculation of an action or calc annotated ToolExecution, as the external tool sees it: the tool and URI the metadata names, the inputs read from the run keyed by their ToolVariable names, and the outputs the tool is to answer.
func (*ToolCall) Bind ¶
Bind reads the tool's outputs, keyed by ToolVariable name, as the values of the call's output parameters: each quantity converted to its parameter's declared unit. An output missing, unknown, or not readable as its parameter's value is a ToolError.
func (*ToolCall) Context ¶ added in v0.9.2
Context is the context the call's performance runs in, nil for a call built outside one.
func (*ToolCall) ConvertInput ¶ added in v0.9.2
ConvertInput expresses an input's number in the unit spelled: from is the unit the value was sent in, to the unit the tool answers in. The units must share a dimension, and the call must run under a context to read unit expressions.
type ToolDivergence ¶
ToolDivergence is a tool answering two performances or calculations with equal inputs differently: the outcome table over it is not reproducible, and the run says so without changing.
func (ToolDivergence) Describe ¶
func (d ToolDivergence) Describe() string
Describe renders the divergence for a diagnostic.
func (ToolDivergence) Diagnostic ¶
func (d ToolDivergence) Diagnostic() diag.Diagnostic
Diagnostic is the divergence as a finding about the run, a warning since the results resting on the tool are not reproducible.
func (ToolDivergence) Location ¶
func (d ToolDivergence) Location() (string, source.Span)
Location is the annotated action's or calc's declaration.
func (ToolDivergence) String ¶
func (d ToolDivergence) String() string
String is the trace line the divergence is recorded as.
type ToolError ¶
type ToolError struct {
Tool string
Kind ToolErrorKind
Detail string
}
ToolError reports one tool invocation's failure: the tool, what failed, and the detail.
type ToolErrorKind ¶
type ToolErrorKind int
ToolErrorKind is what failed in one tool invocation.
const ( // ToolProcessFailed is a process that could not be started or exited non-zero. ToolProcessFailed ToolErrorKind = iota // ToolMalformed is a reply that is not one JSON object of the protocol, or a value in it // the receiving parameter cannot read. ToolMalformed // ToolMissingOutput is an `out` parameter the reply gave no value for. ToolMissingOutput // ToolUnknownOutput is a reply value no ToolVariable of the action receives. ToolUnknownOutput // ToolTimeout is a process that outlived OPENSYSML_TOOL_TIMEOUT. ToolTimeout // ToolRefused is a reply carrying the tool's own error message. ToolRefused // ToolUnsentInput is an input the protocol carries no value of. ToolUnsentInput // ToolAmbiguousVariable is a ToolVariable name two parameters of the action carry. ToolAmbiguousVariable )
func (ToolErrorKind) String ¶
func (k ToolErrorKind) String() string
String names the kind as the error spells it.
type ToolNotRegisteredError ¶
type ToolNotRegisteredError struct {
Tool string
}
ToolNotRegisteredError reports the tool a performance named and nothing answers to.
func (*ToolNotRegisteredError) Error ¶
func (e *ToolNotRegisteredError) Error() string
Error is the refusal, naming the environment variable that registers tools.
func (*ToolNotRegisteredError) Is ¶
func (e *ToolNotRegisteredError) Is(target error) bool
Is matches ErrToolNotRegistered.
type ToolOutput ¶
type ToolOutput struct {
Variable string
Parameter string
// Declared is the parameter's declaration, whose unit the tool's answer is converted to.
Declared *symbols.Symbol
}
ToolOutput is one `out` or `inout` parameter the tool answers, under its ToolVariable name.
type ToolRunner ¶
type ToolRunner interface {
RunTool(call *ToolCall) (ToolAnswer, error)
}
ToolRunner runs the tool a ToolExecution names for one performance or calculation, binding the tool's outputs through ToolCall.Bind. A context with no runner attached refuses every tool-computed action or calc as not registered.
type ToolValue ¶
ToolValue is one value as the tool protocol carries it: a number or truth in Value, or a string in Text when Value is invalid, and for a quantity the unit expression it is measured in. A non-nil Items makes the value a sequence: each item is a scalar (its own Value/Text, Unit empty — the sequence's Unit is shared by every item); an empty sequence is a non-nil empty slice. Readers always allocate Items non-nil.
func ToolValueOf ¶
ToolValueOf is a value as the tool protocol carries it; false for one it does not carry. A sequence carries its elements in Items; a unit every element shares is hoisted to the sequence's Unit.
type TraceKind ¶
type TraceKind int
TraceKind classifies a trace record.
const ( // TraceLine is a record the trace prints as a line and a query does not read // past its text: steps, evaluations, calculations, object lifecycle. TraceLine TraceKind = iota // TraceAccept is an event a behavior took off its queue: a signal or an // operation call. The trace prints no line for it. TraceAccept // TraceSend is a message posted onto the bus. The trace prints no line for it. TraceSend // TraceTransition is a transition fired. TraceTransition // TraceEntry is a state entered. TraceEntry // TraceExit is a state exited. TraceExit // TraceDo is one step of a state's do behavior. TraceDo // TraceChoice is a choice point the run drew. TraceChoice // TraceGuard is a guard the run read to report a choice and could not evaluate. TraceGuard )
type TraceOrigin ¶
TraceOrigin is where a record was made: the clock's instant, the object whose behavior made it and that behavior, each nil where the run has none.
type TraceRecord ¶
type TraceRecord struct {
Kind TraceKind
Origin TraceOrigin
// State is the state entered, exited or stepped; From and To are a fired
// transition's endpoints.
State, From, To string
// Event is the trigger a transition fired on, or the signal or operation an
// accept or send carries; Payload is the message's payload.
Event string
Payload map[string]Value
// Target is the object a send was addressed to, nil for a broadcast or a
// destination named only as text (kept in To).
Target *Instance
// Action reports an entry or exit behavior ran with the entry or exit.
Action bool
// Note is a TraceChoice's or TraceGuard's note.
Note RunNote
// contains filtered or unexported fields
}
TraceRecord is one entry of a run's trace. The printed line is derived from the record, so what a query reads and what `-trace` prints cannot drift.
func (TraceRecord) Line ¶
func (r TraceRecord) Line() (line string, printed bool)
Line is the line the trace prints for the record; printed is false for a record the trace keeps without printing.
func (TraceRecord) Text ¶
func (r TraceRecord) Text() string
Text is what a query reads as the record's text: its printed line, or for an accept or send its kind and event.
type TraceRecorder ¶
type TraceRecorder struct {
// contains filtered or unexported fields
}
TraceRecorder keeps a run's trace as typed records, in the order they were made, and prints them as the deterministic lines the golden trace tests read.
Evaluation entries are recorded in post-order: the sub-expressions of an expression appear before it, indented one level deeper, so sibling evaluation order and nesting are both readable off the trace. A constant sub-expression is answered by the semantic constant folder without evaluating its operands, so it appears with no children.
Clear marks records printed rather than dropping them: a query reads the whole run, or the most recent limit records of one bounded by NewEventRecorder.
func NewEventRecorder ¶
func NewEventRecorder(limit int) *TraceRecorder
NewEventRecorder creates a recorder nothing prints, keeping the most recent limit records (all when 0).
func NewTraceRecorder ¶
func NewTraceRecorder() *TraceRecorder
NewTraceRecorder creates a new trace recorder.
func (*TraceRecorder) BeginEval ¶
func (tr *TraceRecorder) BeginEval()
BeginEval opens a nesting level for one expression's sub-expressions.
func (*TraceRecorder) Clear ¶
func (tr *TraceRecorder) Clear()
Clear marks every record printed, so Entries starts over, and resets nesting depth.
func (*TraceRecorder) Disable ¶
func (tr *TraceRecorder) Disable()
Disable disables trace recording.
func (*TraceRecorder) Dropped ¶
func (tr *TraceRecorder) Dropped() (count int, upTo float64)
Dropped reports how many records the limit discarded and the instant of the last of them.
func (*TraceRecorder) EndEval ¶
func (tr *TraceRecorder) EndEval(label string, value Value, err error)
EndEval closes the level BeginEval opened and records the expression's outcome, so the entry appears after the sub-expressions it consumed.
func (*TraceRecorder) EndStatement ¶
func (tr *TraceRecorder) EndStatement()
EndStatement closes the level RecordStatement or RecordLoopIteration opened.
func (*TraceRecorder) Entries ¶
func (tr *TraceRecorder) Entries() []string
Entries returns the lines of the records made since the last Clear, in order.
func (*TraceRecorder) Mark ¶
func (tr *TraceRecorder) Mark() int
Mark is the whole-run position the next record takes, for RecordAcceptAt to insert there later.
func (*TraceRecorder) RecordAccept ¶
func (tr *TraceRecorder) RecordAccept(origin TraceOrigin, event string, payload map[string]Value)
RecordAccept records an event a behavior took off its queue: the signal or operation it names, with the payload it carries.
func (*TraceRecorder) RecordAcceptAt ¶
func (tr *TraceRecorder) RecordAcceptAt(mark int, origin TraceOrigin, event string, payload map[string]Value)
RecordAcceptAt records an accept as RecordAccept does, placed at mark: before the records the dispatch of the event made. A mark already printed stays printed.
func (*TraceRecorder) RecordActionNodeEnter ¶
func (tr *TraceRecorder) RecordActionNodeEnter(node string)
RecordActionNodeEnter records a token entering the flow an action node owns, whose steps are that node's subperformances.
func (*TraceRecorder) RecordActionNodeExit ¶
func (tr *TraceRecorder) RecordActionNodeExit(node string)
RecordActionNodeExit records the flow an action node owns having completed, which is when the node itself completes.
func (*TraceRecorder) RecordActionStep ¶
func (tr *TraceRecorder) RecordActionStep(step int, tokens []Token)
RecordActionStep records an action executor step with active tokens. Tokens are sorted by ID for deterministic output.
func (*TraceRecorder) RecordActionTerminate ¶
func (tr *TraceRecorder) RecordActionTerminate(perf string, dropped []Token)
RecordActionTerminate records a performance ended by a terminate, with the tokens dropped from its flow in the order they were, lowest ID first.
func (*TraceRecorder) RecordActionTerminatePending ¶
func (tr *TraceRecorder) RecordActionTerminatePending(perf string, waiting bool)
RecordActionTerminatePending records a performance a terminate ended at a parked token: one waiting at an accept, or one whose step had yet to begin.
func (*TraceRecorder) RecordBehaviorRun ¶
func (tr *TraceRecorder) RecordBehaviorRun(kind, name string, id int64)
RecordBehaviorRun records an object's behavior being advanced, which is how the interleaving of several objects' behaviors becomes visible.
func (*TraceRecorder) RecordBehaviorStart ¶
func (tr *TraceRecorder) RecordBehaviorStart(kind, name string, id int64)
RecordBehaviorStart records an object's own execution of a behavior its type exhibits or performs starting.
func (*TraceRecorder) RecordCalcBind ¶
func (tr *TraceRecorder) RecordCalcBind(param string, value Value, source string)
RecordCalcBind records binding one calc input parameter. source names where the value came from ("argument" or "default").
func (*TraceRecorder) RecordCalcEnter ¶
func (tr *TraceRecorder) RecordCalcEnter(name string)
RecordCalcEnter records entering a calc invocation and opens a nesting level.
func (*TraceRecorder) RecordCalcExit ¶
func (tr *TraceRecorder) RecordCalcExit(name string, result Value)
RecordCalcExit closes a calc invocation's nesting level and records its result.
func (*TraceRecorder) RecordCalcExitError ¶
func (tr *TraceRecorder) RecordCalcExitError(name string, err error)
RecordCalcExitError closes a calc invocation that failed, recording why. The failure is part of the ordering contract: it says how far binding and evaluation got before the calc gave up.
func (*TraceRecorder) RecordCalcOutput ¶
func (tr *TraceRecorder) RecordCalcOutput(calc, output string, value Value)
RecordCalcOutput records the value one output feature of a calc usage took. The outputs appear after the one evaluation of the usage's body they are read from, which is how the trace shows that reading several of them ran it once.
func (*TraceRecorder) RecordCalcUsageExit ¶
func (tr *TraceRecorder) RecordCalcUsageExit(kind, name string)
RecordCalcUsageExit closes the nesting level of a calc usage's evaluation, which computes the usage's output features rather than one result, so there is no single value to record for it.
func (*TraceRecorder) RecordCalcUsageReuse ¶
func (tr *TraceRecorder) RecordCalcUsageReuse(kind, name string)
RecordCalcUsageReuse records a calc usage read again with the inputs it already ran over, whose values come from that one run. It opens no nesting level of its own, since nothing runs.
func (*TraceRecorder) RecordCalculationEnter ¶
func (tr *TraceRecorder) RecordCalculationEnter(kind, name string)
RecordCalculationEnter records entering a calculation of the given kind — a calc, or an analysis case — and opens a nesting level.
func (*TraceRecorder) RecordCalculationExit ¶
func (tr *TraceRecorder) RecordCalculationExit(kind, name string, result Value)
RecordCalculationExit closes a calculation's nesting level and records its result.
func (*TraceRecorder) RecordCalculationExitError ¶
func (tr *TraceRecorder) RecordCalculationExitError(kind, name string, err error)
RecordCalculationExitError closes a calculation that failed, recording why.
func (*TraceRecorder) RecordDoStep ¶
func (tr *TraceRecorder) RecordDoStep(origin TraceOrigin, state string)
RecordDoStep records one action of a state's do behavior, which is how the interleaving of concurrently active states' do behaviors becomes visible.
func (*TraceRecorder) RecordEvent ¶
func (tr *TraceRecorder) RecordEvent(event string, time float64)
RecordEvent records an event being processed.
func (*TraceRecorder) RecordLoopIteration ¶
func (tr *TraceRecorder) RecordLoopIteration(iteration int)
RecordLoopIteration records one iteration of a loop and opens a nesting level for what that iteration does, which is how a loop's progress is readable off the trace.
func (*TraceRecorder) RecordNote ¶
func (tr *TraceRecorder) RecordNote(origin TraceOrigin, n RunNote)
RecordNote records a run's note where it was made: before the step line of the action step it belongs to, or before the transition it decided.
func (*TraceRecorder) RecordObjectMaterialized ¶
func (tr *TraceRecorder) RecordObjectMaterialized(typeName string, id int64)
RecordObjectMaterialized records an object being materialized, before any behavior of it starts.
func (*TraceRecorder) RecordOccurrenceCreated ¶
func (tr *TraceRecorder) RecordOccurrenceCreated(typeName string, id int64)
RecordOccurrenceCreated records `create` starting an object during a call.
func (*TraceRecorder) RecordOccurrenceDestroyed ¶
func (tr *TraceRecorder) RecordOccurrenceDestroyed(typeName string, id int64)
RecordOccurrenceDestroyed records an object ending by `destroy`.
func (*TraceRecorder) RecordOccurrenceTerminated ¶
func (tr *TraceRecorder) RecordOccurrenceTerminated(typeName string, id int64)
RecordOccurrenceTerminated records an occurrence ending by `terminate`.
func (*TraceRecorder) RecordSend ¶
func (tr *TraceRecorder) RecordSend(origin TraceOrigin, msg Message, target *Instance)
RecordSend records a message posted onto the bus by the object at origin, or from outside the run where it has none.
func (*TraceRecorder) RecordStateEndedWithOccurrence ¶
func (tr *TraceRecorder) RecordStateEndedWithOccurrence(machine string, abandoned []string)
RecordStateEndedWithOccurrence records the machine's performance ending with the occurrence a `terminate` named, with the states whose do behaviors it abandoned.
func (*TraceRecorder) RecordStateEntry ¶
func (tr *TraceRecorder) RecordStateEntry(origin TraceOrigin, state string, hasEntryAction bool)
RecordStateEntry records entering a state with optional entry action execution.
func (*TraceRecorder) RecordStateExit ¶
func (tr *TraceRecorder) RecordStateExit(origin TraceOrigin, state string, hasExitAction bool)
RecordStateExit records exiting a state with optional exit action execution.
func (*TraceRecorder) RecordStateSpaceStep ¶
func (tr *TraceRecorder) RecordStateSpaceStep(action string, time float64, state, output Value)
RecordStateSpaceStep records the state a dynamics holds at an instant, with the output it computes there: one `(t, x)` sample of the run.
func (*TraceRecorder) RecordStateTerminate ¶
func (tr *TraceRecorder) RecordStateTerminate(stop string, abandoned []string)
RecordStateTerminate records the machine's performance ending at the terminate action stop, with the states whose do behaviors it abandoned.
func (*TraceRecorder) RecordStateTransition ¶
func (tr *TraceRecorder) RecordStateTransition(origin TraceOrigin, fromState, toState string, event string)
RecordStateTransition records a transition fired, with the trigger it fired on.
func (*TraceRecorder) RecordStatement ¶
func (tr *TraceRecorder) RecordStatement(label string)
RecordStatement records one body statement about to run and opens a nesting level for the expressions it evaluates and the statements it contains.
func (*TraceRecorder) Records ¶
func (tr *TraceRecorder) Records() []TraceRecord
Records returns the records kept in order, printed ones included. The slice is read-only.
func (*TraceRecorder) String ¶
func (tr *TraceRecorder) String() string
String returns the trace as a single string (newline-separated entries).
type Traversal ¶
type Traversal struct {
Token int64
Edge lower.ActionEdge
Within []ast.Node
}
Traversal is one succession a token took: which token, the edge, and the nested action nodes whose own flows it was running in (see Token.Within).
type UnassignedOutputError ¶
UnassignedOutputError names the declared output a run could not read because the activation never assigned it, and the calc that declares it.
func (*UnassignedOutputError) Error ¶
func (e *UnassignedOutputError) Error() string
Error keeps the diagnostic text an ErrOutputNotAssigned carried.
func (*UnassignedOutputError) Unwrap ¶
func (e *UnassignedOutputError) Unwrap() error
Unwrap reports the failure as an ErrOutputNotAssigned.
type UnboundSubjectError ¶
type UnboundSubjectError struct {
Kind string // "constraint", "requirement", "analysis", "verification" or "objective"
Element string // name of the element declaring the subject
Subject string // name of the subject parameter
}
UnboundSubjectError reports a check whose subject nothing supplied, naming the subject and how a caller supplies one.
func (*UnboundSubjectError) Error ¶
func (e *UnboundSubjectError) Error() string
func (*UnboundSubjectError) Unwrap ¶
func (e *UnboundSubjectError) Unwrap() error
type Undetermined ¶
type Undetermined struct {
// contains filtered or unexported fields
}
Undetermined is the payload of a ValUndetermined value: what the model does fix about a result it leaves open — the count its values conform to, the values it certainly holds.
func (*Undetermined) Count ¶
func (u *Undetermined) Count() semantics.Range
Count is the multiplicity the undetermined values conform to.
func (*Undetermined) Known ¶
func (u *Undetermined) Known() []Value
Known lists the values the result certainly contains.
func (*Undetermined) Positions ¶
func (u *Undetermined) Positions() []Value
Positions lists the leading positions the model fixes, in order: a determined value fills one, an undetermined one holding an exact count fills that many. Nil fixes none.
func (*Undetermined) Reason ¶
func (u *Undetermined) Reason() string
Reason names why the result is undetermined, phrased for a diagnostic.
type UndeterminedBindingError ¶
type UndeterminedBindingError struct {
Target string
Binding string
Endpoint string
// Other is the binding's end opposite Endpoint, as written.
Other string
// Across names the collection the binding's end path crosses to reach Target, if any.
Across string
}
UndeterminedBindingError reports a feature valued by nothing but bindings that each link one unspecified value of it, or bind it together with the same feature of other objects a collection holds, so none of them determines what it holds.
func (*UndeterminedBindingError) Error ¶
func (e *UndeterminedBindingError) Error() string
func (*UndeterminedBindingError) Unwrap ¶
func (e *UndeterminedBindingError) Unwrap() error
type UnevaluableGuard ¶
type UnevaluableGuard struct {
// Step is the action step the guard was read in, 0 for a state machine.
Step int
// Where names the decision node or the state and event, as a ChoicePoint does.
Where string
// Alternative is the branch or transition by declaration position, as a
// ChoicePoint lists it.
Alternative string
// Reason is the evaluation error.
Reason string
File string
Span source.Span
}
UnevaluableGuard is a guard an executor read only to report a choice, once a branch or transition already held, and could not evaluate. A guard with no result is not true, so its succession is not selected; the run is unchanged.
func (UnevaluableGuard) Describe ¶
func (g UnevaluableGuard) Describe() string
Describe renders the guard for a diagnostic: where it was read, which alternative it guards and why it has no result.
func (UnevaluableGuard) Diagnostic ¶
func (g UnevaluableGuard) Diagnostic() diag.Diagnostic
Diagnostic is the guard as a finding about the run: informational, since the library selects no succession whose guard is not true and defines no failure.
func (UnevaluableGuard) Location ¶
func (g UnevaluableGuard) Location() (string, source.Span)
Location is where the guard was declared.
func (UnevaluableGuard) String ¶
func (g UnevaluableGuard) String() string
String is the trace line the guard is recorded as.
type UnknownCheckFeatureError ¶
UnknownCheckFeatureError names a feature Diverge selects that nothing answers to.
func (*UnknownCheckFeatureError) Error ¶
func (e *UnknownCheckFeatureError) Error() string
func (*UnknownCheckFeatureError) Is ¶
func (e *UnknownCheckFeatureError) Is(target error) bool
Is makes every UnknownCheckFeatureError match ErrUnknownCheckFeature.
type UnknownSendPortError ¶
UnknownSendPortError gives the routed send's invalid port and receiver.
func (*UnknownSendPortError) Error ¶
func (e *UnknownSendPortError) Error() string
func (*UnknownSendPortError) Unwrap ¶
func (e *UnknownSendPortError) Unwrap() error
type UnreachableSendReceiverError ¶
UnreachableSendReceiverError gives the routed send's unresolved receiver.
func (*UnreachableSendReceiverError) Error ¶
func (e *UnreachableSendReceiverError) Error() string
func (*UnreachableSendReceiverError) Unwrap ¶
func (e *UnreachableSendReceiverError) Unwrap() error
type UnroutableSendError ¶
type UnroutableSendError struct {
Port string // the port or target the send named, as written
Outbound []string // ends joined to Port that only carry outward
Address bool // the send addressed a target rather than routing through a port
}
UnroutableSendError reports a send that could not be delivered, naming the port it was sent through and the ends joined to it that refused it, so the model can be corrected. An addressed send names a target rather than a port it routes through, so it reports the path that reached no port of any object.
func (*UnroutableSendError) Error ¶
func (e *UnroutableSendError) Error() string
func (*UnroutableSendError) Unwrap ¶
func (e *UnroutableSendError) Unwrap() error
type UnseededDrawError ¶
type UnseededDrawError struct {
What string
}
UnseededDrawError names the draw a run could not make for want of a seed.
func (*UnseededDrawError) Error ¶
func (e *UnseededDrawError) Error() string
func (*UnseededDrawError) Is ¶
func (e *UnseededDrawError) Is(target error) bool
Is makes every UnseededDrawError match ErrUnseededDraw.
type ValidationReport ¶
type ValidationReport struct {
Root *Instance
Verdicts []ObjectVerdict
// Bounded is true when the walk left nesting unreached — deeper than it
// descends, or past its budget — so the unreached objects are unvalidated.
Bounded bool
// Unread are the feature values that could not be read, whose objects went unvalidated.
Unread []error
}
ValidationReport is what validating an object and the objects it holds found.
func (ValidationReport) Complete ¶
func (r ValidationReport) Complete() bool
Complete reports whether the walk reached every object the root holds.
func (ValidationReport) Count ¶
func (r ValidationReport) Count(status ValidationStatus) int
Count is how many verdicts have status.
func (ValidationReport) Status ¶
func (r ValidationReport) Status() ValidationStatus
Status is the status the report is judged by: one violation makes the object invalid whatever else is undecided, and one undecided assertion leaves it unshown.
func (ValidationReport) Valid ¶
func (r ValidationReport) Valid() bool
Valid reports whether the object is shown valid: it states at least one assertion, every assertion holds and every held object was reached.
type ValidationStatus ¶
type ValidationStatus int
ValidationStatus is what checking one assertion on one object decided.
const ( // ValidationHolds is the assertion evaluating to true on the object. ValidationHolds ValidationStatus = iota // ValidationViolated is the model answering the assertion false. ValidationViolated // ValidationUndecided is an assertion that could not be evaluated. ValidationUndecided )
func (ValidationStatus) String ¶
func (s ValidationStatus) String() string
String names the status for a report a machine reads.
type Value ¶
type Value struct {
Kind ValueKind
Const semantics.Value // ValConst: reuse static evaluator
Instance int64 // ValInstance: instance ID; ValVariant: materialized object, 0 for none
// contains filtered or unexported fields
}
Value is a runtime-evaluable value. The scalar payload stays inline because arithmetic copies values through every evaluator frame; the rarer payloads share one slot so the struct stays at 64 bytes.
func DeclaredMeasurementRef ¶
func DeclaredMeasurementRef(sem *semantics.Model, sym *symbols.Symbol, text string, term semantics.UnitTerm) Value
DeclaredMeasurementRef is the reference a unit declaration names, reducing to term, spelt as text (`SI::km`) or, given none, by its symbol (`km`).
func EnumeratedValue ¶
EnumeratedValue is scalar as the value of the enumeration literal sym: what `high = 3` evaluates to, rebuilt from a wire form that carries both.
func NewArrayValue ¶
NewArrayValue wraps an array over its row-major elements; arrayOf checks the invariant `flattenedSize == size(elements)`.
func NewComplex ¶
func NewComplex(z complex128) Value
NewComplex is the value of one complex number. One with a zero imaginary part is the Real its real part is, as 4 / 2 is the Integer 2: equal to it, and classified as it is.
func NewCoordinateFrameValue ¶
func NewCoordinateFrameValue(frame *CoordinateFrame) Value
NewCoordinateFrameValue wraps a frame as a value.
func NewCoordinateTransformationValue ¶
func NewCoordinateTransformationValue(t *CoordinateTransformation) Value
NewCoordinateTransformationValue wraps a transformation as a value.
func NewEmptySequenceOf ¶
NewEmptySequenceOf is the empty sequence of quantities measured in unit, which types the identity an aggregate of it yields.
func NewEnumLiteral ¶
NewEnumLiteral is the value an enumeration literal that declares no value of its own evaluates to: the identity of that literal.
func NewExprValue ¶
func NewExprValue(node ast.Node, env *EvalContext) Value
NewExprValue defers evaluation of an expression, closing over env: the bindings and scope in force where it was written.
func NewFramedVectorQuantityValue ¶
func NewFramedVectorQuantityValue(num []semantics.Value, frame *CoordinateFrame) Value
NewFramedVectorQuantityValue wraps a vector quantity over a coordinate frame, one component per axis.
func NewMeasurementRefValue ¶
NewMeasurementRefValue wraps a unit as a measurement reference value.
func NewMetaobject ¶
NewMetaobject is the value `x meta T` yields for the element x names: that element as an instance of metaclass, the reflective metaclass of its declaration.
func NewQuantityValue ¶
NewQuantityValue wraps a magnitude expressed in a measurement unit.
func NewSequenceValue ¶
NewSequenceValue wraps an ordered collection. A nil sequence is the empty one.
func NewSetValue ¶
NewSetValue wraps a unique collection. A nil set is the empty one.
func NewTensorQuantityValue ¶
NewTensorQuantityValue wraps a tensor quantity; num and units hold one entry per component, flattenedSize of dimensions in all.
func NewUndeterminedValue ¶
NewUndeterminedValue is an undetermined result of count values, for reason.
func NewVariantValue ¶
NewVariantValue is the variant a variation was bound to, with the object it materialized (0 when it materializes none).
func NewVectorQuantityValue ¶
NewVectorQuantityValue wraps a vector quantity; num and units are the same length.
func NewVectorValue ¶
NewVectorValue wraps the vector of the given numeric components.
func (Value) Complex ¶
func (v Value) Complex() complex128
Complex is the number a ValComplex is; 0 for every other kind.
func (Value) CoordinateFrame ¶
func (v Value) CoordinateFrame() *CoordinateFrame
CoordinateFrame is the payload of a ValCoordinateFrame; nil for every other kind.
func (Value) CoordinateTransformation ¶
func (v Value) CoordinateTransformation() *CoordinateTransformation
CoordinateTransformation is the payload of a ValCoordinateTransformation; nil for every other kind.
func (Value) EnumerationLiteral ¶
EnumerationLiteral is the literal a value is: a ValEnumLiteral itself, or the literal a scalar was evaluated from. Nil for a value that is no literal.
func (Value) Function ¶
Function is the calc a ValFunction is a value of — the definition or usage it was read from; nil for every other kind.
func (Value) FunctionClosesOverBody ¶
FunctionClosesOverBody reports a ValFunction closing over the bindings of the behavior body its calc is declared in, which nothing outside that run can rebuild.
func (Value) FunctionName ¶
FunctionName is the qualified name of the calc a ValFunction is a value of, as the wire and diagnostics spell it.
func (Value) FunctionSelf ¶
FunctionSelf is the object a ValFunction's feature names resolve against, nil for a function closing over none.
func (Value) Literal ¶
Literal is the enumeration literal a ValEnumLiteral is: a literal is its own identity, so two values are the same literal exactly when they name the same declaration. Nil for every other kind.
func (Value) LiteralText ¶
LiteralText renders an enumeration literal as it is written, qualified by the enumeration it is a literal of: `Color::red`.
func (Value) MeasurementRef ¶
func (v Value) MeasurementRef() *MeasurementRef
MeasurementRef is the payload of a ValMeasurementRef; nil for every other kind.
func (Value) MetaobjectClass ¶
MetaobjectClass is the reflective metaclass a ValMetaobject is an instance of; nil for every other kind.
func (Value) MetaobjectElement ¶
MetaobjectElement is the element a ValMetaobject denotes; nil for every other kind.
func (Value) MetaobjectText ¶
MetaobjectText renders a metaobject as the element it denotes and the metaclass it is an instance of: `meta(Pkg::x : KerML::Feature)`.
func (Value) Object ¶
Object returns the object a value denotes: an instance, or the object a selected variant materialized.
func (Value) Scalar ¶
Scalar is v shorn of any enumeration literal identity: the bare scalar a scalar-valued literal equals, or v itself for any other value.
func (Value) TensorQuantity ¶
func (v Value) TensorQuantity() *TensorQuantity
TensorQuantity is the payload of a ValTensorQuantity; nil for every other kind.
func (Value) Undetermined ¶
func (v Value) Undetermined() *Undetermined
Undetermined returns the payload of a ValUndetermined value, nil for any other.
func (Value) VectorQuantity ¶
func (v Value) VectorQuantity() *VectorQuantity
VectorQuantity is the payload of a ValVectorQuantity; nil for every other kind.
type ValueKind ¶
type ValueKind int
ValueKind distinguishes runtime value types.
const ( ValInvalid ValueKind = iota ValConst // wraps semantics.Value (int/real/bool/infinity) ValNull ValString ValInstance ValSequence ValSet ValExpr // wraps unevaluated AST node for delayed evaluation (e.g., BodyExpr for select/collect) ValQuantity // a magnitude and the measurement unit it is expressed in ValVariant // the variant selected for a variation, and the object it materializes ValEnumLiteral // one literal of an enumeration definition, identified by itself ValComplex // one complex number, its real and imaginary parts together ValArray // a Collections::Array: its dimensions and its row-major elements ValVector // a NumericalVectorValue: the numbers of its one dimension ValVectorQuantity // a VectorQuantityValue: a vector with a measurement unit per axis ValMeasurementRef // a ScalarMeasurementReference: a unit by declaration and reduction ValTensorQuantity // a TensorQuantityValue: an array of numbers with a measurement unit per component ValCoordinateFrame // a VectorMeasurementReference: a frame's axes, or a measurement scale's one ValCoordinateTransformation // a CoordinateTransformation: a placement of one frame in another ValFunction // a calc as a value: its lowered shape closed over the environment it was read in ValMetaobject // an element of the model as an instance of its reflective metaclass (`x meta T`) ValUndetermined // a model-level result the model does not determine; see Undetermined )
type Vector ¶
type Vector struct {
Elements []semantics.Value
// Object is the NumericalVectorValue object the value was read from, which keeps
// answering the members a specialization adds; 0 for a vector made by value.
Object int64
}
Vector is a VectorValues::NumericalVectorValue: the numbers of an Array of one dimension, its `dimension`.
type VectorQuantity ¶
type VectorQuantity struct {
Num []semantics.Value
Units []Unit
// Frame is the coordinate frame the vector was written over (`(1, 2, 3) [datum]`),
// whose axes Units are; nil for one written over a scalar unit.
Frame *CoordinateFrame
}
VectorQuantity is a Quantities::VectorQuantityValue: the numbers `num` and the unit each axis of its measurement reference (`mRef.mRefs`) is expressed in.
func (*VectorQuantity) Dimension ¶
func (vq *VectorQuantity) Dimension() int
Dimension is the number of components.
type VerdictKind ¶
type VerdictKind string
VerdictKind is the verdict a run of a verification case's body produced, one literal of the library's VerdictKind enumeration.
const ( // VerdictPass is a body whose verdict value is VerdictKind::pass. VerdictPass VerdictKind = "pass" // VerdictFail is a body whose verdict value is VerdictKind::fail. VerdictFail VerdictKind = "fail" // VerdictInconclusive is a body that ran and produced no verdict value. VerdictInconclusive VerdictKind = "inconclusive" // VerdictError is a body whose run could not be carried out. VerdictError VerdictKind = "error" )
type VerdictStatus ¶
type VerdictStatus int
VerdictStatus is what a check of a case decided.
const ( // VerdictSatisfied is a check whose required conditions all held. VerdictSatisfied VerdictStatus = iota // VerdictNotSatisfied is a check with a required condition that did not hold. VerdictNotSatisfied // VerdictUndecided is a check that could not be evaluated. VerdictUndecided )
func (VerdictStatus) String ¶
func (s VerdictStatus) String() string
String names the status as a report words it.
type VerificationResult ¶
type VerificationResult struct {
// Verdict is the body's verdict.
Verdict VerificationVerdict
// Run is the case's outputs and the verdict of each objective and
// assertion; zero when the body could not run.
Run AnalysisResult
// Subcases are the verdicts of the verification cases this case performs as
// steps. The library states no roll-up of a subcase's verdict into its
// parent's (VerificationCases::VerificationCase::subVerificationCases), so
// each is reported on its own.
Subcases []VerificationVerdict
}
VerificationResult is what one run of a verification case produced: the verdict of its body, what the run reported as an analysis case's run does, and the verdict of each verification subcase its body performs.
type VerificationVerdict ¶
type VerificationVerdict struct {
// Case is the qualified name of the verification case that ran.
Case string
// Symbol declares the verification case.
Symbol *symbols.Symbol
// Kind is the VerdictKind literal the body produced.
Kind VerdictKind
// Detail is the message of an error verdict, or why an inconclusive one
// decided nothing; empty for pass and fail.
Detail string
// Subcase marks the verdict of a case performed by another, which the
// library states no roll-up for and which is therefore reported on its own.
Subcase bool
}
VerificationVerdict is the verdict one run of a verification case's body produced. It is reported beside the requirement-satisfaction verdicts of the same case, which it does not replace: the SysML v2 specification leaves the evaluation of a verdict unspecified, so this verdict is what running the body and the library's own PassIf calculation answer.
type ViaNotPortError ¶
type ViaNotPortError struct {
Via string // the via path as written
Value string // the object the binding holds, formatted
}
ViaNotPortError gives the bound via path holding an object that is no port, and what it holds.
func (*ViaNotPortError) Error ¶
func (e *ViaNotPortError) Error() string
func (*ViaNotPortError) Unwrap ¶
func (e *ViaNotPortError) Unwrap() error
type Violation ¶
type Violation struct {
Kind ViolationKind
// Name is the property violated, empty for a deadlock or a failure.
Name string
// Err is the deadlock or the failure as the executor reported it, nil for a property.
Err error
// Depth is how many moves the witness makes.
Depth int
Witness Witness
// Mass is the probability of the schedules reaching this violation: the sum
// of their path masses, each the product of its picks' shares — a weighted
// choice's stated share, an unweighted one's uniform share. It is a lower
// bound while the report's MassBounded holds.
Mass float64
}
Violation is one violation a schedule reached, with the schedule as its witness.
type ViolationError ¶
type ViolationError struct {
Kind string // "constraint" or "requirement"
Element string // name of the element stating the condition
What string // "assertion" or "require condition"
Condition string // the condition, rendered
}
ViolationError reports a condition that evaluated to false, naming the condition so a verdict says which one failed. It unwraps to ErrViolated, since it is a verdict about the model rather than a failure to evaluate.
func (*ViolationError) Error ¶
func (e *ViolationError) Error() string
func (*ViolationError) Unwrap ¶
func (e *ViolationError) Unwrap() error
type ViolationKind ¶
type ViolationKind int
ViolationKind classifies what a schedule reached.
const ( // ViolationProperty is a property evaluating false at a reached state. ViolationProperty ViolationKind = iota // ViolationDeadlock is a state with no move where an action is not complete. ViolationDeadlock // ViolationFailure is a typed runtime error a move raised. ViolationFailure )
func (ViolationKind) String ¶
func (k ViolationKind) String() string
type Witness ¶
type Witness struct {
Objects []ObjectNamed
Inputs []InputTaken
// DrawPolicy is the policy the draws were resolved under; the line is written
// only for a fixed policy, so a random run's witness reads as before.
DrawPolicy DrawPolicy
// ClockStep is the step, in seconds, the run's clock ticked by; the line is
// written only for a stepped clock, so a continuous run's witness reads as before.
ClockStep float64
Draws []DrawTaken
Choices []ChoiceTaken
Trace string
// Property names the property false at the state the schedule reaches, or
// whose evaluation there fails as Fails says; empty for a state or a run's failure.
Property string
// Fails is the deadlock or failure the schedule ends in, as the executor
// spells it — or the property's evaluation raised; empty for a state the run goes on from.
Fails string
}
Witness is one schedule as a witness file holds it: the objects its moves name bound to their paths, the inputs the run fixes before its first move, the values its random draws took, the choices that fix the schedule as a replay follows them, and the trace the run leaves, as the trace recorder writes it.
func ParseWitness ¶
ParseWitness reads a witness as Witness.String writes it: the header of input and choice lines, after the blank line ending it the trace, exact, and after a blank line ending that the claims closing it, if any.
func (Witness) Empty ¶
Empty reports whether the witness fixes no input, records no draw and takes no choice.
func (Witness) String ¶
String renders the witness as a file holds it: its objects one per line, its inputs one per line, `draws by <policy>` for a fixed draw policy, `clock steps by <seconds>` for a stepped clock, its draws one per line, its choices one per line — or `no choice points` — a blank line, the trace, and after a blank line the claims closing it: `property: <name>` for a property's, `fails: <the failure>` for a schedule ending in a failure, last.
type WitnessDrawError ¶
type WitnessDrawError struct {
// Draw is the 1-based position of the draw in the witness, 0 past its last.
Draw int
What string
Reason string
}
WitnessDrawError names the draw a replay could not follow and why.
func (*WitnessDrawError) Error ¶
func (e *WitnessDrawError) Error() string
func (*WitnessDrawError) Is ¶
func (e *WitnessDrawError) Is(target error) bool
Is makes every WitnessDrawError match ErrWitnessDraw.
type WitnessInputError ¶
WitnessInputError reports a witness input the run could not fix before its first move: the feature named, and why.
func (*WitnessInputError) Error ¶
func (e *WitnessInputError) Error() string
func (*WitnessInputError) Is ¶
func (e *WitnessInputError) Is(target error) bool
Is makes every WitnessInputError match ErrWitnessInput.
type WitnessObjectError ¶
type WitnessObjectError struct {
Object ObjectNamed
Reason string
}
WitnessObjectError reports an object a witness names by path that the run replaying it did not make.
func (*WitnessObjectError) Error ¶
func (e *WitnessObjectError) Error() string
func (*WitnessObjectError) Is ¶
func (e *WitnessObjectError) Is(target error) bool
Is makes every WitnessObjectError match ErrWitnessObject.
Source Files
¶
- action_body_run.go
- action_choice.go
- action_executor.go
- action_frame.go
- action_holds.go
- action_statements.go
- action_subflow.go
- action_terminate.go
- adopt.go
- adopt_frame.go
- advance.go
- analysis.go
- analysis_run.go
- array.go
- assign_chain.go
- binding.go
- binding_reads.go
- budget.go
- builtin_names.go
- builtins.go
- builtins_named.go
- builtins_occurrence.go
- builtins_signature.go
- calc_statements.go
- calc_usage.go
- carry.go
- case_step.go
- cast.go
- check.go
- check_body.go
- check_invocation.go
- check_moves.go
- check_reduce.go
- check_replay.go
- check_run.go
- check_schedule.go
- check_state.go
- choice.go
- classification.go
- classifier_behavior.go
- classify.go
- clock.go
- clock_read.go
- collections.go
- compile.go
- compiled_ops.go
- compiled_stmts.go
- complex.go
- condition.go
- connector.go
- context.go
- coordinate_frame.go
- declared.go
- dependents.go
- describe.go
- doc.go
- draw_policy.go
- errors.go
- eval.go
- evaluation_log.go
- executor_common.go
- explore.go
- explore_queue.go
- extent.go
- frame.go
- frame_functions.go
- frame_read.go
- frame_transform.go
- function_value.go
- held.go
- held_image.go
- held_image_behavior.go
- holders.go
- instance.go
- invoke_action.go
- invoke_calc.go
- invoke_operation.go
- invoke_predicate.go
- library_conversions.go
- library_frame.go
- library_functions.go
- library_operators.go
- library_unevaluable.go
- lifetimes.go
- materialize.go
- measurement_ref.go
- measurement_ref_functions.go
- metadata.go
- metaobject.go
- model.go
- modeled.go
- montecarlo.go
- montecarlo_case.go
- nested_redefinition.go
- object_path.go
- occurrence_terminate.go
- open_domain.go
- outcome.go
- outer_feature.go
- perform.go
- pristine.go
- quantity.go
- quantity_functions.go
- random_functions.go
- range.go
- replay.go
- routing.go
- satisfy.go
- scale_arith.go
- scale_conversion.go
- schedule_replay.go
- scheduler.go
- set_feature.go
- set_order.go
- shape.go
- shared_default.go
- shared_verdict.go
- signal.go
- snapshot.go
- start_behavior.go
- state_change_trigger.go
- state_executor.go
- state_region_entry.go
- state_region_transition.go
- state_route.go
- state_run_to_completion.go
- state_space.go
- state_statements.go
- state_unit_front.go
- statements.go
- subsetting.go
- sweep.go
- sweep_queue.go
- tensor.go
- tensor_functions.go
- tool.go
- tool_calc.go
- trace.go
- transition_payload.go
- undetermined.go
- uniqueness.go
- validate.go
- value.go
- value_equality.go
- variation.go
- vector_functions.go
- verification_cases.go
- verification_run.go
- via_reference.go
- write_conformance.go