Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FormaSL language guide

This is a reference for the implemented FormaSL surface, not a claim that every admitted construct has a complete evaluator, provider, or persistence route. The implementation keeps three boundaries separate:

QuestionPublic operationWhat a positive result means
Is the source admitted and elaborated?formasl checkThe supplied source set passed the current source and semantic gateway.
What checked structure was retained?formasl inspectThe requested checked projection was produced; inspection does not execute an application.
What did a selected bridge do?formasl run --gas NOne of the implemented family routes produced a typed outcome under that budget.

A parsed form is therefore neither an external fact, a provider invocation, nor a durable mutation by itself. This guide labels source forms and records the runtime boundary for each family instead of deleting syntax whose execution route is intentionally bounded.

Fences labelled formasl-syntax and formasl-realization are complete parser-admission witnesses for the source and realization planes. They are executably parsed by the documentation gate, but are not presented as a promise that every referenced contract resolves or every family has a productive runtime bridge. Ordinary formasl fences are complete facade-checked examples.

Source and realization units

There are two concrete-language planes:

  • A .fsl source unit contains exactly one module.
  • A .fsp realization unit contains exactly one realization. It is a plan for bindings and requirements, not another semantic module.

The CLI checks the .fsl operands supplied on one command line as one explicit source set. It does not search neighbouring directories to satisfy imports. For example, the composition example requires both examples/F06-dag-composition-realization/artifact-model.fsl and examples/F06-dag-composition-realization/canonical.fsl on the command line.

Modules, imports, exports, and interfaces

The current parser accepts the following module-level forms. Q denotes a qualified reference and Name a local identifier.

module Q { … }
import Q
import Q { Name, Name as LocalName }
import claim Q as local_claim
export { Q, Q as PublicName }
interface PublicInterface {
    expose Q
    expose Q as PublicName
}

import Q { … } is the selective-import spelling; do not invent a ::* or ::{…} spelling. Imports are resolved only against the explicit source set provided to check, inspect, run, or realize.

module module_surface {
    import other_module { Entity as ImportedEntity, Contract }
    import claim other_module::foreign_claim as imported_claim
    export { ImportedEntity as PublicEntity }
    interface Public {
        expose ImportedEntity as PublicEntity
        expose Contract
    }
}

Names, terms, expressions, and layout

  • A bare identifier cannot contain -; use "team-a" when the value is a hyphenated string. Reserved words such as case, fact, base, view, app, and application-family keywords are not safe bare declaration names. Escape an identifier with backticks only where the grammar permits it.
  • $name is a lexical variable in claims, fields, and application parameters. ?name is a witness variable in patterns and rules. _ is an anonymous wildcard in atom/pattern positions.
  • A canonical relation or rule atom uses a parenthesized named-role map: Rel(role: value, other: ?w). It is not a record literal and it is not a brace role map.
  • Expression positions accept literals, lexical variables, qualified references, member access, lists, typed records, pure calls, unary not and -, and the implemented binary operators. A witness variable is accepted only in a bound-expression position.
  • A hard line break or ; terminates a clause. Two clauses on one line require ;; braces delimit modules and structured bodies.

The current declaration form is kind-led. In particular, content is a real declaration kind; historical fact and base spellings are not aliases for it.

Declarations and relation contracts

The frontend implements these kind-led declaration families:

// types and nominal structure
type Name<Param <: Bound> [specializes Parent] [ { field: value … } ]
alias type Name<…> = Target<…>
distinct type Name<…> = Target<…> [ { field: value … } ]
opaque type Name<…> [ { field: value … } ]
subtype Child <: Parent

// semantic declarations
relation Name<…> [using Q] { role … }
theory Name [using Q] { use Q | statement Name using Q { … } | adopt Q [under Q] }
ontology Name [using Q] { … }
rule Name using Q(?w: Type, …) { … }
constraint Name using Q($x: Type, …) { … }
policy Name using Q { … }
hypothesis Name($x: Type, …) using Q [ { … } ]
action Name($x: Type, …) [-> Result] using Q [ { … } ]
content Name [: Type] [using Q] [ { field: value … } ]

type … specializes … and subtype … <: … are distinct authored forms. A subtype Child <: Parent must name an already admitted compatible type; it is not a shorthand that creates the type declaration.

A relation has named roles. Each role uses one of the two current admissibility forms:

role name: Type [using Q] [ { role-contract-clause … } ]
role name accepts Q [using Q] [ { role-contract-clause … } ]

Within a role contract, current clauses include:

occurs 1 | 0..1 | 1..* counting Q
multiplicity: Q
ordering: Q
slot: Q
qualify: Q
correlation: Q
field_name: expression

A finite range with its lower bound greater than its upper bound rejects as MALFORMED_RANGE. These clauses are source and checked contracts; their presence does not assert an external store is enforcing the relation.

module declaration_surface {
    type Entity
    type Asset specializes Entity
    alias type EntityAlias = Entity
    distinct type AssetKey = Entity
    opaque type Token
    subtype Asset <: Entity

    relation Owns {
        role owner: Entity
        role asset accepts Entity
    }

    content Basis
    theory Base {}
    ontology Catalog using Base {
        use Base
        statement entry using Base { note: "catalogue" }
        adopt Base under Base
    }
    policy Gate using Basis {
        clause allow {
            where true
            note: "policy"
        }
    }
    constraint Valid using Basis($asset: Asset) {}
    hypothesis Candidate($asset: Asset) using Basis {}
    action Record($asset: Asset) using Basis {}
}

The following complete source is checked by the documentation gate and shows the basic type/relation/assertion path used by the larger examples:

module language_core {
    type Person
    type Topic

    relation Mentions {
        role speaker: Person
        role subject: Topic
    }

    assert claim first_mention : Mentions(speaker: "sam", subject: "formasl") {
        by : $guide
    }
}

Claims and lifecycle records

Claims are relation occurrences with an authored lifecycle. The current surface is not claim import; the import form leads with import:

import claim Q as local_claim
assert claim name : Relation(role: value, …) { by: expression … }
adopt claim existing_claim as local_name { by: expression … }
retract claim local_name { by: expression … }
supersede claim old_name with new_name { by: expression … }

The standard contract-field vocabulary includes by, for, under, based_on, valid_at, recorded_at, scope, frame, and support. The assertion body must include its by attribution. supersede records a lifecycle edge; it does not delete the old occurrence and it does not, by itself, calculate a unique “current” claim.

module claim_surface {
    type Artifact
    type Position
    relation States {
        role subject: Artifact
        role position: Position
    }

    assert claim open_v1 : States(subject: $release, position: $open) {
        by : $registry
        valid_at : $t1
        recorded_at : $t2
    }
    adopt claim open_v1 as accepted_open {
        by : $reviewer
        based_on : $review_basis
    }
    retract claim accepted_open {
        by : $reviewer
        based_on : $later_evidence
    }
    assert claim open_v2 : States(subject: $release, position: $open) {
        by : $registry
        based_on : $correction
    }
    supersede claim open_v1 with open_v2 {
        by : $registry
        based_on : $correction
    }
}

For a checked lifecycle and conflict example, use examples/F07-claim-lifecycle-conflict-time/canonical.fsl.

Query applications

A match application names a query over relation occurrences; it does not match a type declaration. Its using Q header is optional (all other application families require using Q):

match Name($parameter: Type, …) [using Q] [-> Result] {
    query-clause …
}

A pattern witness begins with ? and uses a relation role map. Every referenced relation and role must be declared. The complete query-clause surface and its current execution boundary are described next.

module language_query {
    type Name

    relation Greets {
        role greeter: Name
        role greeted: Name
    }

    assert claim greeting : Greets(greeter: "world", greeted: "formasl") {
        by : $guide
    }

    match FindGreetings() {
        pattern ?greeting: Greets(greeter: ?who)
    }
}

Query clauses, paths, and execution boundary

The following are current source clauses. Aggregate operators are spelled exactly COUNT, SUM, MIN, MAX (uppercase) and resolve against the exact language/operator basis — a content named Count is not an aggregate operator:

pattern ?occurrence: Relation(role: ?value, …)
path ?path from ?from to ?to { step Relation from role to role … }
where bound_expression
optional { query-match-item … }
exists { query-match-item … }
not exists { query-match-item … }
alternative [using Q] { branch { query-match-item … } branch { … } }
select expression [as alias], …
distinct expression, …
aggregate COUNT(expression) [by expression, …] [as ?aggregate]
group by expression, …
having bound_expression
order by expression [asc|desc], …
any N | offset N | limit N | top N by expression … ties Q
view graph Name { include bound_expression | field: expression … }

A path body also admits repeat min..max [as ?group] { … }, alternative set|multiset|using Q { branch { … } … }, each ?item in ?group where …, summarize Q(expression) as ?summary, reuse: Q, and selector: Q. The source grammar can read repeat 1..*, but the check boundary rejects an unbounded path with INVALID_UNBOUNDED_PATH_FORMATION; use a finite upper bound when the intent is a checkable bounded path.

module query_surface {
    type Artifact
    relation DependsOn {
        role dependent: Artifact
        role prerequisite: Artifact
    }
    content QueryContract

    match QueryClauseMatrix($g: Artifact) using QueryContract {
        pattern ?edge: DependsOn(dependent: ?x, prerequisite: ?y)
        where ?x == $g
        optional {
            pattern ?next: DependsOn(dependent: ?y, prerequisite: ?z)
        }
        exists {
            pattern ?exists: DependsOn(dependent: ?x, prerequisite: ?y)
        }
        not exists {
            pattern ?missing: DependsOn(dependent: ?z, prerequisite: ?x)
        }
        alternative {
            branch { pattern ?left: DependsOn(dependent: ?x, prerequisite: ?y) }
            branch { pattern ?right: DependsOn(dependent: ?y, prerequisite: ?z) }
        }
        group by ?x
        having ?x == $g
        select ?x as dependent
        distinct ?x
        aggregate COUNT(?edge) by ?x as ?n
        order by ?x desc
        any 3
        offset 1
        limit 10
        top 5 by ?x desc ties QueryContract
        view graph DependencyView {
            include ?x
        }
    }

    match BoundedPaths() {
        pattern ?edge: DependsOn(dependent: ?x, prerequisite: ?y)
        path ?p from ?x to ?y {
            step DependsOn from dependent to prerequisite
            step ?w: DependsOn from dependent to prerequisite
            repeat 1..3 as ?group {
                step DependsOn from dependent to prerequisite
                alternative set {
                    branch { step DependsOn from dependent to prerequisite }
                    branch { step DependsOn from dependent to prerequisite }
                }
            }
            alternative multiset {
                branch { step DependsOn from dependent to prerequisite }
                branch { step DependsOn from dependent to prerequisite }
            }
            each ?step in ?group where ?step == ?x
            summarize COUNT(?step) as ?summary
            reuse: ReusePolicy
            selector: SelectorContract
        }
    }
}

The implemented query engine (formasl_query::evaluate, routed through the public run bridge) evaluates the full admitted match clause surface: pattern conjunctions, where/having filters, optional, exists/not exists, alternative branches, path traversal, COUNT/SUM/MIN/MAX aggregates (each with its as witness), group by, select, distinct, order by, any, offset, limit, top … ties, and view graph clauses.

  • Aggregates are spelled exactly COUNT, SUM, MIN, MAX (uppercase) and resolve against the exact language/operator basis, never inferred from a content name. SUM folds only under an exact closed commutative-monoid reducer domain and MIN/MAX only under an exact determining-order contract; a nonvalue among fold inputs is a typed rejection, never a silent skip. On an empty global group COUNT yields 0 and SUM the typed additive zero, while MIN/MAX leave their alias undefined without deleting the group.
  • path executes its contract pipeline — endpoint correlation, role-exact steps, reuse policy, admissible family, selector, post-filter — and binds a structured path/path-group value distinct from any reference or display string. The public machine projection renders it only under schema revision 1; revision 0 fails closed on such values rather than laundering them. An unbounded repeat is rejected at check time with INVALID_UNBOUNDED_PATH_FORMATION.

Treat a match result as the result of this engine boundary: a clause that cannot complete under its owner’s contract fails closed with its typed outcome — never a silent skip, never a laundered COMPLETE.

For checked query fixtures, see examples/F04-query-semantics/basic.fsl and examples/F04-query-semantics/advanced.fsl.

Rules and bounded inference

A rule must lead with a declared using basis. Rule variables are witness variables (?x), not lexical $x variables. A derived-head witness must be range-restricted by the body; every variable in a naf atom must already be positively bound in the same rule.

rule Name using Relation(?x: Type, …) {
    when Relation(role: ?x, …)
    naf Relation(role: ?x, …)
    where bound_expression
    exists ?w
    aggregate ?n = AggregateQ(?value) by ?key
    derive [positive|negative] Relation(role: expression, …)
}

infer Name($parameter: Type, …) using Basis {
    theory: Q
    goal Relation(role: ?w, …)
    // or: goal: Q
}

Inside a rule body, the aggregate clause’s by group components admit exactly three forms (OD-RC-R2-AGG-03):

aggregate ?n = COUNT(Source) by Source.role          // member-derived
aggregate ?n = COUNT(Source) by Source.role as ?g     // seeded or member-derived output
aggregate ?n = COUNT(Source) by ?key                  // compatibility shorthand
  • by Source.role groups by the source member’s role value; no same-named binder is synthesized.
  • by Source.role as ?g correlates the member role with ?g: when ?g is positively bound elsewhere in the rule body the component is seeded (outer value → group), otherwise ?g is an explicit output binder available after group selection.
  • by ?key is compatibility shorthand: the binder must be positively bound by exactly one DISTINCT role of the exact aggregate source over the whole rule; zero candidates reject with AGGREGATE_GROUP_CORRELATION_REQUIRED, more than one with AMBIGUOUS_AGGREGATE_GROUP_CORRELATION. Correlation by spelling, source order, or first match never decides.

Inside a rule body, the aggregate clause’s operator name is a declared aggregate basis (for example a content), distinct from the uppercase language operators used in match aggregates.

module reasoning_surface {
    type Node
    relation Edge {
        role from: Node
        role to: Node
    }
    relation Reach {
        role from: Node
        role to: Node
    }

    rule Seed using Edge(?x: Node) {
        when Edge(from: ?a, to: ?b)
        derive positive Reach(from: ?a, to: ?b)
    }
    rule Step using Edge(?x: Node) {
        when Edge(from: ?a, to: ?b)
        when Reach(from: ?b, to: ?c)
        naf Edge(from: ?c, to: ?a)
        derive positive Reach(from: ?a, to: ?c)
    }
    rule ExistentialReach using Reach(?x: Node) {
        when Edge(from: ?a, to: ?b)
        exists ?w
        derive positive Reach(from: ?a, to: ?w)
    }
    content Basis
    infer Reachability() using Basis {
        goal Reach(from: ?from, to: ?to)
    }
}

The implemented inference route covers the positive R1 closure path, the R2 route (including its admitted stratified-negation/expression subset), and the R3 warded-existential route. It is bounded by --gas: a nonconverged route is not a successful result. R1/R2 report FIXPOINT_REACHED or OUT_OF_GAS; R3 can report COMPLETE_UNDER_GOALS or WITNESS_BUDGET_EXHAUSTED; none stands for an unbounded proof.

Rule using basis semantics (spatiality closure). The using position of a rule is an exact-contract reference; formation — not resolution — owns its basis semantics. On the public run path, the resolved declaration kind fixes the disposition:

using target resolves toDisposition on the public run path
theory / ontologyReasoning authority — the rule participates in an application only under that exact authority.
relationContent/dependency coordinate — the rule joins the application-relative executable chain when the relation is reachable through admitted rule heads or named by the application’s goal set.
contentNamed basis coordinate under the application’s selected authority — never independently authority-bearing.
any other kind (rule, constraint, policy, hypothesis, action, type, …)Typed formation rejection RULE_WIRE_REJECTION — no kind without defined rule-basis semantics is silently relation-like.

