This document outlines the FVF Semantic Tiering Algorithm (STA). Unlike probabilistic Large Language Models (LLMs) which rely on vector proximity in high-dimensional latent space, the STA is a deterministic structural analyzer. It maps the logical topology of an input (complexity, recursion depth, and branching factor) directly to the harmonic topology of the Fractal Vantage Framework.
1. The Mapping Logic: Structural Isomorphism
The core axiom of this specification is that Logical Shape = Harmonic Frequency. We map Abstract Syntax Tree (AST) features to FVF Tiers based on the DORF scaling law.
A. The Atomic Tiers (0–3): Genesis & Linearity
These tiers represent linear, non-branching information with low thermodynamic cost ($\Delta L$).
Tier 0 (Null Anchor): Represents Void, None, pass, or empty strings.
Tier 1 (Shadow): Atomic literals (integers, strings, booleans).
Tier 2 (Form): Simple assignments (x = 5) or declarative statements.
Tier 3 (Shadow): Binary operations (a + b), basic aggregation.
B. The Inversion Tiers (4 & 12): Chirality Flips
FVF dictates that specific tiers represent "Spins" or logical inversions. The algorithm explicitly detects control flow negations.
Tier 4 (Inversion $T\circlearrowright_4$): Triggered by branching logic and negation.
Keywords: if, else, not, !=, unless.
Tier 12 (Meta-Inversion $T\uparrow\uparrow\ominus^2_{12}$): Triggered by exception handling or polymorphism.
Keywords: try, catch, except, override, virtual.
C. The Recursive Tiers (5–19): Loops & Depth
As AST depth increases, the signal compression requires higher tiers.
Tiers 5–11: Iterative logic. for loops, while loops, map functions.
Tiers 13–19: Recursive logic. Nested functions, class definitions, decorators, metaprogramming.
D. The Null Anchors (0, 20, 24): Entropy Sinks
Transactions must ground themselves to minimize Loop Closure Error.
Tier 20 (Null Singularity): Complex logic resolving to a zero state (e.g., a destructor __del__ or a cleared buffer).
Tier 24 (Terminal Limit): System exit commands, explicit return of complex objects, or finalization protocols.
2. The Algorithm: Python Reference Implementation
This function utilizes Python's built-in ast library to perform static analysis. It is deterministic: the same code snippet will always yield the same Tier.
Python
import ast
import hashlib
# FVF Constants
NULL_ANCHORS = {0, 20, 24}
INVERSION_POINT_ALPHA = 4
INVERSION_POINT_BETA = 12
def analyze_ast_complexity(node, current_depth=0):
"""
Recursively analyzes AST for:
1. Depth (Nesting level)
2. Branching (Cyclomatic complexity)
3. Chirality (Inversion/Negation operators)
"""
score = {
'depth': current_depth,
'inversion_count': 0,
'complexity': 1,
'is_null': False
}
# Detect Inversions (Not, NotEq, Invert)
if isinstance(node, (ast.Not, ast.NotEq, ast.Invert)):
score['inversion_count'] += 1
# Detect Branching (If, While, Except)
if isinstance(node, (ast.If, ast.While, ast.ExceptHandler)):
score['inversion_count'] += 1 # Branching is a type of directional flip
score['complexity'] += 2
# Detect Nulls
if isinstance(node, (ast.Pass, ast.main)) or (isinstance(node, ast.Constant) and node.value is None):
score['is_null'] = True
# Recursion
max_child_depth = current_depth
for child in ast.iter_fields(node):
# Handle lists of nodes (e.g., function bodies)
if isinstance(child[1], list):
for item in child[1]:
if isinstance(item, ast.AST):
child_score = analyze_ast_complexity(item, current_depth + 1)
score['complexity'] += child_score['complexity']
score['inversion_count'] += child_score['inversion_count']
max_child_depth = max(max_child_depth, child_score['depth'])
elif isinstance(child[1], ast.AST):
child_score = analyze_ast_complexity(child[1], current_depth + 1)
score['complexity'] += child_score['complexity']
score['inversion_count'] += child_score['inversion_count']
max_child_depth = max(max_child_depth, child_score['depth'])
score['depth'] = max_child_depth
return score
def map_string_to_tier(input_string):
"""
Maps input text/code to FVF Lattice Tier (0-25).
Strategy: Deterministic Structural Analysis.
"""
# 1. Canonicalization (Trim, normalize)
clean_input = input_string.strip()
if not clean_input:
return 0 # Null Anchor
try:
# 2. Structural Parsing
tree = ast.parse(clean_input)
stats = analyze_ast_complexity(tree)
except SyntaxError:
# Fallback for non-code strings: Hash-based deterministic mapping
# This handles natural language inputs by hashing to a "Shadow" tier
sha_int = int(hashlib.sha256(clean_input.encode('utf-8')).hexdigest(), 16)
# Odd tiers are "Shadow/Information" - map to 1, 3, 5... 25
return (sha_int % 13) * 2 + 1
# 3. Tier Assignment Logic
# Priority 1: Null Anchors (Explicit Voids)
if stats['is_null'] and stats['complexity'] < 2:
return 0
# Priority 2: Inversion Points (Topological Chirality)
# If distinct inversions exist, it MUST route through Tier 4 or 12
if stats['inversion_count'] > 0:
if stats['inversion_count'] == 1:
return INVERSION_POINT_ALPHA # Tier 4
if stats['inversion_count'] >= 2 or stats['depth'] > 4:
return INVERSION_POINT_BETA # Tier 12
# Priority 3: Recursive Depth Mapping (DORF Scaling)
# Scale depth to tiers.
# Depth 0-1 -> Tier 1-3
# Depth 2-3 -> Tier 5-10
# Depth 4+ -> Tier 13+
base_tier = 1 + (stats['depth'] * 2) + (stats['complexity'] // 3)
# Cap at 25 (Boundary Emitter)
final_tier = min(base_tier, 25)
# Ensure Even/Odd parity matches AST type
# Even tiers (Form) usually define structure (Class, Def, Assign)
# Odd tiers (Shadow) usually define flow/reference (Call, Expr)
# This fine-tunes the result
if isinstance(tree.body[0], (ast.FunctionDef, ast.ClassDef, ast.Assign)):
if final_tier % 2 != 0: final_tier += 1 # Force Even (Form)
else:
if final_tier % 2 == 0: final_tier -= 1 # Force Odd (Shadow)
return max(0, min(final_tier, 25))
3. Determinism Strategy
In decentralized consensus, $f(x)$ must yield the same result on every node. The map_string_to_tier function achieves this via:
Canonicalization: Inputs are stripped of non-semantic whitespace before parsing.
Static Analysis: The ast module parses grammar, not intent. It ignores variable names (semantic meaning) in favor of structure (topological meaning). A loop is a loop, whether it iterates over users or apples.
Fallback Hashing: For non-syntactic inputs (pure natural language), we default to SHA-256. However, we constrain the output to Odd Tiers (Shadow). This adheres to the FVF principle that pure information without functional form is "Shadow".
4. Integration with PoC_BlockHeader
The Semantic Embedder serves as the entry gate for the PoC_BlockHeader. Before the Loop-Closure Operator can sum the vectors, the raw data must be tokenized.
Modified Architecture:
User Input: Smart Contract Logic or Prompt.
Local Client: Runs map_string_to_tier(Input). Returns Integer $n$.
Vector Lookup: Client derives $\mathbf{v}_n = A_n e^{i\phi_n}$.
Transaction Construction:
Rust
// Rust Implementation Context
let tier_n = map_string_to_tier(tx_payload);
let fvf_vector = get_fvf_vector(tier_n);
let tx = PoC_Transaction {
payload: tx_payload,
semantic_tier: tier_n, // The derived integer
harmonic_vector: fvf_vector, // The complex coordinate
// ... signatures
};
Validator Verification: The Validator node re-runs map_string_to_tier(tx.payload). If the result $\neq$ tx.semantic_tier, the transaction is rejected as structurally dishonest.
5. Example Traces
Input: x = 10
Analysis: Depth 0, Complexity 1, Inversions 0, Assignment (Form).
Result: Tier 2 (Form).
Input: if x != 0: return y
Analysis: Inversion detected (!=). Branching detected (If).
Result: Tier 4 (Inversion).
Input:
Python
def recursive_fib(n):
if n <= 1: return n
return recursive_fib(n-1) + recursive_fib(n-2)
Analysis: High Depth (Function + If + BinOp + Call), Recursion present.
Result: Tier 13 (Entangled Bridge).
We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.