expression_to_unit(identifier(_Pos,Name),Out) :-
unit_alias(Name,AliasDef)
-> Out = AliasDef
; valid_unit_symbol(Name),
Out = [[0,Name,1]].
expression_to_unit(power_of(_Pos,identifier(Pos,Name),Exponent),Unit) :- !,
expression_to_unit(identifier(Pos,Name),UnitOfIdentifier),
unary_minus_exponent(Exponent,NumericExponent),
power_of_multiply_units(NumericExponent,UnitOfIdentifier,Unit).
expression_to_unit(power_of(_Pos,integer(_Pos2,10),Exponent),Unit) :- !,
unary_minus_exponent(Exponent,NumericExponent),
Unit = [[NumericExponent,na,na]].
expression_to_unit(mult_or_cart(_Pos,Arg1,Arg2),Unit) :- !,
expression_to_unit(Arg1,Unit1), expression_to_unit(Arg2,Unit2),
multiply_units(Unit1,Unit2,Unit).
expression_to_unit(div(_Pos,Arg1,Arg2),Unit) :- !,
expression_to_unit(Arg1,Unit1), expression_to_unit(Arg2,Unit2),
units_domain_division(Unit1,Unit2,Unit).
expression_to_unit(integer(_Pos,10),[[1,na,na]]) :- !.