Repository navigation
Conversation
Contributor
F* NFV audit: provedAudited head: Partial scope: proved 4 obligations on the bisection loop of execute_soft_after_unbounded (progress, invariant preservation, init, exit optimality) under stated monotonicity assumptions. Other changed functions excluded. Download the audit sources, report, and log from the run artifacts; no branch writes were attempted. F* modelmodule SoftBisect
(* Model of the bisection in opt::context::execute_soft_after_unbounded
(src/opt/opt_context.cpp @ 6723a0b). P c models "reaches_infinity succeeds
under cost <= c". Environment assumption: P is monotone (a looser cap cannot
lose unboundedness) and holds at the total weight (hi0), where the cap is
vacuous because cost <= sum of weights always. *)
let monotone (p: int -> bool) = forall (a b: int). a <= b /\ p a ==> p b
let mid (lo hi: int) : int = (lo + hi) / 2
let inv (p: int -> bool) (lo hi: int) =
0 <= lo /\ lo <= hi /\ p hi /\ (forall (c: int). c < lo ==> ~(p c))
let progress (lo hi: int) : Lemma (requires 0 <= lo /\ lo < hi)
(ensures lo <= mid lo hi /\ mid lo hi < hi) = ()
let step_true (p: int -> bool) (lo hi: int)
: Lemma (requires inv p lo hi /\ lo < hi /\ p (mid lo hi)) (ensures inv p lo (mid lo hi)) = ()
let step_false (p: int -> bool) (lo hi: int)
: Lemma (requires inv p lo hi /\ monotone p /\ lo < hi /\ ~(p (mid lo hi)))
(ensures inv p (mid lo hi + 1) hi) = ()
let init (p: int -> bool) (hi0: int)
: Lemma (requires 0 <= hi0 /\ p hi0 /\ (forall (c: int). c < 0 ==> ~(p c)))
(ensures inv p 0 hi0) = ()
let result (p: int -> bool) (lo hi: int)
: Lemma (requires inv p lo hi /\ lo = hi)
(ensures p lo /\ (forall (c: int). p c ==> lo <= c)) = ()
let rec loop (p: int -> bool) (lo hi: int) (fuel: nat)
: Pure (int & int) (requires inv p lo hi /\ monotone p)
(ensures (fun r -> inv p (fst r) (snd r)))
(decreases fuel)
= if lo < hi && fuel > 0 then begin
let m = mid lo hi in
if p m then loop p lo m (fuel - 1)
else loop p (m + 1) hi (fuel - 1)
end else (lo, hi)
This is a scoped semantic source audit, not mechanized verification of the C++ implementation or the entire PR. Generated by Fstar NFV PR audit. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11820.
Minimizing
efollowed byite(e = 1, 1, 3)returned-ooand[0, 1]. The upper bound of 1 came from an initial model withe = 1. That model cannot realize the first objective's unbounded direction. Optimize converted the second objective to MaxSMT and skipped it during lexicographic limit computation.The fix discards model-derived upper bounds for all remaining soft objectives when an earlier objective is unbounded. For each soft objective, it searches for the least penalty cap under which the earlier objective remains unbounded, using the existing unboundedness check. Rational weights determine a discrete cost grid. An exact penalty is committed before processing the next objective. If the round budget is exhausted, the reported interval retains all costs consistent with the probes.
The original input now returns
(e (* (- 1) oo))and a secondary objective of3.Validation
opt_boundssuite covers the reported real-valued ITE, objective and model getters, both optimization directions, fractional soft weights, a dependent third objective, and a zero-round budget.