Zulip Chat Archive

Stream: new members

Topic: failed to define inductive datatype


Pedro Minicz (Jan 05 2022 at 19:47):

Why definitions term₂ and term₃ don't work? I don't understand the "nested occurrence [...]" error messages. Is there any work around I can do to fix them?

structure Language :=
(functions :   Type)
(relations :   Type)

variable (L : Language)

def Language.constants := L.functions 0

inductive term₁
| var (k : ) : term₁
| func {l : } (f : L.functions l) (args : list term₁) : term₁

-- nested occurrence contains variables that are not parameters
inductive term₂
| var (k : ) : term₂
| func {l : } (f : L.functions l) (args : vector term₂ l) : term₂

-- nested occurrence lives in universe '0' but must live in resultant universe '1'
inductive term₃
| var (k : ) : term₃
| func {l : } (f : L.functions l) (args : list term₃) (h : args.length = l): term₃

Reid Barton (Jan 05 2022 at 20:15):

I suggest using args : fin l → term.

Pedro Minicz (Jan 05 2022 at 21:12):

Thanks for the suggestion.

Pedro Minicz (Jan 05 2022 at 21:13):

I would love to hear an explanation of why definitions 2 and 3 don't work tho.

Alex J. Best (Jan 05 2022 at 21:16):

Check out https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/nested.20inductive.20type.20error/near/211030307

Pedro Minicz (Jan 05 2022 at 21:20):

Thanks Alex :smiley:


Last updated: Dec 20 2023 at 11:08 UTC