Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
fae1183
feat: small-step CFG infrastructure for forward-simulation proof
PROgram52bc Jun 8, 2026
c81249b
feat: structured-to-unstructured forward soundness for simple-shape p…
PROgram52bc Jun 8, 2026
187a819
wip: skeleton for loop extension (no invs, no measures, no body inits)
PROgram52bc Jun 9, 2026
4979a64
wip(pause): v3 inline loop-arm — mid-implementation checkpoint
PROgram52bc Jun 9, 2026
aac90d5
wip(checkpoint): rewrite loop_det_decompose_h_gen to v3 translator sh…
PROgram52bc Jun 10, 2026
8e36e96
wip(checkpoint): add ReflTransT structured peeling helpers (seqT/stmt…
PROgram52bc Jun 10, 2026
88eb4d4
wip(checkpoint): add loop_iterations_det + peel_off_one_iteration_det…
PROgram52bc Jun 10, 2026
55f8180
wip(checkpoint): add loop_iterations_to_cont_det helper (exit variant…
PROgram52bc Jun 10, 2026
f4b690e
wip(checkpoint): strengthen loop_iterations_det with freshVars preser…
PROgram52bc Jun 10, 2026
e583ce7
wip(checkpoint): close stmtsToBlocks_simulation .loop arm inline (ter…
PROgram52bc Jun 10, 2026
0762a29
feat: close both .loop arm sorries inline (terminal + _to_cont); 0 so…
PROgram52bc Jun 10, 2026
bfcc6b1
docs: add loop-extension-v3 design document
PROgram52bc Jun 10, 2026
346a9cf
simplify(1): unused-simp-nil-append — drop never-firing List.nil_appe…
PROgram52bc Jun 10, 2026
016669e
simplify(1): unused-simp-statet-pure — drop never-firing StateT.pure …
PROgram52bc Jun 10, 2026
80554c1
simplify(1): unused-simp-singleton-append — drop never-firing List.si…
PROgram52bc Jun 10, 2026
706b977
simplify(2): dead-stmtsToCFG-exiting-cluster — delete unused stmtsToC…
PROgram52bc Jun 10, 2026
3e69ca2
simplify(2): dead-have-h-x-not-then-5553 — drop unused h_x_not_then i…
PROgram52bc Jun 10, 2026
83bb962
simplify(2): dead-stmt-{noMeasureLoops-loop-measure,simpleShape-block…
PROgram52bc Jun 10, 2026
6c3e42a
simplify(3): h-eval-loop-termmode — drop by/have/exact-this wrapper o…
PROgram52bc Jun 10, 2026
ca12238
simplify(3): have-exact-this-2566 — inline h_shape_lentry to single term
PROgram52bc Jun 10, 2026
1a86b94
simplify(4): unique-combined-ite-triple — merge then/else/rest projec…
PROgram52bc Jun 10, 2026
d8c98ae
simplify(4): fresh-body-vs-rest-inits-mirror — merge mirror pair into…
PROgram52bc Jun 10, 2026
661e901
fix(ci): align goto metadata with infra base (no default arg)
PROgram52bc Jun 10, 2026
ab2097a
simplify(4): loop_iterations_det-dead-{h_body_no_inits,hwfv_pre,hwfva…
PROgram52bc Jun 11, 2026
5b2a5ce
simplify(4): h-combined-no-gen-suffix-get — drop dead getVars NoGenSu…
PROgram52bc Jun 11, 2026
8d9ac2c
simplify(5): merge condGoto true/false helper pairs + bundle ite bran…
PROgram52bc Jun 11, 2026
64c2e00
simplify(6): extract invMapM_genStep (dedup 4 loop-arm sites) + golf …
PROgram52bc Jun 11, 2026
64c7be7
docs: fix stale comments (merged-lemma refs, required-md notation, dr…
PROgram52bc Jun 11, 2026
d93789e
hygiene: tighten maxRecDepth, drop dead linter suppressions + unused …
PROgram52bc Jun 12, 2026
5943c93
hoist-port Step 0: add base-lib helpers + DetToKleene visibility flip
PROgram52bc Jun 15, 2026
9f95e92
hoist-port Step 1: add 18 LoopInitHoist files + StringGen helpers
PROgram52bc Jun 15, 2026
66b9c83
pipeline Phase 1: drop in nondetElim pass on hoist foundation
PROgram52bc Jun 15, 2026
7d553a4
phase2-bridge: add PipelineBridge with direction-A structural preconds
PROgram52bc Jun 15, 2026
1e59913
phase2-bridge: add direction-B structural preconds + hoist simpleShap…
PROgram52bc Jun 15, 2026
792f69f
phase2-bridge: store-condition helpers + composition-obstruction reco…
PROgram52bc Jun 15, 2026
df752b0
StringGen kind-contract: per-prefix membership witnesses
PROgram52bc Jun 15, 2026
68ad1be
nondetElim: generalize simulation over a label-kind predicate Q
PROgram52bc Jun 15, 2026
7f2b0ce
phase2-hoist: generalize LoopInitHoistRewrite over label-kind Q
PROgram52bc Jun 15, 2026
9b7c916
phase2-hoist: generalize LoopInitHoistLoopDriver over label-kind Q
PROgram52bc Jun 15, 2026
258b3bd
phase2-hoist: generalize LoopInitHoistLoopArmWF over label-kind Q
PROgram52bc Jun 15, 2026
23fbf72
phase2-hoist: retarget LoopInitHoistCorrect to Q-parameterized ArmWF …
PROgram52bc Jun 15, 2026
f35a0e4
phase2-hoist: thread LoopArmWF WF classification family over label-ki…
PROgram52bc Jun 15, 2026
a19e944
phase2-hoist: generalize LoopInitHoistCorrect over label-kind Q; add …
PROgram52bc Jun 15, 2026
0472d65
phase3-s2u: generalize S2U correctness over label-kind Q
PROgram52bc Jun 15, 2026
9d1ca9c
phase3-s2u: add s2uKind label-kind + structuredToUnstructured_sound_kind
PROgram52bc Jun 15, 2026
e641367
phase3b1-s2u: extend s2uKind to all 13 mint prefixes
PROgram52bc Jun 15, 2026
46ede78
phase3b2-s2u: add AllGenPrefix pass-tracking lemmas
PROgram52bc Jun 15, 2026
4416dc8
phase3b4-s2u: self-discharge foreign-label obligation; drop h_wf_foreign
PROgram52bc Jun 15, 2026
1cdf77c
phase4.1-bridge: cross-pass foreignness of minted names
PROgram52bc Jun 15, 2026
5d048a7
phase4.2-A: ndelim->s2u foreignness + nondetElim output name classifi…
PROgram52bc Jun 15, 2026
1f5ad52
phase4.2-A: nondetElim output uniqueInits via window-tracked classifi…
PROgram52bc Jun 15, 2026
7d387ee
phase4: close the structured-to-unstructured pipeline chain
PROgram52bc Jun 15, 2026
155463f
cleanup: remove detached axiom-audit files
PROgram52bc Jun 15, 2026
bbb54ca
optimize signature
PROgram52bc Jun 15, 2026
9ec88cf
cleanup: trim redundant simp arg in nondetElimM_hoistedNamesFreshInGu…
PROgram52bc Jun 15, 2026
b6969e2
cleanup: doc hygiene — drop ephemeral resolution phrasing + uncommitt…
PROgram52bc Jun 16, 2026
f5084b5
cleanup: remove dead lemmas from StringGen (append-eq/reverse utils, …
PROgram52bc Jun 16, 2026
d1432e3
cleanup: remove dead genStep_label_mem_or_suffix + SrcNamesFreshFromG…
PROgram52bc Jun 16, 2026
e04439f
cleanup: remove dead liftInitsInLoopBody_no_inits wrappers + namesFre…
PROgram52bc Jun 16, 2026
a11724d
cleanup: remove dead prelude_bridge_list_md + bridge_out_nested_union…
PROgram52bc Jun 16, 2026
987a1e3
cleanup: remove dead nondetElim_loopMeasureNone + Section 5 store_cle…
PROgram52bc Jun 16, 2026
c5c31a6
cleanup: remove dead Step-7 preservation wrappers + cascade privates …
PROgram52bc Jun 16, 2026
51acbd7
cleanup: remove dead hoistedNamesFreshInRhsAndGuards preservation cha…
PROgram52bc Jun 16, 2026
bdcd610
cleanup: collapse s2uKind_gen conclusion + hQmint type onto S2UMintWi…
PROgram52bc Jun 16, 2026
6dd2741
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
fb7baf2
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
26d1b1f
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
70ee126
cleanup: remove unused-section-variable + simp/var warnings (Pipeline…
PROgram52bc Jun 16, 2026
1f59e86
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
a8ab778
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
e65b639
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
7d2bd91
cleanup: remove unused-section-variable + simp/var warnings (Structur…
PROgram52bc Jun 16, 2026
63764de
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
e2fcb05
cleanup: remove unused-section-variable + simp/var warnings (LoopInit…
PROgram52bc Jun 16, 2026
02bb479
cleanup: remove cross-rebuild-revealed section-variable warnings (Loo…
PROgram52bc Jun 16, 2026
b2ec42d
cleanup: remove cross-rebuild-revealed section-variable warnings (Loo…
PROgram52bc Jun 16, 2026
1fe053a
cleanup: clear remaining mutual-block section-variable warnings
PROgram52bc Jun 16, 2026
4bef11c
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
0b3c86b
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
7145c67
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
8429675
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
3609c49
cleanup: thread eval-machinery instances through stepB_bodySim_of_lif…
PROgram52bc Jun 16, 2026
6ec3f6d
cleanup: thread eval-machinery instances through loop_arm_close (Loop…
PROgram52bc Jun 16, 2026
3c1b1c6
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
52fad12
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
5ad39ef
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
eedcb4b
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
b0f12e4
cleanup: explicit per-decl typeclass instances, remove section-variab…
PROgram52bc Jun 16, 2026
804f099
relax pipeline_sound: eliminate h_hf₀, generalize entry failure flag
PROgram52bc Jun 17, 2026
59b301c
relax pipeline_sound: weaken h_store_clean to source-inits + minted-k…
PROgram52bc Jun 17, 2026
190fb1b
relax pipeline_sound: weaken h_disj to gen-free userLabelsShapeNodup
PROgram52bc Jun 17, 2026
cc6e8d6
phase1-noexit: corrected exit-clause feasibility probe (GO, sorry-free)
PROgram52bc Jun 17, 2026
748ee0e
phase2-noexit: sum-typed exiting-target two-guard driver (build-green…
PROgram52bc Jun 17, 2026
c3dde23
phase3a-noexit: sum-typed provider vocabulary + terminal/renamed-guar…
PROgram52bc Jun 17, 2026
d3c3896
phase3b-noexit: every BodyTransport arm's sum-typed StmtSimES proven …
PROgram52bc Jun 17, 2026
0d8c37c
phase3-noexit: record Phase-3 verdict + scope correction in scratch
PROgram52bc Jun 17, 2026
60709c2
phase4-noexit: record Phase-4 feasibility verdict (feasible-not-compl…
PROgram52bc Jun 17, 2026
c43de9d
phase1-noexit: BodyTransport produces sum-typed BodySimES (admits .exit)
PROgram52bc Jun 17, 2026
83db5a1
phase2-noexit: sum-type union-carrier driver + rewire loop_arm_close
PROgram52bc Jun 17, 2026
eda5afa
phase3-noexit: rewire §E .loop arm to the sum-typed driver (drop h_sr…
PROgram52bc Jun 17, 2026
aef322e
phase4-noexit: drop h_noexit from pipeline_sound + the hoist mutual c…
PROgram52bc Jun 17, 2026
1099085
cleanup: drop never-imported noexit design-record scratch file
PROgram52bc Jun 18, 2026
975ddd1
remove dead terminal-only driver + Step-B provider clusters (R1+R2)
PROgram52bc Jun 18, 2026
025d20f
remove dead Contains/LoopArmWF clusters (R3+R4)
PROgram52bc Jun 18, 2026
6c3414a
remove dead S2U/StringGen/NondetElim remnants (R5+R6)
PROgram52bc Jun 18, 2026
886edbc
remove dead noExit defs + stale section header (R7 cascade)
PROgram52bc Jun 18, 2026
8da5b02
remove dead suffix-route remnant (R8)
PROgram52bc Jun 18, 2026
64cde01
audit: tighten pipeline_sound hypotheses (-6 hyps, net -2 LoC)
PROgram52bc Jun 18, 2026
538727c
comment pass (noexit-stack): drop dangling refs to deleted terminal-o…
PROgram52bc Jun 18, 2026
94836d0
comment pass (hoist-core): drop dead noExit/compose_union refs, fix t…
PROgram52bc Jun 18, 2026
fd3636d
comment pass (s2u/nondet/stringgen): repoint deleted sound-blanket re…
PROgram52bc Jun 18, 2026
034fdf1
comment pass (pipeline-bridge): fix stale precondition list, repoint …
PROgram52bc Jun 18, 2026
d76b555
rename live OptE files to descriptive names
PROgram52bc Jun 18, 2026
0f5f6f5
Q1a: restate hoist initVars/modVars shapefree hyps as NoGenSuffix
PROgram52bc Jun 22, 2026
29b6480
remove hoistedNamesFreshInGuards from pipeline precondition
PROgram52bc Jun 22, 2026
3e0fd51
add CFG Lang instance for refinement vocabulary
PROgram52bc Jun 22, 2026
b4ef4fb
restate pipeline_sound as OverapproximatesAllowingExtraVars refinement
PROgram52bc Jun 22, 2026
72a7e02
exit-sim spike: prove pipeline_no_escaping_exit covered-exit no-escape
PROgram52bc Jun 22, 2026
866ff1c
relocate NoGenSuffix to a base module for cheap reuse
PROgram52bc Jun 22, 2026
21b4e10
flip NoGenSuffix to kind-first shape
PROgram52bc Jun 23, 2026
08bd16f
restate exprsShapeFree leaves via NoGenSuffix
PROgram52bc Jun 23, 2026
9b5c2fd
unify store-undefinedness hyps under NoGenStore; split h_store_mints …
PROgram52bc Jun 23, 2026
5ef91dc
drop unused noGenSuffix_iff_membFirst bridge
PROgram52bc Jun 23, 2026
2f6df7b
add CFGConfig .exiting outcome + StepCFG exit rule + emitter fix
PROgram52bc Jun 23, 2026
7e1f988
S2U: exiting simulation lemmas + top-level exiting soundness
PROgram52bc Jun 23, 2026
54fd9be
surface banked exiting drivers for nondetElim + hoist passes (new sig…
PROgram52bc Jun 23, 2026
97c1735
pipeline_sound: thread dual terminal-OR-exiting conclusion
PROgram52bc Jun 23, 2026
dbaf3a6
CFGSemantics: stuck-config lemmas for terminal/exiting halts
PROgram52bc Jun 23, 2026
43e0c90
Lang.cfg.exitingCfg: use the real .exiting config
PROgram52bc Jun 23, 2026
f33d67e
pipeline_overapproximates non-vacuous exiting clause, drop h_noesc
PROgram52bc Jun 23, 2026
feb391c
fix stale pipeline_no_escaping_exit docstring
PROgram52bc Jun 23, 2026
98c03d7
state pipeline_overapproximates via OverapproximatesAllowingExtraVars…
PROgram52bc Jun 23, 2026
6d97186
relocate userBlockLabels + userLabelsShapeNodup to a base module
PROgram52bc Jun 23, 2026
c4040fa
fold userLabelsShapeNodup into WFProcedureProp
PROgram52bc Jun 23, 2026
f637f1d
WFProcedureProp: project userLabelsShapeNodup as a derivation lemma
PROgram52bc Jun 23, 2026
96db998
WF Stage 2: rewire pipeline_sound to source-side userLabelsShapeNodup
PROgram52bc Jun 23, 2026
93a6b31
compositional Track A: prove pipeline_sound_terminal_compositional (o…
PROgram52bc Jun 24, 2026
e77c8cf
compositional Track B: target-shape (domain) guarantee on the CFG out…
PROgram52bc Jun 24, 2026
2900503
CanFail preservation through the pipeline (conditional on a source en…
PROgram52bc Jun 23, 2026
c849b64
import CanFailPreservation into Strata lib
PROgram52bc Jun 24, 2026
8ed9147
env-lifted StoreAgreement preorder
PROgram52bc Jun 24, 2026
bf067cb
extend Lang with InitEnvWFParamsTy + initEnvWF (Unit/True defaults)
PROgram52bc Jun 24, 2026
3e25d30
port OverapproximatesUpto family + consumer lemmas
PROgram52bc Jun 24, 2026
ca78805
custom source initEnvWF carrying rho0-dependent pipeline preconditions
PROgram52bc Jun 24, 2026
17f5446
Stage 1: bring the validated _to_fail halting-condition infra onto th…
PROgram52bc Jun 25, 2026
dde08b8
Stage 2 (partial): add stmts_cons_reaches_failing' decomposition prim…
PROgram52bc Jun 25, 2026
4b41304
Stage 2: stmtsToBlocks_simulation_to_fail mutual sibling (failing-con…
PROgram52bc Jun 25, 2026
a4585f8
Stage 3a: top-level S2U _to_fail corollaries (stmtsToCFG_to_fail + ki…
PROgram52bc Jun 25, 2026
19f2e3c
Stage 3b: pipeline_to_fail + exiting-compositional infra
PROgram52bc Jun 25, 2026
01c62f3
Stage 3b + Phase 4: canFail_pipeline + pipeline_overapproximates_upto
PROgram52bc Jun 25, 2026
b1ba4fe
nondetElim_to_fail: failing-config simulation sibling
PROgram52bc Jun 25, 2026
2944bb7
loop driver: failing-config fuel recursion loopDet_lift_sf_2g_undef_F…
PROgram52bc Jun 25, 2026
96ddf08
loop driver: raw + renamed-guard failing-target wrappers
PROgram52bc Jun 25, 2026
b8c8e02
StepBProvider: failing-config body sim vocabulary (BodySimFail/StmtSi…
PROgram52bc Jun 25, 2026
91fd974
StepBProvider: remaining failing-config StmtSimFail producers
PROgram52bc Jun 25, 2026
65fb594
BodyTransport: failing-config body transport (bodyTransport_to_fail)
PROgram52bc Jun 25, 2026
12ffa22
failing-config step-B composition + lift providers
PROgram52bc Jun 25, 2026
062935c
LoopArmWF: failing-config loop arm closer (loop_arm_close_fail)
PROgram52bc Jun 25, 2026
6848eb0
hoist_to_fail: failing-config simulation sibling for the loop-init hoist
PROgram52bc Jun 25, 2026
47922fa
discharge StructuredPassFailingBridge: unconditional CanFail + Upto i…
PROgram52bc Jun 25, 2026
57961a6
PipelineEnvRel preorder + linter cleanup
PROgram52bc Jun 25, 2026
1c7fdd6
document Upto-vs-extra-vars relationship; drop unused simp args
PROgram52bc Jun 25, 2026
da3e04e
retire legacy pipeline_overapproximates; Upto instance is the sole st…
PROgram52bc Jun 25, 2026
ed671f7
build-verified cleanup of the pipeline proof cluster (-217 LoC)
PROgram52bc Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ A JDK (11+) providing `javac` must be on your `PATH`. For running the
Java/Ion integration test, download the ion-java jar:

```bash
wget -q -O StrataTestExtra/Languages/Java/testdata/ion-java-1.11.11.jar \
wget -q -O StrataTestExtra/DDM/Integration/Java/testdata/ion-java-1.11.11.jar \
https://github.com/amazon-ion/ion-java/releases/download/v1.11.11/ion-java-1.11.11.jar
```

Expand Down
4 changes: 4 additions & 0 deletions Strata.lean
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ import Strata.Languages.Laurel.LaurelCompilationPipeline

/- Code Transforms -/
import Strata.Transform.CallElimCorrect
import Strata.Transform.CanFailPreservation
import Strata.Transform.CoreSpecification
import Strata.Transform.DetToKleeneCorrect
import Strata.Transform.PipelineBridge
import Strata.Transform.ProcBodyVerifyCorrect
import Strata.Transform.StructuredToUnstructuredCorrect

/- Strata Languages — additional -/
import Strata.Languages.B3
Expand All @@ -59,6 +62,7 @@ import Strata.DL.SMT.FactoryCorrect
import Strata.DL.SMT.Translate

/- Code Transforms — additional -/
import Strata.Transform.GenSuffix
import Strata.Transform.StructuredToUnstructured

/- Other -/
Expand Down
37 changes: 32 additions & 5 deletions Strata/DL/Imperative/BasicBlock.lean
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,30 @@ where `n` is the total number of blocks in the graph.
where execution should proceed next, if anywhere. -/
inductive DetTransferCmd (Label : Type) (P : PureExpr) where
/-- Transfer to `lt` if `p` is true, or `lf` is `p` is false. -/
| condGoto (p : P.Expr) (lt lf : Label) (md : MetaData P := .empty)
| condGoto (p : P.Expr) (lt lf : Label) (md : MetaData P)
/-- Stop execution of the current unstructured program. If in a procedure
body, this can be interpreted as returning to the caller. -/
| finish (md : MetaData P := .empty)
| finish (md : MetaData P)
/-- Escape the current unstructured program by an uncaught structured exit
to `lbl`. Unlike `finish` (a normal return), this records that control
left the program via an exit that no enclosing block caught, preserving
the escaping label so the outcome kind is observable on the target side. -/
| exitTo (lbl : Label) (md : MetaData P)

/-- For the moment, we don't have an unconditional jump in the language, and
model it instead using `condGoto`. By defining this function, we can easily
create unconditional jumps, and future proof against the possibility of adding
it as a constructor in the future. -/
def DetTransferCmd.goto [HasBool P] (l : Label) : DetTransferCmd Label P :=
condGoto HasBool.tt l l
@[expose] def DetTransferCmd.goto [HasBool P] (l : Label) (md : MetaData P) : DetTransferCmd Label P :=
condGoto HasBool.tt l l md

/-- A `NondetTransfer` command terminates a non-deterministic basic block,
indicating the list of possible blocks where execution could proceed next, if
anywhere. -/
inductive NondetTransferCmd (Label : Type) (P : PureExpr) where
/-- Transfer to any one of a list of labels, non-deterministically. `goto`
with no labels is equivalent to `finish` in `DetTransferCmd` -/
| goto (ls : List Label) (md : MetaData P := .empty)
| goto (ls : List Label) (md : MetaData P)
deriving Inhabited

def NondetTransferCmd.targets : NondetTransferCmd Label P → List Label
Expand Down Expand Up @@ -79,13 +84,35 @@ structure CFG (Label Block : Type) where

--------

/-- Strip metadata from a deterministic transfer command. -/
def DetTransferCmd.stripMetaData : DetTransferCmd Label P → DetTransferCmd Label P
| .condGoto p lt lf _ => .condGoto p lt lf .empty
| .finish _ => .finish .empty
| .exitTo lbl _ => .exitTo lbl .empty

/-- Strip metadata from a non-deterministic transfer command. -/
def NondetTransferCmd.stripMetaData : NondetTransferCmd Label P → NondetTransferCmd Label P
| .goto ls _ => .goto ls .empty

/-- Strip transfer metadata from a deterministic basic block. -/
def DetBlock.stripMetaData (blk : DetBlock Label Cmd P) : DetBlock Label Cmd P :=
{ blk with transfer := blk.transfer.stripMetaData }

/-- Strip transfer metadata from all blocks in a deterministic CFG. -/
def CFG.stripDetMetaData (cfg : CFG Label (DetBlock Label Cmd P)) :
CFG Label (DetBlock Label Cmd P) :=
{ cfg with blocks := cfg.blocks.map fun (lbl, blk) => (lbl, blk.stripMetaData) }

--------

open Std (ToFormat Format format)

def formatDetTransferCmd (P : PureExpr) (c : DetTransferCmd Label P)
[ToFormat Label] [ToFormat P.Ident] [ToFormat P.Expr] [ToFormat P.Ty] : Format :=
match c with
| .condGoto c lt lf md => f!"{md}condGoto {c} {lt} {lf}"
| .finish md => f!"{md}finish"
| .exitTo lbl md => f!"{md}exitTo {lbl}"

def formatNondetTransferCmd (P : PureExpr) (c : NondetTransferCmd Label P)
[ToFormat Label] [ToFormat P.Ident] [ToFormat P.Expr] [ToFormat P.Ty] : Format :=
Expand Down
Loading
Loading