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

006-parse_nested_parens does not validate that the computed depth is correct #43

Open
3 tasks
Tracked by #44
jesyspa opened this issue Sep 30, 2024 · 0 comments
Open
3 tasks
Tracked by #44
Labels
weak postcondition The postcondition is (much) weaker than what is specified in the prompt

Comments

@jesyspa
Copy link
Collaborator

jesyspa commented Sep 30, 2024

The algorithm checks only that the depth is non-negative. res := []; would be a valid implementation.

Possible strengthenings:

  • Prove that the split of a string gives a list of strings that join up to the starting string.
  • Prove that parse_paren_group returns the maximum depth.
  • Prove that parse_nested_parens gives an array that matches with the behaviour of split and parse_paren_group.

Note that this may require strengthening the precondition to ensure that the string really does consist of a number of groups.

@jesyspa jesyspa added the weak postcondition The postcondition is (much) weaker than what is specified in the prompt label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
weak postcondition The postcondition is (much) weaker than what is specified in the prompt
Projects
None yet
Development

No branches or pull requests

1 participant