Skip to content

Conversation

@namasikanam
Copy link
Collaborator

@namasikanam namasikanam commented Dec 1, 2025

Another example for eHoare (done with @mzini). This example considers a nested loop which uniformly samples a boolean matrix of size $n \times m$, and proves that the probably of sampling any boolean matrix of size $n \times m$ is no more than $2 ^ {- n \times m}$.

My original purpose for this example was to figure out a game hopping in a big proof, but it turned out that this game hopping is not needed. But I think this is a good example for demonstrating how to do proof in eHoare.

require import StdOrder.
(*---*) import RealOrder.

lemma mul0z (x : int) : 0 * x = 0.
Copy link
Member

Choose a reason for hiding this comment

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

Already exists. Remove.

lemma mul0z (x : int) : 0 * x = 0.
proof. by auto. qed.

lemma neg0: -0 = 0.
Copy link
Member

Choose a reason for hiding this comment

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

Already exists. Remove.

lemma neg0: -0 = 0.
proof. by auto. qed.

lemma xle_rle:
Copy link
Member

Choose a reason for hiding this comment

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

Surprised if it does not exist. If not, move it to the standard library.

by rewrite !to_pos_pos //; exact (ler_trans x).
qed.

lemma Ep_dbiased (p : real) (f : bool -> xreal) :
Copy link
Member

Choose a reason for hiding this comment

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

Move it to the standard library. Use the link to the E to reuse the proof.

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