Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vienna Development Method
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Natural number multiplication=== <syntaxhighlight lang="rsl"> multp(i,j:nat)r:nat pre true post r = i*j </syntaxhighlight> Applying the proof obligation <code>forall p:T_p & pre-f(p) => f(p):T_r and post-f(p, f(p))</code> to an explicit definition of <code>multp</code>: <syntaxhighlight lang="rsl"> multp(i,j) == if i=0 then 0 else if is-even(i) then 2*multp(i/2,j) else j+multp(i-1,j) </syntaxhighlight> Then the proof obligation becomes: <syntaxhighlight lang="rsl"> forall i, j : nat & multp(i,j):nat and multp(i, j) = i*j </syntaxhighlight> This can be shown correct by: # Proving that the recursion ends (this in turn requires proving that the numbers become smaller at each step) # [[Mathematical induction]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)