Isabelle/Simpl:调用一个过程两次

Isabelle/Simpl:调用一个过程两次,isabelle,Isabelle,在过去的一个多月里,我一直在阅读和使用Isabelle/Simpl。我写过并证明了一些理论。我还写了以下Isabelle/Simpl理论,该理论说明了我目前面临的问题 theory MemTest imports HeapList Vcg begin hoarestate globals_memory = alloc :: "ref list" free :: nat hoarestate globals_x = globals_memory + X :: "ref ⇒ int"

在过去的一个多月里,我一直在阅读和使用Isabelle/Simpl。我写过并证明了一些理论。我还写了以下Isabelle/Simpl理论,该理论说明了我目前面临的问题

theory MemTest imports HeapList Vcg begin

hoarestate globals_memory =
  alloc :: "ref list"
  free :: nat

hoarestate globals_x = globals_memory +
  X :: "ref ⇒ int"

definition sz where "sz == 1::nat"

procedures (imports globals_x)
  testerX(x :: int | result :: ref) 
  "
    ´result :== NEW sz [ ´X :== 0 ];;
    ´result→´X :== ´x
  "
lemma (in testerX_impl) testerX_spec:
"
  ∀x. Γ ⊢⇩t ⦃´x = x ∧ sz ≤ ´free ⦄
             ´result :== PROC testerX(´x)
           ⦃´result ≠ Null ∧ ´result→´X = x⦄
"
  apply(vcg)
  apply(auto)
done    

procedures (imports globals_x)
  testerXcaller(Y::ref, Z::ref)
  "
    ´Y :== CALL testerX(5);;
    ´Z :== CALL testerX(2)
  "
lemma (in testerXcaller_impl) testerXcaller_spec:
  "
    ∀y z. Γ ⊢⇩t 
     ⦃ ´Y = y ∧ ´Z = z ∧ (sz + sz) ≤ ´free ⦄
     PROC testerXcaller(´Y, ´Z)
     ⦃ ´Y ≠ Null ∧ ´Z ≠ Null  ⦄
  "
  apply(vcg)
  apply(auto)
oops

end
从过程
testerXcaller
中调用过程
testerXcaller
两次似乎会妨碍释放
testerXcaller\u规范
引理。应用
vcg
auto
策略后的结果是一个奇怪的子目标,我不知道如何实现:

goal (1 subgoal):
  1. ⋀free X result x. sz + sz ≤ free ⟹ result ≠ Null ⟹ X result = 5 ⟹ sz ≤ x
有人愿意透露一些情况吗

干杯,
George

您的
testerX\u spec
规范不足以传播可用空间的大小。事实上,如果你把它注释掉,具有讽刺意味的是,
testerXcaller\u spec
的证明就通过了

我从未使用过siml,但通过阅读大大纲文档,我发现在这样一个问题上什么都没有。而且免费的
几乎没有,所以我提出了自己的解决方案:

lemma (in testerX_impl) testerX_spec:
"
∀σ x.
 Γ ⊢⇩t ⦃σ. ´x = x ∧ sz ≤ ´free ⦄
         ´result :== PROC testerX(´x)
       ⦃´result ≠ Null ∧ ´result→´X = x ∧ ´result ∈ set ´alloc ∧ ´free =  ⇗σ⇖free - sz⦄
"
  apply(vcg)
  apply(auto)
done    
也就是说,可用空间的大小减少了
sz
。我遇到的困难——因为我不熟悉Simple——是在过程之前访问状态。这是通过
σ
实现的,需要普遍量化,并在前置条件中引入

我还补充说,
result
已被分配到事件中,尽管在这种情况下这不是严格必要的,但它可能是