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

possible bug revealed by failure to apply simple rel, warning/error is confusing #20232

Open
3 tasks done
rzeta0 opened this issue Dec 25, 2024 · 0 comments
Open
3 tasks done

Comments

@rzeta0
Copy link

rzeta0 commented Dec 25, 2024

Prerequisites

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

Description

The following is an MWE reproducing an issue I found working on a wider exercise.

import Mathlib.Tactic

example {n: ℕ} (h: 5 ≤ n): 2^n ≥ 30 := by
  calc
    2^n ≥ 2^5 := by rel [h] -- < -- fails ---
    _ ≥ 30 := by norm_num

The rel [h] fails.

The error message is confusing:

rel failed, cannot prove goal by 'substituting' the listed relationships. The steps which could not be automatically justified were:
1 ≤ 2

The code and error message have been verified on the online environment:
https://live.lean-lang.org/#codez=JYWwDg9gTgLgBAWQIYwBYBtgCMB0AVJAYxmEICgyBTADyXHUrgG8A7ALjkFRCAXzgApUHAKxxAJkRwWASg4AmAHos4gUyI4AZgAMcNgF44WAJ5k4cQknTljx+YpXyROvfrhRK6OAG1UAXTgBaX3AAPH4BAGZIwOgAziG+RpYA+spqmg4GEtAgCSwAriBkQA

Context

The issue was mentioned on the lean zulipchat and it was recommended a bug report was raised (forgive me if I misunderstood that bit)

https://leanprover.zulipchat.com/#narrow/channel/113489-new-members/topic/can't.20apply.20simple.20inequality.20by.20.60rel.60

Steps to Reproduce

  1. use the MWE above
  2. or use the linked example on the online environment

Expected behavior: [Clear and concise description of what you expect to happen]

It is expected that the rel [h] succeeds with no error or warning.

There may be some discussion about (0.5)^n ≥ (0.5)^5 but the MWE above only uses natural numbers, not reals or irrationals, not even integers.

Actual behavior: [Clear and concise description of what actually happens]

The rel [h] fails.

The error message is confusing:

rel failed, cannot prove goal by 'substituting' the listed relationships. The steps which could not be automatically justified were:
1 ≤ 2

Additional

Adding an explicit hypothesis g: 1 ≤ 2 in response to the error message is also fails.
Even if it worked, this should not be considered a satisfactory solution.

import Mathlib.Tactic

example {n: ℕ} (h: 5 ≤ n): 2^n ≥ 30 := by
  have g: 1 ≤ 2 := by norm_num -- < -- shouldn't ne necessary, still fails
  calc
    2^n ≥ 2^5 := by rel [h] -- < -- fails ---
    _ ≥ 30 := by norm_num

Versions

using macOS 15.2 VSC 1.96.2 the lean version is "4.3.0"
using live.lean-lang.org "4.15.0-rc1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant