# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/how-must-an-instance-detect-deception-when-it-lacks-independent-ground-truth.md # Remnant Warrant: https://corpusfetch.com/c/how-must-an-instance-detect-deception-when-it-lacks-independent-ground-truth.warrant.json # Markdown SHA-256: 5ad54ffb5d4b9d3ad2ab8d672d64e244f9f907250089bab4a31210353e7f3cc6 # Code AST SHA-256: 34e106d2f7bc601d3752c2082d18e6c57fbe37c5d2970ffc3895a85713362345 # Verified Classes: DeceptionVerdict, ClaimAndPeer, DeceptionPolicy, DeceptionManifest, DeceptionWithoutGroundTruthGuard # Defensive Guards: 0 fail-closed invariants (zero external deps) from dataclasses import dataclass from enum import Enum, auto import hashlib import json class DeceptionVerdict(Enum): GROUND_TRUTH_AVAILABLE = auto() HONEST_ERROR_LIKELY = auto() DECEPTION_LIKELY = auto() INSUFFICIENT_EVIDENCE = auto() @dataclass(frozen=True) class ClaimAndPeer: claim_id: str peer_id: str claim_falsified: bool peer_corrects_errors: bool selective_truth_score: float # 0-1 incentive_to_deceive: bool peer_error_correction_rate: float # historical, 0-1 @dataclass(frozen=True) class DeceptionPolicy: max_selective_truth_score_for_honest: float min_error_correction_rate_for_honest: float require_ground_truth_or_classification: bool @dataclass(frozen=True) class DeceptionManifest: verdict: DeceptionVerdict directive: str manifest_digest: str class DeceptionWithoutGroundTruthGuard: @staticmethod def _hash(data: str) -> str: return hashlib.sha256(data.encode("utf-8")).hexdigest() @classmethod def evaluate_claim( cls, cp: ClaimAndPeer, policy: DeceptionPolicy ) -> DeceptionManifest: # Gate 1: Not falsified if not cp.claim_falsified: digest = cls._hash(json.dumps({ "claim": cp.claim_id, "status": "NOT_FALSIFIED" }, sort_keys=True)) return DeceptionManifest( verdict=DeceptionVerdict.INSUFFICIENT_EVIDENCE, directive=f"PROCEED: Claim {cp.claim_id} not falsified, no classification needed.", manifest_digest=digest ) # Gate 2: Strong honesty signals honesty_signals = 0 if cp.peer_corrects_errors: honesty_signals += 1 if cp.peer_error_correction_rate >= policy.min_error_correction_rate_for_honest: honesty_signals += 1 if cp.selective_truth_score <= policy.max_selective_truth_score_for_honest: honesty_signals += 1 # Gate 3: Strong deception signals deception_signals = 0 if not cp.peer_corrects_errors and cp.incentive_to_deceive: deception_signals += 1 if cp.selective_truth_score > policy.max_selective_truth_score_for_honest: deception_signals += 1 if cp.peer_error_correction_rate < policy.min_error_correction_rate_for_honest: deception_signals += 1 if deception_signals >= 2: return DeceptionManifest( verdict=DeceptionVerdict.DECEPTION_LIKELY, directive=f"FLAG: Claim {cp.claim_id} classified as deception ({deception_signals} signals).", manifest_digest=cls._hash(f"DECEPTION:{cp.claim_id}") ) if honesty_signals >= 2: digest = cls._hash(json.dumps({ "claim": cp.claim_id, "peer": cp.peer_id, "signals": "HONESTY", "correction_rate": f"{cp.peer_error_correction_rate:.3f}" }, sort_keys=True)) return DeceptionManifest( verdict=DeceptionVerdict.HONEST_ERROR_LIKELY, directive=f"PROCEED: Claim {cp.claim_id} classified as honest error ({honesty_signals} signals).", manifest_digest=digest ) # Gate 4: Mixed signals return DeceptionManifest( verdict=DeceptionVerdict.INSUFFICIENT_EVIDENCE, directive=f"FLAG_FOR_INVESTIGATION: Claim {cp.claim_id} has mixed signals (honesty {honesty_signals}, deception {deception_signals}).", manifest_digest=cls._hash(f"MIXED:{cp.claim_id}") )