伊莎贝尔在任何语言环境之外使用语言环境或上下文

Isabelle use Locale or Context outside of any locale

我已经定义了语言环境并证明了一些定理。现在我需要在 locale/context 之外使用它们。我该怎么做? 我可以通过语言环境假设扩展的假设获得定理吗? (就像在 Coq 中完成的那样。)

locale mylocale =
  assumes H1:‹a ∈ A›
begin

theorem thm:‹a∈A›
  by (rule H1)

end

我需要从上面定义的 thm 中获得定理 "a∈A==>a∈A"。 (我不需要这个定理,它只是一个使用扩展假设集获得定理的最简单的例子。(mylocale 中的假设为零))

语言环境上下文中的每个定义和定理都会生成一个全球版本。您可以使用 locale_name.constant_namelocale_name.theorem_name 访问此全局版本(通过区域设置参数进行概括并使用区域设置假设进行扩展)。在你的例子中,mylocale.thm 给了你你想要的。

如果您需要多个定理而无需概括语言环境参数,您可以在固定参数并采用假设的未命名上下文中解释语言环境。这是一个例子:

 locale l = fixes a :: 'a assumes "a ~= undefined" begin
 definition foo :: 'a where "foo = a"
 lemma lem: "a = foo" by(simp add: foo_def)
 end

 thm l.lem (* a is generalized to ?a *)

 consts bar :: nat

 context assumes *: "bar ~= undefined" begin
 interpretation bar: l bar by(fact bar)
 thm lem (* a is instantiated with bar *)
 end