-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fingerprinting variables and bound identifiers #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, and the fix looks good.
But I think we should also invalidate all the fingerprint files that were generated before the fix. One way to do this would be to insert a version number right (followed by some punctuation) after creating the buffer in fp_sequent, to make the new fingerprints different from the old ones.
I pushed a commit that adds the version number of |
There is a build failure that appears unrelated to the changes in this pull request. Only the macOS build fails when packaging Isabelle in the installer (in particular when downloading Isabelle):
The same failure occurred when building another commit: https://github.com/tlaplus/tlapm/runs/1570729628 |
The URL from where Isabelle is downloaded is currently unreachable, which may explain the installer packaging failures (interestingly, the Ubuntu runs succeeded, with the message "Isabelle2011-1 ALREADY downloaded" when downloading Isabelle). |
To not hammer the upstream download sites, the build caches artifacts. Perhaps, this Github action cache task isn't working on macOS. There is a new version of this cache action that supposedly fixes the problem on macOS. I will update the Github action once tum.de site is back up. |
Indeed, the entire site isabelle.in.tum.de <http://isabelle.in.tum.de/> is currently down. Should be a temporary issue.There are mirrors at https://www.cl.cam.ac.uk/research/hvg/Isabelle/download_past.html <https://www.cl.cam.ac.uk/research/hvg/Isabelle/download_past.html> and https://mirror.cse.unsw.edu.au/pub/isabelle/download_past.html <https://mirror.cse.unsw.edu.au/pub/isabelle/download_past.html>, perhaps one could use them in the installer script.
… On 17 Dec 2020, at 17:55, Ioannis Filippidis ***@***.***> wrote:
The URL from where Isabelle is downloaded is currently unreachable, which may explain the installer packaging failures (interestingly, the Ubuntu runs succeeded, with the message "Isabelle2011-1 ALREADY downloaded" when downloading Isabelle).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#23 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABZCW5NRVTAP425K3BRDCGTSVIZYPANCNFSM4UU73DVA>.
|
Done in f827e37 |
Thank you for fixing the cache action. |
Inserting the TLAPM version number means that all fingerprint files will be invalidated at each new release. This is probably OK but we should discuss it with the other developers. |
255cf53
to
4316c26
Compare
I force-pushed a commit that changes the number that is placed at the start of the fingerprints file, and removes the code for the older versions of the fingerprints. The previously pushed commit that inserted the version of |
for printing the strings used to create the fingerprints of proof obligations.
Variables were fingerprinted as `VAR(i)` where `i` an index, and bound identifiers also with `VAR(j)` where `j` an index produced using a different counter. The counter for variables is `counthyp`, and the counter for bound constants and bound variables is `countvar`. When the two counters are both equal to 1, `VAR(1)` results for both the occurrence of a variable, and the occurrence of a constant bound by a rigid quantifier. This commit adds a test file that catches this error.
to avoid loading any erroneous fingerprints. Also, change the number that is placed at the start of the fingerprints file. A date is used as this number (in the code this number is assigned to a variable called `magic_number` within the module `Fpfile`).
4316c26
to
5209885
Compare
Have you tried this version in a directory that contains fingerprint files from an older version? As far as I can tell, this will complain that it cannot load the fingerprint file, then stop. If the file contains the old magic number, it would be better to rename it (to |
I had not tried the revised fingerprinting in the presence of fingerprint files from an older version, thank you for suggesting trying this, renaming the old fingerprints file, and printing a warning. I tried now, first with:
set -x
rm -rf .tlacache fingerprints_old
cat Test.tla
tlapm_old Test.tla
tree .tlacache
cp .tlacache/Test.tlaps/fingerprints fingerprints_old
tlapm_new Test.tla
tree .tlacache
diff -s fingerprints_old .tlacache/Test.tlaps/fingerprints.corrupted and the result of
In this case After this failure to load the old fingerprints file, declaring it as corrupted (it is an old fingerprints file, but not corrupted), and moving the old fingerprints file to Second, I tried with both:
the result is:
The resulting behavior of When Even with this modification to The older version of tlapm above, I think that the relevant lines of code are: Lines 548 to 602 in 5209885
From the above observations, I think that it would be better to change
Also, updating the filename searched for in the invocation of The error message about the corrupted fingerprints file could be extended to mention also that the corrupted fingerprints file has been moved to It is imaginable that
This execution of |
Thanks for running the experiments. The current behavior is good enough as far as I'm concerned, but if you want to fix the error messages ("corrupted" -> "old" and "End_of_file") and it's easy to do, why not. In any case I don't think we should spend too much time on this part of the system. |
cf0f9ec
to
2a72442
Compare
instead of files with extension `.fp`. It appears that `tlapm` does not write files with extension `.fp` (as `ag "\.fp"` suggests).
also: - handle exception `End_of_file` that can arise when reading the output of a failed `ls` (e.g., for nonexistent files matching the glob) - handle exit status other than zero exit code of `ls` - do not catch errors that arise when renaming an existing fingerprints file (using `Sys.rename`), to prevent overwriting that file in case the rename fails - distinguish between reasons of failing to open existing fingerprints file: - file that contains an old magic number (renamed by appending `.old`) - file that contains unrecognized magic number (renamed by appending `.corrupted`) - file that could not be read by mashal (`Marshal.from_channel` failed) (renamed by appending `.corrupted`) - other reasons: assert false - add more information to error messages
2a72442
to
a1ec54a
Compare
Thank you for the feedback. I added commits that change this behavior by:
The exception handling ended up being somewhat complex. Also, errors that may arise when renaming an existing fingerprints file ( The following script first creates a fingerprints file with an older version of PS4="> "
set -x
rm -rf .tlacache fingerprints_old
cat Test.tla
tlapm_old Test.tla
tree .tlacache
cp .tlacache/Test.tlaps/fingerprints fingerprints_old
tlapm_new Test.tla
tree .tlacache
diff -s fingerprints_old .tlacache/Test.tlaps/fingerprints.old The output from this script is:
The following script first runs the old version of PS4="> "
set -x
rm -rf .tlacache fingerprints_corrupted
cat Test.tla
tlapm_old Test.tla
tree .tlacache
echo "corrupted" > .tlacache/Test.tlaps/fingerprints
cp .tlacache/Test.tlaps/fingerprints fingerprints_corrupted
tlapm_new Test.tla
tree .tlacache
diff -s fingerprints_corrupted .tlacache/Test.tlaps/fingerprints.corrupted The output from this script is:
The following scipt first runs the older version of PS4="> "
set -x
rm -rf .tlacache fingerprints_old
cat Test.tla
tlapm_old Test.tla
tree .tlacache
tlapm_old Test.tla
tree .tlacache
cp .tlacache/Test.tlaps/fingerprints fingerprints_old
tlapm_new Test.tla
tree .tlacache
diff -s fingerprints_old .tlacache/Test.tlaps/fingerprints.old The output from this script is:
The following script first runs the older version of PS4="> "
set -x
rm -rf .tlacache fingerprints_corrupted
cat Test.tla
tlapm_old Test.tla
tree .tlacache
tlapm_old Test.tla
tree .tlacache
echo "corrupted" > .tlacache/Test.tlaps/fingerprints
cp .tlacache/Test.tlaps/fingerprints fingerprints_corrupted
tlapm_new Test.tla
tree .tlacache
diff -s fingerprints_corrupted .tlacache/Test.tlaps/fingerprints.corrupted The output from this script is:
The older version of tlapm above, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good now.
src/backend/fpfile.ml
Outdated
failwith ("`ls` returned no stdout " ^ | ||
" when looking for older fingerprints file, " ^ | ||
"so it appears that there are no older fingerprints files.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
failwith ("`ls` returned no stdout " ^ | |
" when looking for older fingerprints file, " ^ | |
"so it appears that there are no older fingerprints files.") | |
failwith ("`ls` returned no stdout \ | |
when looking for older fingerprints file, \ | |
so it appears that there are no older fingerprints files.") |
src/backend/fpfile.ml
Outdated
" when looking for older fingerprints file, " ^ | ||
"so it appears that there are no older fingerprints files.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" when looking for older fingerprints file, " ^ | |
"so it appears that there are no older fingerprints files.") | |
" when looking for older fingerprints file, \ | |
so it appears that there are no older fingerprints files.") |
src/backend/fpfile.ml
Outdated
| _ -> failwith ("`ls` stopped by a signal while " ^ | ||
"looking for older fingerprints file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _ -> failwith ("`ls` stopped by a signal while " ^ | |
"looking for older fingerprints file") | |
| _ -> failwith ("`ls` stopped by a signal while \ | |
looking for older fingerprints file") |
Co-authored-by: Damien Doligez <damien.doligez@gmail.com>
Thank you for the comments and approving the changes. I applied the suggested changes. |
Thank you for merging these changes. |
Fingerprinting of variables and bound constants could lead to coincidence of fingerprints for different expressions. An example test case is added. Please find more details in the commit messages. The expressions used to create the fingerprints can be read with the function
print_fp
that is added by the first commit, after uncommenting the call to this function.