Switch steps to not redundantly include code

This commit is contained in:
2026-10-06 19:30:35 -05:00
parent 234d17394e
commit 655b7de684
2 changed files with 24 additions and 23 deletions

View File

@@ -186,27 +186,28 @@ instance {g : Graph} {idx₁ idx₂ : g.Index} {ρ₁ ρ₂ ρ₃ : Env} :
HAppend (Traceₗ g idx₁ idx₂ ρ₁ ρ₂) (EvalBasicStmtOpt ρ₂ (g.nodes idx₂) ρ₃)
(Trace g idx₁ idx₂ ρ₁ ρ₃) := ⟨Traceₗ.appendStep⟩
/-- The (index, statement) pairs executed by a single optional-statement step. -/
/-- The node executed by an optional-statement step; empty nodes are omitted. -/
def EvalBasicStmtOpt.steps {α : Type*} (idx : α) {ρ₁ ρ₂ : Env} {obs : Option BasicStmt} :
EvalBasicStmtOpt ρ₁ obs ρ₂ → List (α × BasicStmt)
EvalBasicStmtOpt ρ₁ obs ρ₂ → List α
| .none => []
| .some (bs := bs) _ => [(idx, bs)]
| .some _ => [idx]
def Step.steps {g : Graph} {a b : Configuration g} : Step g a b → List (g.Index × BasicStmt)
def Step.steps {g : Graph} {a b : Configuration g} : Step g a b → List g.Index
| .execute (i := i) h => h.steps i
| .edge _ => []
/-- Executed statements in chronological order; edges and empty nodes contribute nothing. -/
def Path.steps {g : Graph} {a b : Configuration g} : Path g a b → List (g.Index × BasicStmt)
/-- Executed nodes in chronological order; edges and empty nodes contribute nothing.
The instruction at each node is given by `g.nodes`, rather than copied into the history. -/
def Path.steps {g : Graph} {a b : Configuration g} : Path g a b → List g.Index
| .nil => []
| .cons s p => s.steps ++ p.steps
abbrev Trace.steps {g : Graph} {i j : g.Index} {ρ₁ ρ₂ : Env}
(p : Trace g i j ρ₁ ρ₂) : List (g.Index × BasicStmt) := Path.steps p
(p : Trace g i j ρ₁ ρ₂) : List g.Index := Path.steps p
abbrev Traceₗ.steps {g : Graph} {i j : g.Index} {ρ₁ ρ₂ : Env}
(p : Traceₗ g i j ρ₁ ρ₂) : List (g.Index × BasicStmt) := Path.steps p
(p : Traceₗ g i j ρ₁ ρ₂) : List g.Index := Path.steps p
abbrev Traceᵣ.steps {g : Graph} {i j : g.Index} {ρ₁ ρ₂ : Env}
(p : Traceᵣ g i j ρ₁ ρ₂) : List (g.Index × BasicStmt) := Path.steps p
(p : Traceᵣ g i j ρ₁ ρ₂) : List g.Index := Path.steps p
@[simp] lemma Path.steps_append {g : Graph} {a b c : Configuration g}
(p : Path g a b) (q : Path g b c) :