Introduce a finite-height lattice instance for Bool, then build the
reaching-definitions analysis on top of the forward framework:
* Spa/Lattice/Bool.lean: FiniteHeightLattice Bool (the two-element
lattice false ≤ true), making FiniteMap A Bool ks a finite-height
"power set" lattice for free.
* Spa/Analysis/Reaching.lean: DefSet prog = FiniteMap prog.State Bool
prog.states as the per-variable lattice of definition sites, with a
StmtEvaluator whose transfer function performs a strong update
(assignment to k at node s sets k's def-set to {s}).
The analysis computes a least fixed point and produces correct
reaching-definitions sets. Soundness (relating def-sets to actual
execution provenance) is deferred; not yet exposed in Spa.lean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
653 B
Lean4
25 lines
653 B
Lean4
import Spa.Lattice
|
|
import Spa.Fixedpoint
|
|
import Spa.Isomorphism
|
|
import Spa.Lattice.Unit
|
|
import Spa.Lattice.Prod
|
|
import Spa.Lattice.AboveBelow
|
|
import Spa.Lattice.IterProd
|
|
import Spa.Lattice.FiniteMap
|
|
import Spa.Lattice.Bool
|
|
import Spa.Language.Base
|
|
import Spa.Language.Notation
|
|
import Spa.Language.Semantics
|
|
import Spa.Language.Graphs
|
|
import Spa.Language.Traces
|
|
import Spa.Language.Properties
|
|
import Spa.Language
|
|
import Spa.Analysis.Forward.Lattices
|
|
import Spa.Analysis.Forward.Evaluation
|
|
import Spa.Analysis.Forward.Adapters
|
|
import Spa.Analysis.Forward
|
|
import Spa.Showable
|
|
import Spa.Analysis.Utils
|
|
import Spa.Analysis.Sign
|
|
import Spa.Analysis.Constant
|