module hw2p1. import lists. type one_element list A -> o. type two_or_more_elements list A -> o. type three_elements list A -> o. type palindrome list A -> o. type common_sub_seq list A -> list A -> list A -> o. type sub_seq list A -> list A -> o. type example int -> list int -> o. Place code for these predicates here. If you need to add other predicates and type declarations, please do. Use This module fragment as a guide only. example 0 nil. example 1 (1::nil). example 2 (1::3::nil). example 3 (1::3::1::nil). example 4 (1::3::5::8::nil). example 5 (2::3::1::4::5::6::7::2::3::nil). example 6 (2::3::6::5::5::6::5::2::3::4::5::6::nil). example 7 (2::3::6::5::5::6::6::5::5::6::3::2::nil).You should be able to have a session with Elp similar to this one.
module hw2p2. kind nat type. type z nat. type s nat -> nat. type even nat -> o. type odd nat -> o. type half nat -> nat -> o. type mod3 nat -> nat -> o. Place code for these predicates here. If you need to add other predicates and type declarations, please do. Use This module fragment as a guide only. type number string -> nat -> o. number "zero" z. number "one" (s z). number "two" (s (s z)). number "three" (s (s (s z))). number "four" (s (s (s (s z)))). number "five" (s (s (s (s (s z))))).You should be able to have a session with Elp similar to this one.