Skip to content

ITreeLang & small examples#1

Open
petrosyh wants to merge 15 commits intodongjaelee1:mainfrom
petrosyh:vibe
Open

ITreeLang & small examples#1
petrosyh wants to merge 15 commits intodongjaelee1:mainfrom
petrosyh:vibe

Conversation

@petrosyh
Copy link
Copy Markdown
Collaborator

@petrosyh petrosyh commented Mar 3, 2026

No description provided.

Copy link
Copy Markdown
Owner

@dongjaelee1 dongjaelee1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a clear motivation behind some examples.
Otherwise LGTM

Comment thread src/tutorial/advanced_examples/cross_sts1.v
Comment thread src/tutorial/examples/Example4.v
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks Cross-STS sim idea in this file is cool, but I don't get the motivation behind this.
Probably merge Example5.v and Example7.v into a single file and come up with a better example that demonstrates Cross-STS technique, if you want to keep this idea in the tutorial.
But again, I don't see a clear motivation in keeping this idea in the tutorial.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivation is simple: sometimes users want to prove behavioral refinement between two semantics that are built on different underlying semantics styles (e.g., Imp vs. ITreeLang). For example, I’ve previously proved a simulation between a CompCert-style small-step semantics and an ITree-style semantics.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few thoughts.
If we are keeping this in the tutorial, we should make "Advance examples" directory and put this there,
because I think this technique is not strictly necessary for the purpose of tutorial (it feels much more specific and advanced).

If we decide to have "Advanced examples" directory and put this technique in there, we should devise a minimal yet motivating example for this technique.
Maybe something like a minimal version of CompCert-ITree simulation (simulation between low-level & high-level languages)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are keeping this in the tutorial, we should make "Advance examples" directory and put this there, because I think this technique is not strictly necessary for the purpose of tutorial (it feels much more specific and advanced).

I agree about this.

Maybe something like a minimal version of CompCert-ITree simulation (simulation between low-level & high-level languages)?

In my case, I proved a simulation between ITree-style Clight and CompCert-style Clight. Separately, I think it's important to separate concerns: changing the semantics style and proving an optimization pass are really two different proof obligations, so compilation proofs are more naturally done within a single semantics style.

If we decide to have "Advanced examples" directory and put this technique in there, we should devise a minimal yet motivating example for this technique.

That said, one could imagine an exercise where students do program logic reasoning on an ITree-style source language and then prove a compilation pass in CompCert-style semantics. But I worry that would be overkill for a tutorial — as you mentioned before, the semantic-style bridging alone is already nontrivial.

Copy link
Copy Markdown
Collaborator Author

@petrosyh petrosyh Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reorganized the directory structure — examples are now under tutorial/examples/ and cross-STS examples under tutorial/advanced_examples/. Let me know if you'd prefer a different layout.

Comment thread src/tutorial/advanced_examples/cross_sts2.v
Comment thread src/tutorial/ITreeLang.v
petrosyh and others added 11 commits March 5, 2026 22:55
Add handle_mem refinement proving ITree semantics with memory handled
refines the memory-silent Imp STS for all programs.

Proved:
- Memory handler (handle_mem) and all helper lemmas
- Continuation denotation (denote_cont) and denote_seq_cont
- aeval_handle_sim at 3 levels (paco4, _sim, gpaco4)
- Combined STS (X_STS) and handled ITree STS
- CSkip, CAsgn (with kont dispatch), CSeq cases fully

Remaining (Admitted):
- CIf, CWhile, CRet, CMemLoad, CMemStore, CExternal cases
- Blocking issue: sim_progress needs ps=true, but aeval_handle_sim'
  may leave ps'=false for deterministic expressions (ANum, AId)
- Fix: destruct ps' + kont dispatch for false case

Also: added tau;; to denote_com CSeq to ensure source progress.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Reverted the tau;; added to denote_com CSeq (keeps original semantics)
- Added com_size measure and well-founded induction (lt_wf_ind) to handle
  CSeq chains without requiring source progress
- CSkip, CAsgn, CSeq, CIf cases structurally complete (with admits for
  Step_silent_undefined subcases where source UB needs to be shown)
- Key pattern: gstep at top, aeval_handle_sim' for expressions,
  IHsz for CSeq (smaller command), econs 6 + gfinal.left for CIH
- Remaining: CWhile iter unfolding, CRet, CMemLoad/Store, CExternal
  need individual MCP debugging for bind structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Key discoveries:
- gstep at top + IHsz (well-founded induction) for CSeq chains
- kont_dispatch tactic for Kstop (UB) / Kseq (tau + ES_Skip) dispatch
- aeval_handle_sim' for expression eval inside _sim
- CWhile WhileTrue: replace continuation with denote_cont via func_ext_dep
- No tau;; added to denote_com CSeq (original semantics preserved)

Still Admitted - remaining cases need bind structure debugging:
- CMemLoad, CMemStore, CExternal bind/norm patterns
- Step_silent_undefined subcases (source UB proof)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Reverted tau;; from denote_com CSeq
- Added no_aeval_sim: if aeval doesn't hold, source reaches UB
- Main theorem proof structure complete but Admitted
- Remaining: CMemLoad/CExternal bind normalization issues

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants