Theory Voblint_Solver.Solver_Trace
theory Solver_Trace
imports Globals_Rule
begin
section ‹A solver trace inside the exported code›
text ‹The vendored interface hides the solver's state fields (‹TD_side_Interface›).
The traced equations below restate the solver's own terms, so this theory names
those fields again, as input abbreviations of the hidden constants.›
abbreviation (input) point where "point ≡ TD_side_upd_rule.state.point"
abbreviation (input) point_update where "point_update ≡ TD_side_upd_rule.state.point_update"
abbreviation (input) σ where "σ ≡ TD_side.state.σ"
abbreviation (input) σ_update where "σ_update ≡ TD_side.state.σ_update"
text ‹
The executable solver can report its steps. ‹trace_event› is the identity on
the logic's side: it takes a channel name and a suspended event and returns
‹()›, so every equation below is proved equal to the untraced one by
unfolding it. Code export maps the constant to a target-language hook
(‹Trace_Run›); the hook forces the suspension only when tracing is on, so an
untraced run never builds an event. The Eval target keeps the equation, so
proofs by evaluation run the same code without any hook.
The traced solver is a copy of the vendored solver's executable functions
under new constants, each defined as the function it copies and given the
traced equation as its code equation. The vendored functions keep their own
code equations, so a caller that names them runs no hook; only a caller that
names the traced constants reports events.
›
definition trace_event :: "String.literal ⇒ (unit ⇒ 'e) ⇒ unit" where
"trace_event channel e = ()"
text ‹
One event per solver step that Goblint's tracing of its top-down solvers
reports (@{url "https://github.com/goblint/analyzer/blob/master/src/solver/td_simplified.ml"},
@{url "https://github.com/goblint/analyzer/blob/master/src/solver/td3.ml"}), plus two with
no counterpart there:
‹Ev_Rhs›, the value a right-hand side returns, and the start and end of one
solve, and ‹Ev_Wpoint_Clear›, an iteration of an already stable unknown
dropping it from the widening points. A local unknown is ‹'x›, a global one
‹'g›, a value ‹'d›. Booleans are
the solver's own sets read at the step: ‹called›, ‹stabl›, and ‹point›, the
widening points, and whether an old value is ‹⊥›.
›