Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Isabelle中Takeuchi函数终止性的证明_Isabelle_Termination - Fatal编程技术网

Isabelle中Takeuchi函数终止性的证明

Isabelle中Takeuchi函数终止性的证明,isabelle,termination,Isabelle,Termination,以下是我试图证明这一点的尝试: 这里有几个问题。首先,我应该在moore函数中返回一个三元组。现在,系统正在抱怨错误: 类型统一失败:类型“int”和“\u”冲突⇒ _" 应用程序中的类型错误:操作数类型不兼容 接线员:op≤ x::(int)⇒ int⇒ int)⇒ 布尔操作数:y::int 然后,当然终止证明不会成功,因为我没有应用上面的终止函数(方法应该类似于) 如何解决这个问题?首先,您的moore函数当前不返回一个三元组,而是一个包含两个ints并返回一个int的函数。对于三元组,您必

以下是我试图证明这一点的尝试:

这里有几个问题。首先,我应该在moore函数中返回一个三元组。现在,系统正在抱怨错误:

类型统一失败:类型“int”和“\u”冲突⇒ _"

应用程序中的类型错误:操作数类型不兼容

接线员:op≤ x::(int)⇒ int⇒ int)⇒ 布尔操作数:y::int

然后,当然终止证明不会成功,因为我没有应用上面的终止函数(方法应该类似于)


如何解决这个问题?

首先,您的
moore
函数当前不返回一个三元组,而是一个包含两个
int
s并返回一个
int
的函数。对于三元组,您必须编写
int×int×int
。此外,元组被构造为
(x,y,z)
,而不是像你那样的
xyz

此外,没有理由使用
fun
(更不用说
function
)来定义
moore
函数,因为它不是递归的。
definition
工作得很好。另一方面,对于
tk
,您需要使用
function
,因为没有明显的词典终止度量

此外,返回三元组的函数在Isabelle中处理起来通常有点难看;定义三个单独的函数更有意义。将所有这些放在一起,您可以这样定义您的函数:

definition m1 where "m1 = (λ(x,y,z). if x ≤ y then 0 else 1)"
definition m2 where "m2 = (λ(x,y,z). nat (Max {x, y, z} - Min {x, y, z}))"
definition m3 where "m3 = (λ(x,y,z). nat (x - Min {x, y, z}))"

function tk :: "int ⇒ int ⇒ int ⇒ int" where
  "tk x y z = ( if x ≤ y then y else tk (tk (x-1) y z) (tk (y-1) z x) (tk (z-1) x y))"
  by auto
termination proof (relation "m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {}", goal_cases)
  case 1
  show "wf (m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {})"
    by (auto intro: wf_mlex)
next
  case (2 x y z)
  thus ?case sorry
next
  case (3 x y z)
  thus ?case sorry
next
  case (4 x y z)
  thus ?case sorry
next
  case (5 x y z)
  thus ?case sorry
qed
然后,您可以使用部分归纳规则
tk.pinduct
轻松证明
tk
函数的部分正确性定理:

lemma tk_altdef:
  assumes "tk_dom (x, y, z)"
  shows   "tk x y z = (if x ≤ y then y else if y ≤ z then z else x)"
  using assms by (induction rule: tk.pinduct) (simp_all add: tk.psimps)
tk_dom(x,y,z)
假设表示
tk
终止于
(x,y,z)

现在,如果我正确阅读了您链接的论文,终止证明的模板如下所示:

definition m1 where "m1 = (λ(x,y,z). if x ≤ y then 0 else 1)"
definition m2 where "m2 = (λ(x,y,z). nat (Max {x, y, z} - Min {x, y, z}))"
definition m3 where "m3 = (λ(x,y,z). nat (x - Min {x, y, z}))"

function tk :: "int ⇒ int ⇒ int ⇒ int" where
  "tk x y z = ( if x ≤ y then y else tk (tk (x-1) y z) (tk (y-1) z x) (tk (z-1) x y))"
  by auto
termination proof (relation "m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {}", goal_cases)
  case 1
  show "wf (m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {})"
    by (auto intro: wf_mlex)
next
  case (2 x y z)
  thus ?case sorry
next
  case (3 x y z)
  thus ?case sorry
next
  case (4 x y z)
  thus ?case sorry
next
  case (5 x y z)
  thus ?case sorry
qed
终止证明(关系“m1 m2 m3{}”,目标案例)
案例1
显示“wf(m1 m2 m3{})”
作者(自动介绍:wf_mlex)
下一个
外壳(2 x y z)
这样?对不起
下一个
外壳(3 x y z)
这样?对不起
下一个
外壳(4 x y z)
这样?对不起
下一个
外壳(5 x y z)
这样?对不起
量化宽松

在这里的最后四种情况中,您将不得不进行显示度量值减少的实际工作。
操作符将多个度量值组合成一个词典度量值。显示该度量值中包含的内容的相关规则是
mlex_less
mlex_le
首先,y我们的
moore
函数目前不返回一个三元组,而是一个取两个
int
s并返回一个
int
的函数。对于三元组,您必须编写
int×int×int
。此外,元组被构造为
(x,y,z)
,而不是像您那样的
xyz

此外,没有理由使用
fun
(更不用说
function
)来定义
moore
函数,因为它不是递归的。
definition
工作得很好。另一方面,对于
tk
,您需要使用
function
,因为没有明显的词典终止度量

此外,返回三元组的函数在Isabelle中处理起来通常有点难看;定义三个单独的函数更有意义。将所有这些放在一起,您可以这样定义您的函数:

definition m1 where "m1 = (λ(x,y,z). if x ≤ y then 0 else 1)"
definition m2 where "m2 = (λ(x,y,z). nat (Max {x, y, z} - Min {x, y, z}))"
definition m3 where "m3 = (λ(x,y,z). nat (x - Min {x, y, z}))"

function tk :: "int ⇒ int ⇒ int ⇒ int" where
  "tk x y z = ( if x ≤ y then y else tk (tk (x-1) y z) (tk (y-1) z x) (tk (z-1) x y))"
  by auto
termination proof (relation "m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {}", goal_cases)
  case 1
  show "wf (m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {})"
    by (auto intro: wf_mlex)
next
  case (2 x y z)
  thus ?case sorry
next
  case (3 x y z)
  thus ?case sorry
next
  case (4 x y z)
  thus ?case sorry
next
  case (5 x y z)
  thus ?case sorry
qed
然后,您可以使用部分归纳规则
tk.pinduct
轻松证明
tk
函数的部分正确性定理:

lemma tk_altdef:
  assumes "tk_dom (x, y, z)"
  shows   "tk x y z = (if x ≤ y then y else if y ≤ z then z else x)"
  using assms by (induction rule: tk.pinduct) (simp_all add: tk.psimps)
tk_dom(x,y,z)
假设表示
tk
终止于
(x,y,z)

现在,如果我正确阅读了您链接的论文,终止证明的模板如下所示:

definition m1 where "m1 = (λ(x,y,z). if x ≤ y then 0 else 1)"
definition m2 where "m2 = (λ(x,y,z). nat (Max {x, y, z} - Min {x, y, z}))"
definition m3 where "m3 = (λ(x,y,z). nat (x - Min {x, y, z}))"

function tk :: "int ⇒ int ⇒ int ⇒ int" where
  "tk x y z = ( if x ≤ y then y else tk (tk (x-1) y z) (tk (y-1) z x) (tk (z-1) x y))"
  by auto
termination proof (relation "m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {}", goal_cases)
  case 1
  show "wf (m1 <*mlex*> m2 <*mlex*> m3 <*mlex*> {})"
    by (auto intro: wf_mlex)
next
  case (2 x y z)
  thus ?case sorry
next
  case (3 x y z)
  thus ?case sorry
next
  case (4 x y z)
  thus ?case sorry
next
  case (5 x y z)
  thus ?case sorry
qed
终止证明(关系“m1 m2 m3{}”,目标案例)
案例1
显示“wf(m1 m2 m3{})”
作者(自动介绍:wf_mlex)
下一个
外壳(2 x y z)
这样?对不起
下一个
外壳(3 x y z)
这样?对不起
下一个
外壳(4 x y z)
这样?对不起
下一个
外壳(5 x y z)
这样?对不起
量化宽松

在这里的最后四个例子中,您将不得不进行实际工作来显示度量值减少。
操作符将多个度量值组合成一个词典度量值。显示该度量值中包含的内容的相关规则是
mlex_less
mlex_le
,谢谢,@Manuel埃伯尔。有没有关于证明程序终止的伊莎贝尔教程?有功能包手册,它链接到伊莎贝尔网站上:也可以考虑这种挑剔,但是我们这里所说的是递归函数规范的终止,而不是程序的终止。OES没有任何程序和执行的概念。所有它知道的都是函数。谢谢,MauneleBeL。有没有伊莎贝尔教程与证明程序终止有关?有功能包手册,它链接在伊莎贝尔网站上:你也可以考虑这个挑剔,但是我们在这里讨论的是终止。递归函数规范,而不是程序的终止。HOL是一个逻辑框架;它没有任何程序和执行的概念。它只知道函数。