# SymLan v1.0 Language Specification

Date: May 4, 2026  
Status: Reference draft for compiler/runtime implementation  
Primary change from v0.1/v0.2.5: the 7D continuous feature vocabulary is replaced by Construction A+, written here as the Π_A+ vocabulary readout operator.

## 1. Language Philosophy and Positioning

SymLan is a substrate-native programming language. Existing languages define symbols first and compute over them; SymLan specifies the physical or simulated arena in which symbols may become available. A SymLan source program declares controlled substrate dimensions and constraints, compiles them into a HAL execution plan, runs the substrate, and then resolves a vocabulary from the substrate's own attractor structure. The program is semantically incomplete until that substrate execution occurs and a `Vocabulary<resolved>` exists.

The formal 4D property is this: a SymLan program specifies three programmer-controlled dimensions and leaves the fourth dimension to substrate execution. For continuous oscillator substrates, the specified dimensions are coupling strength `κ`, phase relation request `φ`, and coherence target `T`. For the reference Hopfield substrate, the specified dimensions are weight matrix `W`, load factor `α = M/N`, and substrate size `N`. The fourth dimension is `V`, the resolved vocabulary generated by `Π_A+ = PEFP(k) + θ:auto ternary quantization + τ_E attractor polarity`. A SymLan program does not contain its complete symbol system in source code. It asks the substrate to produce that symbol system, then uses the resolved glyphs.

Minority position in this draft: SymLan v1.0 should treat Hopfield plus Π_A+ as the reference backend, and BZ/VO₂ as experimental HAL backends until they demonstrate equivalent replay fidelity and drift control. Construction A+ directly resolves the Round 9 drift and entropy objections for discrete Hopfield state vectors. It does not automatically prove that every continuous substrate has the same stability.

## 2. Complete Type System

### 2.1 Type Phases

Every SymLan value has one of three resolution phases:

```text
declared    known from source text
pending     handle exists, concrete substrate value does not
resolved    value is bound to substrate observations and Π_A+ output
```

`Basin` and `Vocabulary` are emergent types. They may be named while `pending`, but they cannot be inspected, sent, asserted as collision-free, or exported as final artifacts until they are `resolved`.

### 2.2 Primitive Types

`Node`  
A substrate addressable unit. In BZ this may be a chamber or optical ROI. In VO₂ this may be an oscillator element. In Hopfield this may be a logical port, probe, or named subset of state indices.

`Coupling`  
A nominal resonance relation between nodes. Its canonical oscillator representation is the record defined in section 2.3. Hopfield substrates may reject oscillator couplings unless the HAL defines a graph-to-weight translation.

`Phase`  
A real angular value normalized to `[-π, π]`. Accepted source forms include radians, `pi` forms, and degrees.

`Coherence`  
A positive substrate coherence target. For oscillator substrates it denotes the target ratio or proxy for `I_Formative / I_Containing`. For Hopfield substrates it is not a primary control dimension.

`Basin`  
An attractor basin handle. Before execution it is `Basin<pending>`. After vocabulary resolution it is `Basin<resolved>` with a basin identifier, representative state, replay prototype, and glyph assignment.

`Token`  
A transmissible symbolic unit. In v1.0 a token is not a 7D vector. It is a `Glyph` plus metadata sufficient to replay, validate, and prove provenance.

`Glyph`  
A compact unsigned integer in `Int[0..39365]` for the default `k=9` Π_A+ alphabet. Its canonical structure is one attractor-polarity bit and nine ternary PEFP digits.

`Vocabulary`  
A mapping from resolved basins to glyphs, plus entropy and replay measurements. A vocabulary is the fourth dimension `V`.

`FieldVector`  
A numeric vector derived from substrate state. For Hopfield, the reference field vector is `h = W · s`, where `s ∈ {-1,+1}^N`. For continuous substrates, it is the HAL-provided state embedding or local field embedding.

`Threshold`  
A scalar or vector quantization boundary. `auto` delegates selection to the Π_A+ max-margin threshold procedure. A literal `Float` is permitted but must be reproducible under the HAL's units and normalization.

### 2.3 Composite Types

```text
Coupling = (
  κ: Float[0.0..1.0],
  φ: Phase,
  T: Float where T > 0.0
)
```

`κ` is normalized coupling strength. `φ` is a requested or declared phase relation. `T` is a coherence target or substrate-specific proxy. A HAL may reject a `Coupling` when the substrate cannot implement one of these dimensions.

```text
HopfieldSubstrate = (
  N: Int where N > 0,
  M: Int where M > 0,
  W: Matrix[N×N],
  α: Float = M / N
)
```

`W` must be finite and square. The reference Hopfield HAL requires `W[i,i] = 0` and either symmetric weights or an explicit asymmetric tolerance declaration. The reference capacity guard is `α < α_c ≈ 0.138`; reference programs should stay below `α ≤ 0.10` unless they are deliberately testing overload behavior. Construction A+ validation covers antisymmetric perturbation `λ ∈ [0, 0.010]` as a fabrication-asymmetry envelope, but a compiler must still record the actual `W` hash and `λ` estimate.

```text
Token = (
  glyph: Glyph,
  vocabulary_id: Identifier,
  basin_id: Identifier,
  substrate_id: Identifier,
  feature_spec: FeatureSpec,
  theta: ThresholdVector,
  tau_E: Bit,
  pefp_digits: Ternary[9],
  prototype: ReplayPrototype,
  provenance: ProvenanceRecord,
  statistics: TokenStatistics
)
```

The required glyph range is `0..39365` for `PEFP(k: 9)`. If a program uses a non-default `k`, `Token` remains well typed only if the selected transmission format can represent `2 × 3^k` glyphs.

```text
Vocabulary =
  { Basin<resolved> -> Glyph }
  × EntropyMeasure
  × ReplayFidelity
  × VocabularyMetadata
```

Expanded form:

```text
Vocabulary = (
  id: Identifier,
  status: pending | resolved | imported,
  substrate: SubstrateRef,
  feature_spec: FeatureSpec,
  basins: Set<Basin<resolved>>,
  glyphs: Map<BasinId, Glyph>,
  inverse_glyphs: Map<Glyph, BasinId>,
  entropy: EntropyMeasure,
  replay: ReplayFidelity,
  collisions: Int,
  transition_graph: Matrix[Glyph, Glyph, Probability],
  provenance: ProvenanceRecord
)
```

### 2.4 Supporting Types

