(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the GNU General Public License as published by  *)
(*  the Free Software Foundation, either version 2 of the License, or  *)
(*  (at your option) any later version.  This file is also distributed *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(* A solver for subtyping constraints. *)
Local Open Scope nat_scope.
Local Open Scope error_monad_scope.
(** This module provides a solver for sets of subtyping constraints of the following kinds: [base-type <: T(x)] or [T(x) <: base-type] or [T(x) <: T(y)]. The unknowns are the types [T(x)] of every identifier [x]. *)
(** The interface for base types and the subtyping relation. *)
Module Type TYPE_ALGEBRA.
(** Type expressions *)
Parameter t: Type.
Parameter eq: forall (x y: t), {x=y} + {x<>y}.
Parameter default: t.
(** Subtyping *)
Parameter sub: t -> t -> Prop.

Axiom sub_trans: forall x y z, sub x y -> sub y z -> sub x z.
Parameter sub_dec: forall x y, {sub x y} + {~sub x y}.