| |
(* pour charger le fichier compile polynome.cmo dans le mode interactif *)
#load "polynome.cmo";;
open Polynome;;
(* l'anneau des entiers *)
module I =
struct
type t = int
let zero = 0
let unite = 1
let plus = ( + )
let mult = ( * )
let equal = ( = )
let print = print_int
end;;
(* les polynomes a coefficients entiers *)
module X = Make (I);;
let xm = X.monome;;
let p = X.mult (X.plus (xm 1 0) (xm 1 1)) (X.plus (xm 1 0) (xm (-1) 1));;
let q = X.plus (xm 1 0) (xm (-1) 2);;
X.equal p q;;
module Y = Make (X);;
let ym = Y.monome;;
let x = ym (xm 1 1) 0;; (* (1 X^1) Y^0 *)
let y = ym (xm 1 0) 1;; (* (1 X^0) Y^1 *)
let moins_unite = ym (xm (-1) 0) 0;; (* ((-1) X^0) Y^0 *)
let moins p q = Y.plus p (Y.mult moins_unite q);;
let p = Y.mult (Y.plus x y) (moins x y);;
let q = moins (Y.mult x x) (Y.mult y y);;
Y.equal p q;;
Y.print p;;
|
|