```text
EntropyMeasure = (
  method: shannon | renyi0 | empirical,
  value_bits: Float,
  support_size: Int,
  sample_count: Int
)

ReplayFidelity = (
  Λ: Float[0.0..1.0],
  trials: Int,
  successes: Int,
  criterion: ReplayCriterion
)

FeatureSpec =
  PEFP(k: Int where k > 0)
  | statespace(k: Int where k > 0)

ThresholdVector = Vector[k, Float]

ReplayPrototype = (
  state_vector: Optional<Vector>,
  waveform: Optional<Waveform>,
  injection_plan: Optional<HALInjectionPlan>
)

ProvenanceRecord = (
  source_hash: Hash,
  hal_name: Identifier,
  hal_version: String,
  substrate_hash: Hash,
  run_id: Identifier,
  created_at: Timestamp
)
```

### 2.5 Type Operations

```text
Substrate.initialize(params: Record) -> Substrate<declared>
Substrate.calibrate(substrate: Substrate<declared>, profile: CalibrationSpec) -> CalibrationReport
Substrate.run(substrate: Substrate<declared>, duration: Duration | steps: Int, seed: Seed) -> RunResult

Hopfield.learn(N: Int, M: Int, α: Float, seed: Seed, rule: LearningRule) -> HopfieldSubstrate
Hopfield.energy(substrate: HopfieldSubstrate, s: Vector[N, {-1,+1}]) -> Float
Hopfield.local_field(substrate: HopfieldSubstrate, s: Vector[N, {-1,+1}]) -> FieldVector[N]
Hopfield.relax(substrate: HopfieldSubstrate, s0: Vector[N, {-1,+1}]) -> Basin<resolved>

couple(source: Node, target: Node, c: Coupling) -> Edge
observe(target: Node | Substrate | Network, window: Duration) -> ObservationSet

Vocabulary.register(
  target: Substrate | Node | Network,
  θ: Threshold | auto,
  features: FeatureSpec
) -> Vocabulary<pending>

Vocabulary.resolve(
  vocabulary: Vocabulary<pending>,
  run: RunResult,
  operator: PiAPlusSpec
) -> Vocabulary<resolved> | ResolutionError

Vocabulary.export(vocabulary: Vocabulary<resolved>, uri: String) -> Artifact
Vocabulary.import(uri: String) -> Vocabulary<imported>
Vocabulary.compose(left: Vocabulary<resolved>, right: Vocabulary<resolved>, mode: ComposeMode) -> Vocabulary<pending>

Basin.lookup(vocabulary: Vocabulary<resolved>, glyph: Glyph) -> Basin<resolved>
Basin.distance(a: Basin<resolved>, b: Basin<resolved>, metric: Metric) -> Float

Glyph.encode(τ_E: Bit, digits: Ternary[k]) -> Glyph
Glyph.decode(glyph: Glyph, k: Int) -> (τ_E: Bit, digits: Ternary[k])
Glyph.collisions(vocabulary: Vocabulary<resolved>) -> Int

Token.from(vocabulary: Vocabulary<resolved>, selector: BasinSelector) -> Token<resolved>
Token.send(token: Token<resolved>, channel: Channel | Node) -> SendResult
Token.receive(channel: Channel, timeout: Duration) -> Token<resolved> | Timeout

Replay.validate(vocabulary: Vocabulary<resolved>, trials: Int) -> ReplayFidelity
Entropy.measure(vocabulary: Vocabulary<resolved>, method: EntropyMethod) -> Float
```

### 2.6 Type Error Conditions

The compiler must reject these conditions before execution:

- `features: 7D` in v1.0 source. Error: `ObsoleteFeatureSpec`.
- `PEFP(k)` used on a backend that cannot expose a local field operator or field embedding. Error: `FeatureUnsupportedByHAL`.
- `Token.from(V, selector)` where `V` is not known to resolve before use. Error: `UnresolvedVocabularyUse`.
- `send` or `replay` of a token derived from `Vocabulary<pending>` outside an `after resolve` block. Error: `PendingTokenSend`.
- `assert glyph V { collisions == 0; }` where `V` is pending and no run schedule resolves it. Error: `PendingGlyphAssertion`.
- `Glyph` literal outside `0..39365` when `k=9`. Error: `GlyphOutOfRange`.
- Hopfield `W` not `N×N`. Error: `InvalidWeightMatrix`.
- Hopfield `M`, `N`, and `α` inconsistent beyond tolerance. Error: `InvalidLoadFactor`.
- Hopfield `α >= 0.138` unless the declaration is explicitly marked as an overload test. Error: `HopfieldCapacityExceeded`.
- Hopfield `0.10 < α < 0.138` in reference-mode compilation. Warning: `HopfieldCapacityMarginWarning`.
- Oscillator `κ` outside `[0,1]`, `T <= 0`, or unparseable `φ`. Error: `InvalidCoupling`.
- A HAL selected for a program does not implement required methods. Error: `HALContractViolation`.

The runtime may raise these after execution:

- `ResolutionError`: Π_A+ cannot assign a collision-free glyph mapping.
- `EntropyAssertionFailed`: measured entropy does not satisfy an assertion.
- `ReplayFailed`: `Λ` is below the required threshold.
- `SubstrateTimeout`: a bounded run did not converge or did not produce enough observations.
- `HALRoundTripError`: the backend cannot replay or reconstruct the requested token with declared fidelity.

## 3. Complete Grammar (EBNF)

### 3.1 Lexical Conventions

```ebnf
program             = [ module_decl ] , { import_decl } , { top_level_item } ;

letter              = "A" | "B" | "C" | "D" | "E" | "F" | "G"
                    | "H" | "I" | "J" | "K" | "L" | "M" | "N"
                    | "O" | "P" | "Q" | "R" | "S" | "T" | "U"
                    | "V" | "W" | "X" | "Y" | "Z"
                    | "a" | "b" | "c" | "d" | "e" | "f" | "g"
                    | "h" | "i" | "j" | "k" | "l" | "m" | "n"
                    | "o" | "p" | "q" | "r" | "s" | "t" | "u"
                    | "v" | "w" | "x" | "y" | "z" | "_" ;

digit               = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
integer             = digit , { digit } ;
float               = integer , "." , { digit } | integer ;
signed_float        = [ "+" | "-" ] , float ;
identifier          = letter , { letter | digit } ;
string              = '"' , { string_char } , '"' ;
string_char         = letter | digit | " " | "_" | "-" | "." | "/" | ":" | "#" ;
boolean             = "true" | "false" ;
bit                 = "0" | "1" ;
trit                = "0" | "1" | "2" ;
glyph_literal       = integer ;
hash_literal        = "#" , { letter | digit } ;
base64_char         = letter | digit | "+" | "/" | "-" | "_" ;
base64_6            = base64_char , base64_char , base64_char , base64_char , base64_char , base64_char ;
ternary_10          = bit , trit , trit , trit , trit , trit , trit , trit , trit , trit ;

duration            = float , duration_unit ;
duration_unit       = "ns" | "us" | "ms" | "s" | "min" | "h" | "cycles" ;
steps               = integer , "steps" ;
bits                = float , "bits" ;
percentage          = signed_float , "%" ;

phase_expr          = signed_float
                    | "pi"
                    | "-" , "pi"
                    | "pi" , "/" , integer
                    | "-" , "pi" , "/" , integer
                    | signed_float , "deg" ;

comparator          = ">" | ">=" | "<" | "<=" | "==" | "!=" ;
arrow               = "->" | "<->" ;
```

