Turn buildCfg into a method

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2026-06-25 09:45:30 -05:00
parent 341a0b80b4
commit c4e5747b6d
4 changed files with 21 additions and 21 deletions

View File

@@ -167,10 +167,10 @@ export GGraph (comp link loop skipto singleton wrap loop_inputs loop_outputs)
end Graph
open Graph in
def buildCfg : Stmt Graph
def Stmt.cfg : Stmt Graph
| .basic bs => singleton [bs]
| .andThen s₁ s₂ => buildCfg s₁ buildCfg s₂
| .ifElse _ s₁ s₂ => buildCfg s₁ buildCfg s₂
| .whileLoop _ s => loop (buildCfg s)
| .andThen s₁ s₂ => s₁.cfg s₂.cfg
| .ifElse _ s₁ s₂ => s₁.cfg s₂.cfg
| .whileLoop _ s => loop s.cfg
end Spa

View File

@@ -174,8 +174,8 @@ theorem EndToEndTrace.wrap {g : Graph} {ρ₁ ρ₂ : Env}
(etr : EndToEndTrace g ρ₁ ρ₂) : EndToEndTrace (Graph.wrap g) ρ₁ ρ₂ :=
(EndToEndTrace.singleton_nil ρ₁).concat (etr.concat (EndToEndTrace.singleton_nil ρ₂))
theorem buildCfg_sufficient {s : Stmt} {ρ₁ ρ₂ : Env}
(h : EvalStmt ρ₁ s ρ₂) : EndToEndTrace (buildCfg s) ρ₁ ρ₂ := by
theorem Stmt.cfg_sufficient {s : Stmt} {ρ₁ ρ₂ : Env}
(h : EvalStmt ρ₁ s ρ₂) : EndToEndTrace s.cfg ρ₁ ρ₂ := by
induction h with
| basic ρ₁ ρ₂ bs hbs =>
exact EndToEndTrace.singleton (EvalBasicStmts.cons hbs EvalBasicStmts.nil)