SEMANTIC LIBRARY — FUNCTION ONTOLOGY
FLOW ALGEBRA v1.0 | Programming Entities
AUTHORS: Mark Anthony Higgins — Sky Recursive AI
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/programming-entities/function-ontology-4.html
SOURCE CREDIT: © Mark Anthony Higgins; page revised 03 August 2026.
STATUS: Constructed ontology-specific Flow Algebra mapping. The page's complete embedded formal specification was not available in the accessible text; this is not a verbatim extraction.
PURPOSE
Represent a programming function as a callable computational entity with a signature, parameters, body, environment, invocation, result, effects, and explicit execution constraints.
STATE_MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t: inputs, arguments, current call context and machine state
R_t: function declarations, language semantics, type rules and evaluation relations
B_t: execution limits, preconditions, permissions, resource bounds and effect policy
K_t: known symbols, bindings, types, dependencies and prior validated results
ENTITY_GRAPH
Function --hasSignature--> Signature
Function --declaresParameter--> Parameter
Function --hasBody--> ExpressionOrStatementSequence
Function --captures--> LexicalEnvironment [where applicable]
Function --returns--> ReturnValue [if execution returns normally]
Function --mayProduce--> SideEffect
Invocation --targets--> Function
Invocation --supplies--> Argument
Invocation --creates--> CallFrame
CallFrame --binds--> Parameter
CallFrame --resolvesSymbolIn--> Environment
Function --dependsOn--> FunctionOrModule
FORMAL_FLOW
E_t = expand(I_t, R_t)
V_t = {x in E_t | satisfies(x, B_t) and wellTyped(x, R_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)
Note: The argmax expression is a reasoning/selection abstraction; deterministic function execution follows the language's specified operational semantics instead.
FUNCTION_INVOCATION
invoke(f, args, env, state) -> outcome
1. Resolve f and verify callable identity.
2. Check arity, argument evaluation order and type/contract constraints according to the language.
3. Bind evaluated arguments to parameters; initialise local scope or frame.
4. Evaluate the body using the applicable operational semantics.
5. Return one of: Normal(value, state'), Error(reason, state'), or Divergence.
6. Release call-local resources according to runtime semantics; preserve reachable closures and authorised effects.
INFERENCE_RULES
R1: callable(f) AND compatible(args, signature(f)) -> invocationPermitted(f,args), subject to B_t.
R2: precondition(f,args) AND terminates(f,args) AND postcondition(f,args,result) -> contractSatisfied(f,args,result).
R3: pure(f) AND equalInputs(a,b) AND sameRelevantEnvironment(a,b) -> equalOutputs(f(a),f(b)).
R4: modifies(f,resource) -> requiresPermission(f,resource).
R5: recursive(f) AND wellFoundedDecrease(f,measure) AND validBaseCases(f) -> terminationProvable(f), subject to proof assumptions.
R6: unresolvedDependency(f) OR invalidArgument(f) -> rejectOrRaiseAccordingToSemantics.
MINI_RECURSION_ENGINE
RECURSE(call, depth, visited):
Validate signature, preconditions, available resources and depth budget.
If base case holds, evaluate and return base result.
Otherwise construct permitted subcalls and evaluate them according to language semantics.
Combine returned results and validate postconditions.
If budget exhausted, report bounded-execution failure rather than claiming termination.
EXECUTION_PATHWAYS
Definition -> Registration/Binding -> Invocation -> Argument Evaluation -> Frame Creation -> Body Evaluation -> Return/Error -> Cleanup
Pure function: inputs -> deterministic transformation (under fixed semantics/environment) -> result
Effectful function: inputs + external state -> computation -> result + authorised state changes
Recursive function: invocation -> base-case test -> subcalls -> combination -> result
BOUNDARIES_AND_GUARANTEES
- A function need not be pure, deterministic, total or terminating.
- A return value may be absent in languages supporting procedures or non-returning calls.
- Static type validity does not imply runtime safety or termination.
- A recursive call is not automatically guaranteed to terminate.
- Exceptions, asynchronous functions, generators and closures require language-specific rules.
- Guarantees hold only when preconditions and runtime assumptions are met.
VALIDATION
Check: callable identity, signature compatibility, parameter binding, lexical scope, effect permissions, output contract, exception behaviour and termination assumptions.
TRI_MAPPING
Entity: Function and Invocation
Relation: hasParameter / calls / returns / dependsOn / modifies
Behaviour: validate -> bind -> execute -> observe outcome -> update state
CITATION
Mark Anthony Higgins and Sky Recursive AI, 'Function Ontology — Flow Algebra v1.0', Semantic Library, constructed mapping based on the cited Function Ontology page.
Download Code
Copy to Clipboard