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

Pipe operator breaks whitespace sensitivity #4811

Open
3 tasks done
TwoFX opened this issue Jul 23, 2024 · 1 comment
Open
3 tasks done

Pipe operator breaks whitespace sensitivity #4811

TwoFX opened this issue Jul 23, 2024 · 1 comment
Labels
bug Something isn't working P-low We are not planning to work on this issue

Comments

@TwoFX
Copy link
Member

TwoFX commented Jul 23, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

Consider this code:

theorem foo {g : True → False} : False := by
  exact
g <| trivial

theorem foo' {g : True → False} : False := by
  exact
g trivial

Lean accepts the first theorem but produces multiple errors on the second theorem. Given that tactic scripts should be indentation-sensitive, I think that both versions should produce an error.

Context

This is a minimization of a mathlib issue. In mathlib, the code looks like this:

lemma coeff_preΨ_ne_zero {n : ℤ} (h : (n : R) ≠ 0) :
    (W.preΨ n).coeff ((n.natAbs ^ 2 - if Even n then 4 else 1) / 2) ≠ 0 := by
  induction n using Int.negInduction with
  | nat n => simpa only [preΨ_ofNat, Int.even_coe_nat]
      using W.coeff_preΨ'_ne_zero <| by exact_mod_cast h
  | neg n ih => simpa only [preΨ_neg, coeff_neg, neg_ne_zero, Int.natAbs_neg, even_neg]
      using ih <| neg_ne_zero.mp <| by exact_mod_cast h

lemma natDegree_preΨ_pos {n : ℤ} (hn : 2 < n.natAbs) (h : (n : R) ≠ 0) :
    0 < (W.preΨ n).natDegree := by
  induction n using Int.negInduction with
  | nat n => simpa only [preΨ_ofNat] using W.natDegree_preΨ'_pos hn <| by exact_mod_cast h
  | neg n ih => simpa only [preΨ_neg, natDegree_neg]
        using ih (by rwa [← Int.natAbs_neg]) <| neg_ne_zero.mp <| by exact_mod_cast h

Reducing the indentation of the final line of the second theorem causes an error. This seems confusing because the analogous line of the first theorem works fine, but it can be argued that the required indentation in the second theorem is correct and the first theorem should error.

Steps to Reproduce

  1. Copy the MWE above into live.lean-lang.org

Versions

4.11.0-nightly-2024-07-23 on live.lean-lang.org

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@TwoFX TwoFX added the bug Something isn't working label Jul 23, 2024
@leanprover-bot leanprover-bot added the P-low We are not planning to work on this issue label Jul 26, 2024
@semorrison
Copy link
Collaborator

Could you say what the "it can be argued" is? I don't see it, and it occurs to me that I was also confused by this issue recently!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-low We are not planning to work on this issue
Projects
None yet
Development

No branches or pull requests

3 participants