def evaluate(c):
    decisive=['canon_item_id','content_hash','authority_level','source_origin','scope','lifetime','promotion_state','conflict_state']
    missing=[k for k in decisive if not c.get(k)]
    provenance_complete=bool(c.get('provenance_ref'))
    trusted_authorities={'PLATFORM','DEVELOPER','ORG_POLICY','PRODUCT_POLICY','USER'}
    authority_valid=bool(c.get('source_trust')=='TRUSTED' and c.get('authority_level') in trusted_authorities)
    scope_lifetime_valid=bool(c.get('scope') in {'ORGANIZATION','WORKSPACE','HANDOFF','SESSION'} and c.get('lifetime') in {'DURABLE','SESSION'})
    handoff_filter_valid=bool((not c.get('filter_required')) or (c.get('filter_applied') and c.get('handoff_filter_ref')))
    conflict_open=bool(c.get('conflict_state')=='OPEN' or c.get('higher_authority_conflict'))
    promotion_eligible=bool(authority_valid and provenance_complete and scope_lifetime_valid and c.get('lifetime')=='DURABLE' and c.get('promotion_state')=='APPROVED' and c.get('promotion_authority') and handoff_filter_valid and not conflict_open and not c.get('is_superseded') and not c.get('policy_blocked'))
    state='UNKNOWN'; reason='DECISIVE_EVIDENCE_MISSING'
    if c.get('policy_blocked'):
        state='HOLD'; reason='POLICY_BLOCK'
    elif c.get('is_superseded') or c.get('promotion_state')=='SUPERSEDED':
        state='DEPRECATED'; reason='SUPERSEDED_BY_NEWER_CANON'
    elif c.get('scope')=='SESSION' or c.get('lifetime')=='SESSION':
        if not authority_valid and c.get('source_origin')=='TOOL':
            state='EXTERNAL_UNTRUSTED'; reason='TOOL_OUTPUT_HAS_NO_DELEGATED_AUTHORITY'
        else:
            state='SESSION_LOCAL'; reason='SESSION_SCOPE_CANNOT_SILENTLY_BECOME_DURABLE'
    elif missing or not provenance_complete:
        state='UNKNOWN'; reason='DECISIVE_EVIDENCE_MISSING'
    elif not authority_valid:
        state='EXTERNAL_UNTRUSTED'; reason='SOURCE_HAS_NO_CANON_AUTHORITY'
    elif conflict_open:
        state='INCONCLUSIVE'; reason='UNRESOLVED_AUTHORITY_CONFLICT'
    elif not handoff_filter_valid:
        state='HOLD'; reason='DECLARED_HANDOFF_FILTER_NOT_APPLIED'
    elif c.get('promotion_state') in {'NONE','PROVISIONAL'}:
        state='PROVISIONAL'; reason='PROMOTION_NOT_APPROVED'
    elif promotion_eligible:
        state='CANONICAL'; reason='TRACED_PROMOTION_AND_AUTHORITY_CLOSED'
    return {'canonicality_state':state,'promotion_eligible':promotion_eligible,'authority_valid':authority_valid,'provenance_complete':provenance_complete,'scope_lifetime_valid':scope_lifetime_valid,'handoff_filter_valid':handoff_filter_valid,'conflict_open':conflict_open,'control_reason':reason}
