Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

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.
Subscribe

  • megaupload captcha

    Someone make a Javascript-based captcha cracker for megaupload. It's strange to see those captchas again because I idly myself wrote a…

  • zombie ghosd

    I was tickled to discover another IBM developerworks article on one of my abandoned hacks and that both it and its predecessor have been translated…

  • gat, a git clone in haskell

    I've been pretty busy with work lately, so I may as well dump this on the internet before it gets too dusty. Though I think I understand Git decently…

  • Post a new comment

    Error

    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.
  • 6 comments