Skip to content

Commit 6ad592f

Browse files
committed
remove redundant flt2dec Kani proof code and refactor format_shortest_opt verification version
1 parent 1ae16af commit 6ad592f

2 files changed

Lines changed: 90 additions & 436 deletions

File tree

library/core/src/num/flt2dec/strategy/dragon.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,6 @@ pub fn format_shortest<'a>(
252252
plus.mul_small(10);
253253
}
254254

255-
// Kani-only: carry the same digit bound to the `assume_init_*` and possible
256-
// `round_up` call sites. This does not change production code.
257-
#[cfg(kani)]
258-
kani::assume(i <= MAX_SIG_DIGITS);
259-
260255
// rounding up happens when
261256
// i) only the rounding-up condition was triggered, or
262257
// ii) both conditions were triggered and tie breaking prefers rounding up.
@@ -427,7 +422,6 @@ pub fn format_exact<'a>(
427422
#[unstable(feature = "kani", issue = "none")]
428423
mod verify {
429424
use super::*;
430-
use crate::kani;
431425

432426
// Buffer-safety-only stubs. These harnesses check that Dragon writes only
433427
// initialized decimal bytes and returns initialized slices. They deliberately
@@ -447,21 +441,11 @@ mod verify {
447441
b
448442
}
449443

450-
// Stub for `Big::mul_digits`; used by `mul_pow10`'s power-of-five path.
451-
fn stub_mul_digits<'a>(b: &'a mut Big, _other: &[Digit]) -> &'a mut Big {
452-
b
453-
}
454-
455444
// Stub for `Big::add`; later comparisons are modeled separately.
456445
fn stub_add<'a>(b: &'a mut Big, _other: &Big) -> &'a mut Big {
457446
b
458447
}
459448

460-
// Stub for `Big::sub`; digit extraction supplies the observed quotient.
461-
fn stub_sub<'a>(b: &'a mut Big, _other: &Big) -> &'a mut Big {
462-
b
463-
}
464-
465449
// Stub for `Big::is_zero`; lets Kani explore both termination choices.
466450
fn stub_is_zero(_b: &Big) -> bool {
467451
kani::any()
@@ -538,9 +522,7 @@ mod verify {
538522
// paths while stubbing expensive Big arithmetic.
539523
#[kani::stub(Big::mul_pow2, stub_mul_pow2)]
540524
#[kani::stub(Big::mul_small, stub_mul_small)]
541-
#[kani::stub(Big::mul_digits, stub_mul_digits)]
542525
#[kani::stub(Big::add, stub_add)]
543-
#[kani::stub(Big::sub, stub_sub)]
544526
#[kani::stub(Big::is_zero, stub_is_zero)]
545527
#[kani::stub(Big::cmp, stub_cmp)]
546528
#[kani::stub(estimate_scaling_factor, stub_estimate_scaling_factor)]
@@ -562,7 +544,6 @@ mod verify {
562544
#[kani::stub(Big::mul_pow2, stub_mul_pow2)]
563545
#[kani::stub(Big::mul_small, stub_mul_small)]
564546
#[kani::stub(Big::add, stub_add)]
565-
#[kani::stub(Big::sub, stub_sub)]
566547
#[kani::stub(Big::cmp, stub_cmp)]
567548
#[kani::stub(estimate_scaling_factor, stub_estimate_scaling_factor)]
568549
#[kani::stub(mul_pow10, stub_mul_pow10)]

0 commit comments

Comments
 (0)