# Defining function for arithmetic expressions

I've got these arithmetic expressions

a  ::=  n  |  x  |  a1 + a2  |  a1 ? a2  |  a1 − a2


which are a part of language.

An undefined element is allowed ⊥ which extends the set of intergers to Z∪{⊥}.

Problem:

I need to define the function

A: Aexp → (State → Z∪{⊥})

by defining equations for each form of the arithmetic expression a.

Now I've tried to come up with an solution but I am pretty sure I am wrong and I gotta admit I am pretty stuck.

Some help understanding this problem would be great.

• What is it you tried, and where/how specifically did you get stuck?
– Raphael
May 8, 2015 at 16:05
• I should gain some confidence in yourself, starting with the use of a capital "I" when writing in the first person, and more generally by abiding by the rules of English syntax. - - - Then it is hard to answer you, if you do not specify at least informally what this syntax is supposed to mean. I suppose n is the representation of a number in Z. But what is "a1 ? a2" ? May 8, 2015 at 16:23
• Do you know how State is defined ? May 8, 2015 at 16:50

$A($ a1 - a2$, s) = minus(A($ a1$,s),A($ a2$,s))$
$A($ a1 - a2$) = \lambda s . minus(A($ a1$,s),A($ a2$,s))$
where $minus$ is the substraction in $\mathbb Z\cup\{\bot\}$