type vari = int
type coni = int
type funi = int
type eqni = int

type cona = int
type funa = int

type cons = { idc : coni; arc : cona; } 
type func = { idf : funi; arf : funa; } 

type pattern = PatVar of vari | PatCon of cons * pattern list

type term = Var of vari | Con of cons * term list | Fun of func * term list

type equation = { lfun : func; lpat : pattern list; rside : term; } 

type varp = int
type polynome =
    VarP of varp
  | Int of int
  | Sum of polynome * polynome
  | Dif of polynome * polynome
  | Prod of polynome * polynome
  | Power of polynome * int
  | Max of polynome * polynome
  | True | False

module OrderedVar : Map.OrderedType with type t = vari
module OrderedCon : Map.OrderedType with type t = cons
module OrderedFun : Map.OrderedType with type t = func

module VarSet : Set.S with type elt = vari

module ConSet : Set.S with type elt = cons

module FunSet : Set.S with type elt = func

type funcon = F of funi | C of coni

module OrderedFunCon : Map.OrderedType with type t = funcon
module Interp : Map.S with type key = funcon

type prog = 
    { rules : equation list ;
      interp : (polynome * varp list) Interp.t ;
      funname : (funi,string) Hashtbl.t ;
      conname : (coni,string) Hashtbl.t } 

exception Rside of eqni
exception Doublon of eqni
exception Lside of eqni
exception Bothside of eqni

val correct_prog : equation list -> bool

val syntX : string -> bool
val syntF : string -> bool
val syntC : string -> bool

val pat_to_term : pattern -> term

val pol_to_string : polynome -> string

exception NoQI

val term_to_pol : prog -> term -> polynome
val rule_to_pol : prog -> equation -> polynome * polynome

