let inv_cons_poly = function
  p 
 -> 
 match p with 
   P (la) -> if not (is_empty_list (la))
               then let
                      (a, d) = head (la)
                    in
                      let
                        (a1, la1) = if d = 0 then (a, tail (la)) else (cons_rat ("0""1"), la)
                      in
                        (a1, P ((List.map (function (x, d) -> (x, d - 1))) (la1)))
               else failwith ("inv_cons_poly : requires a non-null polynomial as its argument")