Mangled-identifier collision detection

Updated Jul 16, 2026

The theoremc::collision module provides build-time collision detection for mangled action-name identifiers across loaded theorem documents. The check runs automatically as part of load_theorem_docs and load_theorem_docs_with_source.

What is checked

The check detects mangled-identifier collisions: two or more different canonical action names that produce the same mangled Rust identifier. This is a defensive safety net; the mangling algorithm is injective by design, so a collision should never occur with well-formed input.

Multiple theorems referencing the same canonical action name is expected and accepted — only distinct canonical names that collide after mangling trigger an error.

When a collision is detected, the loader returns Err(SchemaError::MangledIdentifierCollision { message }) with a human-readable report listing all colliding canonical names per mangled identifier.

Calling the check directly

The collision check can also be called independently:

use theoremc::collision::check_action_collisions;
use theoremc::schema::load_theorem_docs;

let docs = load_theorem_docs(yaml)?;
// The check already ran inside load_theorem_docs, but it can be
// re-run after combining documents from multiple files:
check_action_collisions(&docs)?;