代码之家  ›  专栏  ›  技术社区  ›  tyr.bentsen

逻辑错误还是错误?量词:forall的存在

  •  1
  • tyr.bentsen  · 技术社区  · 6 年前

    // Defining a function and giving it a meaning through axiomatization.
    function EqualsInt(x: int, y: int) : bool;
    axiom (forall x: int, y: int :: EqualsInt(x, y) == (x == y));
    
    
    procedure main()
    { 
      assert (exists i: int :: i == i);         // Assertion is verified.
      assert (forall i: int :: EqualsInt(i,i)); // Assertion is verified.
      assert (exists i: int :: EqualsInt(i,i)); // Assertion does not hold.
    }
    

    为什么前两个断言成立,而最后一个却不成立?

    0 回复  |  直到 6 年前