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: labeled and unique sorries #5757

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Oct 21, 2024

  1. feat: unique sorries

    Motivation: `sorry` should have an indeterminate value so that it's harder to make "fake" theorems about stubbed-out definitions. This PR makes each instance of `sorry` be non-defeq to any other. For example, this now fails:
    ```lean
    example : (sorry : Nat) = sorry := rfl -- fails
    ```
    However, this still succeeds:
    ```lean
    def f (n : Nat) : Nat := sorry
    example : f 0 = f 1 := rfl -- succeeds
    ```
    One can be more careful by putting variables to the right of the colon:
    ```lean
    def f : (n : Nat) → Nat := sorry
    example : f 0 = f 1 := rfl -- fails
    ```
    
    Details:
    
    Adds `Lean.Meta.mkUniqueSorry`, which creates a sorry that is not defeq to any other sorry. It also encodes the source position into the term.
    
    Makes the `sorry` term and `sorry` tactic create unique sorries.
    
    Adds support to the LSP so that "go to definition" on `sorry` in the Infoview goes to the origin of that particular `sorry`.
    
    Fixes `sorry` pretty printing: no more `sorryAx` in the Infoview.
    
    Removes `Lean.Meta.mkSyntheticSorry` in favor of `Lean.Meta.mkSorry`.
    kmill committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    dbc063b View commit details
    Browse the repository at this point in the history
  2. pervasive mkUniqueSorry

    kmill committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    3e91655 View commit details
    Browse the repository at this point in the history
  3. unique -> labeled sorries. Turns out using unique sorries for elabora…

    …tion errors can compound the issues. In any case, they can still be labeled.
    
    improves addPPExplicitToExposeDiff when functions are overapplied
    
    fixes mdata bugs in location RPC handler
    
    fixes leanprover#4972
    kmill committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    64b2f32 View commit details
    Browse the repository at this point in the history
  4. fix tests

    kmill committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    c666fbc View commit details
    Browse the repository at this point in the history
  5. revert comment

    kmill committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    051b236 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2024

  1. more unique

    kmill committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    bcfced4 View commit details
    Browse the repository at this point in the history