Zulip Chat Archive
Stream: lean4
Topic: DecidableEq diamond on Fin
Yaël Dillies (Aug 11 2024 at 22:16):
I have discovered that Mathlib's docs#Fin.instLinearOrder induces a diamond for DecidableEq (Fin n)
:
import Mathlib.Order.Fin.Basic
example (n : ℕ) : instDecidableEqFin n = instDecidableEq_mathlib := rfl -- fails
Yaël Dillies (Aug 11 2024 at 22:17):
This is due to the LinearOrder (Fin n)
instance being defined through docs#LinearOrder.liftWithOrd, which itself uses docs#decidable_of_iff
Yaël Dillies (Aug 11 2024 at 22:19):
... and this is the obvious thing to be doing: We want to prove Decidable (x ≤ y)
from Decidable (↑x ≤ ↑y)
by "rewriting" using decidable_of_iff
. In particular, I don't think that we should change docs#Fin.instLinearOrder .
Yaël Dillies (Aug 11 2024 at 22:20):
Hence, even though the problem is created by Mathlib, it eventually boils down to two core constructs, namely docs#instDecidableEqFin and docs#decidable_of_iff, being defined in incompatible ways.
Yaël Dillies (Aug 11 2024 at 22:20):
Would people be happy with a PR redefining instDecidableEqFin
using decidable_of_iff
?
Yaël Dillies (Aug 11 2024 at 22:26):
... and here is the Mathlib-free MWE that the above Mathlib-full MWE boils down to:
example (n : Nat) : instDecidableEqFin n = fun x y ↦ decidable_of_iff _ Fin.val_inj := rfl -- fails
Kim Morrison (Aug 11 2024 at 23:18):
I suspect there is going to be a bootstrapping issue here: instDecidableEqFin
is in Init.Prelude
, and I think is needed immediately.
Yaël Dillies (Aug 12 2024 at 04:53):
I did notice that, but decidable_of_iff
doesn't really depend on anything either, right?
Kim Morrison (Aug 12 2024 at 11:07):
I guess so! Happy to take a look if you want to make a draft PR to this effect.
Yaël Dillies (Aug 12 2024 at 12:21):
I am trying to write the PR as we speak, but I am discovering that I don't even know how to get the Lean server started on the lean4 repo! I get the following error (on Windows, if relevant):
Error while checking Lean version: info: downloading component 'lean' error: could not download nonexistent lean version `lean4-stage0` info: caused by: could not download file from 'https://github.com/leanprover/lean4/releases/expanded_assets/lean4-stage0' to 'C:⋃ info: caused by: http request returned an unsuccessful status code: 404 Error(Download(HttpStatus(404)), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
Matthew Ballard (Aug 12 2024 at 12:22):
elan toolchain link lean4-stage0 build/release/stage0
assuming you have already built things
Yaël Dillies (Aug 12 2024 at 12:23):
Matthew Ballard said:
assuming you have already built things
What "things"?
Eric Wieser (Aug 12 2024 at 12:23):
Yaël Dillies said:
In particular, I don't think that we should change docs#Fin.instLinearOrder .
I don't really agree with this; I think changing the instance would be fine (but so is your approach)
Matthew Ballard (Aug 12 2024 at 12:23):
stage0
and stage1
-- I'll find the link
Matthew Ballard (Aug 12 2024 at 12:24):
https://lean-lang.org/lean4/doc/make/index.html#generic-build-instructions
Kim Morrison (Aug 13 2024 at 01:41):
Yaël Dillies said:
Matthew Ballard said:
assuming you have already built things
What "things"?
mkdir -p build/release
cd build/release
cmake ../..
cd ../..
make -j32 -C build/release
(only the last line necessary on subsequent runs)
Julian Berman (Aug 13 2024 at 02:37):
-j32
:dollar_bills:
Yaël Dillies (Aug 13 2024 at 08:16):
Hmm,
Matthew Ballard said:
https://lean-lang.org/lean4/doc/make/index.html#generic-build-instructions
Doing this I'm stuck on installing libuv
Yaël Dillies (Aug 13 2024 at 08:17):
Kim Morrison said:
mkdir -p build/release cd build/release cmake ../.. cd ../.. make -j32 -C build/release
Doing this too
Markus Himmel (Aug 13 2024 at 08:27):
Yaël Dillies said:
Doing this I'm stuck on installing libuv
Stuck in what way?
Yaël Dillies (Aug 13 2024 at 08:28):
I don't know what instructions to follow
Markus Himmel (Aug 13 2024 at 08:28):
Which operating system are you using?
Yaël Dillies (Aug 13 2024 at 08:29):
I'm on gitpod, so Ubuntu
Henrik Böving (Aug 13 2024 at 08:30):
Yaël Dillies said:
I'm on gitpod, so Ubuntu
The instructions here give the right packages to install: https://lean-lang.org/lean4/doc/make/ubuntu.html
Last updated: May 02 2025 at 03:31 UTC