Proof step and variable lemmas

1. no writes = save value
2. embedding commutation with steps
3. all variables in code end up in the set of vars
This commit is contained in:
2026-10-06 20:09:08 -05:00
parent f55a440784
commit cfcd3948a3
4 changed files with 141 additions and 30 deletions

View File

@@ -186,14 +186,12 @@ instance {g : Graph} {idx₁ idx₂ : g.Index} {ρ₁ ρ₂ ρ₃ : Env} :
HAppend (Traceₗ g idx₁ idx₂ ρ₁ ρ₂) (EvalBasicStmtOpt ρ₂ (g.nodes idx₂) ρ₃)
(Trace g idx₁ idx₂ ρ₁ ρ₃) := ⟨Traceₗ.appendStep⟩
/-- The node executed by an optional-statement step; empty nodes are omitted. -/
def EvalBasicStmtOpt.steps {α : Type*} (idx : α) {ρ₁ ρ₂ : Env} {obs : Option BasicStmt} :
EvalBasicStmtOpt ρ₁ obs ρ₂ → List α
| .none => []
| .some _ => [idx]
/-- The nonempty node executed by this step; edges and empty nodes are omitted. -/
def Step.steps {g : Graph} {a b : Configuration g} : Step g a b → List g.Index
| .execute (i := i) h => h.steps i
| .execute (i := i) _ =>
match g.nodes i with
| none => []
| some _ => [i]
| .edge _ => []
/-- Executed nodes in chronological order; edges and empty nodes contribute nothing.
@@ -217,7 +215,7 @@ abbrev Traceᵣ.steps {g : Graph} {i j : g.Index} {ρ₁ ρ₂ : Env}
@[simp] lemma Traceₗ.steps_appendStep {g : Graph} {idx₁ idx₂ : g.Index}
{ρ₁ ρ₂ ρ₃ : Env} (tr : Traceₗ g idx₁ idx₂ ρ₁ ρ₂)
(hbs : EvalBasicStmtOpt ρ₂ (g.nodes idx₂) ρ₃) :
(tr ++ hbs).steps = tr.steps ++ hbs.steps idx₂ := by
(tr ++ hbs).steps = tr.steps ++ (Step.execute hbs).steps := by
change Path.steps (Path.append tr (Path.single (.execute hbs))) = _
aesop (add simp [Trace.steps, Traceₗ.steps, Path.single, Path.steps, Step.steps])