The resulting conservation laws: goals never introduce reasoning authority, a foreign rule head never admits a foreign theory, and content dependency is not theory authority. Selection and reachability use exact resolved declaration identities — never display names, module labels, or source ordering. check admits the source shape; executability is decided on the run path.

The end-to-end witnesses are in examples/F05-reasoning-completion/canonical.fsl. A count of zero over a same-stratum derived relation is not a substitute for negation-as-failure.

Application declarations and execution routes

All application signatures use named lexical parameters, optionally with a depends Q dependency annotation, and may declare -> Result:

Name($x: Type, depends Q $y: Type) [-> Result]

match is the sole application family without a mandatory using Q. The implemented headers are:

match Signature { match-clause … }
infer Signature using Q { infer-item … }
analyze Signature using Q [ { field: expression … } ]
transform Signature using Q { transform-item … }
validate|admit|authorize|decide Signature using Q [ { field: expression … } ]
revise Signature using Q [ { field: expression … } ]
scenario Signature using Q from expression { scenario-statement … }
evolve source Signature using Q from expression {
    by: expression
    [under: expression]
    source-change-statement …
}
execution_request|observe|incorporate Signature using Q [ { field: expression … } ]
composition Signature [-> Type] { composition-statement … }

In particular, revise does not have a from clause. An evolve source body requires its by: header; a sketch that omits it is not the implemented surface.

FamilyWhat source/check retainsCurrent run boundary
matchFull query clause surface aboveEngine-backed bridge over the complete admitted clause surface: pattern conjunction, filters, optional, existence, alternatives, path traversal, COUNT/SUM/MIN/MAX, grouping, having, projection, ordering, slicing, and graph views; a clause that cannot complete under its owner’s contract fails closed with its typed outcome.
inferRules and R1/R2/R3 goalsBounded inference with typed closure, goal, witness, or resource outcomes; rule using targets are kind-checked (RULE_WIRE_REJECTION for ungoverned kinds).
analyzeAnalysis declaration and contractBundled analysis operators can complete; other operators return a typed provider requirement, not a hidden provider call.
transformRules, contributions, and constructsAuthored rules execute productively through the native T1 kernel; exact-content coalescence keeps every source origin reconstructible as a dependence edge. A rule-less declaration is recognized as contract-only; a construct shape outside the productive route fails closed.
validate, admit, authorize, decideGoverned application and contract fieldsTyped local family result; no external-world mutation is implied.
scenarioAll scenario statementsThe contracted surface instantiates as one hypothetical context: with, assume, mask, substitution, local introduction, hypothetical transition (typed step judgment), and embedded local applications; the baseline world is never mutated.
reviseRevision contractTyped local revision outcome; no external durable mutation.
evolve sourceAuthored changes and authority headerPrepares a candidate only; it never publishes it.
execution_requestRequest and requester designationRecords a request only — no attempt, dispatch, or effect.
observeObservation bridge designationReports NotAcquired on the bare run route; real acquisition runs only through the P1 session (adapter family, source identity, guarantee scope, receipts at the cap) and stays evidence, never truth.
incorporateIncorporation declarationReports unsupported on the current run route.
compositionStages, order, and coupling declarationUses the composition kernel for supported stage/order/coupling coordinates; unsupported statement kinds fail typed.

There is no separate formasl analyze CLI verb. Select an analysis application through formasl run --app Name --gas N. run never converts REJECTED, UNSUPPORTED, or RESOURCE_EXHAUSTED into a successful no-op.

Complete checked application witnesses

The reference templates above are intentionally compact. The following complete modules are part of the executable documentation corpus and prove the public check path for representative inference, lifecycle, transformation, and governed-application forms.

module language_inference {
    type Node
    relation Edge {
        role from: Node
        role to: Node
    }
    relation Reach {
        role from: Node
        role to: Node
    }

    rule Seed using Edge(?x: Node) {
        when Edge(from: ?from, to: ?to)
        derive positive Reach(from: ?from, to: ?to)
    }

    assert claim edge_ab : Edge(from: "a", to: "b") {
        by : $guide
    }

    infer Reachability() using Edge {
        goal Reach(from: ?from, to: ?to)
    }
}
module language_lifecycle {
    type Artifact
    relation Tracks {
        role artifact: Artifact
    }

    assert claim first : Tracks(artifact: $release) {
        by : $registry
    }
    adopt claim first as reviewed {
        by : $reviewer
    }
    retract claim reviewed {
        by : $reviewer
    }
    assert claim corrected : Tracks(artifact: $release) {
        by : $registry
    }
    supersede claim first with corrected {
        by : $registry
    }
}
module language_transform {
    type Device
    type Value
    relation Reading {
        role device: Device
        role value: Value
    }
    relation Normalized {
        role device: Device
        role value: Value
    }

    transform Normalize($d: Device) using Reading {
        rule normalize {
            match {
                pattern ?r: Reading(device: ?device, value: ?value)
            }
            per match
            construct Normalized as $normalized {
                role device: ?device
                role value: ?value
            }
        }
    }
}
module language_governance {
    type Agent
    content ValidationPolicy
    content AdmissionPolicy
    content AuthorizationPolicy
    content DecisionPolicy

    validate ValidateAgent($agent: Agent) using ValidationPolicy {}
    admit AdmitAgent($agent: Agent) using AdmissionPolicy {}
    authorize AuthorizeAgent($agent: Agent) using AuthorizationPolicy {}
    decide DecideAgent($agent: Agent) using DecisionPolicy {}
}

Transformation

A transformation has a mandatory match block, a contribution mode, and one or more construct blocks. The admitted modes are per match, per distinct_key by expression, …, and per group by expression, …. A transform source can describe meaningful lineage and target construction even though the present runtime returns DeclarationRecognized: the missing T1 world includes a materialized query basis, query-contract admission, target constructors, coverage records, and collision/coverage/loss policy.

module transformation_surface {
    type Sensor
    type Device
    type Value
    relation ReportedReading {
        role sensor: Sensor
        role device: Device
        role value: Value
    }
    relation NormalizedReading {
        role device: Device
        role value: Value
    }

    transform Normalize($d: Device) using ReportedReading {
        rule normalize {
            match {
                pattern ?r: ReportedReading(device: ?device, value: ?value)
            }
            per match
            construct NormalizedReading as $normalized {
                role device: ?device
                role value: ?value
            }
        }
    }
}

The checked transformation witness is examples/F08-transformation-lineage-dependence/canonical.fsl. Its run result is intentionally not evidence that a new external target was materialized.

Scenarios and source evolution

A scenario and a source evolution have different bodies and different runtime limits:

scenario Name($base: Type) using Basis from $base {
    with field: expression
    assume expression
    mask expression under Q
    substitute expression with expression under Q
    introduce local Name: Type using Q { field: expression … }
    transition hypothetical using Q { field: expression … }
    let $result = Application(arg: expression, …)
}

evolve source Name($base: Type) using Basis from $base {
    by: expression
    [under: expression]
    add binding expression
    remove binding expression
    replace binding expression with expression
    relocate binding expression to expression
    incorporate expression [as expression]
    attach metadata expression to expression
}

The scenario parser preserves all listed statements, and the public runtime instantiates the contracted surface: with, assume, mask, substitute, introduce local, transition hypothetical (a typed step judgment; a successor context is introduced only when the step’s precondition holds), and embedded local applications (let $result = App(...)), which execute through the shared executor and are carried on the outcome record. Everything a scenario seals lives in its own hypothetical context; the baseline world is never mutated and never sees scenario content. evolve source prepares a candidate and stops before any publication or external state change.

module scenario_evolution_surface {
    type State
    content ScenarioBasis
    content EvolutionBasis

    scenario WhatIf($base: State) using ScenarioBasis from $base {
        with discount: $d
        assume $assumption
        mask $old under ScenarioBasis
        substitute $old with $new under ScenarioBasis
        introduce local temporary: State using ScenarioBasis { note: "local" }
        transition hypothetical using ScenarioBasis { note: "transition" }
        let $result = Find(base: $base)
    }

    evolve source Migrate($db: State) using EvolutionBasis from $db {
        by : $editor
        under : $policy
        add binding $new
        remove binding $old
        replace binding $x with $y
        relocate binding $z to $location
        incorporate $external as $merged
        attach metadata $metadata to $z
    }
}

This small scenario is a complete checked source and is the productive boundary for the current bridge:

module language_scenario {
    type World
    content ScenarioBasis

    scenario SupplierOutage($base: World) using ScenarioBasis from $base {
        assume $supplier_outage
    }
}

Composition

A top-level composition is selected by run like an application. Its source body can carry local invocation, staged invocation, ordering, coupling, case branches, a returned expression, and an explicit unresolved marker. The core composition form used by the current composer is:

composition Name($input: Type, …) [-> Result] {
    let $value = Application(arg: expression, …)
    stage stage_name = Application(arg: expression, …) [as $result]
    order earlier before later
    couple { stage_a, stage_b, … } using CouplingContract
    case expression { outcome($binding) => statement-or-block … }
    return expression
    unresolved expression
}
module composition_surface {
    type Artifact
    relation DependsOn {
        role dependent: Artifact
        role prerequisite: Artifact
    }
    content Coupling

    match FindDependencies($g: Artifact) {
        pattern ?d: DependsOn(dependent: ?dependent, prerequisite: ?prerequisite)
    }

    composition Pipeline($g: Artifact) {
        stage dependencies = FindDependencies(g: $g) as $deps
        stage review = FindDependencies(g: $g) as $review
        order dependencies before review
        couple { dependencies, review } using Coupling
    }
}

The multi-module checked witness is examples/F06-dag-composition-realization/artifact-model.fsl with examples/F06-dag-composition-realization/canonical.fsl. Pass both .fsl files, not only the importing file, to the CLI.

Realization (.fsp)

A realization is in a separate .fsp unit. It names a target and declares binding/requirement preferences; it does not contain a module declaration and it does not accept $ or ? values in realization-value positions.

realization Plan {
    app ApplicationName {
        bind slot to external "adapter/reference"
        require slot: Capability
        limit slot: value
        prefer slot: value
        budget slot: value
    }
    stage CompositionName#stage_name { … }
    composition Name { … }
    module Name { … }
    source Name { … }
    capability Name { … }
    group GroupName {
        member app ApplicationName
        require slot: value
    }
}

bind uses to; require, limit, prefer, and budget use :. A realization value is a literal, qualified reference, external "…", list, or typed record. A .fsl pure call and either variable class reject in that position.

realization LocalReference {
    app CandidateBasis {
        require capability: Engine
        bind capability to external "reference/formasl-r1"
    }
    app ValidateTransfer {
        require capability: Engine
        bind capability to external "reference/governance-library"
    }
}

For the complete source/plan pair see examples/RP01-bank-transfer/program.fsl and examples/RP01-bank-transfer/local.fsp. Use formasl realize program.fsl --for local.fsp and keep all required source modules on the command line.

Authoring workflow

  1. Start with a complete .fsl module or .fsp realization, never a bare clause pasted into an unrelated plane.
  2. Declare types, relations, and content bases before the claims, rules, and applications that name them. Supply every imported .fsl module explicitly.
  3. Run formasl check after each structural change; use its typed diagnostic code and locus rather than treating a parse failure as an execution failure.
  4. Run formasl inspect --view declarations, claims, applications, or subtypes to inspect what check retained.
  5. Run only the intended item with formasl run --app NAME --gas N. Treat REJECTED, RESOURCE_EXHAUSTED, and UNSUPPORTED as different outcomes.
  6. Use formasl realize only with exactly one .fsp plan via --for; a realization plan is a binding artifact, not an instruction to create an external resource.

For invocation and output details, see the Toolchain reference. For the maintained per-family boundary, see Support and limitations.