### 3.2 Program Structure and Modules

```ebnf
module_decl         = "module" , qualified_name , ";" ;
qualified_name      = identifier , { "." , identifier } ;

import_decl         = "import" , import_target , [ "as" , identifier ] , [ "from" , string ] , ";" ;
import_target       = qualified_name | "{" , import_name , { "," , import_name } , "}" ;
import_name         = identifier ;

export_decl         = "export" , export_target , ";" ;
export_target       = identifier | "{" , identifier , { "," , identifier } , "}" ;
export_stmt         = "export" , identifier , "to" , string , ";" ;

top_level_item      = substrate_decl
                    | hopfield_decl
                    | node_decl
                    | network_decl
                    | channel_decl
                    | vocab_decl
                    | state_decl
                    | token_decl
                    | coupling_stmt
                    | run_stmt
                    | after_resolve_block
                    | replay_stmt
                    | send_stmt
                    | receive_stmt
                    | glyph_assert
                    | assert_stmt
                    | try_stmt
                    | let_stmt
                    | export_stmt
                    | export_decl ;
```

### 3.3 Declarations

```ebnf
substrate_decl      = "substrate" , identifier , ":" , substrate_kind , substrate_body , ";" ;
substrate_kind      = "bz" | "vo2" | "photonic" | "sim" | identifier ;
substrate_body      = "{" , { substrate_field } , "}" ;
substrate_field     = identifier , ":" , value , ";" ;

hopfield_decl       = "hopfield" , identifier , hopfield_body , ";" ;
hopfield_body       = "{" , hopfield_field , { hopfield_field } , "}" ;
hopfield_field      = "N" , ":" , integer , ";"
                    | "M" , ":" , integer , ";"
                    | "alpha" , ":" , float , ";"
                    | "W" , ":" , weight_spec , ";"
                    | "lambda" , ":" , float , ";"
                    | "seed" , ":" , seed_expr , ";"
                    | "dynamics" , ":" , hopfield_dynamics , ";"
                    | "overload_test" , ":" , boolean , ";" ;
hopfield_dynamics   = "async" | "sync" | "stochastic" ;
weight_spec         = "matrix" , "(" , string , ")"
                    | "learn" , "(" , learn_args , ")"
                    | "identity"
                    | identifier ;
learn_args          = learn_arg , { "," , learn_arg } ;
learn_arg           = "rule" , ":" , learning_rule
                    | "patterns" , ":" , integer
                    | "seed" , ":" , seed_expr
                    | "symmetric" , ":" , boolean ;
learning_rule       = "hebbian" | "projection" | "storkey" | identifier ;

node_decl           = "node" , identifier , [ node_body ] , ";" ;
node_body           = "{" , { node_field } , "}" ;
node_field          = "role" , ":" , node_role , ";"
                    | "backend" , ":" , identifier , ";"
                    | "substrate" , ":" , identifier , ";"
                    | "indices" , ":" , index_set , ";" ;
node_role           = "encoder" | "decoder" | "relay" | "reservoir" | "observer" | "port" ;

channel_decl        = "channel" , identifier , channel_body , ";" ;
channel_body        = "{" , { channel_field } , "}" ;
channel_field       = "format" , ":" , transmission_format , ";"
                    | "timeout" , ":" , duration , ";"
                    | "target" , ":" , string , ";" ;
transmission_format = "uint16" | "base64_6" | "ternary_10" ;

network_decl        = "network" , identifier , network_body , ";" ;
network_body        = "{" , { network_item } , "}" ;
network_item        = node_array_decl
                    | topology_decl
                    | coupling_stmt
                    | vocab_decl
                    | node_decl ;
node_array_decl     = "nodes" , ":" , identifier , "[" , integer , "]" , ";" ;
topology_decl       = "topology" , ":" , topology_type , ";" ;
topology_type       = "ring" | "grid" | "mesh" | "all_to_all" | "line" | identifier ;

state_decl          = "state" , identifier , ":" , state_qualifier , "in" , identifier , ";" ;
state_qualifier     = "pending" | "resolved" | "external" ;

token_decl          = "token" , identifier , "from" , token_source , ";" ;
token_source        = vocab_selector | glyph_ref ;
vocab_selector      = identifier , "." , query_expr | identifier , "[" , identifier , "]" ;
glyph_ref           = "glyph" , "(" , glyph_value , ")" , "in" , identifier ;
glyph_value         = glyph_literal | base64_6 | ternary_10 ;
```

### 3.4 Couplings and Composition

```ebnf
coupling_stmt       = node_ref , arrow , node_ref , coupling_spec , [ time_spec ] , ";" ;
node_ref            = identifier
                    | identifier , "[" , index_expr , "]"
                    | identifier , "." , identifier , "(" , index_expr , ")" ;
index_expr          = integer | identifier | identifier , "+" , integer | identifier , "-" , integer ;
index_set           = "[" , integer , ".." , integer , "]" ;

coupling_spec       = "[" , coupling_field , { "," , coupling_field } , "]" ;
coupling_field      = "κ" , ":" , float
                    | "kappa" , ":" , float
                    | "φ" , ":" , phase_expr
                    | "phi" , ":" , phase_expr
                    | "T" , ":" , coherence_expr
                    | "ratio" , ":" , ratio_expr
                    | "envelope" , ":" , envelope_expr ;
coherence_expr      = float
                    | "near" , "(" , float , "," , "tolerance" , ":" , float , ")" ;
ratio_expr          = integer , ":" , integer ;
envelope_expr       = identifier
                    | "attack" , ":" , float , "/" , "decay" , ":" , float ;
time_spec           = "over" , duration | "from" , time_ref , "to" , time_ref ;
time_ref            = identifier | duration ;

composition_stmt    = parallel_block | sequence_block | nested_block ;
parallel_block      = "parallel" , "{" , { top_level_item } , "}" ;
sequence_block      = "sequence" , "{" , { top_level_item } , "}" ;
nested_block        = "nested" , identifier , "{" , { top_level_item } , "}" ;
```

### 3.5 Vocabulary Registration

```ebnf
vocab_decl          = "vocab" , identifier , "=" , vocab_value , ";" ;
vocab_value         = register_expr | call_expr ;
register_expr       = "register" , "(" , register_target , "," , register_args , ")" ;
register_target     = identifier | node_ref ;
register_args       = register_arg , { "," , register_arg } ;
register_arg        = "θ" , ":" , threshold_expr
                    | "theta" , ":" , threshold_expr
                    | "features" , ":" , feature_spec
                    | "window" , ":" , duration
                    | "min_basins" , ":" , integer
                    | "min_entropy" , ":" , bits
                    | "method" , ":" , registration_method
                    | "format" , ":" , transmission_format ;
threshold_expr      = "auto" | float | "fixed" , "(" , float , ")" ;
feature_spec        = "PEFP" , "(" , [ pefp_args ] , ")"
                    | "statespace" , "(" , statespace_args , ")" ;
pefp_args           = pefp_arg , { "," , pefp_arg } ;
pefp_arg            = "k" , ":" , integer ;
statespace_args     = statespace_arg , { "," , statespace_arg } ;
statespace_arg      = "k" , ":" , integer ;
registration_method = "PiAPlus" | "Π_A+" | identifier ;
```

`PEFP()` without arguments means `PEFP(k: 9)`. `statespace(k)` is available for continuous backends that cannot expose a Hopfield-style local field but can expose a stable state embedding. `features: 7D` is invalid v1.0 syntax.

### 3.6 Token, Replay, and Communication Statements

```ebnf
send_stmt           = "send" , send_source , "->" , send_target , [ send_body ] , ";" ;
send_source         = token_ref | glyph_ref | vocab_selector ;
send_target         = node_ref | identifier ;
token_ref           = identifier ;
send_body           = "{" , { send_field } , "}" ;
send_field          = "mode" , ":" , send_mode , ";"
                    | "format" , ":" , transmission_format , ";"
                    | "fidelity" , ":" , float , ";"
                    | "timeout" , ":" , duration , ";" ;
send_mode           = "natural" | "replay" | "inject" ;

receive_stmt        = "receive" , identifier , "from" , identifier , [ receive_body ] , ";" ;
receive_body        = "{" , { receive_field } , "}" ;
receive_field       = "timeout" , ":" , duration , ";"
                    | "format" , ":" , transmission_format , ";" ;

replay_stmt         = "replay" , replay_target , replay_body , [ on_fail_clause ] , ";" ;
replay_target       = identifier | token_ref ;
replay_body         = "{" , replay_field , { replay_field } , "}" ;
replay_field        = "trials" , ":" , integer , ";"
                    | "require" , ":" , replay_requirement , ";"
                    | "seed" , ":" , seed_expr , ";"
                    | "target" , ":" , node_ref , ";" ;
replay_requirement  = "Λ" , comparator , float
                    | "Lambda" , comparator , float
                    | "fidelity" , comparator , float ;

on_fail_clause      = "on" , "fail" , block ;
```

### 3.7 Assertions, Error Handling, and Control

```ebnf
glyph_assert        = "assert" , "glyph" , identifier , glyph_assert_body , ";" ;
glyph_assert_body   = "{" , glyph_assert_field , { glyph_assert_field } , "}" ;
glyph_assert_field  = "collisions" , comparator , integer , ";"
                    | "entropy" , comparator , bits , ";"
                    | "cardinality" , comparator , integer , ";"
                    | "Λ" , comparator , float , ";"
                    | "Lambda" , comparator , float , ";" ;

assert_stmt         = "assert" , assertion_expr , ";" ;
assertion_expr      = entropy_expr , comparator , bits
                    | collision_expr , comparator , integer
                    | distance_expr , comparator , float
                    | capacity_expr , comparator , bits
                    | boolean_expr ;
entropy_expr        = "entropy" , "(" , identifier , [ "," , "method" , ":" , entropy_method ] , ")" ;
collision_expr      = "collisions" , "(" , identifier , ")" ;
distance_expr       = "distance" , "(" , identifier , "," , identifier , "," , "metric" , ":" , metric_name , ")" ;
capacity_expr       = "capacity" , "(" , identifier , ")" ;
entropy_method      = "shannon" | "renyi0" | "empirical" ;
metric_name         = "kolmogorov" | "jsd" | "wasserstein" | "hamming" | "cosine" ;

try_stmt            = "try" , block , catch_clause , { catch_clause } , [ finally_clause ] ;
catch_clause        = "catch" , error_type , "as" , identifier , block ;
finally_clause      = "finally" , block ;
error_type          = "ResolutionError" | "ReplayFailed" | "EntropyAssertionFailed"
                    | "SubstrateTimeout" | "HALRoundTripError" | identifier ;

after_resolve_block = "after" , "resolve" , identifier , block ;
run_stmt            = "run" , identifier , run_args , block ;
run_args            = "for" , duration
                    | "for" , steps
                    | "seed" , ":" , seed_expr
                    | "for" , duration , "," , "seed" , ":" , seed_expr
                    | "for" , steps , "," , "seed" , ":" , seed_expr ;
seed_expr           = "random" | integer | string ;

let_stmt            = "let" , identifier , "=" , expr , ";" ;
block               = "{" , { top_level_item } , "}" ;
boolean_expr        = expr , comparator , expr | identifier ;
query_expr          = "top" , "(" , integer , ")"
                    | "by_glyph" , "(" , glyph_value , ")"
                    | "predict" , "(" , identifier , ")"
                    | "where" , "(" , condition , ")" ;
condition           = expr , comparator , expr ;
expr                = value | identifier | call_expr ;
call_expr           = qualified_name , "(" , [ call_args ] , ")" ;
call_args           = call_arg , { "," , call_arg } ;
call_arg            = identifier , ":" , expr | expr ;
value               = float | integer | string | boolean | duration | bits | hash_literal ;
```

## 4. Compilation Pipeline

### Stage 1: Lexer and Parser to AST

Input: SymLan source text.  
Output: AST plus source spans.

