File size: 585 Bytes
6851d40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// RUN: %verify "%s"

/*******************************************************************************
 *  Copyright by the contributors to the Dafny Project
 *  SPDX-License-Identifier: MIT 
 *******************************************************************************/

module {:options "-functionSyntax:4"} Math {
  function Min(a: int, b: int): int
  {
    if a < b
    then a
    else
      b
  }

  function Max(a: int, b: int): int
  {
    if a < b
    then b
    else
      a
  }

  function Abs(a: int): (a': int)
    ensures a' >= 0
  {
    if a >= 0 then a else -a
  }
}