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

wfParam propagation through lets #7038

Closed
nomeata opened this issue Feb 11, 2025 · 0 comments · Fixed by #7039
Closed

wfParam propagation through lets #7038

nomeata opened this issue Feb 11, 2025 · 0 comments · Fixed by #7039
Assignees
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@nomeata
Copy link
Collaborator

nomeata commented Feb 11, 2025

David gave me this example:

structure Tree where
  children : List Tree

/--
error: failed to prove termination, possible solutions:
  - Use `have`-expressions to prove the remaining goals
  - Use `termination_by` to specify a different well-founded relation
  - Use `decreasing_by` to specify your own tactic for discharging this kind of goal
t c : Tree
⊢ sizeOf c < sizeOf t
-/
#guard_msgs in  
def Tree.depth (t : Tree) : Nat :=
  let children := t.children
  let depths := children.map fun c => Tree.depth c
  match depths.max? with
  | some d => d+1
  | none => 0
termination_by t

This shows that wfParam propagation is incomplete; it should float a wfParam from the definition of children to the occurrences. Should be doable.

Versions

Lean 4.18.0-nightly-2025-02-11

Impact

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

@nomeata nomeata added bug Something isn't working P-medium We may work on this issue if we find the time labels Feb 11, 2025
@nomeata nomeata self-assigned this Feb 11, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 12, 2025
This PR improves the well-founded definition preprocessing to propagate
`wfParam` through let expressions.

Fixes #7038.
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this issue Feb 16, 2025
This PR improves the well-founded definition preprocessing to propagate
`wfParam` through let expressions.

Fixes leanprover#7038.
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-medium We may work on this issue if we find the time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant