Skip to content

Adjusted formatting of provided spec in human_eval problem_2#73

Merged
amit9oct merged 1 commit intotrishullab:mainfrom
barabbs:prob2-spec-reformat
Mar 28, 2026
Merged

Adjusted formatting of provided spec in human_eval problem_2#73
amit9oct merged 1 commit intotrishullab:mainfrom
barabbs:prob2-spec-reformat

Conversation

@barabbs
Copy link
Copy Markdown
Contributor

@barabbs barabbs commented Mar 28, 2026

Hi @amit9oct,

me again, again...

PR addessing issue #72. Let me know if you agree with the edit, or if I'm missing anything.

Copilot AI review requested due to automatic review settings March 28, 2026 14:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #72 by making human_eval/problem_2’s problem_spec formatting/structure consistent with the rest of the human_eval suite, by moving the precondition into the local spec predicate.

Changes:

  • Move number > 0 implication inside spec (instead of guarding the whole termination+postcondition).
  • Simplify the termination/property clause to ∃ result, ... ∧ spec result (consistent with other problems).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +33
number > 0 →
0 ≤ res ∧
res < 1 ∧
number.floor + res = number;
number > 0 →
-- program terminates
(∃ result, impl number = result ∧
∃ result, impl number = result ∧
-- return value satisfies spec
spec result)
spec result
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

Moving the precondition number > 0 inside spec changes problem_spec from an outer implication (number > 0 → ...) to an existential with an inner implication (∃ result, ... ∧ (number > 0 → ...)). The existing theorem correctness proof below still does intro npos right after unfolding, which will no longer type-check because the goal is no longer an implication at the top level. Update the proof to first provide a witness (e.g., use result / refine ⟨result, rfl, ?_⟩) and then intro npos to discharge the inner implication.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It type-checks on my machine, so either I am missing something, or Mr. Copilot here is hallucinating :(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(build also succeeded in the automatic tests)

Copy link
Copy Markdown
Collaborator

@amit9oct amit9oct left a comment

Choose a reason for hiding this comment

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

Yeah, this is correct, makes it more consistent. Thank you for fixing this.
@barabbs, I can merge this if everything looks fine to you.

@barabbs
Copy link
Copy Markdown
Contributor Author

barabbs commented Mar 28, 2026

@amit9oct everything looks good on my side, should be ok to merge

@amit9oct amit9oct merged commit 9c0b34f into trishullab:main Mar 28, 2026
4 of 5 checks passed
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.

3 participants