Skip to content

Make Texan triples persistent - #568

Open
suhr wants to merge 4 commits into
leanprover-community:masterfrom
suhr:pers-triple
Open

Make Texan triples persistent#568
suhr wants to merge 4 commits into
leanprover-community:masterfrom
suhr:pers-triple

Conversation

@suhr

@suhr suhr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Make Texan triples persistent because they really should be.

I have noticed that Rocq Iris defines triples with in bi_scope, but without it in stdpp_scope. But what is the stdpp_scope?

Checklist

  • My code follows the mathlib naming and code style conventions
  • I have added my name to the authors section of any appropriate files

@MackieLoeffel

Copy link
Copy Markdown
Collaborator

stdpp_scope in Rocq is a top-level scope that is always open. In Lean, this corresponds to notations that are directly in the term syntax category, not below an iprop(...). It would be nice to have a term notation for Texan triples, then we could omit the before it. For this notation, we don't need the box since top-level entailments can always be reused.

@suhr

suhr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

I think that a term notation could be added in a next PR.

@ayhon

ayhon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I implemented the term notation in this PR (branch). @suhr, feel free to merge it into this PR if you'd like.

The issue with the term notation is that it requires one to specify the GF from the IProp somewhere in the precondition or postcondition, since the Texan triple syntax doesn't provide a way to specify the underlying PROP the same way entailment does with |-@{...}

@suhr

suhr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

I rebased the last two commits from your branch onto my branch.

Comment thread Iris/Iris/Tests/HeapLang/Par.lean Outdated
meta def wpTexanTripleTerm : Lean.Macro
| `({{ $P:term }} $wpExpr {{ $[$[$xs]* ,]? RET $pat ; $Q:term }}) => do

let transform (xs : Array (TSyntax [`Lean.binderIdent, `Lean.Parser.Term.bracketedBinder])) : MacroM <| TSyntaxArray [`ident, `Lean.Parser.Term.hole, `Lean.Parser.Term.bracketedBinder] :=

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of duplicating this code, can we just desugar this to ⊢ {{ ... }} ... {{ ... }} and then continue elaboration there?

@ayhon ayhon Aug 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You mean have two separate macros

  • {{ .. }} .. {{ .. }} => ⊢ term({{ .. }} .. {{ .. }})
  • term({{ ... }} ... {{ ... }}) => ∀ Φ, $P -∗ ▷ $k -∗ (WP $wpExpr {{ Φ }}), this one without a

?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if term(iprop(_)) => _ would trigger beforehand, maybe we need to translate the first one into BI.Entails iprop(emp) term({{ .. }} .. {{ .. }}) to prevent this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, my idea idea was

  • {{ .. }} .. {{ .. }} => ⊢ iprop({{ .. }} .. {{ .. }})
  • iprop({{ ... }} ... {{ ... }}) => □ ∀ Φ, $P -∗ ▷ $k -∗ (WP $wpExpr {{ Φ }})

But this adds the also for the term notation. Not sure if there is a way to avoid this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Alternatively, we can just extract the shared code to a function that is used by both macros.

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.

3 participants