The lexer emits identifiers, literals, Greek-symbol aliases, punctuation, keywords, comparators, and unit-qualified literals. The parser must preserve source spans for all user-facing diagnostics.

Required AST node types:

```text
Program
ModuleDecl
ImportDecl
ExportDecl
SubstrateDecl
HopfieldDecl
WeightSpec
NodeDecl
ChannelDecl
NetworkDecl
NodeArrayDecl
TopologyDecl
CouplingStmt
CouplingSpec
CompositionBlock
VocabularyDecl
RegistrationSpec
FeatureSpec
StateDecl
TokenDecl
GlyphRef
RunStmt
AfterResolveBlock
ReplayStmt
SendStmt
ReceiveStmt
GlyphAssert
AssertStmt
TryStmt
CatchClause
OnFailClause
LetStmt
CallExpr
QueryExpr
MetricExpr
DurationLiteral
BitsLiteral
PhaseLiteral
```

### Stage 2: Type Checking and Semantic Validation

Input: AST, module environment, selected HAL capability manifests.  
Output: typed AST or diagnostic set.

The checker validates names, imports, phase qualifiers, substrate declarations, HAL compatibility, and all pending/resolved boundaries. It must catch:

- undeclared identifiers and duplicate declarations in one scope;
- obsolete `features: 7D`;
- `PEFP(k)` without a HAL field operator;
- `k` values whose glyph space cannot fit the selected channel format;
- pending vocabulary use outside `after resolve`;
- `replay` without a resolved or scheduled vocabulary;
- invalid `N`, `M`, `α`, or `W` in `hopfield`;
- oscillator couplings that the selected backend cannot implement;
- assertions that cannot be evaluated at their program point;
- missing `catch` or `on fail` behavior when a program declares graceful failure handling.

Stage 2 also builds the run schedule. A program may reference a pending vocabulary before textual resolution only if the compiler can schedule a run and resolution before that use.

### Stage 3: Substrate HAL Translation

The HAL is the boundary between SymLan semantics and executable substrate control. A SymLan-compliant HAL must expose a manifest and implement the common contract below.

#### Common HAL Contract

```text
manifest() -> HALManifest
initialize(params: Record) -> SubstrateHandle
calibrate(handle: SubstrateHandle, spec: CalibrationSpec) -> CalibrationReport
compile(ast: TypedAST, calibration: CalibrationReport) -> HALPlan
execute(plan: HALPlan, run: RunSpec) -> RunResult
observe(handle: SubstrateHandle, target: TargetRef, window: WindowSpec) -> ObservationSet
field_vectors(observations: ObservationSet, feature_spec: FeatureSpec) -> Matrix
candidate_basins(observations: ObservationSet) -> Set<BasinCandidate>
inject(handle: SubstrateHandle, token: Token, target: TargetRef) -> InjectionResult
replay(handle: SubstrateHandle, vocabulary: Vocabulary, trials: Int) -> ReplayReport
round_trip(token: Token) -> RoundTripReport
shutdown(handle: SubstrateHandle) -> Unit
```

`HALManifest` must declare supported substrates, feature operators, timing units, channel formats, coupling limitations, calibration requirements, stochastic controls, and replay support.

#### Hopfield HAL

The reference Hopfield HAL must implement:

```text
state_space() -> {-1,+1}^N descriptor
local_field(s) -> h = W · s
energy(s) -> -0.5 · sᵀ W s
relax(s0, dynamics, seed) -> BasinCandidate
sample_basins(count, seed) -> Set<BasinCandidate>
enumerate_basins(limit) -> Set<BasinCandidate> | TooLarge
weight_hash() -> Hash
asymmetry_lambda() -> Float
```

The Hopfield backend is compliant with v1.0 only if it can return binary states, local fields, energies, and deterministic replay under a fixed `W` and seed.

#### BZ HAL

The BZ HAL must implement:

```text
map_node(node) -> chamber_or_roi
map_coupling(κ, φ, T) -> reagent_light_electrode_plan
calibrate_cycle() -> CycleCalibration
stabilize_temperature() -> StabilizationReport
event_detect(trace) -> EventStream
state_embedding(events, k) -> Matrix
inject_waveform(token, chamber_or_roi) -> InjectionResult
```

BZ backends are not required to support `PEFP(k)` unless they expose a local field operator. They must support `statespace(k)` if they are used for vocabulary registration. The HAL must report drift metrics and calibration provenance because Round 9 identified threshold and basin drift as structural risks.

#### VO₂ HAL

The VO₂ HAL must implement:

```text
map_node(node) -> oscillator_id
map_coupling(κ, φ, T) -> electrical_thermal_plan
calibrate_frequency() -> FrequencyCalibration
measure_phase() -> PhaseTrace
state_embedding(traces, k) -> Matrix
inject_drive(token, oscillator_id) -> InjectionResult
```

VO₂ backends must explicitly report whether `φ` is controllable, measurable only, or emergent. If `φ` is not directly controllable, Stage 2 must reject programs that require fixed phase control without a backend-specific relaxation.

### Stage 4: Vocabulary Resolution by Π_A+

Input: `ObservationSet`, `RegistrationSpec`, HAL field vectors, substrate provenance.  
Output: `Vocabulary<resolved>` or `ResolutionError`.

For the reference Hopfield path:

1. Collect candidate basins. For each sampled or enumerated initial state `s0`, run the Hopfield relaxation rule until it reaches a fixed point or a bounded cycle. Fixed points become basin candidates. Cycles are rejected unless the HAL declares cycle basins.

2. Deduplicate basins by representative state. For binary Hopfield fixed points, the canonical representative is `s ∈ {-1,+1}^N`. The basin identifier is `hash(W_hash, s)`.

3. Compute the local field for each basin:

```text
h_b = W · s_b
```

4. Build the PEFP projection. Let `H` be the matrix whose rows are `h_b`. Compute `μ = mean(H)`, center each row, compute covariance `C`, and take the top `k` eigenvectors `P_k`. The projected eigenfield vector is:

```text
z_b = P_kᵀ · (h_b - μ)
```

Default: `k = 9`.

5. Select `θ:auto`. For each dimension, construct candidate thresholds from midpoints of sorted absolute projected values. The runtime searches threshold vectors and selects the first vector under this ordering:

```text
minimize collision_count_after_ternary_quantization
maximize minimum_margin_to_threshold
maximize empirical_entropy_of_digit_patterns
minimize ||θ||₂
choose lexicographically by dimension index
```

