我正在将一个列表分解为头尾两部分,但稍后我需要一个证明,证明它们在合并时还给了我原始列表:
test: Bool -> String test b = let lst = the (List Nat) ?getListFromOtherFunction in case lst of Nil => "" x :: xs => let eq = the ((x::xs) = lst) ?howToDoIt in ""
我用的是IDRIS1.3.1。
您可以使用依赖模式匹配:
test: List Nat -> String test lst with (lst) proof prf | Nil = "" | (x :: xs) = ?something
在这里 prf 会保持你的平等。
prf
lst 在LHS中,您的证明将在需要时自动简化。
lst