vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use crate::proof::algebra::checker::support::{
    boundary_grid_u32, call_binary, engine_failure_violation, simple_rng, violation,
    ZERO_PRODUCT_COUNTEREXAMPLES,
};
use crate::spec::law::{AlgebraicLaw, LawViolation};
use super::witnessed::*;

fn check_identity_exhaustive(
    op_id: &str,
    f: fn(&[u8]) -> Vec<u8>,
    e: u32,
) -> Result<(u64, Option<LawViolation>), LawViolation> {
    let mut cases = 0u64;
    for a in 0u32..256 {
        cases += 2;
        let ae = call_binary(f, a, e).map_err(|e| engine_failure_violation(op_id, e))?;
        if ae != a {
            return Ok((
                cases,
                Some(violation(op_id, "identity(right)", a, e, 0, ae, a)),
            ));
        }
        let ea = call_binary(f, e, a).map_err(|e| engine_failure_violation(op_id, e))?;
        if ea != a {
            return Ok((
                cases,
                Some(violation(op_id, "identity(left)", e, a, 0, ea, a)),
            ));
        }
    }
    Ok((cases, None))
}