We will encode a dependent elimination rule:
\frac {
u:A+B\quad
x:A+B\vdash C[x]~\mathit {type}
\quad
x:A\vdash v[x]:C[\mathsf {inl}~x]
\quad
x:B\vdash w[x]:C[\mathsf {inr}~x]
}{
\mathsf {case}_{x\mathpunct {.}{C[x]}}(u; x\mathpunct {.}{v[x]}; x\mathpunct {.}{w[x]})
:
C[u]
}
This is encoded by combining the elimination rules for the booleans and the sum of a family of types. We do so via an implicit definition.
\begin {aligned}
\mathsf {case}_{x\mathpunct {.}{C[x]}}(\left \langle \mathsf {true},u\right \rangle ;x\mathpunct {.}{v[x]};x\mathpunct {.}{w[x]})
&:\equiv v[u]
\\
\mathsf {case}_{x\mathpunct {.}{C[x]}}(\left \langle \mathsf {false},u\right \rangle ;x\mathpunct {.}{v[x]};x\mathpunct {.}{w[x]})
&:\equiv w[u]
\end {aligned}
The corresponding explicit definition is more complex, and follows by (un)currying. We could have defined:
\begin {aligned}
&
\mathsf {caseAux}_{x\mathpunct {.}{C[x]}}(
x\mathpunct {.}{v[x]};
x\mathpunct {.}{w[x]}
)
:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod }
}_{(l:\mathsf {bool})}}
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod }
}_{(u:\mathsf {If}(l;A;B))}}
C[\left \langle l,u\right \rangle ]
\\
&\mathsf {caseAux}_{x\mathpunct {.}{C[x]}}(
x\mathpunct {.}{v[x]};
x\mathpunct {.}{w[x]}
) :\equiv
\lambda l\mathpunct {.}
\mathsf {if}_{
z\mathpunct {.}
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod }
}_{(u:\mathsf {If}(z;A;B))}}
C[\left \langle z,u\right \rangle ]
}(l, \lambda u\mathpunct {.} v[u]; \lambda u\mathpunct {.} w[u])
\\[12pt]
&\mathsf {case}_{x\mathpunct {.}{C[x]}}(u; x\mathpunct {.}{v[x]}; x\mathpunct {.}{w[x]})
:\equiv
\mathsf {caseAux}_{x\mathpunct {.}{C[x]}}(x\mathpunct {.}{v[x]}; x\mathpunct {.}{w[x]})~(u.1)~(u.2)
\end {aligned}