STRUCTURE zero:number 
          succ(pred:number):number.

STRUCTURE empty:list 
          add(head:number,tail:list):list.

STRUCTURE True:boolean 
          False:boolean.

STRUCTURE nil:sexpr
	  atom(index:number):sexpr
          cons(car:sexpr,cdr:sexpr):sexpr.




FUNCTION DeleteMinimum(x:list):list;
BEGIN

If (x = empty) Then empty;

If ( (x != empty) And (tail(x) = empty) ) Then empty;

If ( (x != empty) And (tail(x) != empty) And (Leq(head(x),head(tail(x))) = True) ) 
                  Then add(head(tail(x)),DeleteMinimum(add(head(x),tail(tail(x)))));

If ( (x != empty) And (tail(x) != empty) And (Leq(head(x),head(tail(x))) = False) ) 
                  Then add(head(x),DeleteMinimum(tail(x)));

END.

