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

Proofs that don't start with "Proof." are not recognized #125

Open
Lysxia opened this issue Jul 22, 2020 · 5 comments
Open

Proofs that don't start with "Proof." are not recognized #125

Lysxia opened this issue Jul 22, 2020 · 5 comments

Comments

@Lysxia
Copy link
Contributor

Lysxia commented Jul 22, 2020

Compare how cbn is highlighted in this example:

Lemma a : False.
Proof.
cbn.
Abort.

Lemma a : False.
cbn.
@whonore
Copy link
Owner

whonore commented Jul 23, 2020

The problem is tactics are currently only highlighted when they're in a coqProofBody region, which looks for a starting delimiter like Proof or Next Obligation. Without that it's tricky to tell when a proof starts. Some options I can think of are:

  1. Drop the proof body requirement and highlight tactics everywhere, even in places where they may not be valid.
  2. Try to expand proof body to check if the previous vernacular is Lemma, or Theorem, etc. It should probably also check that it's not defined in that same command (Example a : True := I.), but this also has some corner cases (Instance x : Reflexive R := _.).
  3. Keep it as is and don't try to highlight/indent proofs without an explicit start keyword.

1 or 3 are the easiest options but I'm open to 2 if you think this is a common enough/idiomatic use case.

@whonore
Copy link
Owner

whonore commented Jul 23, 2020

Somewhat related: #43.

@Lysxia
Copy link
Contributor Author

Lysxia commented Jul 23, 2020

I'm fine with not fixing it if it's not easy. I just wanted to mention it because it seems somewhat common, but I'm not at all fond of that style.

@whonore
Copy link
Owner

whonore commented Jul 23, 2020

When I next get some time I'll experiment with how hard it is to make a best-effort attempt at something like option 2.

@Tuplanolla
Copy link

As if living with the rooster was not hard enough already,
some proofs in the standard library start with both
Next Obligation and Proof and thus manifest this issue.
The following excerpt is from theories/Classes/EquivDec.v.

#[global]
Program Instance unit_eqdec : EqDec unit eq := fun x y => in_left.

  Next Obligation.
  Proof.
    do 2 match goal with [ x : () |- _ ] => destruct x end.
    reflexivity.
  Qed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants