Getting started
This chapter uses only files already present in the checkout. Start from the repository root after following Installation.
A first source unit
A FormaSL .fsl file contains one module. The shipped
examples/hello.fsl is a minimal, checked program:
module hello {
type Name
relation Greets {
role greeter: Name
role greeted: Name
}
assert claim greeting : Greets(greeter: "world", greeted: "formasl") { by : $doc }
match AllGreets() {
pattern ?g: Greets(greeter: ?who)
}
}
It declares a type and a relation, records one attributable claim, and names a pattern query. The declaration is not a statement that the claim is true in an external world; it is source authority for this program.
Check before you run
check parses, resolves, and elaborates every explicit source argument as one
program. It is the first command to run after changing a source file.
$ formasl check examples/hello.fsl
ACCEPTED module hello
A successful check does not execute an application. Use inspect to see the
curated semantic projections exposed by the product:
$ formasl inspect examples/hello.fsl --view summary
module hello (unit examples/hello.fsl, basis 1)
declarations: 2
claims: 1
applications: 1
--view is mandatory for inspect. The available views are summary,
declarations, claims, applications, and subtypes.
Run an application with a budget
run always requires a gas budget. It never selects an unbounded default.
With no --app selector, the runner selects all applications in the checked
program; use --app for one exact application name.
$ formasl run examples/hello.fsl
usage: run requires --gas (no silent default)
$ formasl run examples/hello.fsl --app AllGreets --gas 1000
query AllGreets -> 1 solution(s) (completion EXHAUSTED_DOMAIN)
The result is a query result over the source-asserted occurrence. It is neither a new assertion in the source nor a write to an external system.
For the current reasoning examples, see
examples/F05-reasoning-completion/canonical.fsl. Its infer applications
exercise positive least-fixpoint reasoning, stratified negation-as-failure, and
the warded-existential R3 route. Gas exhaustion has a distinct result standing;
it is not a negative answer. The precise support boundary is in
Support and limitations.
Request machine JSON deliberately
The default presentation is text. For machine processing, request JSON and
an explicit schema revision. Revision 1 is the current successor machine
vocabulary for all public run-family outcomes.
$ formasl check examples/hello.fsl --format json --schema-revision 1
"schema_revision":1
A check envelope has the same six top-level fields in every machine result:
{
"schema": "formasl.machine",
"schema_version": 1,
"schema_revision": 1,
"operation": "check",
"subject": {
"id": "sha256:b186461740ace98cbb51d3e66db705dd2772c5d1b51b6413d7da5c6e2f321f97",
"sources": [
{
"reference": "examples/hello.fsl",
"revision": 1,
"content_digest": "sha256:d1cb651afb8fd40e6f22f4c7e86d71de77b29a4971caf19d162a959ddec608b9"
}
]
},
"outcome": {
"status": "ACCEPTED",
"diagnostics": []
}
}
--schema-revision applies only to JSON output:
$ formasl check examples/hello.fsl --schema-revision 1
usage: --schema-revision requires --format json
Do not parse text output as a protocol. Use the JSON projection and retain the schema revision with the result.
Bind a realization plan
A realization plan is an .fsp input that binds an already-checked application
or composition stage to explicit capabilities. It does not run those capabilities
or change the .fsl semantics. The repository contains a complete source/plan
pair for this route:
formasl realize examples/RP01-bank-transfer/program.fsl --for examples/RP01-bank-transfer/local.fsp
realize requires exactly one --for <plan.fsp>. run may also receive
--for <plan.fsp> to establish the exact bindings before it evaluates selected
applications. See Toolchain reference for the option matrix and
Programmatic API for the equivalent Rust calls.
Next steps
- Read Mental model for the distinction between claim, consequence, decision, execution request, and observation.
- Read the Language guide before extending the source.
- Read Projects, packages and the release store when your sources become a package with dependencies, tests, or sealed releases.
- Follow the Writing guide for a step-by-step tutorial with runnable witnesses.
- Use Errors and troubleshooting when
check,run, orrealizerejects an input or reports a non-complete standing.