A language to represent and operate.
FormaSL declares the domain, records statements and distinguishes queries, inference, analysis, transformation and decisions. Here are its mechanisms and documented examples.
Declare the domain
Types define categories. Relations specify the roles participants may occupy. Claims record attributable acts of assertion. The language keeps these responsibilities separate.
See the contract in source form
These examples illustrate declarations, queries, rules and transformations from documented files. They are excerpts, not executable code in this browser.
module semantic_roles {
type Agent
type Artifact
type Project
type Environment
relation Assignment {
role assignee: Agent
role artifact: Artifact
role project: Project
role environment: Environment
}
assert claim a1 : Assignment(
assignee: $alice,
artifact: $dataset,
project: $atlas,
environment: $production
) { by : $registry }
}Four roles. One relation.
Assignment brings four typed participants into one occurrence. A Claim records the attributable statement.
module query_basic {
type Artifact
relation DependsOn {
role dependent: Artifact
role prerequisite: Artifact
}
assert claim d1 : DependsOn(
dependent: $app,
prerequisite: $parser
) { by : $manifest }
match DirectDependencies() {
pattern ?d: DependsOn(
dependent: ?dependent,
prerequisite: ?prerequisite
)
}
}Query without modifying the source.
match retrieves dependencies between artifacts without introducing another Claim.
rule Base using DependsOn(?x: Artifact) {
when DependsOn(dependent: ?a, prerequisite: ?b)
derive positive ReachableDependency(
dependent: ?a, prerequisite: ?b
)
}
rule Step using DependsOn(?x: Artifact) {
when DependsOn(dependent: ?a, prerequisite: ?b)
when ReachableDependency(dependent: ?b, prerequisite: ?c)
derive positive ReachableDependency(
dependent: ?a, prerequisite: ?c
)
}Derivation is not assertion.
Rules describe derived consequences; inference does not create an attributable statement by itself.
assert claim open_v1 : States(
subject: $release, position: $open
) {
by : $registry_a
valid_at : t1
recorded_at : $t2
}
adopt claim open_v1 as accepted_open {
by : $reviewer
based_on : $review_basis
recorded_at : $t4
}
retract claim accepted_open {
by : $reviewer
based_on : $later_evidence
recorded_at : $t5
}Revisions preserve history.
Adoption and retraction retain references to earlier Claims and their temporal conditions.
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
}
}
}Construct new structures.
transform specifies how a destination structure is built from source data.
Operations with distinct meanings
match queries relations; rule and infer derive consequences; analyze computes results and models; transform constructs new structures; validate, admit, authorize and decide govern criteria and responsibility; scenario and composition support hypothetical evaluation and controlled combination.
type / relationDefine categories and relation roles.
assert claimIntroduce an identifiable attributable statement.
matchQuery patterns, paths and aggregations.
rule / inferDerive consequences under declared theories.
analyzeRun analysis, statistics and models, including graph algorithms and GNNs.
transformConstruct structures from declared correspondences.
validate / admitEvaluate criteria and govern admission.
authorize / decideKeep authorization distinct from accountable decisions.
scenarioEvaluate hypothetical conditions.
compositionCombine operations with explicit dependencies.
From source to evaluation
Source code can be checked and inspected before an operation is run. A budget called gas bounds logical work. Incomplete execution is not the same as a false conclusion. A decision does not mean an external action took place.