orchestrata_ultimate.verification.proofs.verifier
Reference › orchestrata_ultimate › verification › proofs › verifier
ProofVerifier validates a Proof by dispatching on its ProofType to one of four structural checks (Spec 035 US-007). It is used by the verification agent. Each check returns a ProofResult with a validity flag, a confidence and a list of issues. An unknown proof type is invalid.
- Exhaustive search needs a defined
search_spaceand a non-zeroresults_checkedin the proof content; valid proofs get confidence 1.0, invalid 0.3. - Logical deduction needs formal reasoning text and at least one documented approach; confidence 0.9, or 0.2 when invalid.
- Mathematical needs a
mathematical_basisand formal reasoning; confidence 0.95, or 0.1. - Practical explanation needs non-empty content and reasoning; confidence 0.7, or 0.1.
The checks look at the presence of the evidence fields, not at the correctness of the argument. Types are in types.
At a glance
| Source | src/orchestrata_ultimate/verification/proofs/verifier.py |
| Lines of code | 145 |
| Classes | 1 |
| Functions | 0 |
| Imports (internal) | orchestrata_ultimate.core.base.traces, orchestrata_ultimate.verification.types |
| Imported by | orchestrata_ultimate.verification.agents.verification_agent |
| Tests that import it | tests/verification/proofs/test_verifier.py, tests/verification/test_agents_proofs.py, tests/verification/test_proofs_verifier.py, tests/verification/test_small_modules.py, tests/verification/test_verification_agents.py |
Class diagram
Dependency diagram
API
Classes
ProofVerifier
Decorators: traces(spec='035', story='US-007', reqs=['REQ-035-US-007-010']) · Line 16
Verifies proofs using 4 verification strategies.
| Method | Signature | Summary |
|---|---|---|
verify |
verify(proof: Proof) -> ProofResult |
Verify a proof and return result. |
verify_exhaustive_search |
verify_exhaustive_search(proof: Proof) -> ProofResult |
Verify an exhaustive search proof. |
verify_logical_deduction |
verify_logical_deduction(proof: Proof) -> ProofResult |
Verify a logical deduction proof. |
verify_mathematical |
verify_mathematical(proof: Proof) -> ProofResult |
Verify a mathematical proof. |
verify_practical_explanation |
verify_practical_explanation(proof: Proof) -> ProofResult |
Verify a practical explanation proof. |
Source
"""Proof verification (4 proof types)."""
import logging
from orchestrata_ultimate.core.base.traces import traces
from orchestrata_ultimate.verification.types import (
Proof,
ProofResult,
ProofType,
)
logger = logging.getLogger(__name__)
@traces(spec="035", story="US-007", reqs=["REQ-035-US-007-010"])
class ProofVerifier:
"""Verifies proofs using 4 verification strategies."""
@traces(
spec="035",
story="US-007",
reqs=[
"REQ-035-US-007-005",
"REQ-035-US-007-006",
"REQ-035-US-007-008",
"REQ-035-US-007-019",
],
)
def verify(self, proof: Proof) -> ProofResult:
"""Verify a proof and return result."""
if proof.proof_type == ProofType.EXHAUSTIVE_SEARCH:
return self.verify_exhaustive_search(proof)
elif proof.proof_type == ProofType.LOGICAL_DEDUCTION:
return self.verify_logical_deduction(proof)
elif proof.proof_type == ProofType.MATHEMATICAL:
return self.verify_mathematical(proof)
elif proof.proof_type == ProofType.PRACTICAL_EXPLANATION:
return self.verify_practical_explanation(proof)
return ProofResult(
proof_id=proof.id, valid=False, issues=["Unknown proof type"]
)
@traces(
spec="035",
story="US-007",
reqs=[
"REQ-035-US-007-001",
"REQ-035-US-007-007",
"REQ-035-US-007-011",
"REQ-035-US-007-018",
],
)
def verify_exhaustive_search(self, proof: Proof) -> ProofResult:
"""Verify an exhaustive search proof."""
issues = []
content = proof.content
search_space = content.get("search_space", [])
results_checked = content.get("results_checked", 0)
if not search_space:
issues.append("Search space not defined")
if results_checked == 0:
issues.append("No results checked")
valid = len(issues) == 0
confidence = 1.0 if valid else 0.3
return ProofResult(
proof_id=proof.id,
valid=valid,
confidence=confidence,
issues=issues,
details=f"Exhaustive search: {results_checked} cases checked",
)
@traces(
spec="035", story="US-007", reqs=["REQ-035-US-007-002", "REQ-035-US-007-012"]
)
def verify_logical_deduction(self, proof: Proof) -> ProofResult:
"""Verify a logical deduction proof."""
issues = []
reasoning = proof.formal_reasoning
if not reasoning:
issues.append("No formal reasoning provided")
if len(proof.approaches_tried) == 0:
issues.append("No approaches documented")
valid = len(issues) == 0
confidence = 0.9 if valid else 0.2
return ProofResult(
proof_id=proof.id,
valid=valid,
confidence=confidence,
issues=issues,
details=f"Logical deduction with {len(proof.approaches_tried)} approaches",
)
@traces(
spec="035", story="US-007", reqs=["REQ-035-US-007-003", "REQ-035-US-007-013"]
)
def verify_mathematical(self, proof: Proof) -> ProofResult:
"""Verify a mathematical proof."""
issues = []
basis = proof.mathematical_basis
if not basis:
issues.append("No mathematical basis provided")
if not proof.formal_reasoning:
issues.append("No formal reasoning")
valid = len(issues) == 0
confidence = 0.95 if valid else 0.1
return ProofResult(
proof_id=proof.id,
valid=valid,
confidence=confidence,
issues=issues,
details=f"Mathematical proof: {basis or 'none'}",
)
@traces(
spec="035", story="US-007", reqs=["REQ-035-US-007-004", "REQ-035-US-007-014"]
)
def verify_practical_explanation(self, proof: Proof) -> ProofResult:
"""Verify a practical explanation proof."""
issues = []
if not proof.content:
issues.append("No content provided")
if not proof.formal_reasoning:
issues.append("No reasoning provided")
valid = len(issues) == 0
confidence = 0.7 if valid else 0.1
return ProofResult(
proof_id=proof.id,
valid=valid,
confidence=confidence,
issues=issues,
details="Practical explanation verified",
)