// CalcDefaultMainOperator.dfy

/*
module _System {
  /* CALL GRAPH for module _System:
   * SCC at height 1:
   *   RotateLeft
   * SCC at height 1:
   *   RotateRight
   * SCC at height 0:
   *   array
   * SCC at height 0:
   *   nat
   * SCC at height 0:
   *   object
   */
  type string(==,0) = seq<char>

  type {:axiom} nat(==,0) = x: int
    | 0 <= x

  trait {:compile false} object { }
  /*-- non-null type
  type {:axiom} object(==) = c: object? | c != null /*special witness*/
  */

  class {:compile false} array<arg> {
    const Length: int
  }
  /*-- non-null type
  type {:axiom} array(==)<arg> = c: array?<arg> | c != null /*special witness*/
  */

  type {:compile false} /*_#Func1*/ -T0 ~> +R {
    ghost function requires(x0: T0): bool
      reads reads(x0)

    ghost function reads(x0: T0): set<object?>
      reads reads(x0)
  }

  type {:compile false} /*_#PartialFunc1*/ -T0 --> +R = f: T0 ~> R
    | forall x0: T0 :: f.reads(x0) == {}
    /*special witness*/

  type {:compile false} /*_#TotalFunc1*/ -T0 -> +R = f: T0 --> R
    | forall x0: T0 :: f.requires(x0)
    /*special witness*/

  type {:compile false} /*_#Func0*/ () ~> +R {
    ghost function requires(): bool
      reads reads()

    ghost function reads(): set<object?>
      reads reads()
  }

  type {:compile false} /*_#PartialFunc0*/ () --> +R = f: () ~> R
    | f.reads() == {}
    /*special witness*/

  type {:compile false} /*_#TotalFunc0*/ () -> +R = f: () --> R
    | f.requires()
    /*special witness*/

  datatype /*_tuple#2*/ (+T0, +T1) = _#Make2(0: T0, 1: T1)

  type bool { }

  type char { }

  type int { }

  type real {
    const Floor: int
  }

  type ORDINAL {
    const IsLimit: bool
    const IsSucc: bool
    const Offset: int
    const IsNat: bool
  }

  type _bv {
    function RotateLeft(w: nat): selftype

    function RotateRight(w: nat): selftype
  }

  type set<+T> { }

  type iset<*T> { }

  type seq<+T> { }

  type multiset<+T> { }

  type map<+T, +U> {
    const Keys: set<T>
    const Values: set<U>
    const Items: set<(T, U)>
  }

  type imap<*T, +U> {
    const Keys: iset<T>
    const Values: iset<U>
    const Items: iset<(T, U)>
  }

  datatype /*_tuple#0*/ () = _#Make0
}
// bitvector types in use:
*/

/* CALL GRAPH for module _module:
 * SCC at height 0:
 *   TestBool
 * SCC at height 0:
 *   TestMultiset
 * SCC at height 0:
 *   TestSet
 */
lemma TestBool(F: bool, T: bool)
  requires F == false && T == true
  decreases F, T
{
  calc <== {
    false;
  <==
    T;
  <==
    F;
  }
  calc ==> {
    true;
  ==>
    F;
  ==>
    T;
  }
  calc ==> {
    F;
  ==>
    T;
  ==>
    false;
  }
  calc <== {
    false;
  <==
    T;
  <==
    F;
  }
}

lemma TestSet(Empty: set<int>, Nonempty: set<int>)
  requires |Empty| == 0 && |Nonempty| > 0
  decreases Empty, Nonempty
{
  calc >= {
    {};
  >=
    Nonempty;
  >=
    Empty;
  }
  calc <= {
    Empty;
  <=
    Nonempty;
  <=
    {};
  }
}

lemma TestMultiset(Empty: multiset<int>, Nonempty: multiset<int>)
  requires |Empty| == 0 && |Nonempty| > 0
  decreases Empty, Nonempty
{
  calc >= {
    multiset{};
  >=
    Nonempty;
  >=
    Empty;
  }
  calc <= {
    Empty;
  <=
    Nonempty;
  <=
    multiset{};
  }
}

module PrintTest {
  /* CALL GRAPH for module PrintTest:
   * SCC at height 1:
   *   Eleven
   * SCC at height 1:
   *   Ten
   * SCC at height 1:
   *   TenAgain
   * SCC at height 1:
   *   TenOnceMore
   * SCC at height 1:
   *   Twelve
   * SCC at height 1:
   *   TwentyOne
   * SCC at height 0:
   *   Even
   * SCC at height 0:
   *   Five
   * SCC at height 0:
   *   NewEven
   * SCC at height 0:
   *   NewOdd
   * SCC at height 0:
   *   Odd
   * SCC at height 0:
   *   Six
   * SCC at height 0:
   *   Twenty
   * SCC at height 0:
   *   Yes
   */
  function Five(): int
  {
    5
  }

  ghost function Six(): int
  {
    6
  }

  function Ten(): int
  {
    var f: int := Five();
    ghost var s: int := Six();
    assert s == 6;
    f + f
  }

  function TenAgain(): int
  {
    var ten: int := var f: int := Five(); ghost var s: int := Six(); assert s == 6; f + f;
    ten
  }

  ghost function TenOnceMore(): int
  {
    ghost var ten: int := ghost var f: int := Five(); ghost var s: int := Six(); assert s == 6; f + f;
    ten
  }

  ghost function Eleven(): int
  {
    ghost var f: int, s: int := Five(), Six();
    f + s
  }

  ghost function Twelve(): int
  {
    ghost var s: int, t: int := Six(), Six();
    s + t
  }

  function Twenty(): int
  {
    var x: int :| x == 10;
    x + x
  }

  function TwentyOne(): int
  {
    ghost var x: int :| x == 10 && Yes(x);
    assert x + x + 1 == 21;
    21
  }

  ghost predicate Yes(x: int)
    decreases x
  {
    true
  }

  type Odd = x: int
    | ghost var rr: int := 2; x % rr == 1
    witness var ww: int := 2; ww + 7

  newtype NewOdd = x: int
    | ghost var rr: int := 2; x % rr == 1
    witness var ww: int := 2; ww + 7

  type Even = x: int
    | ghost var rr: int := 2; x % rr == 0
    ghost witness ghost var ww: int := 2; ww + 8

  newtype NewEven = x: int
    | ghost var rr: int := 2; x % rr == 0
    ghost witness ghost var ww: int := 2; ww + 8
}
CalcDefaultMainOperator.dfy(9,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(14,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(20,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(24,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(34,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(40,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(49,4): Error: the calculation step between the previous line and this line could not be proved
CalcDefaultMainOperator.dfy(55,4): Error: the calculation step between the previous line and this line could not be proved

Dafny program verifier finished with 9 verified, 8 errors
