This is example bash shell session, demonstrating the MPCP.py program. Note '$' is the shell prompt. First we run MPCP.py from the command line. The output shows that the string w='ababab' (embedded in the first domino) leads to a match, using the other dominos from L_dominos. So we say this w is in the language defined by L_dominos. $ python3 MPCP.py Solving MPCP: #/#Sababab# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# FOUND MATCH: 0 4 2 1 2 1 2 3 5 1 2 1 2 3 6 2 1 2 3 7 1 2 3 4 2 3 5 8 # Sa b a b a b # Sb a b a b # Ta b a b # Tb a b # Sa b # Sb #T# #Sababab# S b a b a b # T a b a b # T b a b # S a b # S b # T # Second, we start python in interactive mode, loading MPCP as a 'module'. First we solve some textbook examples (page227, pag227b, page239). Then for a few strings w in {a,b}*, we test whether dominos(w) has a match. $ python3 Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from MPCP import * >>> mpcp(page227) Solving MPCP: b/ca a/ab ca/a abc/c NO MATCH (no solution exists) >>> mpcp(page227b) Solving MPCP: a/ab b/ca ca/a abc/c FOUND MATCH: 0 1 2 0 3 a b ca a abc ab ca a ab c >>> mpcp(page239) Solving MPCP: ab/abab b/a aba/b aa/a FOUND MATCH: 0 0 2 1 1 3 3 ab ab aba b b aa aa abab abab b a a a a >>> mpcp(dominos('a')) Solving MPCP: #/#Sa# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# NO MATCH (no solution exists) >>> mpcp(dominos('aba')) Solving MPCP: #/#Saba# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# FOUND MATCH: 0 4 2 1 3 5 1 3 6 8 # Sa b a # Sb a # Ta #T# #Saba# S b a # T a # T # >>> mpcp(dominos('abbab')) Solving MPCP: #/#Sabbab# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# FOUND MATCH: 0 4 2 2 1 2 3 5 2 1 2 3 7 1 2 3 4 2 3 5 8 # Sa b b a b # Sb b a b # Tb a b # Sa b # Sb #T# #Sabbab# S b b a b # T b a b # S a b # S b # T # >>> mpcp(dominos('abbaba')) Solving MPCP: #/#Sabbaba# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# FOUND MATCH: 0 4 2 2 1 2 1 3 5 2 1 2 1 3 7 1 2 1 3 4 2 1 3 5 1 3 6 8 # Sa b b a b a # Sb b a b a # Tb a b a # Sa b a # Sb a # Ta #T# #Sabbaba# S b b a b a # T b a b a # S a b a # S b a # T a # T # >>> mpcp(dominos('abbabb')) Solving MPCP: #/#Sabbabb# a/a b/b #/# Sa/S Sb/T Ta/T Tb/S #T#/# NO MATCH FOUND (gave up after 10000 steps) >>> Say that L_dominos defines the language: L = { w in {a,b}*: dominos(w) has a match } As given, L is the strings with an odd number of b's. In homework, you are asked to edit 'L_dominos' so that it defines some other language in {a,b}*.