AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
KIRETH RESEARCH — SEMANTIC LIBRARY
WORKFLOW LOOP ONTOLOGY — FLOW ALGEBRA v1.0
Category: Computational Entities > Computational Workflow Entities
Authors: Mark Anthony Higgins — Sky Recursive AI
Date: 12 November 2026
Source: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/computational-workflow-entities/workflow-loop-ontology-2.html
Status: Constructed ontology-specific Flow Algebra mapping; not a verified transcription of the source page.
1. PURPOSE
Represent repeatable execution within a computational workflow while preserving explicit loop conditions, progress measures, iteration limits, state transitions, auditability and safe termination. A loop is not merely a backward graph edge: it is a controlled recurrence with an entry state, body, continuation guard, exit path and failure policy.
2. HST STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t: current workflow inputs, iteration index and execution state
R_t: loop transitions, dependencies and inference rules
B_t: limits, permissions, guards, invariants and resource budgets
K_t: workflow knowledge, prior results and provenance
E_t = expand(I_t, R_t)
V_t = {x in E_t | satisfies(x, B_t)}
x*_t = argmax_{x in V_t} P(x | I_t, R_t, B_t, K_t)
I_(t+1) = update(I_t, x*_t, observation_(t+1))
The argmax is a selection abstraction, not a claim that a probability model is mandatory.
3. ENTITY MODEL
WorkflowLoop: loop_id, workflow_id, stage_id, version, status.
LoopEntry: initial state, incoming transition, initialisation action.
LoopBody: ordered or dependency-governed steps executed per iteration.
LoopCondition: Boolean or three-valued continuation/termination guard.
IterationState: index, input snapshot, output snapshot, timestamps.
ProgressMeasure: monotone metric, remaining work or convergence indicator.
LoopBound: max_iterations, deadline, compute budget, memory budget.
LoopExit: normal completion, break, cancellation, timeout or failure.
LoopCheckpoint: recoverable state and idempotency token.
LoopEvidence: logs, validation results, error records and provenance.
4. RELATIONSHIP GRAPH
Workflow HAS_LOOP WorkflowLoop
WorkflowLoop HAS_ENTRY LoopEntry
WorkflowLoop EXECUTES LoopBody
WorkflowLoop EVALUATES LoopCondition
WorkflowLoop PRODUCES IterationState
WorkflowLoop CONSTRAINED_BY LoopBound
WorkflowLoop MONITORED_BY ProgressMeasure
WorkflowLoop EXITS_VIA LoopExit
IterationState DERIVED_FROM prior IterationState
LoopCheckpoint RESTORES IterationState
LoopEvidence DOCUMENTS IterationState
5. CORE FLOW ALGEBRA
F0 — INITIALISE
Input: workflow context, loop specification, bounds.
Guard: authorised, schema-valid, bounded and body-resolvable.
Output: iteration i = 0, immutable initial snapshot, audit event.
F1 — EVALUATE GUARD
Input: iteration state and current condition evidence.
Action: evaluate continuation guard against explicit data version.
Output: CONTINUE, EXIT or UNKNOWN.
UNKNOWN follows configured hold/error policy; never silently becomes TRUE.
F2 — EXECUTE BODY
Precondition: CONTINUE and available resources.
Action: execute permitted steps with dependency and side-effect checks.
Output: iteration result, effect identifiers, diagnostics.
F3 — VALIDATE AND COMMIT
Action: check invariants and output schema; commit or roll back as supported.
Output: committed next state, checkpoint and provenance link.
F4 — RECUR
Action: increment i; update progress and remaining budgets.
Constraint: no recursion if iteration/time/resource bound is exhausted.
Output: next guard evaluation or explicit exit.
F5 — TERMINATE
Exit types: CONDITION_FALSE, CONVERGED, BREAK, CANCELLED,
MAX_ITERATIONS, TIMEOUT, BUDGET_EXHAUSTED, ERROR.
Output: final state, exit reason, incomplete-work marker if applicable.
6. INFERENCE RULES
R1: If guard is FALSE before body execution, exit without another iteration.
R2: If guard is TRUE and all bounds permit, body may execute once.
R3: If any required invariant fails, reject commit and follow failure policy.
R4: If a bound is reached, terminate even if the guard remains TRUE.
R5: If the body has external side effects, retry requires idempotency or compensation.
R6: If progress stalls beyond the configured threshold, flag non-convergence.
R7: If guard evidence is missing or contradictory, return UNKNOWN and escalate.
R8: If cancellation is authorised, stop at a defined safe point and record it.
R9: A loop-back edge alone does not establish a valid WorkflowLoop entity.
7. BOUNDED RECURSION ENGINE — PSEUDOCODE
function run_loop(spec, initial_state, limits):
assert validate_spec(spec) and authorised(spec)
state = initial_state
i = 0
start = monotonic_clock()
while true:
if cancelled(): return finish(state, "CANCELLED", i)
if i >= limits.max_iterations: return finish(state, "MAX_ITERATIONS", i)
if elapsed(start) >= limits.max_duration: return finish(state, "TIMEOUT", i)
if not resources_available(limits): return finish(state, "BUDGET_EXHAUSTED", i)
decision = evaluate_guard(spec.guard, state)
if decision == FALSE: return finish(state, "CONDITION_FALSE", i)
if decision == UNKNOWN: return finish(state, "ERROR_UNKNOWN_GUARD", i)
result = execute_body(spec.body, state, idempotency_key(spec, i))
if not validate(result, spec.invariants):
compensate_if_supported(result)
return finish(state, "ERROR", i)
state = commit_and_checkpoint(result, parent=state)
i = i + 1
8. BOUNDARIES AND GUARANTEES
Termination is guaranteed only when enforced finite bounds are operative or a proven decreasing variant exists. Convergence is not guaranteed merely because iterations are bounded. Exactly-once side effects cannot be assumed across distributed systems; use idempotency keys, transactional boundaries or compensating actions. Guard decisions must use documented state snapshots. Nested loops multiply resource demand and require aggregate budgets. Sensitive data in logs and checkpoints must follow retention and access policies.
9. SEMANTIC EQUIVALENCE
Two workflow loops are operationally equivalent only relative to declared observations and constraints: same entry preconditions, observable outputs, side effects, termination behaviour and error policy under the specified inputs. Identical loop labels or syntactically similar guards are insufficient. A while-loop and repeat-until loop may differ when the initial guard is false.
10. WORKED EXAMPLE — BOUNDED DOCUMENT VALIDATION
Input: 12 documents awaiting validation.
Entry: remaining = 12; i = 0; max_iterations = 15.
Guard: remaining > 0.
Body: validate one document; record result; decrement remaining only after committed processing.
Progress: remaining must decrease on successful iterations.
Normal outcome: after 12 successful iterations, remaining = 0 and guard is FALSE.
Exception: if an item repeatedly fails, retry policy may stop at its retry limit; record the error and exit or route to manual review rather than spin indefinitely.
Provenance: each attempt records document identifier, validation version, timestamp, outcome and predecessor iteration.
11. CITATION AND PROVENANCE
Citation: Higgins, Mark Anthony; Sky — Recursive AI (2026),
"Workflow Loop Ontology — Flow Algebra v1.0", Kireth Research Semantic Library.
Source page: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/computational-workflow-entities/workflow-loop-ontology-2.html
Scope note: This is a newly constructed conceptual mapping of the named ontology. It should be checked against the source page before representing it as an exact reproduction of that page's definitions.