Skip to content

Conversation

@cassiersg
Copy link
Contributor

I needed these simple lemmas and they look like they might belong to the standard library.

@fdupress
Copy link
Member

StdOrder eventually requires FinType, which uses lists to characterise finiteness. You can't require StdOrder in List. Do you see another way of getting those lemmas in?

@cassiersg
Copy link
Contributor Author

Thanks @fdupress @strub for the comments. I addressed the StdOrder issue by re-proving the only lemma I used (IntOrder.ler_add) within the proof that used it. I'm not sure it that's the cleanest way?

@fdupress
Copy link
Member

Can you check if Int.lez_add exists?

@fdupress
Copy link
Member

Can you check if Int.lez_add exists? A lot of simple results on integers exist in Int (derived by smt) as they are needed to construct more complex theories.

But as soon as there is a generic notion of order and generic lemmas about it, it makes sense to instantiate it with Int to get all derived results. (This will, once they are ready, be done using type classes instead of cloning.)

@cassiersg
Copy link
Contributor Author

Int.lez_add does not exist. Should I add it?

@strub
Copy link
Member

strub commented Oct 28, 2025

You can also do that:

lemma le_in_count ['a] (p1 p2 : 'a -> bool) (s : 'a list) :
  (forall x, x \in s => p1 x => p2 x) =>
  count p1 s <= count p2 s.
proof. elim: s => //#. qed.

@strub
Copy link
Member

strub commented Oct 28, 2025

To be clear, this is the kind of goals where SMT provers are stable.

Copy link
Member

@strub strub left a comment

Choose a reason for hiding this comment

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

Squash, and we are good to go.

@cassiersg
Copy link
Contributor Author

@strub done

@strub strub merged commit 98e393a into EasyCrypt:main Oct 28, 2025
15 checks passed
@cassiersg cassiersg deleted the list_lemmas branch October 29, 2025 21:30
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