For a literal threshold, the compiler expands the scalar to a vector in normalized PEFP coordinates. A backend may reject a literal threshold if the normalization is not reproducible.

6. Ternary quantize each PEFP coordinate:

```text
q_i(b) = 0 if z_b[i] < -θ_i
q_i(b) = 1 if -θ_i <= z_b[i] <= θ_i
q_i(b) = 2 if z_b[i] > θ_i
```

The 9-trit pattern is:

```text
Q_b = (q_0, q_1, q_2, q_3, q_4, q_5, q_6, q_7, q_8)
```

7. Compute attractor energy:

```text
E_b = -0.5 · s_bᵀ W s_b
```

Normalize energies to zero mean and unit robust scale when at least three basins exist.

8. Resolve `τ_E` by max-margin polarity. For all basin pairs that share the same ternary pattern `Q`, the runtime tries to place the pair on opposite sides of an energy threshold `β`. Candidate `β` values are midpoints of sorted normalized energies. Select `β` by:

```text
maximize separated_collision_pairs
maximize minimum |E_b - β|
minimize unresolved_collision_pairs
choose smallest β among ties
```

Then:

```text
τ_E(b) = 0 if E_b < β
τ_E(b) = 1 if E_b >= β
```

If any two distinct basins still share `(τ_E, Q)`, the vocabulary has a glyph collision. A program with `collisions == 0` asserted must fail resolution.

9. Encode the glyph. First compute the ternary PEFP index:

```text
g_A(b) = Σ_{i=0}^{k-1} q_i(b) · 3^i
```

Then use the patent-aligned interleaved polarity encoding:

```text
glyph(b) = 2 · g_A(b) + τ_E(b)
```

For `k=9`, `g_A ∈ Int[0..19682]` and `2 × 3^9 = 39,366`, so `glyph ∈ Int[0..39365]`.

10. Compute vocabulary statistics:

```text
p_g = observed_count(g) / total_observed_tokens
H(V) = -Σ_g p_g log₂(p_g)
capacity(V) = log₂(|support(V)|)
collisions(V) = number of duplicate glyph assignments
```

At `M=54` with uniform empirical distribution, `H(V) = log₂(54) = 5.755 bits`.

11. Return `Vocabulary<resolved>` only if all declared `min_basins`, `min_entropy`, and glyph assertions are satisfied. Otherwise return `ResolutionError` or the specific assertion failure.

For continuous substrates:

- If the HAL exposes a local field operator, the same PEFP procedure applies to HAL field vectors.
- If not, `statespace(k)` uses the HAL state embedding and the same `θ:auto`, ternary quantization, `τ_E` if an energy or polarity scalar is exposed, and glyph encoding.
- A continuous backend that cannot expose either PEFP-compatible fields or stable statespace embeddings is not SymLan v1.0 vocabulary-compliant.

### Stage 5: Token Generation and Transmission

Input: `Vocabulary<resolved>`, selector, transmission format.  
Output: `Token<resolved>` and optional channel payload.

Token selection resolves a basin by query, glyph, or ranking. The generated token stores the glyph, PEFP digits, `τ_E`, source vocabulary, replay prototype, and provenance.

Supported transmission formats:

```text
uint16      unsigned 16-bit integer, valid because 39365 < 65536
base64_6    fixed-width six-character base-64 string for registry-safe transport
ternary_10  one polarity bit followed by nine ternary digits
```

The canonical format is `uint16`. Text channels should use `base64_6`. Human inspection and debugging may use `ternary_10`.

### Stage 6: Token-Replay Validation

Input: `Vocabulary<resolved>`, trial count, target substrate/channel, replay criterion.  
Output: `ReplayFidelity` with `Λ`.

For each trial:

1. Select a token according to the vocabulary's replay schedule.
2. Inject or transmit the token through the HAL.
3. Observe the receiver or relaxed substrate state.
4. Classify the resulting basin or glyph.
5. Count success if the observed glyph matches the expected glyph or accepted transition target.

Replay fidelity:

```text
Λ = successes / trials
```

Default GO criteria:

```text
collisions(V) == 0
H(V) >= declared min_entropy, when present
Λ >= declared replay requirement, default 0.90 when replay is asserted
HAL round-trip fidelity >= 0.90 for replay-capable backends
```

FAIL behavior:

- If the statement has `on fail`, control enters that block with an error value in scope.
- If the replay occurs inside `try`, the runtime raises `ReplayFailed`.
- If unhandled, the program terminates with `NO-GO` and dependent exports are suppressed.

## 5. Standard Library v1.0

Every SymLan runtime must provide these modules and functions.

### Substrate

```text
Substrate.initialize(params: Record) -> Substrate
Substrate.calibrate(substrate: Substrate, profile: CalibrationSpec) -> CalibrationReport
Substrate.capabilities(substrate: Substrate) -> HALManifest
Substrate.run(substrate: Substrate, duration: Duration | steps: Int, seed: Seed) -> RunResult
Substrate.observe(substrate: Substrate, target: TargetRef, window: WindowSpec) -> ObservationSet
Substrate.shutdown(substrate: Substrate) -> Unit
```

### Hopfield

```text
Hopfield.learn(N: Int, M: Int, alpha: Float, seed: Seed, rule: LearningRule) -> HopfieldSubstrate
Hopfield.energy(substrate: HopfieldSubstrate, state: Vector) -> Float
Hopfield.local_field(substrate: HopfieldSubstrate, state: Vector) -> FieldVector
Hopfield.relax(substrate: HopfieldSubstrate, state: Vector, seed: Seed) -> Basin
Hopfield.sample(substrate: HopfieldSubstrate, count: Int, seed: Seed) -> Set<Basin>
Hopfield.asymmetry(substrate: HopfieldSubstrate) -> Float
```

### Vocabulary

```text
Vocabulary.register(substrate, θ: auto | Float, features: PEFP(k) | statespace(k)) -> Vocabulary<pending>
Vocabulary.resolve(vocabulary: Vocabulary<pending>, run: RunResult) -> Vocabulary<resolved>
Vocabulary.export(vocabulary: Vocabulary<resolved>, uri: String) -> Artifact
Vocabulary.import(uri: String) -> Vocabulary<imported>
Vocabulary.compose(left: Vocabulary<resolved>, right: Vocabulary<resolved>, mode: ComposeMode) -> Vocabulary<pending>
Vocabulary.compare(left: Vocabulary<resolved>, right: Vocabulary<resolved>, metric: Metric) -> Float
Vocabulary.top(vocabulary: Vocabulary<resolved>, n: Int) -> List<Token>
```

