What is the relation between Dafny's Hilbert epsilon operator and apparently redundant code?

你离开我真会死。 提交于 2021-01-29 14:11:20

问题


In the Dafny code below the var notUsed := t; line seems redundant as notUsed is, as the name suggests, not used. But, with out this line the var e :| e in t line becomes not unique. Why has this assignment changed the uniqueness?

predicate setIsSeq<T>(t : set<T>, q : seq<T>) 
  { (|t| == |q|)  ==>
   (forall i :: (0 <= i < |q|) ==> (q[i] in t)) &&
   (forall x :: x in t ==> (x in q))
}
function method fSetToSeq<T>(t : set<T>) : (r : seq<T>)
  decreases t 
  ensures setIsSeq(t,r);
 {
  var notUsed := t;//with out this var e:|e in t; is not unique
  if (|t| == 0) then [] 
  else (
    var e :| e in t; 
    var tx := t - {e};
    var qx := fSetToSeq(tx);
    [e] + qx  //part of the var e:|e in t expression and is unique
    )
  } 

回答1:


This is a bug. Please report it on github: https://github.com/dafny-lang/dafny/issues



来源:https://stackoverflow.com/questions/63916646/what-is-the-relation-between-dafnys-hilbert-epsilon-operator-and-apparently-red

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!