vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
//! Composition-chain minimization.

/// Remove operations from a chain while preserving a failure.
///
/// The caller owns the semantic check because generated chains can represent
/// laws, backend parity, or mutation-kill cases. This function supplies a
/// deterministic delta pass over contiguous spans.
#[inline]
pub fn shrink_chain<T: Clone>(mut chain: Vec<T>, is_failure: impl Fn(&[T]) -> bool) -> Vec<T> {
    if !is_failure(&chain) {
        return chain;
    }

    let mut span = chain.len().saturating_div(2).max(1);
    while span > 0 && chain.len() > 1 {
        let mut removed = false;
        let mut start = 0;
        while start + span <= chain.len() {
            let mut trial = chain.clone();
            trial.drain(start..start + span);
            if !trial.is_empty() && is_failure(&trial) {
                chain = trial;
                removed = true;
            } else {
                start += 1;
            }
        }
        if !removed {
            span /= 2;
        }
    }
    chain
}