Zulip Chat Archive

Stream: general

Topic: Type mismatch error for output, yet no output type specified


nrs (Oct 15 2024 at 00:28):

structure Signature' where
  symbols : Type
  arity : symbols -> Nat

inductive μ' (σ : Signature')
| mk {α : Type} : Sigma (fun x => Vect α (σ.arity x)) -> μ' σ

variable (σ : Signature')
variable (n : Nat)
 #check fun (x : μ' σ) => match x with | μ'.mk (Sigma.mk fst snd) => snd

Why would the above error out with the following?

type mistmatch, alternative has type
  Vect α (σ.arity x) : Type
but is expected to have type
  ?m.24081 (μ'.mk x, y) : Sort ?u.24078

No issue when we take fst instead. Shouldn't the output type be inferred by what I choose as an output? if so why am I failing typecheck?


Last updated: May 02 2025 at 03:31 UTC