Using the Hoare-Rules I want to show that I can imply
{x >= 0} --> {a + y = x}
PROGRAMM
// PRECONDITION
{x >= 0}
a = x;
y = 0;
// POSTCONDITION
{a + y = x}
Using the assignment rules I get
// PRECONDITION
{x >= 0}
{x + 0 = x} // assignment rule
a = x;
{a + 0 = x} // assignment rule
y = 0;
// POSTCONDITION
{a + y = x}
To show
{x >= 0} --> {a + y = x}
therefore I need to show in a last step
{x >= 0} --> {x + 0 = x}
How can I show this or what is wrong in my proof?
Your reasoning is correct.
To prove an implication formally, argue as follows:
x >= 0
x + 0 = x
x >= 0 --> x + 0 = x