use koru_lambda_core::DistinctionEngine;
#[test]
fn test_falsify_unintended_associativity() {
println!("\nTest: Non-Associativity Verification (Documented Behavior)");
println!(" Testing that construction history is preserved...");
let engine1 = DistinctionEngine::new();
let engine2 = DistinctionEngine::new();
let d0 = engine1.d0().clone();
let d1 = engine1.d1().clone();
println!(" Path 1: (a⊕b)⊕c");
let a1 = engine1.synthesize(&d0, &d1);
let b1 = engine1.synthesize(&a1, &d0);
let c1 = engine1.synthesize(&a1, &d1);
let ab = engine1.synthesize(&a1, &b1);
let result1 = engine1.synthesize(&ab, &c1);
println!(" Result 1 ID: {}", result1.id());
println!(" Path 2: (a⊕c)⊕b");
let a2 = engine2.synthesize(&d0, &d1);
let b2 = engine2.synthesize(&a2, &d0);
let c2 = engine2.synthesize(&a2, &d1);
let ac = engine2.synthesize(&a2, &c2);
let result2 = engine2.synthesize(&ac, &b2);
println!(" Result 2 ID: {}", result2.id());
assert_ne!(
result1.id(),
result2.id(),
"FALSIFIED: Unintended associativity detected! Construction history is lost.\n \
This indicates (a⊕b)⊕c = (a⊕c)⊕b, which violates the design intent.\n \
Both paths yielded: {}",
result1.id()
);
println!("\nHypothesis sustained.");
println!(" Non-associativity verified:");
println!(" (a⊕b)⊕c ≠ (a⊕c)⊕b");
println!(" Construction history is preserved");
println!(" Path 1 result: {}", result1.id());
println!(" Path 2 result: {}", result2.id());
}
#[test]
fn test_falsify_construction_history_loss() {
println!("\nTest: Construction History Preservation");
println!(" Testing multiple construction sequences...");
let d0 = {
let engine = DistinctionEngine::new();
engine.d0().clone()
};
let d1 = {
let engine = DistinctionEngine::new();
engine.d1().clone()
};
let engine1 = DistinctionEngine::new();
let step1_a = engine1.synthesize(&d0, &d1);
let step2_a = engine1.synthesize(&step1_a, &d0);
let result_a = engine1.synthesize(&step2_a, &d1);
let engine2 = DistinctionEngine::new();
let step1_b = engine2.synthesize(&d0, &d1);
let step2_b = engine2.synthesize(&step1_b, &d1);
let result_b = engine2.synthesize(&step2_b, &d0);
let engine3 = DistinctionEngine::new();
let step1_c = engine3.synthesize(&d0, &d1);
let result_c = engine3.synthesize(&step1_c, &step1_c);
println!(" Sequence 1 ID: {}", result_a.id());
println!(" Sequence 2 ID: {}", result_b.id());
println!(" Sequence 3 ID: {}", result_c.id());
assert_ne!(
result_a.id(),
result_b.id(),
"FALSIFIED: Sequences 1 and 2 produced identical results (history loss)"
);
assert_ne!(
result_a.id(),
result_c.id(),
"FALSIFIED: Sequences 1 and 3 produced identical results (history loss)"
);
assert_ne!(
result_b.id(),
result_c.id(),
"FALSIFIED: Sequences 2 and 3 produced identical results (history loss)"
);
println!("\nHypothesis sustained.");
println!(" Construction history fully preserved");
println!(" All three distinct sequences produced unique distinctions");
}