(**************************************************************************)
(*                                                                        *)
(*  This file is part of WP plug-in of Frama-C.                           *)
(*                                                                        *)
(*  Copyright (C) 2007-2015                                               *)
(*    CEA (Commissariat a l'energie atomique et aux energies              *)
(*         alternatives)                                                  *)
(*                                                                        *)
(*  you can redistribute it and/or modify it under the terms of the GNU   *)
(*  Lesser General Public License as published by the Free Software       *)
(*  Foundation, version 2.1.                                              *)
(*                                                                        *)
(*  It is distributed in the hope that it will be useful,                 *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *)
(*  GNU Lesser General Public License for more details.                   *)
(*                                                                        *)
(*  See the GNU Lesser General Public License version 2.1                 *)
(*  for more details (enclosed in the file licenses/LGPLv2.1).            *)
(*                                                                        *)
(**************************************************************************)

(* this is a prelude for Alt-Ergo*)
(** The theory BuiltIn_ must be appended to this file*)
(** The theory Bool_ must be appended to this file*)
(** The theory bool_Bool_ must be appended to this file*)
(** The theory int_Int_ must be appended to this file*)
type 'a set

logic empty : 'a set

logic singleton : 'a -> 'a set

logic ac union : 'a set, 'a set -> 'a set

logic ac inter : 'a set, 'a set -> 'a set

logic member : 'a, 'a set -> prop

logic member_bool : 'a, 'a set -> bool

logic range : int, int -> int set

logic range_sup : int -> int set

logic range_inf : int -> int set

logic range_all : int set

predicate eqset(a: 'a1 set, b: 'a1 set) =
  (forall x:'a1. (member(x, a) <-> member(x, b)))

predicate subset(a: 'a1 set, b: 'a1 set) =
  (forall x:'a1. (member(x, a) -> member(x, b)))

predicate disjoint(a: 'a1 set, b: 'a1 set) =
  (forall x:'a1. (member(x, a) -> (not member(x, b))))

axiom member_bool1 :
  (forall x:'a.
  (forall s:'a set [member_bool(x, s)]. (member(x, s) -> (member_bool(x,
  s) = true))))

axiom member_bool2 :
  (forall x:'a.
  (forall s:'a set [member_bool(x, s)]. ((not member(x, s)) ->
  (member_bool(x, s) = false))))

axiom member_empty :
  (forall x:'a [member(x, (empty : 'a set))]. (not member(x,
  (empty : 'a set))))

axiom member_singleton :
  (forall x:'a. forall y:'a [member(x, singleton(y))]. (member(x,
  singleton(y)) -> (x = y)))

axiom member_singleton1 :
  (forall x:'a. forall y:'a [member(x, singleton(y))]. ((x = y) -> member(x,
  singleton(y))))

axiom member_union :
  (forall x:'a.
  (forall a1:'a set. forall b:'a set [member(x, union(a1, b))]. (member(x,
  union(a1, b)) -> (member(x, a1) or member(x, b)))))

axiom member_union1 :
  (forall x:'a.
  (forall a1:'a set. forall b:'a set [member(x, union(a1, b))]. ((member(x,
  a1) or member(x, b)) -> member(x, union(a1, b)))))

axiom member_inter :
  (forall x:'a.
  (forall a1:'a set. forall b:'a set [member(x, inter(a1, b))]. (member(x,
  inter(a1, b)) -> member(x, a1))))

axiom member_inter1 :
  (forall x:'a.
  (forall a1:'a set. forall b:'a set [member(x, inter(a1, b))]. (member(x,
  inter(a1, b)) -> member(x, b))))

axiom member_inter2 :
  (forall x:'a.
  (forall a1:'a set. forall b:'a set [member(x, inter(a1, b))]. ((member(x,
  a1) and member(x, b)) -> member(x, inter(a1, b)))))

axiom union_empty :
  (forall a:'a1 set [union(a, (empty : 'a1 set))| union((empty : 'a1 set),
  a)]. (union(a, (empty : 'a1 set)) = a))

axiom union_empty1 :
  (forall a:'a1 set [union(a, (empty : 'a1 set))| union((empty : 'a1 set),
  a)]. (union((empty : 'a1 set), a) = a))

axiom inter_empty :
  (forall a:'a1 set [inter(a, (empty : 'a1 set))| inter((empty : 'a1 set),
  a)]. (inter(a, (empty : 'a1 set)) = (empty : 'a1 set)))

axiom inter_empty1 :
  (forall a:'a1 set [inter(a, (empty : 'a1 set))| inter((empty : 'a1 set),
  a)]. (inter((empty : 'a1 set), a) = (empty : 'a1 set)))

axiom member_range :
  (forall x:int. forall a:int. forall b:int [member(x, range(a, b))].
  (member(x, range(a, b)) -> (a <= x)))

axiom member_range1 :
  (forall x:int. forall a:int. forall b:int [member(x, range(a, b))].
  (member(x, range(a, b)) -> (x <= b)))

axiom member_range2 :
  (forall x:int. forall a:int. forall b:int [member(x, range(a, b))].
  (((a <= x) and (x <= b)) -> member(x, range(a, b))))

axiom member_range_sup :
  (forall x:int. forall a:int [member(x, range_sup(a))]. (member(x,
  range_sup(a)) -> (a <= x)))

axiom member_range_sup1 :
  (forall x:int. forall a:int [member(x, range_sup(a))]. ((a <= x) ->
  member(x, range_sup(a))))

axiom member_range_inf :
  (forall x:int. forall b:int [member(x, range_inf(b))]. (member(x,
  range_inf(b)) -> (x <= b)))

axiom member_range_inf1 :
  (forall x:int. forall b:int [member(x, range_inf(b))]. ((x <= b) ->
  member(x, range_inf(b))))

axiom member_range_all :
  (forall x:int [member(x, range_all)]. member(x, range_all))

