Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial sequences package + Make package names consistent #11

Merged
merged 19 commits into from
Feb 8, 2024

Conversation

dnezam
Copy link
Collaborator

@dnezam dnezam commented Dec 8, 2023

Implements all definitions from Dafny that do not rely on any (multi)set-related definitions. These will be implemented using separate branches.

Additionally renames the packages to their singular form, and updates folder and file names for consistency.

@dnezam dnezam requested a review from jcp19 December 8, 2023 14:39
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
@dnezam dnezam requested a review from jcp19 December 27, 2023 07:52
jcp19
jcp19 previously approved these changes Jan 9, 2024
Copy link
Collaborator

@jcp19 jcp19 left a comment

Choose a reason for hiding this comment

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

Should be ready to merge after my comments are addressed

math/math.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
sequences/seqs.gobra Outdated Show resolved Hide resolved
@dnezam dnezam changed the title Add initial sequences package Add initial sequences package + Make package names consistent Feb 6, 2024
@viperproject viperproject deleted a comment from jcp19 Feb 6, 2024
seq and set are already reserved, hence we rename them back to their
plural counterparts which, according to this [forum exchange](https://forum.golangbridge.org/t/naming-conventions/11180) at least,
seems to be the way to go.
@dnezam dnezam requested a review from jcp19 February 6, 2024 12:24
util/util.gobra Outdated Show resolved Hide resolved
util/util.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
seqs/seqs.gobra Outdated Show resolved Hide resolved
* Remove unnecessary postcondition
* Factor out some quantified postconditions into separate lemmas to have
  an extrinsic proof of those properties as explained in
  https://dafny.org/blog/2023/12/01/avoiding-verification-brittleness/
@dnezam dnezam requested a review from jcp19 February 7, 2024 14:26
util/util.gobra Outdated Show resolved Hide resolved
@dnezam
Copy link
Collaborator Author

dnezam commented Feb 8, 2024

The following functions still have a quantifier in their postcondition:

  • Remove (2 quantifiers ensuring the rest of the sequence is the same)
  • RemoveValue (2 quantifiers ensuring the rest of the sequence is the same)
  • Insert (2 quantifiers ensuring the rest of the sequence is the same)
  • Reverse (1 quantifier ensuring the "reversed" property)
  • Repeat (1 quantifier ensuring the contents of the sequence)
  • Max (1 quantifier ensuring that the maximum is indeed the maximum)
  • Min (1 quantifier ensuring that the minimum is indeed the minimum)

Do we want to factor out these quantifiers like we did for IndexOf and IndexOfLast? Additionally, it may be useful to put the 2 quantifiers ensuring that a sequence is the same besides at one index into a separate function, since it is reused multiple times.

@dnezam dnezam requested a review from jcp19 February 8, 2024 10:10
Copy link
Collaborator

@jcp19 jcp19 left a comment

Choose a reason for hiding this comment

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

LGTM, regarding the lemmas with quantified postconditions, I think it is preferable to wait with the changes until we have more information and experience using the library

@dnezam dnezam merged commit 1d99270 into main Feb 8, 2024
1 check passed
@dnezam dnezam deleted the sequences branch February 8, 2024 13:49
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