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

lib: Requalify: better document annotation #813

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

Xaphiosis
Copy link
Member

Previous attempts to update the code to allow ctrl+clicking on names resulted in markup overlap errors for arch_requalify commands. This was due to a misconception that YXML strings already containing correct position information (e.g. obtained via Parse.const) would be used directly by Proof_context.read_const/read_type_name. This is not the case. Instead, position information is adjusted for the content length, and since we add a prefix for L4V_ARCH, we got annotation that did not match the document text.

After hours of digging to uncover the above issue, we get this:

  • the "check_parsed_nm" in gen_requalify was not an extra check, but a hook to do document annotation; updated comments
  • use Proof_Context.check_const/check_type_name with parsed position of Parse.name, and manually report resulting markup
  • since the above works for arch_requalify_const, the normal requalify_const becomes a simpler instance
  • the whole Parse.const/Parse.typ was a red herring and ultimately did not add anything to the code except for read_const/read_type_name interaction; removed

The resulting code is simpler; a large cautionary comment remains for future generations.

@Xaphiosis Xaphiosis added enhancement arch-split splitting proofs into generic and architecture dependent labels Aug 27, 2024
@Xaphiosis Xaphiosis requested a review from corlewis August 27, 2024 05:00
@Xaphiosis Xaphiosis requested a review from lsf37 August 27, 2024 05:00
@Xaphiosis
Copy link
Member Author

Looks like this needs more work, some issues with creative requalify in CRefine got me :(

Copy link
Member

@corlewis corlewis left a comment

Choose a reason for hiding this comment

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

Great job working through this horrible issue and thank you for the detailed comment!

Previous attempts to update the code to allow ctrl+clicking on names
resulted in markup overlap errors for arch_requalify commands.
This was due to a misconception that YXML strings already containing
correct position information (e.g. obtained via Parse.const) would
be used directly by Proof_context.read_const/read_type_name. This is not
the case. Instead, position information is adjusted for the content
length, and since we add a prefix for L4V_ARCH, we got annotation that
did not match the document text.

After hours of digging to uncover the above issue, we get this:
* the "check_parsed_nm" in gen_requalify was not an extra check, but a
  hook to do document annotation; updated comments
* use Proof_Context.check_const/check_type_name with user-supplied name
  and parsed position of Parse.name, and manually report resulting markup
  (do not use previously resolved name as it could point to a hidden
  const/type)
* since the above works for arch_requalify_const, the normal
  requalify_const becomes a simpler instance of it
* the whole Parse.const/Parse.typ was a red herring and ultimately did
  not add anything to the code except for read_const/read_type_name
  interaction; removed

The resulting code is simpler; large cautionary comments remain for
future generations.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Document/test surprising interactions of hide_const, locales and
requalify for the purposes of temporarily making arch-specific constants
visible in theory scope.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
@Xaphiosis Xaphiosis force-pushed the arch-split_requalify_anno branch from c11037f to e949698 Compare August 27, 2024 10:08
@Xaphiosis Xaphiosis requested a review from corlewis August 27, 2024 10:09
@Xaphiosis
Copy link
Member Author

Updated to fix the lookup of a resolved name, because somehow it's possible to look up a short name and get a qualified name that's been hidden... which for whatever reason is fine to create aliases to, but not find to resolve to (we use this in Kernel_C for temporarily making things visible to C Parser).
Added example in Requalify_Test, theory linter is complaining about diagnostic commands there.

Copy link
Member

@lsf37 lsf37 left a comment

Choose a reason for hiding this comment

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

Cool. And impressive job finding all that out, this is about as arcane as it gets.

Copy link
Member

@corlewis corlewis left a comment

Choose a reason for hiding this comment

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

Looks even better now with the tests passing! Once again, thank you for the thorough comments in the new test.

@Xaphiosis Xaphiosis merged commit 53f44de into seL4:master Aug 28, 2024
13 of 14 checks passed
@Xaphiosis Xaphiosis deleted the arch-split_requalify_anno branch August 28, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-split splitting proofs into generic and architecture dependent enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants