Skip to content

Fix async while rule#935

Open
lyonel2017 wants to merge 2 commits intomainfrom
asynchile
Open

Fix async while rule#935
lyonel2017 wants to merge 2 commits intomainfrom
asynchile

Conversation

@lyonel2017
Copy link
Contributor

Fix #774

@strub strub changed the title Fix asynchile rule Fix async while rule Mar 12, 2026
@lyonel2017 lyonel2017 force-pushed the asynchile branch 2 times, most recently from 536fb81 to 07e7aa9 Compare March 19, 2026 14:31
@lyonel2017 lyonel2017 marked this pull request as ready for review March 19, 2026 15:09
@lyonel2017 lyonel2017 requested a review from strub March 19, 2026 15:09
@oskgo
Copy link
Contributor

oskgo commented Mar 20, 2026

Now that you have a fresh understanding of how the tactic works, could you write up documentation? That would also make review simpler.

@lyonel2017 lyonel2017 marked this pull request as draft March 24, 2026 12:32
@lyonel2017 lyonel2017 marked this pull request as ready for review March 24, 2026 15:56
- ``f1`` and ``f2`` are the unrolling condition, initial by the parameter
``k1`` and ``k2``.

Concretely, the tactic implements the following rulee::
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Concretely, the tactic implements the following rulee::
Concretely, the tactic implements the following rule::

-------------------------------------------------------------------------------------------
equiv[while b1 {c1} ~ while {b2} c2: Pre ==> Post]

The following example shows ``asynctwhile`` on a prhl goal. The program
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The following example shows ``asynctwhile`` on a prhl goal. The program
The following example shows ``async while`` on a prhl goal. The program

@@ -0,0 +1,91 @@
========================================================================
Tactic: ``asyncwhile`` Tactic
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Tactic: ``asyncwhile`` Tactic
Tactic: ``async while`` Tactic

Tactic: ``asyncwhile`` Tactic
========================================================================

The ``asyncwhile`` tactic applies to probabilistic relational Hoare Logic
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The ``asyncwhile`` tactic applies to probabilistic relational Hoare Logic
The ``async while`` tactic applies to probabilistic relational Hoare Logic


The ``asyncwhile`` tactic applies to probabilistic relational Hoare Logic
goals where the programs contains a ``while`` loop.
Unlike the ``while`` tactic, the ``asyncwhile`` tactic allows to reason
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Unlike the ``while`` tactic, the ``asyncwhile`` tactic allows to reason
Unlike the ``while`` tactic, the ``async while`` tactic allows to reason

[ (fun r => x <= r ), (x{2} ) ]
(!(x{1} < 10)) (!(x{2} < 10))
:
(x{1} = x{2}) => //=.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you should use intro patterns to discharge trivial side conditions or simplify side conditions in doc examples. This hides the side condition from the reader.

equiv[skip ~ while b2 {c2}: I /\ b2 /\ L2 /\ ==> I]
(Pre => I) /\ (I /\ !b1 /\ !b2 => Post)
-------------------------------------------------------------------------------------------
equiv[while b1 {c1} ~ while {b2} c2: Pre ==> Post]
Copy link
Contributor

@oskgo oskgo Mar 24, 2026

Choose a reason for hiding this comment

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

This does not match the implementation.

The first equiv should be using f1 k1 and f2 k2 in the loop condition.

Both the next equivs are instead a hoare statement about a single iteration together with a phoare statement about termination. This is different from what is written here. In the equivs written here the invariant is permitted to temporarily fail as long as it is restored before the end of the final iteration. In the equivs written here the invariant has to hold even after multiple iterations, while in the implemented tactic the invariant only needs to hold for a single iteration starting from where L1/L2 holds.

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.

Tactic async while is unsound

2 participants