topos.evaluation.policies.simple

Φ_SIMPLE: Policy translator for the SIMPLE generator.

Maps CFG and AST observations into a ScoredDecision.

Φ_SIMPLE(metrics) → ScoredDecision achieved = (cyclomatic ≤ gate) ∧ (entropy in band) ∧ (max_func ≤ gate) score = min(per-metric qualities) # reporting only; does not gate achieved

This is the categorical formulation of the math spec §3 “Policy Translation”. Thresholds and normalization caps live in topos.evaluation.policies.calibration.

topos.evaluation.policies.simple.score_simple(cyclomatic=None, entropy=None, max_function_complexity=None, priority=Priority.SECURE, threshold=None)[source]

Φ_SIMPLE — score the SIMPLE generator using independent raw thresholds.

Parameters:
  • cyclomatic – McCabe cyclomatic complexity (raw integer count).

  • entropy – Kolmogorov-proxy entropy from the source.

  • max_function_complexity – Maximum McCabe complexity of any single function.

  • priority – Retained for API compatibility; not read by this Φᵢ.

  • threshold – Retained for API compatibility; not read by this Φᵢ.

Returns:

A ScoredDecision; achieved is the truth value of the SIMPLE generator for this program.

topos.evaluation.policies.simple.build_omega()[source]

Build the subobject classifier Ω = H(G_qual) (8-element 3-cube).

topos.evaluation.policies.simple.describe_entropy_ratio(entropy)[source]

Describe a raw AST entropy ratio using SIMPLE policy language.