### Glyph

```text
Glyph.encode(tau_E: Bit, digits: Ternary[k]) -> Glyph
Glyph.decode(glyph: Glyph, k: Int) -> GlyphParts
Glyph.collisions(vocabulary: Vocabulary<resolved>) -> Int
Glyph.cardinality(k: Int) -> Int
Glyph.format(glyph: Glyph, format: uint16 | base64_6 | ternary_10) -> Payload
Glyph.parse(payload: Payload, format: uint16 | base64_6 | ternary_10) -> Glyph
```

### Token

```text
Token.from(vocabulary: Vocabulary<resolved>, selector: BasinSelector) -> Token
Token.send(glyph: Glyph | Token, channel: Channel) -> SendResult
Token.receive(channel: Channel, timeout: Duration) -> Token | Timeout
Token.replay(token: Token, target: Node | Substrate) -> ReplayTrial
Token.metadata(token: Token) -> TokenMetadata
```

### Replay

```text
Replay.validate(vocabulary: Vocabulary<resolved>, trials: Int) -> Λ: Float
Replay.report(vocabulary: Vocabulary<resolved>) -> ReplayReport
Replay.require(vocabulary: Vocabulary<resolved>, threshold: Float) -> Pass | ReplayFailed
```

### Entropy

```text
Entropy.measure(vocabulary: Vocabulary<resolved>) -> Float
Entropy.measure(vocabulary: Vocabulary<resolved>, method: shannon | renyi0 | empirical) -> Float
Entropy.support(vocabulary: Vocabulary<resolved>) -> Int
Entropy.distribution(vocabulary: Vocabulary<resolved>) -> Distribution
```

### Tower

```text
Tower.register(vocabulary: Vocabulary<resolved>, authority: String) -> TowerId
Tower.fetch(id: TowerId) -> Vocabulary<imported>
Tower.compose(left: TowerId, right: TowerId, mode: ComposeMode) -> Vocabulary<pending>
Tower.provenance(id: TowerId) -> ProvenanceRecord
```

The Tower module is optional for local runtimes but required for runtimes claiming registry interoperability.

### Diagnostics

```text
Diagnostics.emit(error: Error) -> Unit
Diagnostics.trace(run: RunResult) -> Trace
Diagnostics.provenance(value: Token | Vocabulary | RunResult) -> ProvenanceRecord
```

## 6. Eight Complete Programs

### Program 1: Hello World

```symlan
module examples.hello;

hopfield H {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "hello", symmetric: true);
  lambda: 0.000;
  dynamics: async;
};

channel out {
  format: uint16;
  timeout: 100ms;
  target: "stdout";
};

vocab V = register(H, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus, format: uint16);

run discovery for 10000steps, seed: "hello-run" {
}

after resolve V {
  token W1 from V.top(1);
  send W1 -> out {
    mode: replay;
    format: uint16;
    fidelity: 0.90;
  };
}
```

### Program 2: Vocabulary Survey with Collision and Entropy Assertions

```symlan
module examples.survey;

hopfield H {
  N: 1024;
  M: 74;
  alpha: 0.072266;
  W: learn(rule: projection, patterns: 74, seed: "survey", symmetric: true);
  lambda: 0.005;
  dynamics: async;
};

vocab V = register(H, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);

run survey_run for 20000steps, seed: "survey-run" {
}

after resolve V {
  assert glyph V {
    collisions == 0;
    entropy >= 5.0bits;
    cardinality >= 54;
  };
  export V to "survey.symvoc";
}
```

### Program 3: Arbitrariness Demonstration

```symlan
module examples.arbitrariness;

hopfield A {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "dialect-A", symmetric: true);
  lambda: 0.000;
  dynamics: async;
};

hopfield B {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "dialect-B", symmetric: true);
  lambda: 0.000;
  dynamics: async;
};

vocab VA = register(A, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);
vocab VB = register(B, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);

run run_A for 12000steps, seed: "same-source-A" {
}

run run_B for 12000steps, seed: "same-source-B" {
}

after resolve VA {
  after resolve VB {
    assert distance(VA, VB, metric: kolmogorov) > 0.30;
    assert glyph VA { collisions == 0; entropy >= 5.0bits; };
    assert glyph VB { collisions == 0; entropy >= 5.0bits; };
  }
}
```

### Program 4: Token-Replay Validation

```symlan
module examples.replay_validation;

hopfield H {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "replay", symmetric: true);
  lambda: 0.010;
  dynamics: async;
};

vocab V = register(H, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);

run discovery for 10000steps, seed: "replay-discovery" {
}

after resolve V {
  replay V {
    trials: 1000;
    require: Λ >= 0.990;
    seed: "replay-trials";
  };
  assert glyph V {
    collisions == 0;
    Λ >= 0.990;
  };
}
```

### Program 5: Vocabulary Composition via Tower Registry Identifiers

```symlan
module examples.composition;

import Tower from "stdlib:tower";

vocab VA = Tower.fetch("tower:symvoc:labA:2026-05-04:alpha");
vocab VB = Tower.fetch("tower:symvoc:labB:2026-05-04:beta");

vocab VC = Vocabulary.compose(VA, VB, mode: product);

after resolve VA {
  after resolve VB {
    assert glyph VA { collisions == 0; entropy >= 5.0bits; };
    assert glyph VB { collisions == 0; entropy >= 5.0bits; };
    after resolve VC {
      assert glyph VC { collisions == 0; };
      export VC to "composed_vocab.symvoc";
    }
  }
}
```

### Program 6: Explicit 4D Property Demonstration

```symlan
module examples.four_d_property;

hopfield H1024 {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "same-source", symmetric: true);
  lambda: 0.000;
  dynamics: async;
};

hopfield H2048 {
  N: 2048;
  M: 54;
  alpha: 0.026367;
  W: learn(rule: projection, patterns: 54, seed: "same-source", symmetric: true);
  lambda: 0.000;
  dynamics: async;
};

vocab V1024 = register(H1024, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);
vocab V2048 = register(H2048, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);

run run_1024 for 10000steps, seed: "four-d" {
}

run run_2048 for 10000steps, seed: "four-d" {
}

after resolve V1024 {
  after resolve V2048 {
    assert distance(V1024, V2048, metric: hamming) > 0.00;
    export V1024 to "N1024.symvoc";
    export V2048 to "N2048.symvoc";
  }
}
```

The source-level intent is the same. The programmer changes one declared substrate dimension, `N`; the fourth dimension `V` is resolved differently by substrate execution and Π_A+.

