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: GuessLex: if no measure is found, explain why #2960

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Nov 24, 2023

by showing the matrix of calls and measures, and what we know about that
call (=, <, ≤, ?), e.g.

guessLexFailures.lean:27:0-33:31: error: Could not find a decreasing measure.
The arguments relate at each recursive call as follows:
(<, ≤, =: relation proved, ? all proofs failed, _: no proof attempted)
           x1 x2 x3
1) 29:6-25  =  =  =
2) 30:6-23  =  ?  <
3) 31:6-23  <  _  _
Please use `termination_by` to specify a decreasing measure

It’s a bit more verbose for mutual functions.

It will use the user-specified argument names for functions written

foo (n : Nat) := …

but not with pattern matching like

foo : Nat → … 
  | n => …

This can be refined later and separately (and maybe right away in expandMatchAltsWhereDecls).

@nomeata
Copy link
Collaborator Author

nomeata commented Nov 24, 2023

TODO:

  • Also for mutual recursion
  • More tests

I am not sure how well an ASCII-table works everywhere; the “Problems” pane of VSCode uses a proportional font.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 24, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 24, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Nov 24, 2023
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Nov 24, 2023

Base automatically changed from joachim/guess-lex to master November 27, 2023 18:50
nomeata added a commit that referenced this pull request Nov 28, 2023
which also removes an error condition at the use site.

While I am at it, I rename a parameter in `GuessLex` that I forgot to
rename earlier.

The effect will be user-visible (in obscure corner cases) with #2960, so
I’ll have the test there.

A few places would benefit from a `lambdaTelescopeBounded` that
garantees the result has the right length (eta-expanding when
necessary). I’ll look into that separately, and left TODOs here.
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 28, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 29, 2023
…erm (#2974)

which also removes an error condition at the use site.

While I am at it, I rename a parameter in `GuessLex` that I forgot to
rename earlier.

The effect will be user-visible (in obscure corner cases) with #2960, so
I’ll have the test there.

A few places would benefit from a `lambdaTelescopeBounded` that
garantees the result has the right length (eta-expanding when
necessary). I’ll look into that separately, and left TODOs here.
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 1, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 1, 2023
@nomeata nomeata force-pushed the joachim/guess-lex-verbose branch from f38d0ae to b5e369d Compare December 1, 2023 15:49
@nomeata nomeata changed the title feat: GuessLex: If no measure is found, explain why feat: GuessLex: if no measure is found, explain why Dec 1, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 1, 2023
@nomeata nomeata marked this pull request as ready for review December 2, 2023 11:22
@nomeata nomeata added the will-merge-soon …unless someone speaks up label Dec 4, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 4, 2023
@nomeata nomeata added this pull request to the merge queue Dec 5, 2023
Merged via the queue into master with commit 17825bf Dec 5, 2023
@nomeata nomeata deleted the joachim/guess-lex-verbose branch December 5, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants