
prelude "(* This file is generated by Why3's coq-ssreflect driver *)"
prelude "(* Beware! Only edit allowed sections below    *)"

printer "coq-ssr"
filename "%t.v"

valid 0
unknown "Error: \\(.*\\)$" "\\1"
fail "Syntax error: \\(.*\\)$" "\\1"
time "why3cpulimit time : %s s"

transformation "inline_trivial"
transformation "eliminate_non_struct_recursion"
transformation "eliminate_if"
transformation "eliminate_literal"
transformation "eliminate_non_lambda_set_epsilon"
transformation "eliminate_projections"
transformation "simplify_formula"


theory BuiltIn

  prelude "\n\
Require Import ssreflect ssrbool ssrfun ssrnat seq eqtype ssrint.\n\
Require Import ssrint ssrwhy3.\n\
Set Implicit Arguments.\n\
Unset Strict Implicit.\n\
Unset Printing Implicit Defensive.\n\
"

  syntax type int "int"
  syntax type real "R"
  syntax predicate  (=)   "(%1 = %2)"

end

theory Unit
  syntax type unit "unit"
end

theory HighOrd
  syntax type (->) "(%1 -> %2)"
  syntax function (@)  "(%1 %2)"
end

theory Bool
  syntax type bool   "bool"

  syntax function True  "true"
  syntax function False "false"
end

theory bool.Bool
  syntax function andb  "(Init.Datatypes.andb %1 %2)"
  syntax function orb   "(Init.Datatypes.orb %1 %2)"
  syntax function xorb  "(Init.Datatypes.xorb %1 %2)"
  syntax function notb  "(Init.Datatypes.negb %1)"
  syntax function implb "(Init.Datatypes.implb %1 %2)"
end

theory map.Map
  syntax function get "(%1 %2)"
end

theory int.Int

  prelude "\n\
Require Import ssralg ssrnum.\n\
Import GRing.Theory Num.Theory.\n\
Local Open Scope ring_scope."

  syntax function zero "0%:Z"
  syntax function one  "1%:Z"

  syntax function (+)  "(%1 + %2)%R"
  syntax function (-)  "(%1 - %2)%R"
  syntax function ( * )  "(%1 * %2)%R"
  syntax function (-_) "(-%1)%R"

  syntax predicate (<=) "(%1 <= %2)%R"
  syntax predicate (<)  "(%1 < %2)%R"
  syntax predicate (>=) "(%1 >= %2)%R"
  syntax predicate (>)  "(%1 > %2)%R"

  remove prop MulComm.Comm
  remove prop MulAssoc.Assoc
  remove prop Unit_def_l
  remove prop Unit_def_r
  remove prop Inv_def_l
  remove prop Inv_def_r
  remove prop Assoc
  remove prop Mul_distr_l
  remove prop Mul_distr_r
  remove prop Comm
  remove prop Unitary
  remove prop Refl
  remove prop Trans
  remove prop Antisymm
  remove prop Total
  remove prop NonTrivialRing
  remove prop CompatOrderAdd
  remove prop CompatOrderMult
  remove prop ZeroLessOne

end

theory array.Array

  syntax type array "(array %1)"

  syntax function ([]) "(get %1 %2)"
  syntax function length "(size %1 : int)"
  syntax function elts "(get %1)"
(* does not exist anymore
  syntax function make "(make %1 %2)"
*)

end

theory matrix.Matrix

  syntax type matrix "(matrix %1)"

  syntax function rows "(nrows %1 : int)"
  syntax function columns "(ncols %1 : int)"
  syntax function elts "(matrix_get_curry %1)"
(* does not exist anymore
  syntax function make "(matrix_make %1 %2)"
*)

end
