Skip to content

Feature exception#806

Merged
strub merged 1 commit intomainfrom
feature-exception
Mar 5, 2026
Merged

Feature exception#806
strub merged 1 commit intomainfrom
feature-exception

Conversation

@lyonel2017
Copy link
Contributor

@lyonel2017 lyonel2017 commented Sep 9, 2025

This PR introduce exceptions for Hoare Logic.

We can define exception :

exception assume.
exception assert.

We can raise exception using raise assume or if (x = 3) else raise assert (raise an exception when a condition is not true):

module M ={
  proc f (x:int) : int = {
    if (x = 3) else raise assert;
    x <- 1;
    if (x = 3)  {
       raise assume;
    }
    if (x=3) {
        raise assert;
      }
  return x;
  }
}.

We can define postconditions for each exception and a default postcondition:

lemma assume_assert : hoare [M.f : pre ==> post | assume:p1 |assert: p2 | p3].

Examples are available in examples/exception.ec.

@lyonel2017 lyonel2017 force-pushed the feature-exception branch 2 times, most recently from 415a5d1 to b415379 Compare September 21, 2025 19:49
@lyonel2017 lyonel2017 requested a review from strub September 21, 2025 19:49
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 4 times, most recently from b717865 to 7e145ca Compare September 22, 2025 20:48
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 4 times, most recently from cac4299 to 8a1385e Compare October 3, 2025 09:53
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 2 times, most recently from 1185838 to ee89281 Compare November 1, 2025 11:50
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 2 times, most recently from ae978f0 to 2fa2c24 Compare December 19, 2025 17:25
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 2 times, most recently from ee9b68e to 2719b38 Compare December 23, 2025 18:16
@lyonel2017 lyonel2017 marked this pull request as ready for review December 23, 2025 18:45
@lyonel2017 lyonel2017 requested a review from bgregoir December 23, 2025 18:45
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 3 times, most recently from 1397fe3 to 7f90d68 Compare December 30, 2025 18:13
@lyonel2017 lyonel2017 force-pushed the feature-exception branch 3 times, most recently from 5ff2221 to 342576e Compare January 16, 2026 17:07
@strub strub force-pushed the feature-exception branch 4 times, most recently from 2270f47 to 76b7307 Compare March 3, 2026 14:48
@strub strub self-assigned this Mar 3, 2026
@strub strub force-pushed the feature-exception branch from 5ae4831 to 387bbaa Compare March 5, 2026 03:29
Co-Authored-By: Benjamin Gregoire <Benjamin.Gregoire@inria.fr>
Co-Authored-By: Pierre-Yves Strub <pierre-yves.strub@pqshield.com>
@strub strub force-pushed the feature-exception branch from e7a4d7f to a5c1a1a Compare March 5, 2026 04:35
@strub strub added the feature label Mar 5, 2026
@strub strub enabled auto-merge (rebase) March 5, 2026 04:36
@strub strub merged commit bba1f1b into main Mar 5, 2026
16 checks passed
@strub strub deleted the feature-exception branch March 5, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants