15-816 Linear Logic |
S |- e ==> v -------------------- ev_s ------------------ ev_true S |- (s e) ==> (s v) S |- true ==> true S |- c1 / c2 ; K exec --------------------- exec_seq S |- c1 ; c2 / K exec S1, x=v', S2 |- e ==> v S1, x=v, S2 |- K term ------------------------------------------------- exec:= S1, x=v', S2 |- x := e / K exec S |- c / K exec ------------- term_nop --------------- term_seq S |- nop term S |- c ; K term
Question 1: Represent the three judgments in Lolli and encode evaluation, execution and termination.
Question 2: Write a Lolli predicate times2 N
which calculates and prints 2 * N, by executing an appropriate
program in this language.
Assume the cube has the following initial configuration (front view/ back view).
The goal is to find a sequence of rotations which transforms this configuration into the final configuration.
Encode the representation of the initial configuration in Lolli, together with the possible rotations, and write a function which determines the shortest number of rotations to arrive at the final configuration.