Closed ywata closed 2 years ago
Another small test case; this also seems to be triggered by dependent arguments:
def natToType : Nat → Type
| 0 => Unit
| _ => Bool
inductive Foo : Nat → Char → Prop
| mk (n : Nat) (elem : natToType n) (c : Char) : Foo n c
/-
constructor Foo.mk : ∀ (n : ℕ) (c : Char), natToType n → Foo n c
-/
#print Foo.mk
Thanks for posting the two examples. Lean 4 tries to reorder arguments when trying to transform inductive datatype indices into parameters. For example, in the second example, both indices are converted into indices.
#print Foo
-- it will say that `Foo` has 2 parameters
I can see this reordering feels unexpected. I will experiment and try to improve. For example, we can try to reorder only auto implicit parameters.
Prerequisites
Description
Mario investigated and minimized my example. I only report minimized example here.
Steps to Reproduce
Expected behavior: The check command shows something like below:
Actual behavior: The check command actually shows
Note that arguments are swapped.
Reproduces how often: It always gives the same result
Versions
Lean (version 4.0.0-nightly-2022-05-14, commit 4934104eaf87, Release) Mac OS 10.15.7