in air/src/air/assertions/tests.rs [206:365]
fn assertion_overlap() {
// ----- single-single overlap ----------------------------------------------------------------
let a = Assertion::single(3, 2, BaseElement::ONE);
let b = Assertion::single(3, 2, BaseElement::ONE);
assert!(a.overlaps_with(&b));
// different registers: no overlap
let b = Assertion::single(1, 2, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
// different steps: no overlap
let b = Assertion::single(3, 1, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
// ----- single-periodic overlap --------------------------------------------------------------
let a = Assertion::periodic(3, 2, 4, BaseElement::ONE);
let b = Assertion::single(3, 2, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::single(3, 6, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::single(3, 10, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
// different registers: no overlap
let b = Assertion::single(1, 2, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different steps: no overlap
let b = Assertion::single(3, 3, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// ----- single-sequence overlap --------------------------------------------------------------
let values = vec![BaseElement::ONE, BaseElement::ZERO];
let a = Assertion::sequence(3, 2, 8, values);
let b = Assertion::single(3, 2, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::single(3, 10, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::single(3, 18, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
// different registers: no overlap
let b = Assertion::single(1, 2, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different steps: no overlap
let b = Assertion::single(3, 3, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// ----- periodic-periodic overlap ------------------------------------------------------------
let a = Assertion::periodic(3, 4, 8, BaseElement::ONE);
let b = Assertion::periodic(3, 4, 8, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::periodic(3, 4, 16, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::periodic(3, 0, 4, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
// different registers: no overlap
let b = Assertion::periodic(1, 4, 8, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step: no overlap
let b = Assertion::periodic(0, 0, 8, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step and bigger stride: no overlap
let b = Assertion::periodic(0, 0, 16, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// ----- sequence-sequence overlap ------------------------------------------------------------
let values = vec![BaseElement::ONE, BaseElement::ZERO];
let a = Assertion::sequence(3, 4, 8, values.clone());
let b = Assertion::sequence(3, 4, 8, values.clone());
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::sequence(3, 4, 16, values.clone());
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::sequence(3, 0, 4, values.clone());
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
// different registers: no overlap
let b = Assertion::sequence(1, 4, 8, values.clone());
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step: no overlap
let b = Assertion::sequence(0, 0, 8, values.clone());
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step and bigger stride: no overlap
let b = Assertion::sequence(0, 0, 16, values.clone());
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// ----- sequence-periodic overlap ------------------------------------------------------------
let values = vec![BaseElement::ONE, BaseElement::ZERO];
let a = Assertion::sequence(3, 4, 8, values.clone());
let b = Assertion::periodic(3, 4, 8, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::periodic(3, 4, 16, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
let b = Assertion::periodic(3, 0, 4, BaseElement::ONE);
assert!(a.overlaps_with(&b));
assert!(b.overlaps_with(&a));
// different registers: no overlap
let b = Assertion::periodic(1, 4, 8, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step: no overlap
let b = Assertion::periodic(0, 0, 8, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
// different first step and bigger stride: no overlap
let b = Assertion::periodic(0, 0, 16, BaseElement::ONE);
assert!(!a.overlaps_with(&b));
assert!(!b.overlaps_with(&a));
}