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

feat: hover for cases/induction case names #1660

Merged
merged 4 commits into from
Sep 29, 2022

Conversation

digama0
Copy link
Collaborator

@digama0 digama0 commented Sep 28, 2022

This makes the zero and succ in

  induction x with
  | zero => ...
  | succ x => ...

into clickable links to the inductive constructors. It also does its best with custom inductives but most likely will not work unless the custom inductive is added manually. (Fundamentally this is because the case names correspond to local binding names in the recursor, not directly to definitions.)

@Vtec234
Copy link
Member

Vtec234 commented Sep 28, 2022

It also does its best with custom inductives but most likely will not work unless the custom inductive is added manually.

Do you mean "with custom induction principles", or actually that Nat specifically somehow has special support?

@digama0
Copy link
Collaborator Author

digama0 commented Sep 28, 2022

I mean things that aren't inductives but try to act like one by having a bunch of theorems with names similar to the constructors and recursor of an inductive type. Because the implementation uses isInductive on the parent of the recursor, that means that if you have a Nat.myRecOn (where Nat could be any inductive) with minor premises named zero and succ, then the hovers will work, and will target Nat.zero and Nat.succ. If you name the minor premises foo and bar then nothing will be linked. And if you have MyNat.recOn where def MyNat := Nat, then even if MyNat.zero and MyNat.succ exist they will not be linked.

@digama0 digama0 force-pushed the induction_alt_hover branch 2 times, most recently from 32807f8 to a5110e9 Compare September 29, 2022 01:58
src/Lean/Elab/Tactic/Induction.lean Show resolved Hide resolved
@Kha Kha enabled auto-merge (rebase) September 29, 2022 15:47
@Kha Kha merged commit 1463c9c into leanprover:master Sep 29, 2022
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.

None yet

3 participants