Skip to content

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 raise (x = 3) assert (raise an exception when a condition is not true):

module M ={
  proc f (x:int) : int = {
    raise (x = 3) 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 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
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