Skip to content

Add Isar output mode#1391

Draft
edoput wants to merge 27 commits intoutwente-fmt:devfrom
edoput:dev
Draft

Add Isar output mode#1391
edoput wants to merge 27 commits intoutwente-fmt:devfrom
edoput:dev

Conversation

@edoput
Copy link

@edoput edoput commented Dec 19, 2025

Checklist:

  • The wiki is updated in accordance with the changes in this PR. For example: syntax changes, semantics changes, VerCors flags changes, etc.

PR description

This PR introduces a syntactic transformation from PVL to Isabelle. This allows for translating PVL's ADTs to a locale to prove they are consistent. The transformation is available as a command from vct, see example.

bin/vct --isar --isar-output=foo.thy res/universal/res/adt/*.pvl 

This creates a new file foo.thy pre-filled with a locale for each ADT. The user can then provide a witness for each locale to prove the corresponding ADT consistent.

@bobismijnnaam bobismijnnaam marked this pull request as draft January 8, 2026 12:08
@bobismijnnaam bobismijnnaam changed the title [wip] add Isar output mode Add Isar output mode Jan 8, 2026
@bobismijnnaam
Copy link
Contributor

I converted your PR into a draft one. Feel free to un-draft it once you're planning on merging it soon.

Copy link
Member

@superaxander superaxander left a comment

Choose a reason for hiding this comment

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

I have two small comments

Group(Text("tuple<") <> Doc.args(ts) <> ">{" <> Doc.args(values) <> "}")
override def layout(implicit ctx: Ctx): Doc = {
ctx.syntax match {
case Ctx.Isar => Group(Text("(") <> Doc.args(ts) <> "," <> Doc.args(values) <>Text(")"))
Copy link
Member

Choose a reason for hiding this comment

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

I think this might not be the right syntax in Isabelle, ts is the sequence of types in the tuple

assoc(xs) <> "[" <> from <> ".." <> to <> "]"
override def layout(implicit ctx: Ctx): Doc = {
ctx.syntax match {
case Ctx.Isar => Text("nths") <+> assoc(xs) <+> "{" <> from <> ".." <> to <> "}"
Copy link
Member

Choose a reason for hiding this comment

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

I believe in Isabelle this is an inclusive range whereas in VerCors this is exclusive.

In PVL

seq<int> s = [1,2,3];
s[1..2] == [2]

In Isabelle

nths [1::int,2,3] {1 .. 2} = [2, 3]

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

Comments