forge
Explore
Log in

Don't you dare go Hollow

refusal_inventory: say WHICH kind of proof each PROVEN row carries

Browse files at this commit

28056ec0ff82da78c65e40117370c8c7817f9905Ahmet Kaan GümüşParent: 9e73b94
The table was a 2-tuple, so a row whose gate drives a hand-built stream into
the guard read exactly like a row whose gate sweeps an alphabet and shows
nothing reaches it. That distinction is what makes a row's strength legible,
and it was inexpressible.

Adds `Proof { NegativeGate, Enumeration }` + `label()`, a third tuple element
on all 32 rows (7 NEGATIVE, 25 ENUMERATION), and
`every_proven_row_names_which_kind_of_proof_it_carries` as the non-vacuity:
every variant is used by a row, the two labels do not collapse, and the
(4,8) chroma-table row's ENUMERATION tag is pinned to three pieces of
evidence inside that gate's OWN BODY -- the exact call-site count, the
(4,8)/(8,4) residual loop, and the unreachability assertion -- so the tag is
backed by the gate and not by its name.

The `Proof::TablePin` variant lane-av1refusalclaim r3 proposed is NOT carried:
its only row is that same (4,8) row, whose gate r3 wrote against was
`every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table`
(decode_rect_split's tables). Main's row names
`every_chroma_unit_decode_block_rect_can_present_has_a_coefficient_table`,
which reads all eight decode_block_rect call sites' own literal bw/bh, pins
the chroma table exactly, and asserts the (4,8)/(8,4) residual is
UNPRODUCIBLE. The reach domain r3 called unestablished is therefore measured,
so ENUMERATION is the honest tag and a variant with no row would be dead
weight. The enum's doc comment records when to re-add it.
crates/ec-av1/src/refusal_inventory.rsmodified+153 -4
@@ -301,7 +301,47 @@ const REFUSALS: &[&str] = &[
301301 /// `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact` is the
302302 /// witness.
303303 #[cfg(test)]
304-const PROVEN: &[(&str, &str)] = &[
304+/// Which KIND of proof each [`PROVEN`] row carries.
305+///
306+/// A 2-tuple made every row look equally proven, which is the whole defect:
307+/// a row whose gate drives a hand-built stream into the guard and a row
308+/// whose gate sweeps an alphabet and shows nothing reaches it are held to
309+/// the same standard and read the same way. `label()` is what the tests
310+/// print, so the distinction is visible in the suite's own output.
311+///
312+/// lane-av1refusalclaim r3 also proposed a third variant, `TablePin`
313+/// ("the arms are pinned exactly but the domain the table is REACHED over
314+/// is unestablished"). It is deliberately NOT carried: the one row it was
315+/// minted for now has a gate that establishes the reach domain
316+/// (`every_chroma_unit_decode_block_rect_can_present_has_a_coefficient_table`
317+/// reads the eight `decode_block_rect` call sites' own literal `bw`/`bh`,
318+/// pins the resulting chroma table exactly, and asserts the `(4,8)`/`(8,4)`
319+/// residual is UNPRODUCIBLE), so `Enumeration` is the honest tag and a
320+/// variant with no row would be dead weight. Re-add it the day a gate really
321+/// pins a table without measuring its caller domain -- and give it a row.
322+#[cfg(test)]
323+enum Proof {
324+ /// A written stream REACHES the guard and is refused by this exact
325+ /// string: the gate goes RED if the guard is removed.
326+ NegativeGate,
327+ /// The gate enumerates every input the guard can be reached over and
328+ /// shows that none of them reaches it: it proves UNREACHABILITY, so it
329+ /// is GREEN if the guard is removed.
330+ Enumeration,
331+}
332+
333+#[cfg(test)]
334+impl Proof {
335+ fn label(&self) -> &'static str {
336+ match self {
337+ Proof::NegativeGate => "NEGATIVE (reaches the guard; red on removal)",
338+ Proof::Enumeration => "ENUMERATION (proves unreachability; green on removal)",
339+ }
340+ }
341+}
342+
343+#[cfg(test)]
344+const PROVEN: &[(&str, &str, Proof)] = &[
305345 // lane-t900 r20, census: three real streams present exactly the 18
306346 // `(side, write_w, write_h)` triples `INTER_BLOCK_SHAPES` lists, and
307347 // `rect_inter_residual_supported` covers every rectangular one -- the only
@@ -318,6 +358,7 @@ const PROVEN: &[(&str, &str)] = &[
318358 (
319359 "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding",
320360 "a_block_shape_census_over_three_real_streams_leaves_the_rect_residual_refusal_unreachable",
361+ Proof::Enumeration,
321362 ),
322363 // lane-t900 r20, census: the shapes that can reach `decode_intra_rect_in_inter`'s
323364 // size-group/tx-category lookup are the ten rectangular census shapes with
@@ -326,6 +367,7 @@ const PROVEN: &[(&str, &str)] = &[
326367 (
327368 "an intra-coded {bw}x{bh} block on the inter block path (no size-group/tx-category row for that shape here)",
328369 "every_intra_in_inter_shape_the_census_lists_has_a_size_group_row",
370+ Proof::Enumeration,
329371 ),
330372 // lane-t900 r20, census: the only sub-8 footprints three real streams
331373 // present are the 16x4/4x16 strips of a 16x16-level 1:4 partition, whose
@@ -334,6 +376,7 @@ const PROVEN: &[(&str, &str)] = &[
334376 (
335377 "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once for two strips; only the inter path implements that pairing)",
336378 "a_sub8_footprint_census_over_real_streams_leaves_the_intra_16x4_pairing_refusal_unreachable",
379+ Proof::Enumeration,
337380 ),
338381 // lane-t900 r20, census: the rect transform tables and scans, enumerated
339382 // over the shapes the measured block-shape domain hands each helper (block
@@ -347,14 +390,17 @@ const PROVEN: &[(&str, &str)] = &[
347390 (
348391 "a rectangular inter luma transform unit whose shape has no coefficient table set here",
349392 "every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan",
393+ Proof::Enumeration,
350394 ),
351395 (
352396 "a rectangular inter chroma transform unit whose shape has no coefficient table set here",
353397 "every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan",
398+ Proof::Enumeration,
354399 ),
355400 (
356401 "a rectangular transform unit whose shape has no coefficient scan table here",
357402 "every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan",
403+ Proof::Enumeration,
358404 ),
359405 // lane-t900 r21, enumeration: a var-tx leaf is never larger than the unit
360406 // the tree was entered with, and both callers enter at or below their own
@@ -363,10 +409,12 @@ const PROVEN: &[(&str, &str)] = &[
363409 (
364410 "an inter var-tx tree with a leaf transform larger than 32x32",
365411 "a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered",
412+ Proof::Enumeration,
366413 ),
367414 (
368415 "an inter var-tx tree with a leaf transform larger than 64x64",
369416 "a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered",
417+ Proof::Enumeration,
370418 ),
371419 // Pre-existing proofs, registered by lane-t900 r21: a negative gate (a
372420 // hand-built 12-bit sequence header is refused BY THIS EXACT STRING rather
@@ -380,32 +428,38 @@ const PROVEN: &[(&str, &str)] = &[
380428 (
381429 "a 32x32 partition type this decoder does not code (value={part32})",
382430 "every_partition_value_of_an_enumerated_alphabet_has_an_arm",
431+ Proof::Enumeration,
383432 ),
384433 (
385434 "an INTER 32x32 partition type this decoder does not code (value={part32})",
386435 "every_partition_value_of_an_enumerated_alphabet_has_an_arm",
436+ Proof::Enumeration,
387437 ),
388438 (
389439 "a 128x128 superblock partition value outside the 8-symbol alphabet",
390440 "every_partition_value_of_an_enumerated_alphabet_has_an_arm",
441+ Proof::Enumeration,
391442 ),
392443 // lane-t900 r24, enumeration: the key-frame superblock root's own `match`
393444 // has an arm for all ten `partition_w64` values.
394445 (
395446 "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4",
396447 "every_partition_value_of_an_enumerated_alphabet_has_an_arm",
448+ Proof::Enumeration,
397449 ),
398450 // lane-t900 r24, enumeration: the inter 16x16-level if/else chain's
399451 // branches name all ten `partition_w16` values between them.
400452 (
401453 "an inter 16x16-level partition value outside NONE/HORZ/VERT/SPLIT/AB/1:4",
402454 "every_partition_value_of_an_if_chain_alphabet_is_named_by_a_branch",
455+ Proof::Enumeration,
403456 ),
404457 // lane-t900 r24, enumeration: every (CDF width, symbol) pair a tx_type row
405458 // can present maps to a distinct member of that width's own set.
406459 (
407460 "a tx_type symbol outside its CDF's own set: {t}",
408461 "every_tx_type_symbol_of_every_cdf_width_maps_into_its_own_set",
462+ Proof::Enumeration,
409463 ),
410464 // lane-t900 r24 + lane-av1txr RE-PIN, measured: the reader covers spec
411465 // 5.11.40's whole value domain (`0..=(1 << 20) - 2`, both ends of every
@@ -419,6 +473,7 @@ const PROVEN: &[(&str, &str)] = &[
419473 (
420474 "a Golomb tail longer than this decoder reads",
421475 "read_golomb_reads_every_value_a_conformant_stream_can_carry",
476+ Proof::Enumeration,
422477 ),
423478 // lane-t900 r25, enumeration: `parse_tile_group` is the only producer of
424479 // the `tiles` vector `decode_stream` tests, and its success path always
@@ -427,6 +482,7 @@ const PROVEN: &[(&str, &str)] = &[
427482 (
428483 "a frame OBU with no tile group",
429484 "a_frame_obu_that_parses_always_carries_at_least_one_tile",
485+ Proof::Enumeration,
430486 ),
431487 // lane-t900 r25, negative gates: hand-built streams that reach each
432488 // refusal by name and output no picture (a `show_existing_frame` header
@@ -434,10 +490,12 @@ const PROVEN: &[(&str, &str)] = &[
434490 (
435491 "a show_existing_frame header naming an empty reference slot",
436492 "a_show_existing_frame_header_naming_an_empty_slot_is_refused_by_name",
493+ Proof::NegativeGate,
437494 ),
438495 (
439496 "an inter frame with no key frame before it",
440497 "an_inter_frame_opening_a_stream_is_refused_by_name",
498+ Proof::NegativeGate,
441499 ),
442500 // lane-t900 r25, enumeration: a motion_mode/obmc symbol is read only under
443501 // `is_motion_variation_allowed_bsize` (min side >= 8), and each of the 17
@@ -446,6 +504,7 @@ const PROVEN: &[(&str, &str)] = &[
446504 (
447505 "a motion_mode symbol for a block shape with no CDF row here",
448506 "every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row",
507+ Proof::Enumeration,
449508 ),
450509 // lane-av112bit: real-aomenc 12-bit streams, each refused by name
451510 // (the gates encode with aomenc --bit-depth=12 and assert the exact
@@ -470,6 +529,7 @@ const PROVEN: &[(&str, &str)] = &[
470529 (
471530 "a chroma format of 4:2:2 (subsampling_x != subsampling_y): this decoder decodes 4:2:0 and 4:4:4; 4:2:2 is not ported, and 4:4:0 (0,1) is not a codable cell",
472531 "a_non_420_subsampled_sequence_header_is_refused_by_name",
532+ Proof::NegativeGate,
473533 ),
474534 // lane-av1txr-r2 paired, lane-av1-qmatrix RETIRED with its gate: the
475535 // refusal's witness is now
@@ -488,6 +548,7 @@ const PROVEN: &[(&str, &str)] = &[
488548 (
489549 "an intra mode this decoder does not code (round 2)",
490550 "every_intra_mode_symbol_of_the_y_mode_alphabet_is_coded",
551+ Proof::Enumeration,
491552 ),
492553 // lane-t900 r26, enumeration: `compute_image_size` is 0 only for a zero
493554 // frame width/height, which no path a header can code produces (swept
@@ -495,6 +556,7 @@ const PROVEN: &[(&str, &str)] = &[
495556 (
496557 "a frame with no mode-info grid",
497558 "every_frame_size_a_header_can_code_has_a_mode_info_grid",
559+ Proof::Enumeration,
498560 ),
499561 // lane-t900 r26, negative gates: written streams that reach each refusal
500562 // by name (a 64x32 inter frame over a 64x64 reference; a stream opening on
@@ -511,6 +573,7 @@ const PROVEN: &[(&str, &str)] = &[
511573 (
512574 "a reference frame selected with no picture at this frame's own ref_frame_idx slot for it",
513575 "a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name",
576+ Proof::NegativeGate,
514577 ),
515578 // lane-t900 r27, negative gate + census: a written key frame carrying
516579 // each of the three mode-overriding features (over three segment ids) is
@@ -536,6 +599,7 @@ const PROVEN: &[(&str, &str)] = &[
536599 (
537600 "a frame whose segmentation enables SEG_LVL_REF_FRAME/SKIP/GLOBALMV (this decoder reads segment_id but never lets a segment override a block's reference, skip or mode)",
538601 "a_frame_whose_segmentation_overrides_a_block_mode_is_refused_by_name",
602+ Proof::NegativeGate,
539603 ),
540604 // lane-t900 r27, structural audit + witness: `record_inter_rect_mi` is the
541605 // single writer of the interp-filter neighbour band, and no call site
@@ -549,6 +613,7 @@ const PROVEN: &[(&str, &str)] = &[
549613 (
550614 "an OBMC neighbour whose switchable interp filter was never recorded",
551615 "every_inter_record_publishes_an_obmc_readable_filter",
616+ Proof::Enumeration,
552617 ),
553618 // lane-t900 r28: all three scaled-reference (superres) refusals -- the
554619 // 8x8 partition leaf, the sub-8x8 inter block and warp -- are LIFTED and
@@ -564,10 +629,12 @@ const PROVEN: &[(&str, &str)] = &[
564629 (
565630 "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
566631 "every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table",
632+ Proof::Enumeration,
567633 ),
568634 (
569635 "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)",
570636 "every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table",
637+ Proof::Enumeration,
571638 ),
572639 // lane-av1-refusalaudit, enumeration + witness2 hunt: decode_block_rect64's
573640 // chroma-unit table covers every conformant 64-axis strip unit in both
@@ -581,6 +648,7 @@ const PROVEN: &[(&str, &str)] = &[
581648 (
582649 "a 64-axis strip whose chroma unit has no coefficient table",
583650 "every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table",
651+ Proof::Enumeration,
584652 ),
585653 // lane-av1rect8x16, enumeration: `decode_block_rect`'s `_` arm. The nine
586654 // textual `decode_block_rect(` matches are 1 declaration + 8 call sites
@@ -602,6 +670,7 @@ const PROVEN: &[(&str, &str)] = &[
602670 (
603671 "a rectangular chroma transform whose size has no coefficient table",
604672 "every_chroma_unit_decode_block_rect_can_present_has_a_coefficient_table",
673+ Proof::Enumeration,
605674 ),
606675 // lane-t900 r33, enumeration: each of the four symbols this guard tests is
607676 // read under a size gate that no 128-pixel side passes (the call site's
@@ -610,6 +679,7 @@ const PROVEN: &[(&str, &str)] = &[
610679 (
611680 "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)",
612681 "no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol",
682+ Proof::Enumeration,
613683 ),
614684 // lane-av1txr: the sub-8x8 intrabc refusal this census pinned is GONE (the
615685 // capability landed; see the note in `REFUSALS`). The census gate survives
@@ -628,10 +698,12 @@ const PROVEN: &[(&str, &str)] = &[
628698 (
629699 "a reference picture whose height does not match this frame's own true size",
630700 "an_inter_frame_shorter_than_its_reference_is_refused_by_name",
701+ Proof::NegativeGate,
631702 ),
632703 (
633704 "a frame naming primary_ref_frame at a reference slot with no saved CDF state",
634705 "an_inter_frame_naming_an_unrefreshed_primary_ref_slot_is_refused_by_name",
706+ Proof::NegativeGate,
635707 ),
636708 ];
637709
@@ -703,7 +775,8 @@ pub(crate) fn pins_refusal(src: &str, refusal: &str) -> bool {
703775 #[cfg(test)]
704776 mod tests {
705777 use super::{
706- CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, PROVEN, REFUSALS, squash_source,
778+ CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, PROVEN, Proof, REFUSALS,
779+ squash_source,
707780 };
708781 use std::collections::BTreeSet;
709782
@@ -2544,7 +2617,7 @@ mod tests {
25442617 let mut neither: Vec<&str> = Vec::new();
25452618 let mut unanchored: Vec<String> = Vec::new();
25462619 let mut unbounded: Vec<String> = Vec::new();
2547- for (reason, gate) in PROVEN {
2620+ for (reason, gate, _kind) in PROVEN {
25482621 assert!(
25492622 found.contains(*reason),
25502623 "{reason:?} is listed as proven but is no longer a decode-path refusal -- \
@@ -2646,7 +2719,7 @@ mod tests {
26462719 #[test]
26472720 fn every_named_gate_body_is_bounded_in_these_files() {
26482721 let mut resolved = 0usize;
2649- for (reason, gate) in PROVEN {
2722+ for (reason, gate, _kind) in PROVEN {
26502723 let body =
26512724 gate_body(gate).unwrap_or_else(|why| panic!("{reason:?} names {gate}: {why}"));
26522725 assert!(
@@ -2668,6 +2741,82 @@ mod tests {
26682741 }
26692742 }
26702743
2744+ /// The taxonomy is a CLAIM about each row, so it carries its own
2745+ /// non-vacuity: every variant is used by at least one row (a variant no
2746+ /// row can be in is not a category), the two labels do not collapse into
2747+ /// one string, and the row lane-av1refusalclaim r3 wanted to RE-TAG is
2748+ /// tagged from evidence inside its own gate BODY -- never from the
2749+ /// gate's name, which is the only thing the previous 2-tuple carried.
2750+ ///
2751+ /// r3 minted a `TablePin` variant because "a rectangular chroma transform
2752+ /// whose size has no coefficient table" was pinned to a table whose
2753+ /// REACHED-OVER domain had never been measured. Main has since replaced
2754+ /// that row's gate with one that reads the eight `decode_block_rect` call
2755+ /// sites' own literal `bw`/`bh`, pins the resulting chroma table exactly,
2756+ /// and asserts the `(4,8)`/`(8,4)` residual is UNPRODUCIBLE. `Enumeration`
2757+ /// is therefore the honest tag and `TablePin` is not carried; if a later
2758+ /// edit weakens that gate back to a bare table pin, the three evidence
2759+ /// pins below go red instead of leaving the row quietly overclaiming.
2760+ #[test]
2761+ fn every_proven_row_names_which_kind_of_proof_it_carries() {
2762+ let mut negative = 0usize;
2763+ let mut enumeration = 0usize;
2764+ for (reason, gate, kind) in PROVEN {
2765+ eprintln!(" {} -- {reason:?} -> {gate}", kind.label());
2766+ match kind {
2767+ Proof::NegativeGate => negative += 1,
2768+ Proof::Enumeration => enumeration += 1,
2769+ }
2770+ }
2771+ assert_eq!(
2772+ negative + enumeration,
2773+ PROVEN.len(),
2774+ "a PROVEN row carries no proof kind, so the table says nothing about it"
2775+ );
2776+ assert!(
2777+ negative > 0,
2778+ "no row is tagged NEGATIVE, so the NegativeGate variant is dead weight"
2779+ );
2780+ assert!(
2781+ enumeration > 0,
2782+ "no row is tagged ENUMERATION, so the Enumeration variant is dead weight"
2783+ );
2784+ assert_ne!(
2785+ Proof::NegativeGate.label(),
2786+ Proof::Enumeration.label(),
2787+ "the two kinds print the same string, so the taxonomy is one category in two hats"
2788+ );
2789+
2790+ let (reason, gate, kind) = PROVEN
2791+ .iter()
2792+ .find(|(reason, _, _)| {
2793+ *reason == "a rectangular chroma transform whose size has no coefficient table"
2794+ })
2795+ .map(|(reason, gate, kind)| (*reason, *gate, kind))
2796+ .expect("the (4,8) chroma-table row left PROVEN");
2797+ assert!(
2798+ matches!(kind, Proof::Enumeration),
2799+ "{reason:?} is tagged {:?}, but its gate enumerates the caller domain",
2800+ kind.label()
2801+ );
2802+ let body = gate_body(gate).unwrap_or_else(|why| panic!("{reason:?} names {gate}: {why}"));
2803+ for evidence in [
2804+ "the number of decode_block_rect call sites changed",
2805+ "for residual in [(4usize, 8usize), (8, 4)]",
2806+ "the caller set can now produce a 4x8/8x4 chroma shape",
2807+ ] {
2808+ assert!(
2809+ body.contains(evidence),
2810+ "{gate} no longer carries {evidence:?}, so the Enumeration tag on {reason:?} \
2811+ claims a reach domain the gate has stopped measuring"
2812+ );
2813+ }
2814+ eprintln!(
2815+ "refusal inventory: {negative} NEGATIVE, {enumeration} ENUMERATION of {} PROVEN rows",
2816+ PROVEN.len()
2817+ );
2818+ }
2819+
26712820 /// Lane-av1refusalspan: the invariant that catches a boundary that
26722821 /// over-reaches. Tested on its own text, so it cannot be satisfied by the
26732822 /// scanner happening to be right on the current sources.