

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(fmod LIST is sort List. ops a b c nil : -> List [ctor]. op append : List List -> List [ctor]. vars L P Q : List. eq append(append(L, P), Q) = append(L, append(P, Q)). eq append(L, nil) = L. eq append(nil, L) = L. endfm)
fmod LIST is protecting INT.
op equal : Int Int -> Bool. ceq equal(N, M) = true if N <= M = true /\ M <= N = true. ceq equal(N, M) = false if N < M = true. ceq equal(N, M) = false if M < N = true.
sorts List. op nil : -> List [ctor].
op : : Int List -> List [ctor]. op member : Int List -> Bool. op append : List List -> List. op rev : List -> List. vars N M N1 N2 : Int. vars L L1 L2 : List.
eq append(nil, L) = L. eq append(N : L1, L2) = N : append(L1, L2).
eq member(N, nil) = false. ceq member(N1, N2 : L) = true if equal(N1, N2) = true. ceq member(N1, N2 : L) = member(N1, L) if equal(N1, N2) = false.
eq rev(nil) = nil. eq rev(N : L) = append(rev(L), N : nil). endfm
(goal rev-append : LIST |- A{L1:List ; L2:List} ((rev(append(L1:List, L2:List))) = (append(rev(L2:List), rev(L1:List)))) .)