Define a length function over $A^{*} \leftarrow{N}$ such that $length(l)$ outputs the length of $l$

cs.stackexchange https://cs.stackexchange.com/questions/98692

  •  05-11-2019
  •  | 
  •  

Pergunta

Consider the following definitions

LIST:

$\overline{nil} \ \ \ \ \ \frac{l}{a \ l}$ $a \in A$

$A^* = \mu \widehat{LIST}, \ A^{\infty} = v \widehat{LIST}$

NAT:

$\overline{0} \ \ \ \ \ \frac{x}{s(x)}$

$ N = \mu \widehat{NAT}, \ N^{\infty} = v \widehat{NAT}$

Given those definitions I have to define a length function over $A^{*} \leftarrow{N}$ such that $length(l)$ outputs the length of $l$.

I have tried to do this problem using structural induction on a given $l$ but I don't seem to get any relevant result.

In general, how would you approach this kind of problem?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top