1
$\begingroup$

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.

$\endgroup$
3
  • 2
    $\begingroup$ What is it you tried, and where/how specifically did you get stuck? $\endgroup$
    – Raphael
    May 8 '15 at 16:05
  • $\begingroup$ 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" ? $\endgroup$
    – babou
    May 8 '15 at 16:23
  • $\begingroup$ Do you know how State is defined ? $\endgroup$
    – babou
    May 8 '15 at 16:50
1
$\begingroup$

Hint: Here is one example

$A($ a1 - a2$, s) = minus(A($ a1$,s),A($ a2$,s))$

or alternatively

$A($ a1 - a2$) = \lambda s . minus(A($ a1$,s),A($ a2$,s))$

where $minus$ is the substraction in $\mathbb Z\cup\{\bot\}$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.