Zulip Chat Archive

Stream: mathlib4

Topic: error


vxctyxeha (Apr 25 2025 at 01:55):

failed to synthesize
OfNat (Fin n) 0
numerals are polymorphic in Lean, but the numeral 0 cannot be used in a context where the expected type is
Fin n
due to the absence of the instance above

Additional diagnostic information may be available using the set_option diagnostics true command.

import Mathlib

open Equiv Subgroup

theorem cyc(n : ) : Subgroup.closure {finRotate (n ), swap 0 1} =  := by

Aaron Liu (Apr 25 2025 at 02:07):

If n = 0 then there are no elements of Fin n

vxctyxeha (Apr 25 2025 at 02:26):

theorem cycles_generate_S_n  (hn : 2  n) : Subgroup.closure {finRotate n, swap 0 1} =  := by

Matt Diamond (Apr 25 2025 at 02:37):

instead of (hn : 2 ≤ n), add [NeZero n]

Matt Diamond (Apr 25 2025 at 02:39):

(or you can leave in (hn : 2 ≤ n)... my point is just that [NeZero n] will fix your issue)


Last updated: May 02 2025 at 03:31 UTC