Assertion of Type Inference Rules/Type Checking I have a problem in a book I am trying to accomplish.



I understand the overall type of the expression is boolean and how it derives. (y * x) will be rule 4 (counting from top right). (y * x) + x when evaluated will be rule 3 and the overall expression when evaluated will be rule 5. 

What I want to figure out is what is the correct way to illustrate the my working? Can someone give or link an example of the correct way to answer a question like this?



Question 2


Proposed solution:
Well, you need to construct a typing derivation which has what you want to prove as a conclusion, and no open premise (i.e., leaves must be axioms, or rules with no premises). In the case of your example, the conclusion will be

$$ int\;x,\,int\;y\;\vdash\;(x &lt; (x \times y) + x) : bool $$

so the proof will start by

$$ {int\;x,\,int\;y\;\vdash\;x : int \quad\quad\quad
  int\;x,\,int\;y\;\vdash\;((x \times y) + x) : int}
  \over {int\;x,\,int\;y\;\vdash\;(x &lt; ((x \times y) + x)) : bool} $$

and then you continue building up the tree until you reach leaves (i.e., rules with no premises). This will immediately be the case in the left branch since you only have a variable.



Here is the full proof (as an image):