#[cfg(verus_keep_ghost)]
use vstd::prelude::*;
#[cfg_attr(verus_keep_ghost, verus_verify)]
pub(super) const RUN_LUT_Z4: u32 = 0x0001_e000;
#[cfg(verus_keep_ghost)]
mod run_helpers {
use vstd::prelude::*;
verus! {
pub(super) open spec fn unpack_run_entry(entry: u32) -> super::super::RunCode {
super::super::RunCode {
bits: ((entry >> 17u32) & 0x01ffu32) as u16,
length: ((entry >> 13u32) & 0x0fu32) as u8,
value: (entry & 0x0fffu32) as u16,
terminal: (entry & 0x1000u32) != 0,
}
}
pub(super) open spec fn run_code_matches_slot(black: bool, code: super::super::RunCode) -> bool {
if code.terminal {
(code.value as int) < 64
&& if black {
super::super::BLACK_TERMINATING@[code.value as int] == code
} else {
super::super::WHITE_TERMINATING@[code.value as int] == code
}
} else if code.value <= 1728 {
code.value >= 64
&& (code.value as int) % 64 == 0
&& ({
let i = (code.value as int) / 64 - 1;
0 <= i < 27
&& if black {
super::super::BLACK_MAKEUP@[i] == code
} else {
super::super::WHITE_MAKEUP@[i] == code
}
})
} else {
code.value >= 1792
&& ((code.value as int) - 1792) % 64 == 0
&& ({
let i = ((code.value as int) - 1792) / 64;
0 <= i < 13 && super::super::COMMON_MAKEUP@[i] == code
})
}
}
pub(super) proof fn run_code_slot_implies_in_tables(black: bool, code: super::super::RunCode)
requires run_code_matches_slot(black, code),
ensures super::super::mmr_spec::run_code_in_implementation_tables(black, code),
{
if code.terminal {
let i = code.value as int;
if black {
assert(0 <= i < super::super::BLACK_TERMINATING@.len() && super::super::BLACK_TERMINATING@[i] == code);
} else {
assert(0 <= i < super::super::WHITE_TERMINATING@.len() && super::super::WHITE_TERMINATING@[i] == code);
}
} else if code.value <= 1728 {
let i = (code.value as int) / 64 - 1;
if black {
assert(0 <= i < super::super::BLACK_MAKEUP@.len() && super::super::BLACK_MAKEUP@[i] == code);
} else {
assert(0 <= i < super::super::WHITE_MAKEUP@.len() && super::super::WHITE_MAKEUP@[i] == code);
}
} else {
let i = ((code.value as int) - 1792) / 64;
assert(0 <= i < super::super::COMMON_MAKEUP@.len() && super::super::COMMON_MAKEUP@[i] == code);
}
}
}
}
mod mode_lut {
#[cfg(verus_keep_ghost)]
use vstd::prelude::*;
#[cfg_attr(verus_keep_ghost, verus_verify)]
const MODE_LUT: [u8; 128] = [
0, 10, 9, 8, 7, 7, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
];
#[cfg(verus_keep_ghost)]
verus! {
spec fn mode_lut_slot_ok(idx: int) -> bool {
let entry = MODE_LUT@[idx];
entry == 0u8 || (
1u8 <= entry && entry <= 10u8 && ({
let code = super::super::MODE_CODES@[(entry - 1) as int];
1u8 <= code.length && code.length <= 7u8
&& ((idx as u32) >> ((7u8 - code.length) as u32)) == code.bits as u32
})
)
}
spec fn mode_lut_all_ok(n: nat) -> bool
decreases n,
{
n == 0 || (mode_lut_slot_ok((n - 1) as int) && mode_lut_all_ok((n - 1) as nat))
}
proof fn mode_lut_all_implies(n: nat, idx: int)
requires 0 <= idx < n, mode_lut_all_ok(n),
ensures mode_lut_slot_ok(idx),
decreases n,
{
if idx < n - 1 {
mode_lut_all_implies((n - 1) as nat, idx);
}
}
proof fn mode_lut_valid(peek7: usize)
requires peek7 < 128usize,
ensures
MODE_LUT@[peek7 as int] == 0u8 || ({
let entry = MODE_LUT@[peek7 as int];
1u8 <= entry && entry <= 10u8 && ({
let code = super::super::MODE_CODES@[(entry - 1) as int];
super::super::mmr_spec::mode_code_in_implementation_table(code)
&& 1u8 <= code.length && code.length <= 7u8
&& ((peek7 as u32) >> ((7u8 - code.length) as u32)) == code.bits as u32
})
}),
{
assert(mode_lut_all_ok(128)) by (compute_only);
mode_lut_all_implies(128, peek7 as int);
let entry = MODE_LUT@[peek7 as int];
if entry != 0u8 {
let slot = (entry - 1) as int;
let code = super::super::MODE_CODES@[slot];
assert(super::super::MODE_CODES@[slot] == code);
}
}
}
#[cfg_attr(verus_keep_ghost, verus_spec(out =>
requires peek7 < 128usize,
ensures
out == 0u8 || ({
1u8 <= out && out <= 10u8 && ({
let code = super::super::MODE_CODES@[(out - 1) as int];
super::super::mmr_spec::mode_code_in_implementation_table(code)
&& 1u8 <= code.length && code.length <= 7u8
&& ((peek7 as u32) >> ((7u8 - code.length) as u32)) == code.bits as u32
})
}),
))]
#[allow(clippy::inline_always)]
#[inline(always)]
pub(in crate::mmr) fn lookup_mode_lut(peek7: usize) -> u8 {
let out = MODE_LUT[peek7];
#[cfg(verus_keep_ghost)]
proof! {
mode_lut_valid(peek7);
}
out
}
}
mod primary_lut {
#[cfg(verus_keep_ghost)]
use super::super::{mmr_spec, RunCode};
#[cfg(verus_keep_ghost)]
use super::run_helpers::{
run_code_matches_slot, run_code_slot_implies_in_tables, unpack_run_entry,
};
#[cfg(verus_keep_ghost)]
use super::RUN_LUT_Z4;
#[cfg(verus_keep_ghost)]
use vstd::prelude::*;
#[cfg_attr(verus_keep_ghost, verus_verify)]
const WHITE_RUN_LUT9: [u32; 512] = [
0x00000000, 0x00000000, 0x0001e000, 0x0001e000, 0x0005101d, 0x0005101d, 0x0007101e,
0x0007101e, 0x0009102d, 0x0009102d, 0x000b102e, 0x000b102e, 0x0006f016, 0x0006f016,
0x0006f016, 0x0006f016, 0x0008f017, 0x0008f017, 0x0008f017, 0x0008f017, 0x0015102f,
0x0015102f, 0x00171030, 0x00171030, 0x0006d00d, 0x0006d00d, 0x0006d00d, 0x0006d00d,
0x0006d00d, 0x0006d00d, 0x0006d00d, 0x0006d00d, 0x0010f014, 0x0010f014, 0x0010f014,
0x0010f014, 0x00251021, 0x00251021, 0x00271022, 0x00271022, 0x00291023, 0x00291023,
0x002b1024, 0x002b1024, 0x002d1025, 0x002d1025, 0x002f1026, 0x002f1026, 0x0018f013,
0x0018f013, 0x0018f013, 0x0018f013, 0x0035101f, 0x0035101f, 0x00371020, 0x00371020,
0x000ed001, 0x000ed001, 0x000ed001, 0x000ed001, 0x000ed001, 0x000ed001, 0x000ed001,
0x000ed001, 0x0010d00c, 0x0010d00c, 0x0010d00c, 0x0010d00c, 0x0010d00c, 0x0010d00c,
0x0010d00c, 0x0010d00c, 0x00491035, 0x00491035, 0x004b1036, 0x004b1036, 0x0026f01a,
0x0026f01a, 0x0026f01a, 0x0026f01a, 0x00511027, 0x00511027, 0x00531028, 0x00531028,
0x00551029, 0x00551029, 0x0057102a, 0x0057102a, 0x0059102b, 0x0059102b, 0x005b102c,
0x005b102c, 0x002ef015, 0x002ef015, 0x002ef015, 0x002ef015, 0x0030f01c, 0x0030f01c,
0x0030f01c, 0x0030f01c, 0x0065103d, 0x0065103d, 0x0067103e, 0x0067103e, 0x0069103f,
0x0069103f, 0x006b1000, 0x006b1000, 0x006d0140, 0x006d0140, 0x006f0180, 0x006f0180,
0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a,
0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a, 0x000eb00a,
0x000eb00a, 0x000eb00a, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b,
0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b,
0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0010b00b, 0x0048f01b, 0x0048f01b, 0x0048f01b,
0x0048f01b, 0x0095103b, 0x0095103b, 0x0097103c, 0x0097103c, 0x013125c0, 0x01332600,
0x01352640, 0x013726c0, 0x004ef012, 0x004ef012, 0x004ef012, 0x004ef012, 0x0050f018,
0x0050f018, 0x0050f018, 0x0050f018, 0x00a51031, 0x00a51031, 0x00a71032, 0x00a71032,
0x00a91033, 0x00a91033, 0x00ab1034, 0x00ab1034, 0x0056f019, 0x0056f019, 0x0056f019,
0x0056f019, 0x00b11037, 0x00b11037, 0x00b31038, 0x00b31038, 0x00b51039, 0x00b51039,
0x00b7103a, 0x00b7103a, 0x002ec0c0, 0x002ec0c0, 0x002ec0c0, 0x002ec0c0, 0x002ec0c0,
0x002ec0c0, 0x002ec0c0, 0x002ec0c0, 0x0030c680, 0x0030c680, 0x0030c680, 0x0030c680,
0x0030c680, 0x0030c680, 0x0030c680, 0x0030c680, 0x00c901c0, 0x00c901c0, 0x00cb0200,
0x00cb0200, 0x019922c0, 0x019b2300, 0x00cf0280, 0x00cf0280, 0x00d10240, 0x00d10240,
0x01a52340, 0x01a72380, 0x01a923c0, 0x01ab2400, 0x01ad2440, 0x01af2480, 0x01b124c0,
0x01b32500, 0x01b52540, 0x01b72580, 0x006ee100, 0x006ee100, 0x006ee100, 0x006ee100,
0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002,
0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002,
0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002,
0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002,
0x000e9002, 0x000e9002, 0x000e9002, 0x000e9002, 0x00109003, 0x00109003, 0x00109003,
0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003,
0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003,
0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003,
0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003, 0x00109003,
0x00109003, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080,
0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080, 0x0024a080,
0x0024a080, 0x0024a080, 0x0024a080, 0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008,
0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008,
0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008, 0x0026b008, 0x0028b009, 0x0028b009,
0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009,
0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009, 0x0028b009,
0x0054d010, 0x0054d010, 0x0054d010, 0x0054d010, 0x0054d010, 0x0054d010, 0x0054d010,
0x0054d010, 0x0056d011, 0x0056d011, 0x0056d011, 0x0056d011, 0x0056d011, 0x0056d011,
0x0056d011, 0x0056d011, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004,
0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004,
0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004,
0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004,
0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00169004, 0x00189005,
0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005,
0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005,
0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005,
0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005, 0x00189005,
0x00189005, 0x00189005, 0x00189005, 0x0068d00e, 0x0068d00e, 0x0068d00e, 0x0068d00e,
0x0068d00e, 0x0068d00e, 0x0068d00e, 0x0068d00e, 0x006ad00f, 0x006ad00f, 0x006ad00f,
0x006ad00f, 0x006ad00f, 0x006ad00f, 0x006ad00f, 0x006ad00f, 0x0036a040, 0x0036a040,
0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040,
0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040, 0x0036a040,
0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006,
0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006,
0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006,
0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006,
0x001c9006, 0x001c9006, 0x001c9006, 0x001c9006, 0x001e9007, 0x001e9007, 0x001e9007,
0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007,
0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007,
0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007,
0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007, 0x001e9007,
0x001e9007,
];
#[cfg_attr(verus_keep_ghost, verus_verify)]
const BLACK_RUN_LUT9: [u32; 512] = [
0x00000000, 0x00000000, 0x0001e000, 0x0001e000, 0x0001e000, 0x0001e000, 0x0001e000,
0x0001e000, 0x0009100d, 0x0009100d, 0x0001e000, 0x0001e000, 0x0001e000, 0x0001e000,
0x000f100e, 0x000f100e, 0x0008f00a, 0x0008f00a, 0x0008f00a, 0x0008f00a, 0x000af00b,
0x000af00b, 0x000af00b, 0x000af00b, 0x0031300f, 0x0001e000, 0x0001e000, 0x0001e000,
0x000ef00c, 0x000ef00c, 0x000ef00c, 0x000ef00c, 0x0008d009, 0x0008d009, 0x0008d009,
0x0008d009, 0x0008d009, 0x0008d009, 0x0008d009, 0x0008d009, 0x000ad008, 0x000ad008,
0x000ad008, 0x000ad008, 0x000ad008, 0x000ad008, 0x000ad008, 0x000ad008, 0x0006b007,
0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007,
0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007, 0x0006b007,
0x0006b007, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006,
0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006,
0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006,
0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006,
0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00049006, 0x00069005, 0x00069005,
0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005,
0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005,
0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005,
0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005, 0x00069005,
0x00069005, 0x00069005, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001, 0x00047001,
0x00047001, 0x00047001, 0x00047001, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00067004,
0x00067004, 0x00067004, 0x00067004, 0x00067004, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003,
0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00045003, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002, 0x00065002,
0x00065002,
];
#[cfg(verus_keep_ghost)]
verus! {
spec fn run_lut_primary_slot_ok(black: bool, idx: int) -> bool {
let entry = if black { BLACK_RUN_LUT9@[idx] } else { WHITE_RUN_LUT9@[idx] };
if entry == 0u32 {
true
} else if entry == RUN_LUT_Z4 {
idx < 32
} else {
let code = unpack_run_entry(entry);
1u8 <= code.length && code.length <= 9u8
&& run_code_matches_slot(black, code)
&& ((idx as u32) >> ((9u8 - code.length) as u32)) == code.bits as u32
}
}
spec fn run_lut_primary_all_ok(black: bool, n: nat) -> bool
decreases n,
{
n == 0
|| (run_lut_primary_slot_ok(black, (n - 1) as int)
&& run_lut_primary_all_ok(black, (n - 1) as nat))
}
proof fn run_lut_primary_all_implies(black: bool, n: nat, idx: int)
requires 0 <= idx < n, run_lut_primary_all_ok(black, n),
ensures run_lut_primary_slot_ok(black, idx),
decreases n,
{
if idx < n - 1 {
run_lut_primary_all_implies(black, (n - 1) as nat, idx);
}
}
proof fn run_lut_primary_valid(black: bool, peek9: usize)
requires peek9 < 512usize,
ensures ({
let entry = if black { BLACK_RUN_LUT9@[peek9 as int] } else { WHITE_RUN_LUT9@[peek9 as int] };
(entry == RUN_LUT_Z4 ==> peek9 < 32usize)
&& (entry != 0u32 && entry != RUN_LUT_Z4 ==> ({
let code = unpack_run_entry(entry);
1u8 <= code.length && code.length <= 9u8
&& mmr_spec::run_code_in_implementation_tables(black, code)
&& ((peek9 as u32) >> ((9u8 - code.length) as u32)) == code.bits as u32
}))
}),
{
if black {
assert(run_lut_primary_all_ok(true, 512)) by (compute_only);
} else {
assert(run_lut_primary_all_ok(false, 512)) by (compute_only);
}
run_lut_primary_all_implies(black, 512, peek9 as int);
let entry = if black { BLACK_RUN_LUT9@[peek9 as int] } else { WHITE_RUN_LUT9@[peek9 as int] };
if entry != 0u32 && entry != RUN_LUT_Z4 {
run_code_slot_implies_in_tables(black, unpack_run_entry(entry));
}
}
}
#[cfg_attr(verus_keep_ghost, verus_spec(out =>
requires peek9 < 512usize,
ensures
(out == RUN_LUT_Z4 ==> peek9 < 32usize)
&& (out != 0u32 && out != RUN_LUT_Z4 ==> ({
let code = RunCode {
bits: ((out >> 17u32) & 0x01ffu32) as u16,
length: ((out >> 13u32) & 0x0fu32) as u8,
value: (out & 0x0fffu32) as u16,
terminal: (out & 0x1000u32) != 0u32,
};
1u8 <= code.length && code.length <= 9u8
&& mmr_spec::run_code_in_implementation_tables(black, code)
&& ((peek9 as u32) >> ((9u8 - code.length) as u32)) == code.bits as u32
})),
))]
#[allow(clippy::inline_always)]
#[inline(always)]
pub(in crate::mmr) fn lookup_run_lut_primary(black: bool, peek9: usize) -> u32 {
let out = if black {
BLACK_RUN_LUT9[peek9]
} else {
WHITE_RUN_LUT9[peek9]
};
#[cfg(verus_keep_ghost)]
proof! {
run_lut_primary_valid(black, peek9);
assert((((out >> 12u32) & 1u32) != 0u32) == ((out & 0x1000u32) != 0u32)) by (bit_vector);
}
out
}
}
mod z4_lut {
#[cfg(verus_keep_ghost)]
use super::super::{mmr_spec, RunCode};
#[cfg(verus_keep_ghost)]
use super::run_helpers::{
run_code_matches_slot, run_code_slot_implies_in_tables, unpack_run_entry,
};
#[cfg(verus_keep_ghost)]
use vstd::prelude::*;
#[cfg_attr(verus_keep_ghost, verus_verify)]
const WHITE_RUN_LUT9_Z4: [u32; 512] = [
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00116700, 0x00116700, 0x00116700,
0x00116700, 0x002587c0, 0x002587c0, 0x00278800, 0x00278800, 0x00298840, 0x00298840,
0x002b8880, 0x002b8880, 0x002d88c0, 0x002d88c0, 0x002f8900, 0x002f8900, 0x00196740,
0x00196740, 0x00196740, 0x00196740, 0x001b6780, 0x001b6780, 0x001b6780, 0x001b6780,
0x00398940, 0x00398940, 0x003b8980, 0x003b8980, 0x003d89c0, 0x003d89c0, 0x003f8a00,
0x003f8a00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000,
];
#[cfg_attr(verus_keep_ghost, verus_verify)]
const BLACK_RUN_LUT9_Z4: [u32; 512] = [
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00116700, 0x00116700, 0x00116700,
0x00116700, 0x002587c0, 0x002587c0, 0x00278800, 0x00278800, 0x00298840, 0x00298840,
0x002b8880, 0x002b8880, 0x002d88c0, 0x002d88c0, 0x002f8900, 0x002f8900, 0x00196740,
0x00196740, 0x00196740, 0x00196740, 0x001b6780, 0x001b6780, 0x001b6780, 0x001b6780,
0x00398940, 0x00398940, 0x003b8980, 0x003b8980, 0x003d89c0, 0x003d89c0, 0x003f8a00,
0x003f8a00, 0x00115012, 0x00115012, 0x00115012, 0x00115012, 0x00115012, 0x00115012,
0x00115012, 0x00115012, 0x00499034, 0x00499034, 0x0095a280, 0x0097a2c0, 0x0099a300,
0x009ba340, 0x004f9037, 0x004f9037, 0x00519038, 0x00519038, 0x00a5a500, 0x00a7a540,
0x00a9a580, 0x00aba5c0, 0x0057903b, 0x0057903b, 0x0059903c, 0x0059903c, 0x00b5a600,
0x00b7a640, 0x002f7018, 0x002f7018, 0x002f7018, 0x002f7018, 0x00317019, 0x00317019,
0x00317019, 0x00317019, 0x00c9a680, 0x00cba6c0, 0x00678140, 0x00678140, 0x00698180,
0x00698180, 0x006b81c0, 0x006b81c0, 0x00d9a200, 0x00dba240, 0x006f9035, 0x006f9035,
0x00719036, 0x00719036, 0x00e5a380, 0x00e7a3c0, 0x00e9a400, 0x00eba440, 0x00eda480,
0x00efa4c0, 0x001f4040, 0x001f4040, 0x001f4040, 0x001f4040, 0x001f4040, 0x001f4040,
0x001f4040, 0x001f4040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00517017,
0x00517017, 0x00517017, 0x00517017, 0x00a59032, 0x00a59032, 0x00a79033, 0x00a79033,
0x00a9902c, 0x00a9902c, 0x00ab902d, 0x00ab902d, 0x00ad902e, 0x00ad902e, 0x00af902f,
0x00af902f, 0x00b19039, 0x00b19039, 0x00b3903a, 0x00b3903a, 0x00b5903d, 0x00b5903d,
0x00b78100, 0x00b78100, 0x002f5010, 0x002f5010, 0x002f5010, 0x002f5010, 0x002f5010,
0x002f5010, 0x002f5010, 0x002f5010, 0x00315011, 0x00315011, 0x00315011, 0x00315011,
0x00315011, 0x00315011, 0x00315011, 0x00315011, 0x00c99030, 0x00c99030, 0x00cb9031,
0x00cb9031, 0x00cd903e, 0x00cd903e, 0x00cf903f, 0x00cf903f, 0x00d1901e, 0x00d1901e,
0x00d3901f, 0x00d3901f, 0x00d59020, 0x00d59020, 0x00d79021, 0x00d79021, 0x00d99028,
0x00d99028, 0x00db9029, 0x00db9029, 0x006f7016, 0x006f7016, 0x006f7016, 0x006f7016,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01918080, 0x01918080, 0x019380c0, 0x019380c0, 0x0195901a, 0x0195901a,
0x0197901b, 0x0197901b, 0x0199901c, 0x0199901c, 0x019b901d, 0x019b901d, 0x00cf7013,
0x00cf7013, 0x00cf7013, 0x00cf7013, 0x00d17014, 0x00d17014, 0x00d17014, 0x00d17014,
0x01a59022, 0x01a59022, 0x01a79023, 0x01a79023, 0x01a99024, 0x01a99024, 0x01ab9025,
0x01ab9025, 0x01ad9026, 0x01ad9026, 0x01af9027, 0x01af9027, 0x00d97015, 0x00d97015,
0x00d97015, 0x00d97015, 0x01b5902a, 0x01b5902a, 0x01b7902b, 0x01b7902b, 0x006f5000,
0x006f5000, 0x006f5000, 0x006f5000, 0x006f5000, 0x006f5000, 0x006f5000, 0x006f5000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000,
];
#[cfg(verus_keep_ghost)]
verus! {
spec fn run_lut_z4_slot_ok(black: bool, idx: int) -> bool {
let entry = if black { BLACK_RUN_LUT9_Z4@[idx] } else { WHITE_RUN_LUT9_Z4@[idx] };
if entry == 0u32 {
true
} else {
let code = unpack_run_entry(entry);
10u8 <= code.length && code.length <= 13u8
&& run_code_matches_slot(black, code)
&& ((idx as u32) >> ((13u8 - code.length) as u32)) == code.bits as u32
}
}
spec fn run_lut_z4_all_ok(black: bool, n: nat) -> bool
decreases n,
{
n == 0
|| (run_lut_z4_slot_ok(black, (n - 1) as int)
&& run_lut_z4_all_ok(black, (n - 1) as nat))
}
proof fn run_lut_z4_all_implies(black: bool, n: nat, idx: int)
requires 0 <= idx < n, run_lut_z4_all_ok(black, n),
ensures run_lut_z4_slot_ok(black, idx),
decreases n,
{
if idx < n - 1 {
run_lut_z4_all_implies(black, (n - 1) as nat, idx);
}
}
proof fn run_lut_z4_valid(black: bool, z4_idx: usize)
requires z4_idx < 512usize,
ensures ({
let entry = if black { BLACK_RUN_LUT9_Z4@[z4_idx as int] } else { WHITE_RUN_LUT9_Z4@[z4_idx as int] };
entry != 0u32 ==> ({
let code = unpack_run_entry(entry);
10u8 <= code.length && code.length <= 13u8
&& mmr_spec::run_code_in_implementation_tables(black, code)
&& ((z4_idx as u32) >> ((13u8 - code.length) as u32)) == code.bits as u32
})
}),
{
if black {
assert(run_lut_z4_all_ok(true, 512)) by (compute_only);
} else {
assert(run_lut_z4_all_ok(false, 512)) by (compute_only);
}
run_lut_z4_all_implies(black, 512, z4_idx as int);
let entry = if black { BLACK_RUN_LUT9_Z4@[z4_idx as int] } else { WHITE_RUN_LUT9_Z4@[z4_idx as int] };
if entry != 0u32 {
run_code_slot_implies_in_tables(black, unpack_run_entry(entry));
}
}
}
#[cfg_attr(verus_keep_ghost, verus_spec(out =>
requires z4_idx < 512usize,
ensures
out != 0u32 ==> ({
let code = RunCode {
bits: ((out >> 17u32) & 0x01ffu32) as u16,
length: ((out >> 13u32) & 0x0fu32) as u8,
value: (out & 0x0fffu32) as u16,
terminal: (out & 0x1000u32) != 0u32,
};
10u8 <= code.length && code.length <= 13u8
&& mmr_spec::run_code_in_implementation_tables(black, code)
&& ((z4_idx as u32) >> ((13u8 - code.length) as u32)) == code.bits as u32
}),
))]
#[allow(clippy::inline_always)]
#[inline(always)]
pub(in crate::mmr) fn lookup_run_lut_z4(black: bool, z4_idx: usize) -> u32 {
let out = if black {
BLACK_RUN_LUT9_Z4[z4_idx]
} else {
WHITE_RUN_LUT9_Z4[z4_idx]
};
#[cfg(verus_keep_ghost)]
proof! {
run_lut_z4_valid(black, z4_idx);
assert((((out >> 12u32) & 1u32) != 0u32) == ((out & 0x1000u32) != 0u32)) by (bit_vector);
}
out
}
}
pub(super) use mode_lut::lookup_mode_lut;
pub(super) use primary_lut::lookup_run_lut_primary;
pub(super) use z4_lut::lookup_run_lut_z4;