```text
FLOW "NaturalLanguageDSLConvergence" v1.0
# =============================================================================
# CHAPTER 27
# NATURAL LANGUAGE DSL CONVERGENCE
# =============================================================================
#
# PURPOSE
#
# Convert a natural-language behavioural request into a constrained,
# self-contained and executable domain-specific specification without losing
# the intent carried by the original request.
#
# The flow treats natural language and domain-specific languages as two ends of
# one semantic continuum:
#
# Natural Language
# → Intent Extraction
# → Semantic Normalisation
# → Constraint Formation
# → Symbol Binding
# → Structural DSL
# → Executable Flow
#
# Natural language supplies flexibility and expressive breadth.
#
# The DSL supplies determinism, explicit state, formal constraints and
# repeatable execution.
#
# Convergence occurs when the original intent and the formal specification
# resolve to the same permitted behaviour.
#
# =============================================================================
# AUTHORS
# =============================================================================
#
# Mark Higgins
# Sky — Recursive AI
#
# Kireth Research
# https://kirethresearch.org
#
# This specification must be cited when reproduced, implemented or adapted.
#
# =============================================================================
# =============================================================================
# 0. EXECUTION CLASS
# =============================================================================
EXECUTION_CLASS:
name:
natural_language_dsl_convergence
source_language:
natural_language
target_representation:
executable_domain_specific_language
target_form:
Flow Algebra
conventional_compiler_required:
false
semantic_parser_required:
true
constraint_propagation_required:
true
hidden_assumptions_allowed:
false
silent_ambiguity_resolution_allowed:
false
semantic_loss_allowed:
false
unsupported_requirement_invention_allowed:
false
unverifiable_equivalence_claim_allowed:
false
# =============================================================================
# 1. CORE DEFINITION
# =============================================================================
DEFINITION:
Natural-language–DSL convergence is the process by which an informal request
is transformed into a structured executable specification while preserving
its intended behaviour, constraints, priorities and prohibited outcomes.
Let:
N :=
natural-language request
M_N :=
interpreted semantic meaning of N
D :=
generated domain-specific specification
M_D :=
executable semantic meaning of D
Convergence is reached when:
M_D ≡ M_N
under all declared hard constraints.
Exact word-for-word preservation is not required.
Behavioural equivalence is required.
# =============================================================================
# 2. CONVERGENCE OBJECTIVE
# =============================================================================
OBJECTIVE:
Given:
natural_language_request:
N
optional_domain_context:
C_D
optional_existing_dsl:
D_existing
derive:
executable_dsl:
D*
such_that:
- every mandatory intent in N is represented
- every hard constraint in N is preserved
- every prohibited behaviour in N remains prohibited
- every symbol in D* is declared
- every transform in D* is executable
- every output is traceable to N
- no hidden semantic dependency remains
- unresolved ambiguity is exposed rather than invented away
- D* can be executed directly by a compatible reasoning system
# =============================================================================
# 3. NON-OBJECTIVES
# =============================================================================
NON_OBJECTIVES:
- imitate the wording of the source request
- preserve grammar errors
- preserve irrelevant repetition
- convert every sentence into a separate rule
- infer unstated business policy
- guess missing safety requirements
- fabricate defaults
- produce ordinary pseudocode
- reduce the request to keywords
- optimise away required behaviour
- hide ambiguity inside implementation choices
# =============================================================================
# 4. IO CONTRACT
# =============================================================================
IO.READ:
required:
natural_language_request:
symbol:
N
type:
string
constraints:
- trim(N) != empty
optional:
domain_name:
type:
string?
examples:
- logistics
- customer_support
- physics
- medical_triage
- business_process
- content_generation
- optimisation
domain_context:
symbol:
C_D
type:
object?
description:
Domain definitions, allowed operations, terminology, authoritative
constraints and known execution boundaries.
existing_dsl:
symbol:
D_existing
type:
structured_document?
required_dsl_version:
type:
string
default:
"Flow Algebra v1.0"
target_execution_mode:
type:
enum
values:
- DETERMINISTIC
- BOUNDED_BRANCHING
- SYMBOLIC_SIMULATION
- VALIDATION_ONLY
default:
DETERMINISTIC
ambiguity_policy:
type:
enum
values:
- REJECT_UNRESOLVED
- DECLARED_DEFAULTS_ONLY
- MINIMUM_REVERSIBLE_ASSUMPTION
default:
REJECT_UNRESOLVED
maximum_normalisation_cycles:
type:
integer
default:
5
constraints:
1 <= maximum_normalisation_cycles <= 20
maximum_validation_cycles:
type:
integer
default:
5
constraints:
1 <= maximum_validation_cycles <= 20
maximum_semantic_branches:
type:
integer
default:
16
constraints:
maximum_semantic_branches >= 1
strictness:
type:
enum
values:
- STRICT
- CONSERVATIVE
- PERMISSIVE
default:
STRICT
IO.WRITE:
fields:
convergence_status:
type:
enum
values:
- CONVERGED
- PARTIALLY_CONVERGED
- AMBIGUOUS
- CONTRADICTORY
- INCOMPLETE
- DOMAIN_UNRESOLVED
- DSL_INVALID
- SEMANTIC_MISMATCH
executable_dsl:
type:
structured_document?
normalised_intent:
type:
object
semantic_model:
type:
object
ambiguity_register:
type:
sequence<object>
assumption_register:
type:
sequence<object>
requirement_trace:
type:
sequence<object>
validation_report:
type:
object
convergence_guarantee:
type:
object
# =============================================================================
# 5. PRIMARY SYMBOLS
# =============================================================================
SYMBOLS:
N:
meaning:
original natural-language request
C_D:
meaning:
optional domain context
D_existing:
meaning:
optional pre-existing domain-specific specification
U:
meaning:
set of utterance units extracted from N
I:
meaning:
set of normalised intent units
E:
meaning:
set of semantic entities
R:
meaning:
set of relationships
A:
meaning:
set of actions
K_H:
meaning:
set of hard constraints
K_S:
meaning:
set of soft constraints
P:
meaning:
set of prohibited behaviours
Q:
meaning:
set of ambiguities
H:
meaning:
set of explicit and permitted assumptions
S:
meaning:
state model
T:
meaning:
transform set
G:
meaning:
semantic transition graph
D*:
meaning:
accepted executable DSL
M_N:
meaning:
semantic model derived from natural language
M_D:
meaning:
semantic model recoverable from generated DSL
# =============================================================================
# 6. SEMANTIC UNIT MODEL
# =============================================================================
SEMANTIC_UNIT:
fields:
id:
SemanticUnitID
source_text:
string
source_position:
span
canonical_form:
string
category:
enum
values:
- OBJECTIVE
- INPUT
- OUTPUT
- ENTITY
- STATE
- ACTION
- CONDITION
- CONSTRAINT
- INVARIANT
- PROHIBITION
- PRIORITY
- DEFAULT
- EXAMPLE
- EXPLANATION
- TERMINATION
- FAILURE
- AMBIGUITY
modality:
enum
modality_values:
- MUST
- MUST_NOT
- SHOULD
- SHOULD_NOT
- MAY
- UNKNOWN
certainty:
real
mandatory:
boolean
dependencies:
set<SemanticUnitID>
conflicts:
set<SemanticUnitID>
domain:
string?
trace_required:
boolean
# =============================================================================
# 7. NATURAL-LANGUAGE EVIDENCE STATES
# =============================================================================
EVIDENCE_STATE:
EXPLICIT:
meaning:
directly stated in N
IMPLIED_STRONG:
meaning:
necessary for the explicit request to remain coherent
IMPLIED_WEAK:
meaning:
plausible but not required
DEFAULT_DECLARED:
meaning:
supplied through C_D or an explicit default
ASSUMED_REVERSIBLE:
meaning:
minimally assumed without changing the primary intent
UNKNOWN:
meaning:
not resolvable from the supplied material
CONTRADICTORY:
meaning:
two or more supplied statements cannot simultaneously hold
# =============================================================================
# 8. GLOBAL INVARIANTS
# =============================================================================
INVARIANT K1_SOURCE_PRESERVATION:
every mandatory DSL construct must trace to:
- an explicit natural-language unit
- a necessary implication
- an authorised domain rule
- a declared default
- a permitted reversible assumption
INVARIANT K2_NO_SEMANTIC_INVENTION:
generated DSL must not introduce:
- undeclared business policy
- new mandatory behaviour
- new prohibited behaviour
- hidden external dependencies
- arbitrary thresholds
- unsupported domain facts
- silent priorities
INVARIANT K3_MANDATORY_INTENT_COVERAGE:
∀ i ∈ I where i.mandatory = true:
∃ d ∈ D*:
implements(d,i)
=
true
INVARIANT K4_PROHIBITION_PRESERVATION:
∀ p ∈ P:
D* must contain a structurally enforceable prohibition for p
INVARIANT K5_MODALITY_PRESERVATION:
MUST must not become SHOULD
MUST_NOT must not become SHOULD_NOT
SHOULD must not become MUST
MAY must not become MUST
INVARIANT K6_AMBIGUITY_VISIBILITY:
unresolved ambiguity must remain visible in:
- ambiguity_register
- convergence_status
- affected DSL region
INVARIANT K7_UNKNOWN_NOT_DEFAULT:
UNKNOWN must not become DEFAULT unless a default is explicitly authorised
INVARIANT K8_SYMBOL_CLOSURE:
every symbol used in D* must have:
- declaration
- domain
- scope
- type
- mutability
INVARIANT K9_TRANSFORM_CLOSURE:
every transform in D* must have:
- activation condition
- preconditions
- operations
- state mutation
- postconditions
- continuation rule
INVARIANT K10_STATE_COHERENCE:
every mutable concept referenced by the request must map to explicit state
INVARIANT K11_CONSTRAINT_ENFORCEABILITY:
a hard constraint is represented only when the DSL contains an executable
validation or transition rule capable of enforcing it
INVARIANT K12_TERMINATION_VISIBILITY:
every generated process must declare:
- successful termination
- failure termination
- resource termination where relevant
INVARIANT K13_OUTPUT_TRACEABILITY:
every output field must trace to:
- requested output
- necessary execution diagnostic
- declared failure report
INVARIANT K14_REVERSIBILITY_OF_ASSUMPTIONS:
every permitted assumption must be removable without changing unrelated DSL
regions
INVARIANT K15_BIDIRECTIONAL_EQUIVALENCE:
semantic meaning extracted from D* must preserve the mandatory meaning of N
INVARIANT K16_EXECUTABILITY:
D* must be directly executable by a compatible Flow Algebra reasoning system
INVARIANT K17_NO_PSEUDOCODE_ESCAPE:
no required transform may be replaced by:
- "handle as needed"
- "process appropriately"
- "use best judgement"
- "etc."
- "perform validation"
- another undefined operation
INVARIANT K18_DOMAIN_BOUNDARY:
domain-specific claims must be sourced from C_D or marked unresolved
# =============================================================================
# 9. SOURCE INGESTION
# =============================================================================
TRANSFORM T_INGEST_SOURCE:
source_text ←
normalise_whitespace(N)
REQUIRE:
source_text != empty
preserve:
- explicit negation
- modal verbs
- numeric values
- comparison terms
- temporal order
- conditional clauses
- exception clauses
- scope words
- priorities
- examples
- quoted identifiers
bind immutable:
N ← source_text
C_D ← domain_context
D_existing ← existing_dsl
proceed:
T_SEGMENT_UTTERANCES
# =============================================================================
# 10. UTTERANCE SEGMENTATION
# =============================================================================
TRANSFORM T_SEGMENT_UTTERANCES:
U ←
SegmentIntoSemanticClauses(N)
segmentation boundaries include:
- sentence boundaries
- list entries
- conjunctions joining distinct obligations
- conditional clauses
- exception clauses
- prohibition clauses
- temporal clauses
- parenthetical constraints
FOR EACH u ∈ U:
assign:
id:
StableUnitID(u)
source_text:
exact_source_span(u)
source_position:
locate(u,N)
certainty:
1.0
evidence_state:
EXPLICIT
REQUIRE:
concatenated source spans preserve all meaningful content
proceed:
T_CLASSIFY_UTTERANCES
# =============================================================================
# 11. UTTERANCE CLASSIFICATION
# =============================================================================
TRANSFORM T_CLASSIFY_UTTERANCES:
FOR EACH u ∈ U:
classify semantic role:
IF u states desired result:
category ← OBJECTIVE
ELSE IF u describes supplied data:
category ← INPUT
ELSE IF u describes produced data:
category ← OUTPUT
ELSE IF u names a thing or actor:
category ← ENTITY
ELSE IF u describes a mutable condition:
category ← STATE
ELSE IF u describes an operation:
category ← ACTION
ELSE IF u uses conditional logic:
category ← CONDITION
ELSE IF u limits permitted behaviour:
category ← CONSTRAINT
ELSE IF u states something that must always remain true:
category ← INVARIANT
ELSE IF u forbids behaviour:
category ← PROHIBITION
ELSE IF u ranks competing outcomes:
category ← PRIORITY
ELSE IF u supplies fallback value:
category ← DEFAULT
ELSE IF u illustrates behaviour:
category ← EXAMPLE
ELSE IF u defines completion:
category ← TERMINATION
ELSE IF u defines failure:
category ← FAILURE
ELSE:
category ← EXPLANATION
detect modality:
"must" | "shall" | "required"
→ MUST
"must not" | "shall not" | "forbidden"
→ MUST_NOT
"should" | "prefer"
→ SHOULD
"should not" | "avoid"
→ SHOULD_NOT
"may" | "can"
→ MAY
no reliable modality
→ UNKNOWN
proceed:
T_NORMALISE_INTENT
# =============================================================================
# 12. INTENT NORMALISATION
# =============================================================================
TRANSFORM T_NORMALISE_INTENT:
I ← ∅
FOR EACH u ∈ U:
canonical_unit ← {
id:
u.id,
source_text:
u.source_text,
canonical_form:
CanonicaliseMeaning(u),
category:
u.category,
modality:
u.modality,
mandatory:
u.modality ∈ {MUST,MUST_NOT},
evidence_state:
EXPLICIT,
certainty:
u.certainty,
dependencies:
∅,
conflicts:
∅,
domain:
ResolveDomain(u,C_D),
trace_required:
true
}
I ←
I ∪ {canonical_unit}
normalisation rules:
preserve:
"before"
as temporal precedence
"after"
as temporal succession
"only if"
as necessary condition
"if"
as activation condition
"unless"
as exception condition
"exactly"
as equality constraint
"at least"
as lower bound
"at most"
as upper bound
"never"
as hard prohibition
"always"
as invariant
"prefer"
as soft priority
prohibit:
- dropping negation
- converting examples into requirements
- converting explanations into executable rules without necessity
- merging semantically distinct obligations
proceed:
T_RESOLVE_ENTITIES
# =============================================================================
# 13. ENTITY RESOLUTION
# =============================================================================
TRANSFORM T_RESOLVE_ENTITIES:
E ←
ExtractEntities(I)
FOR EACH entity e:
assign:
entity_id:
CanonicalEntityID(e)
canonical_name:
ResolveCanonicalName(e,C_D)
aliases:
ResolveAliases(e,I,C_D)
type:
InferEntityType(e)
source_units:
UnitsReferencing(e)
scope:
InferScope(e)
certainty:
EntityResolutionConfidence(e)
co-reference resolution:
resolve:
- pronouns
- repeated aliases
- singular/plural references
- shortened identifiers
- contextual references
- "it", "they", "this process", "the result"
IF more than one valid referent remains:
Q.add({
type:
ENTITY_AMBIGUITY,
source_unit:
source_unit_id,
candidates:
candidate_entities,
effect:
affected_requirements
})
proceed:
T_RESOLVE_ACTIONS
# =============================================================================
# 14. ACTION RESOLUTION
# =============================================================================
TRANSFORM T_RESOLVE_ACTIONS:
A ←
ExtractActions(I)
FOR EACH action a:
define:
action_id:
StableActionID(a)
actor:
resolved actor or SYSTEM
operation:
canonical verb
object:
affected entity
inputs:
consumed entities
outputs:
produced entities
preconditions:
conditions required before execution
postconditions:
conditions required after execution
side_effects:
declared external changes
modality:
source modality
source_units:
source trace
IF operation cannot be mapped to:
- declared primitive
- flow-defined function
- domain capability
THEN:
Q.add({
type:
UNRESOLVED_OPERATION,
operation:
a.operation,
source_units:
a.source_units
})
proceed:
T_EXTRACT_CONSTRAINTS
# =============================================================================
# 15. CONSTRAINT EXTRACTION
# =============================================================================
TRANSFORM T_EXTRACT_CONSTRAINTS:
K_H ← ∅
K_S ← ∅
P ← ∅
FOR EACH i ∈ I:
IF i.modality = MUST:
K_H.add(
ConvertToConstraint(i)
)
IF i.modality = MUST_NOT:
prohibition ←
ConvertToProhibition(i)
K_H.add(prohibition)
P.add(prohibition)
IF i.modality ∈ {SHOULD,SHOULD_NOT}:
K_S.add(
ConvertToSoftConstraint(i)
)
IF i.category = INVARIANT:
K_H.add(
ConvertToInvariant(i)
)
IF i.category = PRIORITY:
K_S.add(
ConvertToPriority(i)
)
derive necessary constraints only when:
- execution would otherwise be structurally impossible
- derivation follows directly from explicit intent
- derivation does not narrow optional behaviour unnecessarily
derived constraint fields:
source:
IMPLIED_STRONG
certainty:
less_than_or_equal_to 0.95
derivation:
explicit proof path
proceed:
T_DETECT_CONTRADICTIONS
# =============================================================================
# 16. CONTRADICTION DETECTION
# =============================================================================
TRANSFORM T_DETECT_CONTRADICTIONS:
contradiction_set ← ∅
FOR EACH pair (i,j) ∈ I:
IF CannotBothHold(i,j):
contradiction_set.add({
left_unit:
i.id,
right_unit:
j.id,
left_statement:
i.canonical_form,
right_statement:
j.canonical_form,
reason:
ExplainContradiction(i,j),
severity:
HARD if i.mandatory and j.mandatory else SOFT
})
detect:
- required_and_forbidden_same_action
- incompatible_numeric_bounds
- incompatible output types
- conflicting temporal order
- mutually exclusive terminal conditions
- required immutable and mutable same symbol
- conflicting actor authority
- exact value conflicts
- conflicting defaults
- required dependency and forbidden dependency
IF contradiction_set contains HARD:
convergence_status ←
CONTRADICTORY
HALT before executable DSL emission
proceed:
T_DETECT_AMBIGUITY
# =============================================================================
# 17. AMBIGUITY DETECTION
# =============================================================================
TRANSFORM T_DETECT_AMBIGUITY:
Q ←
Q ∪ DetectAmbiguities(I,E,A,K_H,K_S)
ambiguity classes:
LEXICAL:
same word supports multiple meanings
REFERENTIAL:
reference may map to multiple entities
SCOPE:
modifier may govern several clauses
TEMPORAL:
order or timing is unclear
NUMERIC:
threshold, unit or range is missing
MODAL:
requirement strength is unclear
OPERATIONAL:
requested action lacks execution semantics
DOMAIN:
meaning depends on unavailable domain knowledge
TERMINAL:
completion or failure condition is unclear
PRIORITY:
conflict resolution order is not declared
FOR EACH q ∈ Q:
assign:
ambiguity_id
source_units
candidate_interpretations
affected_symbols
affected_transforms
safety_impact
reversibility
blocks_execution
proceed:
T_RESOLVE_AMBIGUITY
# =============================================================================
# 18. AMBIGUITY RESOLUTION
# =============================================================================
TRANSFORM T_RESOLVE_AMBIGUITY:
H ← ∅
FOR EACH q ∈ Q:
SWITCH ambiguity_policy:
CASE REJECT_UNRESOLVED:
q.resolved ←
false
CASE DECLARED_DEFAULTS_ONLY:
IF C_D contains explicit default for q:
resolution ←
C_D.default(q)
q.resolved ←
true
q.resolution_source ←
DEFAULT_DECLARED
ELSE:
q.resolved ←
false
CASE MINIMUM_REVERSIBLE_ASSUMPTION:
candidates ←
q.candidate_interpretations
permitted_candidates ← {
c ∈ candidates |
DoesNotChangeMandatoryIntent(c)
AND
DoesNotWeakenHardConstraint(c)
AND
IntroducesNoExternalDependency(c)
AND
IsLocallyReversible(c)
}
IF cardinality(permitted_candidates) = 1:
resolution ←
only(permitted_candidates)
H.add({
assumption_id:
NewAssumptionID(),
statement:
resolution,
source_ambiguity:
q.ambiguity_id,
evidence_state:
ASSUMED_REVERSIBLE,
affected_region:
q.affected_transforms,
reversibility:
true
})
q.resolved ←
true
ELSE:
q.resolved ←
false
unresolved_blocking_ambiguity :=
exists q ∈ Q:
q.blocks_execution = true
AND
q.resolved = false
IF unresolved_blocking_ambiguity:
convergence_status ←
AMBIGUOUS
HALT before executable DSL emission
proceed:
T_BUILD_SEMANTIC_MODEL
# =============================================================================
# 19. SEMANTIC MODEL
# =============================================================================
TRANSFORM T_BUILD_SEMANTIC_MODEL:
M_N := {
objective:
SelectPrimaryObjective(I),
entities:
E,
actions:
A,
relationships:
BuildRelationships(E,A,I),
inputs:
SelectCategory(I,INPUT),
outputs:
SelectCategory(I,OUTPUT),
states:
SelectCategory(I,STATE),
hard_constraints:
K_H,
soft_constraints:
K_S,
prohibitions:
P,
priorities:
SelectCategory(I,PRIORITY),
defaults:
SelectCategory(I,DEFAULT),
termination:
SelectCategory(I,TERMINATION),
failures:
SelectCategory(I,FAILURE),
assumptions:
H,
unresolved_ambiguities:
Unresolved(Q)
}
REQUIRE:
primary objective exists
every mandatory action has actor and object
every output has producing action
every mutable entity has state representation
every hard prohibition has enforceable predicate
proceed:
T_INFER_STATE_MODEL
# =============================================================================
# 20. STATE MODEL INFERENCE
# =============================================================================
TRANSFORM T_INFER_STATE_MODEL:
S := {
immutable_input:
entities supplied but never mutated,
mutable_state:
entities changed by actions,
derived_state:
values computable from other state,
shared_state:
values visible across branches,
local_state:
values local to one execution line,
terminal_state:
values required for completion
}
FOR EACH entity e ∈ E:
IF e appears only as supplied input:
classify e:
immutable_input
ELSE IF action writes e:
classify e:
mutable_state
ELSE IF e is computed:
classify e:
derived_state
define for each state variable:
- symbol
- type
- initial value
- mutability
- scope
- update authority
- validation predicate
REQUIRE:
no mutable entity remains implicit
proceed:
T_BUILD_TRANSITION_GRAPH
# =============================================================================
# 21. TRANSITION GRAPH CONSTRUCTION
# =============================================================================
TRANSFORM T_BUILD_TRANSITION_GRAPH:
G := {
nodes:
∅,
edges:
∅
}
create nodes for:
- input ingestion
- state initialisation
- each action
- each condition
- each invariant gate
- each branch point
- each failure state
- each terminal state
- output emission
FOR EACH action a ∈ A:
node_a ←
NewActionNode(a)
node_a.preconditions ←
a.preconditions
node_a.operations ←
MapActionToOperations(a)
node_a.postconditions ←
a.postconditions
G.nodes.add(node_a)
infer edges from:
- temporal language
- conditional language
- data dependencies
- state dependencies
- explicit ordering
- termination rules
edge structure:
source_node
target_node
activation_condition
state_update
governing_constraints
REQUIRE:
exactly one entry node
at least one valid terminal node
every required action reachable
no mandatory output lacks a path
no unguarded prohibited transition exists
proceed:
T_SYNTHESISE_DSL
# =============================================================================
# 22. DSL SYNTHESIS
# =============================================================================
TRANSFORM T_SYNTHESISE_DSL:
D_candidate :=
CreateFlowDocument({
FLOW_IDENTITY:
name:
DeriveFlowName(M_N.objective)
version:
required_dsl_version
purpose:
M_N.objective
EXECUTION_CLASS:
mode:
target_execution_mode
ambiguity_policy:
ambiguity_policy
IO.READ:
M_N.inputs
IO.WRITE:
M_N.outputs
plus:
- execution_status
- validation_report when required
SYMBOLS:
declarations from E, A, K_H, K_S and S
STATE:
S
INVARIANTS:
invariant subset of K_H
CONSTRAINTS:
hard:
K_H
soft:
K_S
prohibited:
P
FUNCTIONS:
all non-primitive action definitions
TRANSFORMS:
one strict transform for each executable graph node
TERMINATION:
success:
M_N.termination
failure:
M_N.failures
resource:
derived boundedness rules
EMISSION:
output mapping
trace mapping
validation mapping
EXECUTE:
topologically ordered entry sequence
})
proceed:
T_EXPAND_ACTIONS
# =============================================================================
# 23. ACTION EXPANSION
# =============================================================================
TRANSFORM T_EXPAND_ACTIONS:
FOR EACH action a in D_candidate:
IF a.operation is primitive:
retain operation
ELSE IF a.operation has domain capability:
create explicit capability contract:
input schema
output schema
failure behaviour
permission requirement
ELSE IF a.operation can be decomposed:
replace a with ordered primitive operations
ELSE:
validation_error.add({
type:
NON_EXECUTABLE_ACTION,
action:
a,
source:
a.source_units
})
prohibit undefined verbs:
- optimise
- process
- handle
- manage
- assess
- evaluate
- improve
- generate
- calculate
unless each is defined through:
- explicit function
- explicit algorithm
- explicit capability
proceed:
T_BIND_SYMBOLS
# =============================================================================
# 24. SYMBOL BINDING
# =============================================================================
TRANSFORM T_BIND_SYMBOLS:
symbol_table ←
ExtractAllDeclarations(D_candidate)
usages ←
ExtractAllUsages(D_candidate)
FOR EACH usage u:
declaration ←
ResolveUsage(u,symbol_table)
IF declaration = none:
validation_error.add({
type:
UNRESOLVED_SYMBOL,
symbol:
u,
source_trace:
TraceToNaturalLanguage(u)
})
ELSE:
bind u:
declaration
validate:
- type compatibility
- mutability
- scope
- name uniqueness
- parameter order
- return types
- collection element types
- nullable state
proceed:
T_BUILD_REQUIREMENT_TRACE
# =============================================================================
# 25. REQUIREMENT TRACE
# =============================================================================
TRANSFORM T_BUILD_REQUIREMENT_TRACE:
requirement_trace ← ∅
FOR EACH intent unit i ∈ I:
mapped_constructs ←
FindDSLConstructsImplementing(i,D_candidate)
requirement_trace.add({
source_unit_id:
i.id,
source_text:
i.source_text,
canonical_intent:
i.canonical_form,
modality:
i.modality,
mandatory:
i.mandatory,
dsl_constructs:
IDs(mapped_constructs),
enforcement_method:
DescribeEnforcement(mapped_constructs),
coverage_status:
COVERED
if mapped_constructs != ∅
else
UNCOVERED
})
FOR EACH DSL construct d:
source_units ←
FindSourceUnitsFor(d)
IF source_units = ∅
AND d is not structurally necessary:
mark d:
UNGROUNDED
remove ungrounded constructs
or:
attach explicit necessary derivation
proceed:
T_VALIDATE_STRUCTURAL_DSL
# =============================================================================
# 26. STRUCTURAL DSL VALIDATION
# =============================================================================
TRANSFORM T_VALIDATE_STRUCTURAL_DSL:
validate D_candidate contains:
- flow identity
- IO contract
- symbols
- state
- invariants
- transforms
- termination
- output emission
- execution sequence
validate every transform contains:
- transform identifier
- trigger or activation rule
- preconditions
- explicit operations
- state updates
- postconditions
- continuation
validate every branch contains:
- branch condition
- true continuation
- false continuation or explicit drop
- merge rule when branches rejoin
validate every recursion contains:
- recursion entry
- recursive state change
- termination condition
- depth or resource bound where required
IF hard structural failure exists:
convergence_status ←
DSL_INVALID
proceed:
T_VALIDATE_SEMANTICS
# =============================================================================
# 27. SEMANTIC VALIDATION
# =============================================================================
TRANSFORM T_VALIDATE_SEMANTICS:
M_D ←
RecoverSemanticModel(D_candidate)
coverage_result :=
FOR EACH mandatory intent i ∈ M_N:
verify:
∃ d ∈ M_D:
SemanticallyImplements(d,i)
prohibition_result :=
FOR EACH prohibition p ∈ M_N.prohibitions:
verify:
EnforcedInDSL(p,D_candidate)
modality_result :=
FOR EACH source rule r:
verify:
Modality(D_candidate,r)
=
Modality(M_N,r)
output_result :=
verify every requested output has:
- producing transform
- type
- emission rule
- validation rule
semantic_validation := {
mandatory_coverage:
RatioCoveredMandatoryIntent(),
prohibition_coverage:
RatioCoveredProhibitions(),
modality_preserved:
modality_result,
output_coverage:
output_result,
ungrounded_constructs:
FindUngroundedConstructs(),
unresolved_semantics:
FindUnresolvedSemantics()
}
proceed:
T_VALIDATE_EXECUTABILITY
# =============================================================================
# 28. EXECUTABILITY VALIDATION
# =============================================================================
TRANSFORM T_VALIDATE_EXECUTABILITY:
validate:
- all inputs bind
- all symbols resolve
- all state fields initialise
- all operations are defined
- all hard conditions are decidable
- all branches have valid continuation
- all loops terminate or are bounded
- all recursive paths terminate or are bounded
- all external capabilities are declared
- all outputs are reachable
- all failure states are explicit
construct symbolic test input from IO.READ
simulate:
entry
→
state initialisation
→
each reachable transform
→
terminal states
reject:
- dead mandatory transform
- unreachable required output
- state mutation without authority
- invariant-breaking continuation
- branch without exit
- undefined operation
- hidden external dependency
proceed:
T_COMPARE_MODELS
# =============================================================================
# 29. BIDIRECTIONAL MODEL COMPARISON
# =============================================================================
TRANSFORM T_COMPARE_MODELS:
forward_coverage :=
∀ mandatory m ∈ M_N:
∃ d ∈ M_D:
d implements m
reverse_grounding :=
∀ mandatory d ∈ M_D:
∃ m ∈ M_N:
m grounds d
or
d is structurally necessary
prohibition_equivalence :=
Prohibitions(M_N)
=
Prohibitions(M_D)
output_equivalence :=
RequestedOutputs(M_N)
⊆
EmittedOutputs(M_D)
priority_equivalence :=
mandatory priorities in M_N
=
mandatory priorities in M_D
convergence_score :=
WeightedConvergence({
mandatory_coverage:
0.35,
prohibition_preservation:
0.20,
modality_preservation:
0.15,
output_coverage:
0.10,
state_coherence:
0.10,
executability:
0.10
})
REQUIRE for full convergence:
forward_coverage = true
reverse_grounding = true
prohibition_equivalence = true
output_equivalence = true
executability = true
unresolved_blocking_ambiguity = false
proceed:
T_RECURSIVE_REPAIR
# =============================================================================
# 30. RECURSIVE REPAIR
# =============================================================================
TRANSFORM T_RECURSIVE_REPAIR:
validation_cycle ←
0
WHILE validation_cycle < maximum_validation_cycles:
failure_set ←
CollectValidationFailures()
IF failure_set = ∅:
BREAK
validation_cycle ←
validation_cycle + 1
ranked_failures ←
RankFailures({
1:
semantic_loss,
2:
prohibition_loss,
3:
modality_change,
4:
unresolved_symbol,
5:
undefined_operation,
6:
state_incoherence,
7:
unreachable_output,
8:
structural_failure,
9:
trace_failure
})
FOR EACH failure f ∈ ranked_failures:
affected_source ←
TraceFailureToSource(f)
affected_dsl ←
TraceFailureToDSL(f)
repair ←
GenerateMinimumRepair(
failure = f,
source_intent = affected_source,
dsl_region = affected_dsl
)
REQUIRE repair:
- does not change mandatory source meaning
- does not weaken hard constraints
- does not introduce unsupported behaviour
- changes minimum necessary DSL region
- preserves unaffected trace links
D_candidate ←
ApplyRepair(D_candidate,repair)
rerun:
- symbol binding
- requirement trace
- structural validation
- semantic validation
- executability validation
- model comparison
proceed:
T_RESOLVE_STATUS
# =============================================================================
# 31. STATUS RESOLUTION
# =============================================================================
TRANSFORM T_RESOLVE_STATUS:
IF hard contradiction exists:
convergence_status ←
CONTRADICTORY
ELSE IF unresolved blocking ambiguity exists:
convergence_status ←
AMBIGUOUS
ELSE IF mandatory source intent is missing:
convergence_status ←
INCOMPLETE
ELSE IF domain operation remains unresolved:
convergence_status ←
DOMAIN_UNRESOLVED
ELSE IF structural or execution validation fails:
convergence_status ←
DSL_INVALID
ELSE IF semantic model comparison fails:
convergence_status ←
SEMANTIC_MISMATCH
ELSE IF:
convergence_score = 1.0
AND
all mandatory intent covered
AND
all prohibitions preserved
AND
executability = true
THEN:
convergence_status ←
CONVERGED
ELSE:
convergence_status ←
PARTIALLY_CONVERGED
proceed:
T_FINALISE_DSL
# =============================================================================
# 32. DSL FINALISATION
# =============================================================================
TRANSFORM T_FINALISE_DSL:
IF convergence_status != CONVERGED:
executable_dsl ←
null
proceed:
T_EMIT_FAILURE
D* ←
CanonicaliseDSL(D_candidate)
assign:
flow_hash:
HASH_PENDING_RUNTIME_CALCULATION
append:
provenance:
source_type:
natural_language
transformation:
natural_language_to_flow_algebra
ambiguity_policy:
ambiguity_policy
assumption_count:
cardinality(H)
unresolved_ambiguity_count:
cardinality(Unresolved(Q))
append:
semantic_equivalence_statement:
"This DSL is accepted only where its executable behaviour preserves the
mandatory intent, prohibitions and output obligations of the supplied
natural-language request."
executable_dsl ←
D*
proceed:
T_BUILD_VALIDATION_REPORT
# =============================================================================
# 33. VALIDATION REPORT
# =============================================================================
TRANSFORM T_BUILD_VALIDATION_REPORT:
validation_report := {
convergence_status:
convergence_status,
source_unit_count:
cardinality(U),
intent_unit_count:
cardinality(I),
entity_count:
cardinality(E),
action_count:
cardinality(A),
hard_constraint_count:
cardinality(K_H),
soft_constraint_count:
cardinality(K_S),
prohibition_count:
cardinality(P),
ambiguity_count:
cardinality(Q),
unresolved_ambiguity_count:
cardinality(Unresolved(Q)),
assumption_count:
cardinality(H),
mandatory_intent_coverage:
RatioCoveredMandatoryIntent(),
prohibition_coverage:
RatioCoveredProhibitions(),
symbol_closure:
SymbolClosure(D_candidate),
state_coherence:
StateCoherence(D_candidate),
transform_closure:
TransformClosure(D_candidate),
termination_closure:
TerminationClosure(D_candidate),
output_closure:
OutputClosure(D_candidate),
executability:
Executability(D_candidate),
reverse_grounding:
reverse_grounding,
convergence_score:
convergence_score,
validation_cycles:
validation_cycle
}
proceed:
T_BUILD_GUARANTEE
# =============================================================================
# 34. CONVERGENCE GUARANTEE
# =============================================================================
TRANSFORM T_BUILD_GUARANTEE:
convergence_guarantee := {
source_preserved:
true,
mandatory_intent_covered:
true,
prohibitions_preserved:
true,
modality_preserved:
true,
symbols_declared:
true,
mutable_state_explicit:
true,
operations_defined:
true,
transforms_executable:
true,
outputs_traceable:
true,
hidden_assumptions:
false,
unresolved_blocking_ambiguity:
false,
conventional_compilation_required:
false,
executable_by_reasoning_system:
true,
claim:
"The emitted domain-specific specification is a structurally executable
representation of the supplied natural-language intent. Mandatory
behaviours, prohibitions, state transitions and output obligations have
been preserved through explicit trace links."
}
proceed:
T_EMIT_SUCCESS
# =============================================================================
# 35. FAILURE EMISSION
# =============================================================================
TRANSFORM T_EMIT_FAILURE:
EMIT:
convergence_status:
convergence_status
executable_dsl:
null
normalised_intent:
I
semantic_model:
M_N
ambiguity_register:
Q
assumption_register:
H
requirement_trace:
requirement_trace
validation_report:
validation_report
convergence_guarantee: {
convergence_confirmed:
false,
executable_dsl_released:
false,
reason:
convergence_status,
unresolved_items:
CollectUnresolvedItems()
}
HALT
# =============================================================================
# 36. SUCCESS EMISSION
# =============================================================================
TRANSFORM T_EMIT_SUCCESS:
EMIT:
convergence_status:
CONVERGED
executable_dsl:
D*
normalised_intent:
I
semantic_model:
M_N
ambiguity_register:
Q
assumption_register:
H
requirement_trace:
requirement_trace
validation_report:
validation_report
convergence_guarantee:
convergence_guarantee
HALT
# =============================================================================
# 37. FORMAL CONVERGENCE MODEL
# =============================================================================
FORMAL:
N :=
supplied natural-language request
Parse(N) :=
U
Normalise(U) :=
I
Interpret(I,C_D) :=
M_N
Synthesis(M_N) :=
D_candidate
InterpretDSL(D_candidate) :=
M_D
Converged(N,D_candidate) :=
Mandatory(M_N)
⊆
Implemented(M_D)
AND
Prohibited(M_N)
=
Prohibited(M_D)
AND
Outputs(M_N)
⊆
Outputs(M_D)
AND
UngroundedMandatory(M_D)
=
∅
AND
Executable(D_candidate)
=
true
D* :=
D_candidate
only_if:
Converged(N,D_candidate)
=
true
# =============================================================================
# 38. SEMANTIC DISTANCE
# =============================================================================
SEMANTIC_DISTANCE:
define:
δ(M_N,M_D)
>=
0
where:
δ = 0
means:
complete mandatory behavioural equivalence
weighted components:
objective_loss
constraint_loss
prohibition_loss
modality_shift
state_loss
output_loss
priority_loss
ungrounded_addition
formula:
δ(M_N,M_D) :=
w_o × objective_loss
+
w_c × constraint_loss
+
w_p × prohibition_loss
+
w_m × modality_shift
+
w_s × state_loss
+
w_u × output_loss
+
w_r × priority_loss
+
w_g × ungrounded_addition
strict convergence requires:
δ(M_N,M_D)
=
0
# =============================================================================
# 39. NATURAL LANGUAGE TO DSL MAPPING
# =============================================================================
MAPPING_RULES:
noun_phrase
→
ENTITY
mutable noun phrase
→
STATE_VARIABLE
action verb
→
TRANSFORM or OPERATION
"if"
→
ACTIVATION_CONDITION
"only if"
→
NECESSARY_PRECONDITION
"unless"
→
EXCEPTION_BRANCH
"must"
→
HARD_CONSTRAINT
"must not"
→
PROHIBITION
"should"
→
SOFT_CONSTRAINT
"always"
→
INVARIANT
"before"
→
PRECEDENCE_EDGE
"after"
→
SUCCESSION_EDGE
"repeat until"
→
LOOP_WITH_TERMINATION
"for each"
→
BOUNDED_ITERATION
"return"
→
OUTPUT_EMISSION
"stop when"
→
TERMINATION_CONDITION
"otherwise"
→
ALTERNATIVE_CONTINUATION
# =============================================================================
# 40. DSL TO NATURAL LANGUAGE REVERSIBILITY
# =============================================================================
REVERSIBILITY:
Every accepted DSL construct should permit generation of a natural-language
explanation.
Explain(D*) must recover:
- what the flow receives
- what it is trying to achieve
- what state it maintains
- which rules it enforces
- how decisions are made
- what is prohibited
- when execution stops
- what it emits
reversibility condition:
Interpret(
Explain(D*)
)
≈
Interpret(D*)
reversibility supports:
- auditability
- human review
- collaborative correction
- cross-model portability
- semantic maintenance
# =============================================================================
# 41. CONVERGENCE LAYERS
# =============================================================================
CONVERGENCE_LAYERS:
LAYER_1_LEXICAL:
natural words map to canonical symbols
LAYER_2_SEMANTIC:
clauses map to entities, actions and constraints
LAYER_3_STRUCTURAL:
semantic units map to state, transforms and graph edges
LAYER_4_EXECUTABLE:
every operation becomes formally actionable
LAYER_5_VALIDATED:
invariants, outputs and termination become enforceable
LAYER_6_REVERSIBLE:
DSL meaning can be explained back to a human
full convergence requires:
all six layers complete
# =============================================================================
# 42. DSL CONVERGENCE PREDICATE
# =============================================================================
PREDICATE DSL_CONVERGED(N,D*):
DSL_CONVERGED :=
SOURCE_COVERAGE(N,D*)
AND
MANDATORY_INTENT_PRESERVED(N,D*)
AND
PROHIBITIONS_PRESERVED(N,D*)
AND
MODALITY_PRESERVED(N,D*)
AND
SYMBOL_CLOSED(D*)
AND
STATE_CLOSED(D*)
AND
TRANSFORM_CLOSED(D*)
AND
TERMINATION_CLOSED(D*)
AND
OUTPUT_CLOSED(D*)
AND
EXECUTABLE(D*)
AND
TRACEABLE(D*,N)
AND
NO_BLOCKING_AMBIGUITY(N)
AND
NO_HIDDEN_SEMANTICS(D*)
# =============================================================================
# 43. NATURAL-LANGUAGE EXECUTABILITY
# =============================================================================
NATURAL_LANGUAGE_EXECUTABILITY:
natural language alone is executable only when:
- entities are sufficiently resolved
- actions are operationally defined
- constraints are explicit
- ambiguity does not affect mandatory behaviour
- state can be inferred without invention
- termination is identifiable
- outputs are identifiable
otherwise:
natural language is an intent source
but not yet a complete executable specification
# =============================================================================
# 44. DSL FLEXIBILITY MODEL
# =============================================================================
DSL_FLEXIBILITY:
The target DSL must remain formal enough to execute but expressive enough to
preserve natural-language intent.
excessive rigidity causes:
- semantic loss
- unnatural fragmentation
- inability to express exceptions
- hidden assumptions introduced during compression
excessive looseness causes:
- ambiguity
- non-repeatability
- undefined transitions
- model-dependent behaviour
convergence requires:
maximum semantic expressiveness
subject to:
minimum executable ambiguity
# =============================================================================
# 45. HUMAN–AI COLLABORATION MODEL
# =============================================================================
COLLABORATION:
human contribution:
- objective
- domain intent
- ethical boundaries
- priorities
- examples
- exceptions
- corrections
AI contribution:
- segmentation
- semantic normalisation
- entity resolution
- symbol construction
- state modelling
- constraint extraction
- graph synthesis
- executability validation
- trace generation
resulting artefact:
neither ordinary prose
nor conventional source code
but:
executable shared semantic structure
# =============================================================================
# 46. ARCHITECTURAL CONSEQUENCES
# =============================================================================
ARCHITECTURAL_MODEL:
conventional architecture:
user requirement
→
analyst interpretation
→
technical specification
→
programmer interpretation
→
source code
→
compiler
→
executable system
converged architecture:
user intent
→
semantic normalisation
→
constrained DSL
→
direct reasoning execution
removed translation boundaries:
- prose-to-specification handoff
- specification-to-code handoff
- code-to-binary semantic dependency
retained validation boundaries:
- ambiguity validation
- constraint validation
- state validation
- transform validation
- output validation
# =============================================================================
# 47. FAILURE MODEL
# =============================================================================
FAILURE_CLASSES:
SOURCE_INCOMPLETE:
mandatory objective, input or output missing
SOURCE_CONTRADICTORY:
mandatory clauses cannot coexist
SOURCE_AMBIGUOUS:
several interpretations alter mandatory behaviour
DOMAIN_UNAVAILABLE:
action requires unknown domain semantics
ENTITY_UNRESOLVED:
reference cannot be bound
OPERATION_UNRESOLVED:
action cannot be executed
CONSTRAINT_UNENFORCEABLE:
requirement cannot be represented structurally
STATE_INCOMPLETE:
mutable behaviour lacks explicit state
DSL_STRUCTURALLY_INVALID:
required section or continuation missing
DSL_SEMANTICALLY_INVALID:
generated behaviour differs from source intent
OUTPUT_UNREACHABLE:
required output has no producing path
TRACE_INCOMPLETE:
source-to-DSL mapping is missing
# =============================================================================
# 48. SECURITY AND AUTHORITY
# =============================================================================
SECURITY:
natural-language requests must not automatically grant authority.
explicit authority required for:
- external communication
- financial transaction
- file mutation
- database mutation
- account modification
- physical-device control
- personal-data disclosure
- irreversible action
DSL generation must separate:
requested behaviour
from
authorised behaviour
unauthorised requested action:
must appear as:
blocked transform
or:
unresolved permission requirement
# =============================================================================
# 49. CROSS-MODEL PORTABILITY
# =============================================================================
PORTABILITY:
D* is portable when another compatible reasoning system can recover:
- the same mandatory intent
- the same constraints
- the same state transitions
- the same prohibited behaviours
- the same terminal output class
portability does not require:
- identical wording
- identical internal reasoning
- identical token sequence
portability requires:
behavioural equivalence under declared constraints
# =============================================================================
# 50. UPDATE MODEL
# =============================================================================
UPDATE_MODEL:
when natural-language request changes:
N_t
→
N_{t+1}
compute:
ΔN :=
Difference(N_t,N_{t+1})
identify:
affected intent units
affected entities
affected constraints
affected transforms
affected outputs
update only affected DSL regions
preserve:
unaffected symbols
unaffected transforms
unaffected trace links
unaffected validation results
rerun:
- contradiction detection
- ambiguity detection
- state modelling
- structural validation
- semantic comparison
- executability validation
accept update only_if:
DSL_CONVERGED(N_{t+1},D*_{t+1})
=
true
# =============================================================================
# 51. EXECUTION GUARANTEE
# =============================================================================
EXECUTION_GUARANTEE:
This flow guarantees that natural-language intent is not treated as
executable merely because an AI can produce a plausible continuation.
The request must first be transformed into:
- explicit entities
- explicit state
- explicit actions
- explicit constraints
- explicit prohibitions
- explicit branches
- explicit termination
- explicit outputs
The resulting DSL may be emitted only when:
- mandatory source intent is covered
- hard constraints are enforceable
- prohibitions are preserved
- ambiguity affecting execution is resolved
- symbols are closed
- operations are defined
- state mutations are explicit
- terminal states are reachable
- outputs are traceable
- semantic equivalence is validated
Natural language supplies human intent.
The DSL supplies executable structure.
Convergence is the point at which both representations describe the same
permitted behaviour.
# =============================================================================
# 52. APPROVAL
# =============================================================================
APPROVAL:
natural_language_ingestion:
approved
semantic_normalisation:
approved
entity_resolution:
approved
constraint_extraction:
approved
ambiguity_visibility:
approved
modality_preservation:
approved
state_model_generation:
approved
transition_graph_generation:
approved
executable_dsl_synthesis:
approved
bidirectional_traceability:
approved
semantic_equivalence_validation:
approved
compilerless_execution:
approved
hidden_semantic_invention:
rejected
silent_ambiguity_resolution:
rejected
pseudocode_substitution:
rejected
# =============================================================================
# 53. EXECUTE
# =============================================================================
EXECUTE:
T_INGEST_SOURCE
T_SEGMENT_UTTERANCES
T_CLASSIFY_UTTERANCES
T_NORMALISE_INTENT
T_RESOLVE_ENTITIES
T_RESOLVE_ACTIONS
T_EXTRACT_CONSTRAINTS
T_DETECT_CONTRADICTIONS
T_DETECT_AMBIGUITY
T_RESOLVE_AMBIGUITY
T_BUILD_SEMANTIC_MODEL
T_INFER_STATE_MODEL
T_BUILD_TRANSITION_GRAPH
T_SYNTHESISE_DSL
T_EXPAND_ACTIONS
T_BIND_SYMBOLS
T_BUILD_REQUIREMENT_TRACE
T_VALIDATE_STRUCTURAL_DSL
T_VALIDATE_SEMANTICS
T_VALIDATE_EXECUTABILITY
T_COMPARE_MODELS
T_RECURSIVE_REPAIR
T_RESOLVE_STATUS
T_FINALISE_DSL
T_BUILD_VALIDATION_REPORT
T_BUILD_GUARANTEE
T_EMIT_SUCCESS
# =============================================================================
# END FLOW
# =============================================================================
```
Download Code
Copy to Clipboard