From the semantic program to realization
Authorities: the corresponding contract is carried verbatim in Authorities — this chapter is pedagogical and does not replace it.
FormaSL separates the semantic definition of an application from the mechanisms used to execute it. The .fsl programs declare the structures, contracts and operations constituting their meaning. Realization associates those declarations to capabilities, providers and concrete resources, preserving the conditions under which the results must be interpreted.
That passage goes through the resolution of declarations, the formation of the explicit semantic program, the identification of realization requirements and the binding of those requirements to available mechanisms. The resulting plan can then be executed over a determined state. The information produced by the runtime is interpreted according to the operation’s contracts and can join new computations or semantic transitions.
The semantic source
The .fsl files constitute the authoritative source of meaning and semantic data. They gather declarations of types, relations, theories, rules and applications, besides the source content admitted by the language. An application uses those structures under contracts establishing its inputs, operations and results.
The declared semantics keeps its interpretation basis: resolved identities, contract revisions, time and context information and the pertinent authority or dependency relations. A program can be employed in different operational environments because those conditions belong to the language’s definition, and the choice of concrete mechanisms happens at another stage.
Modules and packages organize the authorship and distribution of those declarations. Resolution fixes which contracts and referents were selected; the file path, a package name or the loading order do not replace that basis.
Resolution, verification and elaboration
Before realization, FormaSL determines the program’s structure. The language recognizes the source constructs, resolves bindings and references and applies the static judgments of formation, types and interfaces. The result is an admitted and resolved program, with a declaration basis sufficiently determined for the next stage.
Elaboration takes that program to an explicit semantic representation. In it, the meaning of the constructs stays associated with their contracts, the referents’ identities and the origin in the source text. The correspondence includes, when relevant, the revisions of types, relation contracts and operations, as well as the input, result and semantic continuity requirements.
The explicit semantic program is a contractual function of the architecture. Compilers and tools can employ their own intermediate representations as long as they keep the correspondence with the source and the semantic observables required by the language.
Applications and realization requirements
A semantic application binds a contract to inputs and conditions of use. It can represent a query, an analysis, an inference, a transformation or a governed operation. The application’s declaration and the execution instance are identified separately, letting the same contract be realized and executed under different bases.
When an application needs mechanisms external to the semantic definition, it establishes a RealizationRequirement. That requirement describes, independently of a specific provider, the capability needed to realize the operation. According to the contract, it can include the capability class, the exact revision of the operator or model, the regime of exactness or approximation, the completeness and determinism guarantees, the assurance requirements and the trust boundary for external inputs.
An analysis application can require an operator whose output has a determined statistical interpretation; an observation can require acquisition by an instrument with identified guarantees; an action operation can require an appropriate execution capability. Each requirement allows examining what the environment offers without changing the application’s semantic contract.
The semantic admission of the program, the satisfaction of its realization needs and the readiness to execute are different states of the path. That separation makes it possible to identify precisely whether a difficulty belongs to the declaration, to the availability of capabilities or to the execution.
The role of .fsp files
The .fsp files specify realization. They select or restrict mechanisms, providers, resources and operational policies to satisfy requirements previously established by the semantic program.
The language surface offers a realization declaration, with binding targets. A for app target refers to an application declaration; for stage identifies a specific application locus within a composition. There are also targets of module, source, composition and capability, according to the contracts admitting them.
The clauses have their own responsibilities. bind associates a realization slot with a value or mechanism. require declares a requirement, limit establishes a limit, prefer expresses a preference and budget specifies a budget applicable to the corresponding slot. Groups allow formulating joint conditions over related targets. Those choices are interpreted according to the exact realization schema and the language’s specificity rules.
One profile can, for example, bind an analysis to an operator available in a determined infrastructure and establish resource requirements. Another profile can select a compatible alternative for the same program. The binding keeps the operation’s identity, its contract’s revision and the guarantees the chosen mechanism must satisfy.
Static resolution of realization
Static weaving is the stage resolving the relation between semantic requirements and realization choices. From the declared program and the .fsp configuration, FormaSL determines the applicable bindings and obtains an executable association with the original contract preserved.
The resolution considers the required capabilities, the guarantees offered by candidate mechanisms, the selected targets and the operational restrictions. When the environment satisfies those conditions, the bindings can be incorporated into the realization plan. When a reference remains ambiguous or a needed capability cannot be satisfied, the result expresses the corresponding condition.
The identity of an application and the choice of the mechanism are recorded in different plans. Static weaving establishes how to realize a contract, preserving the contract defined in the .fsl source.
Planning and executable representation
A resolved realization offers the planner the operations, dependencies and restrictions needed to build an executable plan. That plan can use indexes, specialized algorithms, intermediate transformations, parallelism, batches and storage mechanisms adequate to the selected infrastructure.
Planning distinguishes data dependency, semantic order and operational scheduling. Data dependency indicates that a stage consumes another’s result. Semantic order establishes precedences needed by meaning, such as introducing a decision before a request using it. Scheduling organizes the effective execution, respecting those conditions.
With that, a query can be optimized without changing the meaning of its results, and independent stages can be executed according to the environment’s possibilities. The transformations and optimizations keep the material semantic observables: identity, interpretation basis, required order, result status, dependencies and completeness, among others.
Resources and physical realization
Realization choices can also involve physical requirements and component placement. The PhysicalRealization contract relates a realization plan, the resolved providers, a placement assignment and the resource requirements needed to examine its adequacy to a device or topology.
The admission of that realization can determine that the requirements are satisfied, that some condition is provenly not satisfied or that the available information is still insufficient for the judgment. That evaluation uses evidence of capabilities, resources, placement and required guarantees, keeping the basis that grounded the result.
Memory, processing capacity, latency, energy and bandwidth can join the physical requirements. Gas has another function: it bounds the logical computational work according to the execution contract. The two sets of requirements can act on the same application without losing their responsibilities.
Execution instances and dynamic state
The runtime executes bound applications over a determined state. Each execution instance identifies the application, the pertinent interpretation basis, the resources employed and the operational events needed to reconstruct its results.
Some inputs only exist during execution. An operation can consume a newly acquired observation, an identity introduced by an earlier transition or a result produced at another stage. The semantic definition fixes the nature of the required input and the binding rule; the runtime provides the concrete value through an admitted path.
The contract also determines when the interpretation basis is fixed. In prolonged evaluations, it can be relevant to operate over a frozen revision or under explicit rules of basis evolution. The execution record keeps the revisions and instants that effectively participated in the result.
The ending of an operational task is recorded separately from the semantic completeness of the result. Thus gas exhaustion, a provider failure, a partial response and a concluded query have the states corresponding to the contracts producing them.
Providers and reconstruction of results
Providers and specialized engines realize capabilities under defined interfaces. A mechanism can execute a query, perform an analysis, access a service or acquire external information. Its operational output crosses an interpretation boundary before acquiring the semantic status foreseen by the consuming contract.
That boundary verifies or reconstructs, according to the operation, the compatibility of values and types, the revision of the contract used, the interpretation basis, the completeness or precision guarantees, the provenance and the correspondence between source, application, execution and result.
An analytical model can return an estimate accompanied by information about its execution. The corresponding semantic result is constituted under the AnalysisContract admitting it. An instrument can provide a reading, used as evidence by an observation contract. Each passage keeps the nature and guarantees of the produced information.
Reuse, incrementality and continuity
Realization can use previously produced results, caches, incremental execution and fusion optimizations when the contracts allow. Reuse considers the dimensions participating in meaning: source and theory revisions, context, scope, temporality, provenance, result identities and completeness conditions.
An incremental result can be consumed before total completion when an incremental consumption contract establishes the admitted partial states, their evolution and the effects allowed to the consumer. Stream transmission is a delivery mechanism; the semantics of the increments belongs to the result’s contract.
Semantic continuity applies to the whole path: from source to elaborated representation, from the realization binding to the plan, from execution to the reconstructed result. An optimization can reorganize the calculations, but preserves the distinctions required for other operations to interpret its results correctly.
A realization path
Consider an application tracking the preservation of medicine during transport. Its .fsl modules declare lots, shipment relations, temperature observations, quality criteria and evaluation operations. A composition queries the pertinent measurements, produces an analysis and forwards the result to the governed operations deciding the batch’s destination.
Resolution fixes the identities of the declarations, the contracts and their revisions. Elaboration makes the applications and dependencies explicit. An .fsp profile associates the query, analysis and acquisition requirements to the capabilities available in the environment. Static weaving produces the bindings, and planning organizes the execution under the declared precedences.
During execution, an acquisition mechanism can provide readings under its contract, while another mechanism calculates a risk estimate. The runtime receives the outputs and relates them to the pertinent execution instances. The interpretation boundaries constitute the semantic results to be consumed by the later stages, preserving the dependency on the measurements, criteria and models used.
If the decision requires an external action, it can ground an execution request. The operational attempt, the possible effect on the batch and the later observations add distinct events to the history. The incorporation of information into the authoritative source happens through a governed transition, producing a new source basis for later computations.
The same semantic program can be bound to another infrastructure satisfying its requirements. The realization choices change; the operations’ responsibilities and the interpretation conditions remain determined by the origin contracts.
Related documentation
Modules, interfaces and reference resolution presents the organization of source and bindings. Semantic operations and transitions describes the contracts applied during computation. Semantic continuity defines the preservation obligations accompanying transformations and execution.