### Program 7: Graceful Replay FAIL Handling

```symlan
module examples.replay_fail_handling;

hopfield H {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: learn(rule: projection, patterns: 54, seed: "fragile", symmetric: true);
  lambda: 0.010;
  dynamics: async;
};

vocab V = register(H, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus);

run discovery for 8000steps, seed: "fragile-run" {
}

after resolve V {
  try {
    replay V {
      trials: 200;
      require: Λ >= 0.990;
      seed: "fragile-replay";
    };
  } catch ReplayFailed as err {
    replay V {
      trials: 1000;
      require: Λ >= 0.950;
      seed: "recovery-replay";
    } on fail {
      export V to "quarantine_fragile.symvoc";
    };
  } finally {
    assert glyph V {
      collisions == 0;
    };
  }
}
```

### Program 8: Hopfield Substrate with Explicit N, M, and α

```symlan
module examples.hopfield_explicit;

hopfield H {
  N: 1024;
  M: 54;
  alpha: 0.052734;
  W: matrix("weights/H_1024x1024_projection.symw");
  lambda: 0.004;
  seed: "explicit-hopfield";
  dynamics: async;
};

node probe {
  role: observer;
  substrate: H;
  indices: [0..1023];
};

vocab V = register(H, θ: auto, features: PEFP(k: 9), min_basins: 54, min_entropy: 5.0bits, method: PiAPlus, format: uint16);

run catalogue for 25000steps, seed: "explicit-catalogue" {
}

after resolve V {
  token first from V.top(1);
  send first -> probe {
    mode: replay;
    fidelity: 0.99;
  };
  replay V {
    trials: 540;
    require: Λ >= 0.990;
    target: probe;
  };
  export V to "hopfield_explicit.symvoc";
}
```

## 7. Formal Semantics

SymLan v1.0 is best specified by a small-step operational semantics with an explicit substrate environment.

Let:

```text
P       source program
A       typed AST
Σ       compile-time store of declared names and pending handles
R       runtime store of resolved substrate values
H       selected HAL environment
Π_A+    vocabulary readout operator
C       configuration <A, Σ, R, H>
```

Compilation maps source to a protocol, not to a complete symbol denotation:

```text
compile(P, H) = <A, Σ_pending>
```

Declarations extend `Σ`:

```text
Σ ⊢ hopfield Hdecl : HopfieldSubstrate<declared>
Σ ⊢ vocab V = register(Hdecl, θ:auto, PEFP(k:9)) : Vocabulary<pending>
```

Execution transitions invoke the HAL:

```text
<run r for n steps, Σ, R, H> -> <unit, Σ, R[r ↦ H.execute(n)], H>
```

Vocabulary resolution is a semantic transition, not a compile-time reduction:

```text
R[r] = observations
Π_A+(observations, V.pending.spec) = V_resolved
<after resolve V { S }, Σ[V:pending], R, H>
  -> <S, Σ[V:resolved], R[V ↦ V_resolved], H>
```

If `Π_A+` returns collisions or violates declared assertions:

```text
Π_A+(observations, spec) = error
<after resolve V { S }, Σ, R, H> -> <raise ResolutionError, Σ, R, H>
```

Token send is defined only for resolved vocabularies:

```text
Σ ⊢ t : Token<resolved>
<send t -> c, Σ, R, H> -> <unit, Σ, R[result ↦ H.inject(t,c)], H>
```

There is no denotational meaning for the concrete vocabulary `V` before substrate execution. The denotation of a pre-run program is a set of constraints and a pending handle:

```text
⟦P⟧pre = (constraints, HALPlan, pending V)
```

The post-run denotation exists only after resolution:

```text
⟦P⟧post = (constraints, HALPlan, V_resolved, token semantics)
```

SymLan is not a total language. A well-typed SymLan program may fail to resolve a vocabulary, may fail replay, may time out, or may diverge if the substrate run has no bound. A diverging substrate run is modeled as absence of a final configuration. A bounded non-converging run raises `SubstrateTimeout`; an unbounded non-converging run is true divergence.

Determinism is conditional. Given identical source, identical HAL implementation, identical `W`, identical seed, identical calibration, and deterministic Π_A+ tie-breaking, the Hopfield reference semantics are deterministic. Continuous substrates are deterministic only to the degree their HAL can attest equivalent physical conditions.

## 8. Open Problems in v1.0

FM3, HAL non-invertibility, remains open. A HAL can map source constraints to substrate controls and later classify observations, but the inverse map from observed physics back to source intent is generally many-to-one. v1.0 requires `round_trip` reports, but it does not solve the mathematical non-invertibility.

FM4, governance vacuum, remains open. A vocabulary can be generated without hand-labeling glyphs, but deployment still requires authority over `W`, seeds, calibration profiles, validity thresholds, registry admission, provenance, and equivalence claims. The Tower module records provenance; it does not settle governance.

Continuous substrate parity is not proven. Construction A+ resolves the Round 9 drift and entropy failure modes for discrete Hopfield state vectors. BZ and VO₂ backends must independently demonstrate stable embeddings, replay fidelity, and drift controls.

`τ_E` adds one bit, not unlimited collision repair. If more than two basins share the same 9-trit PEFP pattern in the same energy-polarity region, Π_A+ must report collisions. The language treats that as a valid failure, not as something to hide.

Entropy is empirical. The default alphabet has 39,366 possible glyphs, but a resolved vocabulary's information content is the measured distribution `H(V)`, not the theoretical capacity. Uniform `M=54` gives 5.755 bits; a skewed real distribution may not.

Reproducibility and arbitrariness remain in tension. The system must be stable enough to replay and validate, yet contingent enough to produce dialect-like vocabularies across substrate histories. v1.0 can express the tests; it cannot guarantee the result.

Scaling beyond `k=9` is specified but not operationally certified. Larger `k` increases capacity and channel width, but also increases quantization sparsity and collision/overfit risk. A runtime must declare supported `k`.

Security and registry semantics are minimal. v1.0 can hash, export, import, and register vocabularies, but it does not provide a complete trust model, revocation model, dispute process, or semantic query language.

Real-time constraints are backend dependent. The 16-bit glyph format solves the Round 9 7D-vector channel-capacity objection at the language layer, but physical injection, receiver settling, and HAL latency remain substrate-specific.

Patent status is not a language feature. A pending application may matter for commercialization and disclosure control, but compiler correctness must rely on the public technical specification, test vectors, and reproducible HAL behavior.
