我有一个语言环境结构,其中某个语言环境作为另一种语言环境的祖先出现两次,一次通过继承,另一次通过一系列sublocale
解释序列出现。该祖先语言环境的两个实例的参数相等但不相同(它们的相等必须并且可以通过证明来建立)。如何使Isabelle像参数相同时那样将这两个祖先语言环境实例折叠为一个?
下面的最小示例演示了我的情况:
theory Diamond
imports Main
begin
typedecl a
typedecl b
typedecl c
consts a_from_b :: "b ⇒ a"
consts b_from_a_and_c :: "[a, c] ⇒ b"
lemma equality: "a_from_b (b_from_a_and_c a c) = a"
sorry
locale a =
fixes a :: a
locale b =
fixes b :: b
begin
sublocale a "a_from_b b" .
end
locale c = a +
fixes c :: c
begin
sublocale b "b_from_a_and_c a c" .
end
end
命令print_dependencies! c
产生以下输出:
dependencies:
a "a"
a "a_from_b (b_from_a_and_c a c)"
b "b_from_a_and_c a c"
c "a" "c"
很明显,有两个a
的实例。如何利用以上代码中提到的引理将这两个语言环境实例转换为单个实例a "a"
?我试图通过将sublocale
声明中的locale c
解释更改为以下内容来实现这一点:
sublocale b "b_from_a_and_c a c" rewrites "a = a_from_b (b_from_a_and_c a c)"
by (simp add: equality)
但是,这导致Isabelle挂起。
答案 0 :(得分:0)
问题末尾提到的想法几乎可行。只是必须交换rewrite
等式的两边:
sublocale b "b_from_a_and_c a c" rewrites "a_from_b (b_from_a_and_c a c) = a"
by (fact equality)
进行此更改后,print_dependencies! c
将产生以下输出:
dependencies:
a "a"
b "b_from_a_and_c a c"
c "a" "c"