2

又是一个结果出乎意料的小例子。

theory Scratch
imports Main
begin

datatype test = aa | bb | plus test test

axiomatization where
   testIdemo : "x == plus x x"

lemma test1 : "y == plus y y"

现在我收到以下消息:

Auto solve_direct: The current goal can be solved directly with
  Scratch.testIdemo: ?x ≡ test.plus ?x ?x 
Auto Quickcheck found a counterexample:
  y = aa
Evaluated terms:
  test.plus y y = test.plus aa aa

当我尝试运行大锤时,我得到:

"remote_vampire": Try this: using testIdemo by auto (0.0 ms). 
"spass": The prover derived "False" from "test.distinct(5)" and "testIdemo". 
This could be due to inconsistent axioms (including "sorry"s) or to a bug in Sledgehammer. 
If the problem persists, please contact the Isabelle developers.

这是因为我弄乱了==吗?还是我需要为我的公理设置一些其他类型的限制?

跟进:

显然我不应该玩equals :P 所以我需要定义我自己的关系。

axiomatization
testEQ ::  "test ⇒ test ⇒ bool" (infixl "=" 1)
  where
reflexive [intro]: "x = x" and
substitution [elim]: "x = y ⟹ B x = B y" and
symmetric : "x = y ⟹ y = x"

所以我想我必须定义我的基本属性。反身性、替代性和对称性似乎不错。我可以用 'a => 'a => bool 使它通用

现在我将继续定义我的更多关系。继续举例:

axiomatization
  plus :: "test⇒ test⇒ test" (infixl "+" 35)
where
  commutative:  "x + y         = y + x"  and
  idemo:  "x + x           = x"  

a)到目前为止这是正确的 b)如何从这里开始到目前为止,我认为这不会取代引理中的子项,这有点等同于等价点。

4

1 回答 1

3

您的公理意味着 eg aa = plus aa aa,这是错误的,因为数据类型的构造函数在构造上总是不同的。(参见thm test.distinct

事实上,如果你使用axiomatization,你应该真的知道你在做什么——这样很容易引入不一致。(明显地)

如果您想拥有具有某些属性的类型,则必须构造它。例如,您可以定义您的类型的表示类型(例如作为数据类型),然后在其上定义一些相等关系(即哪些值应该等于其他值),然后将“真实”类型定义为商类型您在该关系上的表示类型。

于 2016-01-10T21:59:20.577 回答