简体   繁体   English

在 Isabelle/HOL 中未定义

[英]undefined in Isabelle/HOL

I was trying to prove this lemma in Isabelle/HOL.我试图在 Isabelle/HOL 中证明这个引理。

lemma "(0::nat) ≠ undefined"

But nitpick finds counterexamples to both this and it's negation但是 nitpick 找到了反例,这两者都是否定的

lemma "(0::nat) = undefined"

How is this possible?这怎么可能? I looked up how undefined is defined and it's an axiom:我查了一下 undefined 是如何定义的,这是一个公理:

axiomatization undefined :: 'a

But it's still classical logic, right?但这仍然是经典逻辑,对吧? So either "(0::nat) = undefined" or "(0::nat) ≠ undefined" should be true.所以"(0::nat) = undefined""(0::nat) ≠ undefined"应该是真的。


Background:背景:

I have a function of type:我有一个类型的功能:

type_synonym myfun = "nat ⇒ nat"

and I impose constraints on its image and domain in a locale.我在语言环境中对其图像和域施加了限制。 When I tried to take a specific function and show that it fulfills all conditions in the locale I got problems since some of the conditions only hold for values that are not undefined.当我尝试采用特定函数并证明它满足语言环境中的所有条件时,我遇到了问题,因为某些条件仅适用于未定义的值。

Thank you in advance :)先感谢您 :)

By axiomatisation, each type has one designated value that is undefined .通过公理化,每种类型都有一个undefined指定值。 This is not some separate value that lives outside the normal range of that type, ie undefined :: nat is a natural number, but you do not know which natural number it is, and in fact you will not be able to prove any non-trivial property about undefined .这不是存在于该类型的正常范围之外的某个单独的值,即undefined :: nat是一个自然数,但您不知道它是哪个自然数,实际上您将无法证明任何非-关于undefined微不足道的属性。 A trivial property in this context is one that holds for all values of the type.在此上下文中,一个无关紧要的属性适用于该类型的所有值。

Therefore, the statement undefined ≠ (0 :: nat) is not provable in Isabelle/HOL, and neither is its negation (bugs and inconsistencies aside).因此,语句undefined ≠ (0 :: nat)在 Isabelle/HOL 中是不可证明的,它的否定也不是(除了错误和不一致之外)。

For undefined :: bool in particular, we know that undefined = True ∨ undefined = False , but again, you will not be able to prove undefined = True or undefined = False .特别是对于undefined :: bool ,我们知道undefined = True ∨ undefined = False ,但同样,您将无法证明undefined = Trueundefined = False

For the unit type (the one-element type consisting only of the value () :: unit ), however, you can prove undefined = () , since this is a trivial property.但是,对于单元类型(仅由值() :: unit组成的单元素类型),您可以证明undefined = () ,因为这是一个微不足道的属性。

As for your original problem, it sounds as if you have to change the way you model undefinedness in your application.至于您的原始问题,听起来好像您必须更改应用程序中对不确定性建模的方式。 Since you did not give any details about what you are doing, it is not really possible to give any specific advice about what to do.由于您没有提供有关您正在做什么的任何详细信息,因此实际上不可能就该做什么提供任何具体建议。 But trying to prove anything about undefined is not going to work.但是试图证明任何关于undefined的事情是行不通的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM