Isabelle / HOL:在另一个语言环境中访问解释

时间:2018-06-11 20:12:18

标签: isabelle

我想要建立一个Isabelle / HOL库,其中包含新的定义和证明。该库定义了locale2,我想构建它。在locale2内部,有locale1的解释。

为了在单独的理论中扩展locale2,我定义了locale3 = locale2。但是,在locale3中,我无法弄清楚如何访问locale2对locale1的解释。我怎样才能做到这一点? (我甚至会以正确的方式解决这个问题吗?)

以下是MWE。这是我想要扩展的语言环境的库理论:

theory ExistingLibrary
  imports Main
begin

(* this is the locale with the function I want *)
locale locale1 = assumes True
begin

fun inc :: "nat ⇒ nat"
  where "inc n = n + 1"

end

(* this is the locale that interprets the locale I want *)
locale locale2 = assumes True
begin

interpretation I: locale1
  by unfold_locales auto

end
end

这是我的推广理论。我的尝试位于底部,导致错误:

theory MyExtension
  imports ExistingLibrary
begin

locale locale3 = locale2
begin

definition x :: nat
  where "x = I.inc 7" (* Undefined constant: "I.inc" *)

end
end

1 个答案:

答案 0 :(得分:1)

上下文中的解释仅持续到上下文结束。再次输入上下文时,您必须重复解释以使定义和定理可用:

locale 3 = locale2 begin
interpretation I: locale1 <proof>

出于这个原因,我建议将第一个解释步骤分成两部分:

  1. 一个带有名称的引理,证明了解释步骤的目标。
  2. interpretation命令本身可以证明by(rule引理)
  3. 如果您希望在打开语言环境时以及解释语言环境时进行解释,那么sublocale代替interpretation可能会更好。

相关问题