Zulip Chat Archive

Stream: lean4

Topic: Default value on recursive inductive error


Yuri de Wit (Aug 17 2022 at 18:50):

Consider the following inductive, which works fine:

inductive Value
| mk (data: Float) (prev : Option (Value × Value)) (op: Option Op := .none) (label : Option String := "") (grad : Float)
deriving Repr

When I add a default value to prev:

inductive Value
| mk (data: Float) (prev : Option (Value × Value) := .none) (op: Option Op := .none) (label : Option String := "") (grad : Float)
deriving Repr

I get the following error:

application type mismatch
  optParam _nested.Option_1 none
argument has type
  Option _nested.Prod_2
but function has type
  _nested.Option_1  Type

I can't make much sense out of it. Any ideas?


Last updated: Dec 20 2023 at 11:08 UTC