A one-dimensional handmade Turing Machine and

12 downloads 0 Views 1MB Size Report
Oct 23, 2016 - NetLogo Simulation of a Turing Machine, used as a means of .... students are led: (i) to understand the basics of the way that the machine works, (ii) to make simple ... Obviously it remains to apply these two worksheets in the ...
2ο Πανελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας

200

A one-dimensional handmade Turing Machine and the two–dimensional NetLogo Simulation of a Turing Machine, used as a means of instruction for teaching Complex Systems, Introductory Algorithms and Logic. Iqbal Zafar Software Engineer, Private Sector [email protected] Gkiolmas Aristotelis Researcher, Department of Primary Education, University of Athens, Greece. [email protected] Chalkidis Anthimos Researcher, Department of Primary Education, University of Athens, Greece. [email protected] Papaconstantinou Maria M.Sc., Computer Programmer, University of Piraeus. [email protected] Stoumpa Artemisia Researcher, Department of Primary Education, University of Athens, Greece. [email protected] Karamanos Kostas Researcher, Department of Primary Education, University of Athens, Greece. [email protected] Skordoulis Constantine Professor, Department of Primary Education, University of Athens, Greece. [email protected] Abstract This paper aims at presenting to the public a simple, hand-made, one-dimensional Turing machine created (both in a “real” form and in the form of a virtual simulation) by one of the authors. Afterwards, the machine will be used as a tool in a teaching sequence which was created with the scope of teaching basic principles of computer logic and programming to students of the Greek Secondary education. Then the NetLogo model (simulation) of a two-dimensional Turing machine is examined, as regards its capabilities of teaching the same issues, compared to the first, “real” machine. Keywords: Turing machine, NetLogo, education, teaching, computer logic, worksheet, Complex Systems.

Introduction As proved in the scientific literature (Mitchell, 2009; Wolfram, 2002), a Turing Machine (Turing, 1936) is a prototype computer that can basically perform all the calculations that another computer can do. All the algorithms followed by Turing Machines are the algorithms followed by contemporary computers, too. Correspondingly, if a computational problem cannot be solved by a modern computing machine, it cannot be solved by a Turing Machine either, and vice versa. Such characteristics make Turing Machines very useful in the educational field: a) For depicting and explaining simple properties of computers to the learners, b) For introducing them to specific notions of algorithms and programming and c) To unveil to them some aspects of Complex

Πρακτικά Εργασιών 2ου Πανελλήνιου Συνεδρίου, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας, Λάρισα 21-23 Οκτωβρίου 2016, http://synedrio.eepek.gr

2ο Πανελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας

201

Systems, especially the behavior of cellular automata. Consequently, there has been a lot of argumentation lately about teaching with or about Turing Machines and its benefits for the Computer or the Technology classrooms (Watters, 2015; Prank & Anton, 2011). In the paper, two forms of Turing Machine are used: (i) the one is a hand-made, onedimensional (1-D), one, with a circular tape. It is made by one of the authors, as well as its on-line simulation (found at the website: https://zaf.io/page-ae.html ). (ii) The other is the twodimensional simulation (2-D) of a Turing Machine made with NetLogo (Wilensky, 2002), and existing in the NetLogo Models’ Library. NetLogo (Wilensky, 1999) is a very-well known and widely spread Multi-Agent-Based computing, simulation and modeling environment used – among other things – to teach Informatics and simple properties of Complex Systems (Wilensky & Rand, 2015; Tisue & Wilensky, 2004). Both versions of the Turing Machine are used in an educational context, with worksheets for the students accompanying them. The objectives of the instruction are described within the paper and the worksheets are given as attached. The students addressed at, are, potentially, students of the late Primary and the early Secondary Greek Education. Alternatively the educational set-up is scheduled to be used for undergraduate students (prospective Primary School teachers). The uses of both versions of Turing Machine are complimentary but also somehow comparative, therefore either additional or different learning results are discussed. The main reasons for examining the use of both the “material” and the “simulated” version of the Turing Machine were: (i) to examine what are the learning outcomes in each case and (ii) to make the learners realize that, in the foundation of every programming or computer logic, very simple choices and rules are applied (Haken, 2006). The role of “colours” in the virtual TM is played by “digits” – also depicted as colors – in the NetLogo simulation of the TM. The aforementioned choices and rules are firstly identified by the students (in both cases of worksheets) and, at a second stage, applied by them.

Method At first, the “real” Turing Machine, made by one of the authors, is going to be distributed to a sample of students, and initially some time will be given to them (15-20 minutes) to experiment with it and see the way it works. Then the students will have to complete the Group of Worksheets Number 1 (given as attached to the paper) working in pairs and sitting in front of computers, since the online version of this 1-D machine will also be given to them. Through this worksheet, students are led: (i) to understand the basics of the way that the machine works, (ii) to make simple predictions about its behavior and, afterwards, (iii) test these predictions and to try to realize specific patterns (tending to be complex) created “by” the machine. Secondly, and at the same period of time, an equivalent set of students will work with the NetLogo Model of the 2-D Turing machine based on another worksheet, named Worksheet Number 2 (also given as attached to the paper), with a similar format of the learners. The students are guided through the GUI screen of NetLogo and then asked again questions, prompted to make predictions, check the outcomes and change the parameters of the model with specific objectives.

Analysis of the Worksheets In “Group of Worksheets Number 1” (given as an attached Appendix) the students are at first familiarized with the circular, one - dimensional handmade Turing machine, and then they are prompted to predict – on paper – what will happen with the four different colors (how the variation or pattern of lights will look like), according to the orders they give to (the programming of) the machine. Afterwards, trough trial-and-error procedures, by working with the machine, they try to find out what the final outcome (color) will be and where they did go wrong. Gradually, they start to learn the inner procedures – the algorithms – that this version of the Turing Machine follows, in order to define the colors of the cells at each step. In “Worksheet Number 2” (also given as an Appendix) the learners are guided to work with the NetLogo simulation of the 2-dimensional Turing Machine and then use it in a “programming”

Πρακτικά Εργασιών 2ου Πανελλήνιου Συνεδρίου, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας, Λάρισα 21-23 Οκτωβρίου 2016, http://synedrio.eepek.gr

2ο Πανελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας

202

sense, to create arrays of digits 0 and 1 (digital numbers) symbolically represented as coloured arrays.

Results and Discussion Obviously it remains to apply these two worksheets in the classrooms (of Primary, Secondary and Tertiary Greek Education) during the autumn, to see the final learning outcomes of teaching introductory algorithms, logic and Complex Systems to learners. But we consider them as strong and useful tools towards this aim, in that they are detailed and comparisons can be made between the two as well. The focus in the current work is given in the rigorousness and the accuracy of the worksheets accompanying both “forms” of Turing Machines. The worksheets in both cases were created, on the basis of four basic principles:  the learner has to find by himself the rules governing the Machine, with little intervention by the instructor  the learner has to apply the rules as he conceived them and check by himself whether he conceived them right  the learner reaches at identifying the “right” set of rules governing the Machine and finally  the learner applies the rules that he found, in order to create new pattern s with the machine and its (single) head

Conclusion This is possibly the first time in the Greek Education – and possibly among the first ones in the international educational literature – to set up an effort not to “teach the” or “teach about” the Turing Machine, but to “teach with the help of” the Turing Machine instead. This – we believe – gives some originality and authenticity to the work. Of course, it is necessary to make extended changes and improvisations possibly, but these will come with new versions of the work, as well with its application in the classes, within the current and the next academic year.

References Haken, H. (2006). Information and Self-Organization: A macroscopic approach to Complex Systems (3rd Edition). Berlin: Springer - Verlag. Mitchell, M. (2009). Complexity: A Guided Tour. Oxford: Oxford University Press. Prank, A., & Anton, M. (2011). Using a Learner- and Teacher-Friendly Environment for Turing Machine Programming and Testing. In: Blackburn, P., van Ditmarsch, H., Manzano, M., & Soler-Toscano, F. (Eds). Tools for Teaching Logic. Proceedings of the 3rd International Congress TICTTL 2011, Salamanca, Spain, June 2011. Tisue, S., & Wilensky, U. (2004). NetLogo: A simple environment for modeling complexity. Proceedings of the 5th International Conference on Complex Systems. Boston, USA, May 16-21, 2004. Turing, A., M. (1936). On computable numbers, with an application to the Entscheidungsproblem, Proceedings of the London Mathematic Society, (2), 42, pp. 230–265. Corrections in: Proceedings of the London Mathematic Society, (2), 43 (1937), pp. 544–546. Watters, A. (2015) Teaching Machines: The History of the Future of Education. Speech delivered at the Digital Pedagogy Lab Summer Institute at UW Madison, USA on the 10th August 2015. Retrieved from http://hackeducation.com/2015/08/10/digpedlab, on 20th June 2016. Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University,Evanston, IL. Wilensky, U. (2002). NetLogo Turing Machine 2D model. http://ccl.northwestern.edu/netlogo/models/TuringMachine2D. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL. Wilensky, U., & Rand, W. (2015). An Introduction to Agent-Based Modeling: Modeling natural, social and engineered Complex Systems with NetLogo. Cambridge: MIT Press. Wolfram, S. (2002). A New Kind of Science. Champaign: Wolfram Media Inc.

Πρακτικά Εργασιών 2ου Πανελλήνιου Συνεδρίου, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας, Λάρισα 21-23 Οκτωβρίου 2016, http://synedrio.eepek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

203

Appendices

Appen ndix No 1: Group of Worksheet W ts Number 1 One – Dimension D al, Circular Turing Machine M Turring Machiine Model 1: 1 Introducction Requirements: 5 coloured c pen ncils (black, w white, red, green g and blu ue) or – alternnatively – on ne single pencil and you y can use th he letters : W , R, G, and d B as substittute symbols for the colours. The “ddisplay” screen is used fo or showing thhe colours off the lights an nd where thee cursor’s heaad is. Thee “program” screen descrribes the rulees followed by b the (virtuaal or “real”) T Turing Mach hine in ordeer to switch the t lights to different d coloours. The m machine alwayys starts at sttate 1 and theen proceeds according to o the rules poosed, depending on whaat the colourr of the light at the cursorr head is. Each ““rule” consists of three paarts: • • •

What the new n colour will w be (Blackk, White, Reed, Green or Blue) Towards what w direction the curssor head sho ould move (don’t ( movee, anticlockw wise or clockwise)) What the next n state will be (1, 2, 3,, etc.)

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

204

Turring Machiine Model 1: 1 Worksheeet 1 Obserrve: Understaand the following input, tthe program and the outp put. The Macchine will sw witch the lighht to white. The T Machin ne always staarts at state 1 and, depen nding on the colour of thee light w where the currsor head is, it will choosse the correctt rule.

State 1 •

If the lighht is black then ◦ turn thhe light to white ◦ don’tt move the cu ursor head ◦ stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

205

Turring Machiine Model 1: 1 Worksheeet 2 Challeenge: Try to create a prog gram that: If the ccurrent colouur is black th he Machine w will switch it to red, it willl not move tthe cursor’s head aand will stay in state 1. Reemember thaat the Machin ne always staarts at state 11.

State 1 •

If the lighht is black then ◦ turn thhe light to reed ◦ don’tt move the cu ursor head ◦ stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

206

Turring Machiine Model 1: 1 Worksheeet 3 Obserrve: Using thhe “direction”” command, we can mov ve the cursor head in eachh rule. The follow wing program m turns all thee lights into rred, moving clockwise. Note N that the cursor head continuues to move clockwise affter doing onne circle



State 1 Iff the light is black then ◦ ◦ ◦

turn thhe light to reed move clockwise stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

207

Turring Machiine Model 1: 1 Worksheeet 4 Challeenge: Switchh all the lightts to green m moving clockw wise.

Statee 1 •

If the lighht is black then ◦ turn thhe light to grreen ◦ move clockwise ◦ stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

208

Turring Machiine Model 1: 1 Worksheeet 5 Obserrve: A rule caan also change the numbber of the statte to another number. Thiis is useful for creeating more interesting i prrograms and patterns. In this examplee we are reacching at alternaating betweenn the green- and the bluee- coloured liights.

State 1 • If light is black then ◦ turn thee light green ◦ move cllockwise ◦ go to state 2

Statte 2 • If light is black then he light bluee ◦ turn th ◦ move clockwise ◦ go to state s 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

209

Turring Machiine Model 1: 1 Worksheeet 6 Challeenge: Write the t program that creates the given altternating output (betweenn red and wh hite).

Statee 1 • If light is black b then ◦ turn thee light white ◦ move cllockwise ◦ go to sttate 2

State 2 • If ligh ht is black thhen ◦ tu urn the light rred ◦ move m clockwiise ◦ go o to state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

210

Turring Machiine Model 1: 1 Worksheeet 7 Challeenge: Make the t colours in the output to display like the one beelow, starting ng from the in nput shownn here and byy using the prrogram show wn here.

Statee 1 •

If light is white then ◦ turn thhe light red ◦ don’tt move the cu ursor head ◦ stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

211

Turring Machiine Model 1: 1 Worksheeet 8 Challeenge: Make the t colours in the output to display like the one beelow, starting ng from the in nput shownn here and byy using the prrogram show wn here.

Statee 1 •

If light is blue then ◦ turn thhe light greeen ◦ don’tt move the cu ursor head ◦ stay at a state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

212

Turring Machin ne Model 1 : Worksheeet 9 Obserrve: You cann have multip ple rules withhin a state. Here H we change the colour ur and move clockw wise unless itt’s white.

State 1 If lightt is white theen keeep the light white w don n’t move stayy at state 1

If light is red tthen switch s to greeen go g clockwisee stay s at state 1

If light is grreen then switch to o blue go clock kwise stay at state 1

If light is blue b then switch to o red go clock kwise stay at state 1

Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανεελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, Σ για ττην Προώθηση η της Εκπαιδευττικής Καινοτομί μίας

213

Appen ndix No 2: Worksheet Number__2. Tw wo-Dimensiional NetLoogo Simula ation of Turring Machiine. 1. Tryy to familiariize with the NetLogo N screeen of the Model. M Can yo ou understannd what does each buutton or slideer do? 2. To kkeep the moddel simple, fiix the “Numbber of Headss” (slider) permanently too 1. What do o you obbserve by plaaying and “ru unning” the model (the rest r of the bu uttons at randdom positions)? ___________________________ ______________________ _______________________________ ______ ___________________________ ______________________ _______________________________ ______ 3. Exa ample 1. On the picture p below w, the machinne is program mmed to writte the binaryy number: 10101101010101011010101010101010101001010101010 01010101010 0101010 on tthe white tap pe. Pay attenttion to the faact that the leeast significaant digit is wrritten first an nd so it is loccated at the bottom b of the colored array a (“red” stands for “0 0”, and blue stands for “11”).

Figgure 1: Screeenshot of th he NetLogo GUI as used d in Examplle 1 Logo simulaation, as it is formulated here, h will be developed in n five Now thhe Example 1 of the NetL separatte exercises.

Exerccise 1 Let us program thee machine so as to “write ” the digital number men ntioned abovve (in Example 1). y should fo ollow the stepps below: In ordeer to do so, you Seelect “forwarrd (“- -”) amo ong the four “Turn” butto ons. Seet the “mikoss” (Greek wo ord for: “lenggth”) slider button b to 60. Foor the two firrst commands, adjust the “New Head State” and “New “ Cell Sttate” buttons as Πρακτικκά Εργασιών 2ου Πανελλήνιου Συνεδρίου, Σ με Δ Διεθνή Συμμετοχχή, για την Προ οώθηση της Εκππαιδευτικής Καιινοτομίας, Λάρισ σα 21-23 Οκτωββρίου 2016, http tp://synedrio.eep pek.gr

2ο Πανελλήνιο Συνέδριο, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας

214

shown at the picture above (Example 1). Tip: You do not need to configure the buttons of the two last commands since they are not going to be executed, as no cell is “on” at the beginning. 8. Click on the “setup” button to initialize the machine, and then click on the “go” button to run the program. Tip: count down the red and the blue cells, so as to be sure that the right number is written.

Exercise 2 Configure the machine (write the suitable commands and adjust correctly all the other buttons) so that it writes the binary number 010101010101010101010101010101 on the white tape.

Exercise 3 Write the 30digit binary number 111111000000111111000000111111 on the white tape. Do not erase the number because you will need it on the next exercise. Tips: carve the number up into smaller parts You need to program the machine more than one times in order to write all the parts of the number. Increase accordingly the “mikos” (“length”) slider every time you reprogram the machine before pressing the “go” button.

Exercise 4. Configure the machine – write the suitable commands and adjust the buttons needed – in order to reverse the number written on the tape (on exercise 3). That means that the head moves cell by cell over the number and changes every red cell into a blue one and every blue cell into a red one . Tips: if you want to return the machine’s head at the beginning of the tape do not use the “setup” button because it initializes the machine and so the number written on the tape will be lost. Use the “pigenearxi” (Greek phrase for: “go to the starting point”) button instead. Try the program several times at a low speed (by adjusting the “speed slider”) and observe at the same time the number changing again and again.

Exercise 5 a) Write a number on the tape b) Configure the machine so that it adds the number 1 to this number. Execute the addition and check if it is correct. d) Execute the program two more times so that the binary number 11 (3 in decimal system) is finally added to the initial number Questions a) Did you find it difficult to program the simulated Turing Machine? Describe your experience as a programmer of this initiative machine. b) Was it worth the real and mental experimentation that the scientists designed and carried out in the past in order to construct programmable machines as the one you tried today? Justify your answer. c) Do you think that your experimentation with the virtual (simulated) Turing Machine helped you to understand better how the modern computers work? If your answer is “Yes” please explain how.

Thank you all for your time and co-operation!

Πρακτικά Εργασιών 2ου Πανελλήνιου Συνεδρίου, με Διεθνή Συμμετοχή, για την Προώθηση της Εκπαιδευτικής Καινοτομίας, Λάρισα 21-23 Οκτωβρίου 2016, http://synedrio.eepek.gr

Suggest Documents