Skip to content

RFC: Recover better from a deterministic timeout. #3554

Closed

Description

@fpvandoorn

Proposal

I think it would be nice if Lean deals a bit better when it reaches a deterministic timeout. In a typical case my timeout happens during elaboration/tactic executing of the proof of a theorem, and I would like Lean to still treat that declaration as if there was a sorry/other error in the proof
In particular:

  • It should show mouse-over information over the term that it parsed
  • It should add the declaration (with proof sorry'd) to the environment if the type was elaborated successfully

Related RFC: #3556

Community Feedback

Zulip thread

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

Activity

  1. added
    RFC
    on Mar 1, 2024
  2. leodemoura commented on Mar 6, 2024

    @leodemoura
    Member

    @fpvandoorn Could you please attach an example?
    The following example seems to be doing what you want.

    opaque g : Nat → Nat
    
    def f : (n : Nat) → Nat
      | 0 => g 1
      | n+1 => g (f n)
    
    set_option maxHeartbeats 100 in
    theorem foo : f 30 = x := by
      simp [f] -- (deterministic) timeout at 'whnf', ...
    
    /--
    info: theorem foo : ∀ {x : Nat}, f 30 = x :=
    fun {x} => sorryAx (f 30 = x) true
    -/
    #guard_msgs in
    #print foo

    Here is the hover over f.
    image

  3. fpvandoorn commented on Mar 7, 2024

    @fpvandoorn
    ContributorAuthor

    I get the same desired behavior on your example. I'll try to attach an example the next time I encounter this.

  4. fpvandoorn commented on Apr 3, 2024

    @fpvandoorn
    ContributorAuthor

    I expect that this is a special case of #3831 (which has small mwe's) when the deterministic timeout occurs during elaboration (and not during tactic execution).

  5. fpvandoorn commented on Apr 3, 2024

    @fpvandoorn
    ContributorAuthor

    This realization made it easy to find a MWE for this issue:

    def foo : Nat → Nat
    | 0 => 0
    | n+1 => foo n + 1
    
    set_option maxHeartbeats 100 in /- note: when we remove this, there is a max recursion depth error, 
    and that also causes bar to not be added to the environment -/
    theorem bar : True := by
      simp [show foo 1000 = 1000 from rfl] -- (deterministic) timeout
    
    #print bar -- unknown constant 'bar'

    I expect it is indeed the same cause as #3831.

  6. added a commit that references this issue on May 10, 2024
    aad9fd6
  7. added a commit that references this issue on May 11, 2024
    a875ae3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFC

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions