Functional programming 忽略Isabelle中缺失的模式

Functional programming 忽略Isabelle中缺失的模式,functional-programming,isabelle,theorem-proving,Functional Programming,Isabelle,Theorem Proving,例如,我想定义一个函数来提取列表的第一个元素。对于此函数,我不关心列表为空的情况(例如,我可以确保每次使用该函数时,我都会传递一个非空列表)。但伊莎贝尔会警告你的 Missing patterns in function definition: extracts [] = undefined 我如何处理这种情况?您有很多选择,例如: fun extracts,其中“extracts xs=hd xs” 定义提取,其中[simp]:“提取=hd” fun extracts,其中“extracts

例如,我想定义一个函数来提取列表的第一个元素。对于此函数,我不关心列表为空的情况(例如,我可以确保每次使用该函数时,我都会传递一个非空列表)。但伊莎贝尔会警告你的

Missing patterns in function definition:
extracts [] = undefined

我如何处理这种情况?

您有很多选择,例如:

  • fun extracts,其中“extracts xs=hd xs”
  • 定义提取,其中[simp]:“提取=hd”
  • fun extracts,其中“extracts xs=(x#)的情况xs)⇒ x) “
  • fun extracts,其中“extracts(x#))=x”|“extracts[]=undefined”