Automatically construct an exact rational certificate
rationalize_certificate.RdRounds numerical witnesses at increasing safe resolutions, expands pattern weights to original columns, and calls the exact verifier.
Arguments
- M
Original binary matrix.
- target_num,target_den
Explicit integer target numerators and common denominator.
- feasibility
Solved unrestricted result from check_feasibility.
- tolerance
Positive tolerance, interpreted as its round-tripping decimal when representable within the integer cap.
Details
The exact certificate applies to the rational target supplied, not an unknown population proportion. Integer products are bounded by the existing 2^50 guard. If the required denominator is too large, no certificate is returned; arbitrary precision is not implemented. Resolution starts at 2^20, then 2^31, then the largest conservative safe integer if needed. If the tolerance cannot be represented by a round-tripping decimal within the integer cap (for example, 2^-30), a nonzero certificate bracket remains undecided; an exactly zero upper bound is decisive for any positive tolerance. Numerical ambiguity is not solver failure.
Value
An exact rational bracket with explicit integer witnesses and certificate status, or NULL if no safe witness can be constructed.
Examples
M <- diag(2); f <- check_feasibility(M,c(.5,.5)); rationalize_certificate(M,c(1,1),2,f)
#> $lower_num
#> [1] 0
#>
#> $lower_den
#> [1] 2097152
#>
#> $upper_num
#> [1] 0
#>
#> $upper_den
#> [1] 2097152
#>
#> $exact
#> [1] TRUE
#>
#> $lower
#> [1] 0
#>
#> $upper
#> [1] 0
#>
#> $weight_num
#> [1] 524288 524288
#>
#> $dual_num
#> [1] 0 0
#>
#> $dual_den
#> [1] 1048576
#>
#> $resolution
#> [1] 1048576
#>
#> $target_num
#> [1] 1 1
#>
#> $target_den
#> [1] 2
#>
#> $status
#> [1] "attainable_to_tolerance"
#>