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

Invariants for sequences #78

Open
treiher opened this issue Oct 11, 2019 · 0 comments
Open

Invariants for sequences #78

treiher opened this issue Oct 11, 2019 · 0 comments

Comments

@treiher
Copy link
Collaborator

treiher commented Oct 11, 2019

It should be possible to define invariants for sequences, e.g. show that a sequence contains no duplicates:

type Extensions is sequence of Extension with
   Invariant => (for all I in Extensions => 
                   (for all J in Extensions =>
                      (if I /= J then Extensions (I) /= Extensions (J))));

For #8 / #1254 we also need a way to specify invariants that are checked for each element (e.g. while parsing):

   type Variable_Byte_Integer is sequence of Variable_Byte_Integer_Element
   with
      Value => 
         (Initial => 0,
          Next => Variable_Byte_Integer'Current * 128 + Variable_Byte_Integer'Element.Value,
          Until => (Variable_Byte_Integer'Element.More = False)),
      Element_Invariant => Variable_Byte_Integer'Position <= 4;
@treiher treiher created this issue from a note in RecordFlux Future (To do) Oct 11, 2019
@senier senier mentioned this issue May 12, 2020
@treiher treiher changed the title Support invariants for sequences Invariants for sequences May 28, 2020
@treiher treiher added the v0.4.1 label Jul 14, 2020
@treiher treiher added the v0.5.0 label Jul 9, 2021
@senier senier moved this from To do to Long-term in RecordFlux Future Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants