Evan Martin (evan) wrote in evan_tech,
Evan Martin

do my homework

So we're using this toy language in class, that has code like
x := 4; if x (y := 3); ntimes y (x := x + 1); while 1 (x := 2)
(ntimes e (s) runs statements s e times; getting the value of an undefined variable just gives you zero)

You can present programs theoretically with two values: H, representing the initial state of the variables, s, representing the program (where "s1; s2" is a statement, so s is just a statement).

Part of one of the questions on the assignment was to prove/disprove the following (where "H ; s" means "s with the context of H"):

For all H, e, and s, if H ; s terminates, then H ; ntimes e (s) terminates.
For all H, e, and s, if H ; ntimes e (s) terminates, then H ; s terminates.

I know I haven't provided much, but the language behaves pretty much as you'd expect. Can you prove or provide counterexamples? (I'm pretty sure of my answers, but they weren't what I/Albert expected.)

I thought it was interesting, anyway.

  • blog moved

    As described elsewhere, I've quit LiveJournal. If you're interested in my continuing posts, you should look at one of these (each contains feed…

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • treemaps

    I finally wrote up my recent adventures in treemapping, complete with nifty clickable visualizations.

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.