Game Semantics in Teaching of Classical First Order Predicate Logic to Students of Computer Science

. Game-theoretical interpretation of logical semantics has been ﬁrst suggested in 1950s. Although it is well know among professionals, it is often excluded from introductory courses in logic. In this paper we examine whether and to what extent would including game semantics in the syllabus of an introductory course of predicate and propositional logic prove to be beneﬁcial to students’ understanding of the subject. To that purpose, we have exposed two groups of undergraduate students of computer science to game semantics as part of recitations for the course Propositional and Predicate Logic. We focus mainly on how this a ﬀ ects students’ mastery of two particular topics – alternating quantiﬁcation and restricted quantiﬁcation. Observations were made during the recitations to evaluate any changes in students’ approach to solving relevant problems in classroom. Moreover, before the ﬁnal test of the recitations one of the groups was given a brief review of game semantics and the other was not. We have measured the di ﬀ erence in performance of these two groups and the results support the hypothesis that game semantics helps students master certain topics of predicate logic. We reference some of the later research in psychology and pedagogy to help us explain this e ﬀ ect.


Introduction
The paper is based on the authors experience as a teaching assistant for the course Propositional and Predicate Logic. It is an one-semester introductory course of logic taught to students in the second year of bachelor programme in computer science. The course comprises of two 45 minute lectures and two 45 minute recitations per week. During the course, the students are expected to master the basics of classical propositional and predicate logic (the difference between syntax and semantics, logical connectives and their universality, normal forms, logical theories and their properties, semantic tableau, formal proofs, soundness and completeness, compactness, resolution, Hilbert-style calculus, first order structures, substructures, expansions, reducts, definable sets, Boolean algebras, Löwenheim-Skolem, Skolem, and Herbrandt theorems, isomorphism and elementary equivalence, categoricity, decidability, finite and open axiomatizability, Gödel's incompleteness theorems). As part of the course, students are introduced to semantics of classical first order predicate logic -the usual Tarski definition, as in [8], Definition 1.1.6., is used for that purpose. Game semantics, an equivalent formulation of classical predicate semantics, in not a part of the syllabus of the course. The author has decided to present a restricted version of game semantics to two groups of students during recitations. It should be noted that none of the students were previously exposed to concepts of game theory in any course dedicated to game theory as such. * e-mail: jana.glivicka@vse.cz In this paper, we first present a restricted version of game semantics. We then focus on the two particular topics of our interest, alternating quantification and restricted quantification, in more detail, describing how students respond to certain model examples in classroom and measuring how an in-class review of game semantics affects students' results in a final test. Finally, we try to explain, why and how using game semantics in the teaching of predicate logic might be beneficial to students.

Game semantics
Game semantics was first proposed in [7]. Since then, game-theoretical approach has been widely used in different fields of logic, as can be seen from [5] or [6]. Assigning truth value to a formula in game semantics differs substatially from the usual tarskian way. The tarskian-style definition relies substantially on induction. First, a procedure is defined to assign a truth value to atomic formulas; then the definition proceeds by induction on the complexity of the formula in question, each logical connective or quantifier corresponding to an induction step. The game semantics deploys a different strategy. Here, a game of two players, called Verifier and Falsifier, is played with respect to a given structure and formula in the language of that structure. It is the existence or nonexistence of a winning strategy that is the criterion of truth or falsity of the formula in question.
We present a restricted version of this game, for formulas in prenex normal form, i.e. for formulas of the form is what students encountered during the recitations as it seems sufficient for them to master two topics they often find challenging -alternating quantification and restricted quantification.
Given a formula Q 1 x 1 Q 2 x 2 . . . Q n x n φ(x 1 , x 2 , . . . , x n ) and a structure M, the corresponding game proceeds as follows. The chain of quantifiers is read from left to right. When ∃x i is read, Verifier has to pick an element of the structure M, a witness for the quantifier, that is substituted for x i in the formula φ. When ∀x j is read, it is Falsifier's turn to pick an element, which is again substituted for x j in φ. After all the quantifiers have been read, the players are left with a formula containing no quantification. If the formula is true in M (which can, if needed, be determined by a propositional variant of the game) the Verifier wins, if it is false the Falsifier wins. The formula Verifier has a winning strategy for this game. If not, the formula is false.

Alternating quantification
In introductory logic courses, students often struggle to understand the relation between formulas of the form ∀x∃yφ(x, y) and ∃y∀xφ(x, y). The question whether these are equivalent or one of them implies the other seems to puzzle many students in recitations.
Although it might seem that the difference between the two formulas, and between two mathematical statements with this logical form, should be obvious to students with solid background in mathematics, it should be noted that in the history of mathematics the difference between those two caused much confusion. The famous error in Cauchy's "proof" that a convergent sum of continuous functions is always continuous lies in not distinguishing uniform and pointwise convergence. This can be seen, when analyzed in retrospect, as an example of incorrect handling of alternating quantifiers [3], or rather not clearly distinguishing between two types of convergence that were later formalized with the use of alternating quantifiers.
To see how game-theoretical approach might help students develop an intuition for dealing with alternating quantifiers, let us analyze how students approached the following example encountered during the first recitation, even before the lecture dedicated to predicate logic.
Example: There is a finite game of two alternating players X and Y. The game ends after n rounds and either X or Y wins (it cannot end in a draw). Player X has the first move. There is a formula φ(x 1 , y 1 , . . . , x n , y n ) expressing that in the game with moves x 1 , y 1 , . . . , x n , y n player X is the winner. Using this formula and quantifiers, write a formula expressing that player Y has a winning strategy.
This example was designed to let students work with a long series of alternating quantifiers with hope that the context of the example, a strategy for a game, will get students more interested in the problem then the usual formalization of mathematical statements.
After initial discussion, most of the students gave one of the following answers: Although it is true that both of these formulas imply the existence of winning strategy for player Y, there is substantial difference between them. This difference was clarified in a consequent discussion in which the students themselves, without any hint from the teaching assistant, came to the right conclusion -that 2 allows player Y to react to the moves of player X, while 1 requires Y to choose all her moves in advance, before the game even starts. If Y is able to do the latter, she obviously has even less trouble picking the moves that ensure her victory in reaction to the moves of X.
The intuition gained from the game-theoretical analysis allowed the students to answer without hesitation that ∃y∀xφ(x, y) implies ∀x∃yφ(x, y), while the converse is not true.
This partially supports the hypothesis that students, when presented with well-constructed problems and examples, can themselves develop an understanding of logical concepts that often pose a challenge even to students who have already been exposed to the concept in a traditional lecture. How students proceed in developing such an understanding is, for a particular case, described in [2].

Restricted quantification
After ten weeks of lectures and recitations, the students were given a test. One of the tasks on the test asked them to formalize (in predicate logic) two sentence expressed in natural language. Two recitation groups, A and B, wrote the test. The students attended the same lecture and both recitation groups were lead by the same teaching assistant and worked with the same materials. A week before the test both recitation groups had a brief review of the types of problems to be expected on the test. The two reviews differed only in one aspect -group A was reminded of the existence of game semantics and its basic principles, while group B was not.
All the sentences to be formalized contained restricted quantification, either universal or particular. Universal restricted quantification, i.e. quantification of the form All U's are V., is formalized using universal quantifier and implication, i. e. ∀x(U(x) → V(x)). Particular restricted quantification, i.e. quantification of the form Some U is V., is formalized using existential quantifier and conjunction, i. e. ∃x(U(x) ∧ V(x)). One of the most common mistakes students make (both during recitations and on test) is that they use the right quantifier but the wrong connective, thus formalizing universal restricted quantification as ∀x(U(x) ∧ V(x)) and particular restricted quantification as ∃x(U(x) → V(x)).
Let us now review both test variants, the expected answers and the students results.

Group A assignment
Test assignment: Formalize the following sentences by formulas of first order predicate logic. The only non-logical symbols to be used are: predicate P(x), x is a problem; predicate H(x), x is hard; predicate S (x, y), x can solve y; predicate L(x), x loses a point; predicate F(x), x can formalize sentences.
1. If a problem is hard, no one can solve it.

Not everyone who loses a point cannot formalize
sentences.
Expected answer:

Group B assignment
Test assignment: Formalize the following sentences by formulas of first order predicate logic. The only non-logical symbols to be used are: predicate P(x), x is a problem; predicate H(x), x is hard; predicate S (x, y), x can solve y; predicate L(x), x loses a point; predicate F(x), x can formalize sentences.
1. Anyone who cannot formalize sentences loses a point.
2. All problems that are not solved by anyone are hard.
Expected answer: Table 1 shows how many students in groups A and B provided the right formalization for both, one, or none of the sentences. While the percentage of students who got the whole problem wrong was almost the same in both groups, the percentage of those who got the whole problem right was dramatically higher in group A, the group that reviewed game semantics before the test. We can also see a remarkable difference in the percentage of students who got one answer right and the other wrong, again in favor of group A. This suggest that for students most struggling with the topic introducing game semantics does not have substantial effect. On the other hand, students who understand the topic to some extent seem to be helped by game semantics.

Conclusion
One of the most notable effects of including game semantics in the recitations was a change in how students relate themselves to the subject. Although this was not formally measured, pure observation of the students' behavior in classroom enables us to state that students felt even personally invested in the problems they tried to solve. They used phrases like "Let's say I want to beat you in the game.", "If you play this, I can respond by that.", or "It's easier for me to react to my opponent's moves then to choose all my moves in advance.". All this indicates a kind of personal investment that is usually absent in the learning and teaching of abstract logical concepts. Related to the feeling of a personal investment in the subject is also an increased willingness of the students to get involved in discussions with their classmates about the topic studied; and discussion proves to be an important part of the learning process as can be seen in various fields of education [11].
As our first example, expressing existence of a winning strategy by a formula, shows, the use of game semantics in the classroom may also add a story-like perspective to understanding semantics of first order predicate logic. Students can imagine the two players, they can picture how the game proceeds, they can even try to take the roles of the two players in pairs. All this contributes to creating a story related to what is taught and should be learned during the recitations. Recent psychological research shows that listening to a story constitutes a sense of participation in that story [10]. This sense of participation is what students often lack in the introductory logic courses as most of the content tends to be highly abstract. Also, stories often help students to create mental images [4]. This, again, is very helpful in internalizing the abstract logical concepts.
Another aspect of game semantics is that it provides a certain dynamic to the area that is usually thought of as very static. The world of logic is no longer seen as a neverchanging world of ideal objects but as an arena where certain processes, such as the Verifier and Falsifier choosing their witnesses, take place. Certain dynamical aspect is often present in an intuitive understanding of mathematical concepts but seems to be absent from the formal definitions. The classical example of this shift form dynamical to statical understanding is the concept of limit, where the intuitive notions of approaching or getting closer are replaced by alternating quantification (∀ϵ∃δ). Recovering those dynamical aspects, as done by the game semantics, has a potential to support the students in their grasping of mathematical and logical concepts [9].
It is the authors conviction that the most important benefit of game semantics is that it helps students to form proper mathematical intuition. This much prized, yet not clearly described, asset of a good mathematician is hard to be formally studied. While most mathematicians the author knows would swear by mathematical intuition, many philosophers of mathematics deny even the existence of any such a thing. Let us say that mathematical intuition is an intelectual break-through, a product of entering into the realm of mathematics, different yet not completely sepa-MATEC Web of Conferences 210, 04007 (2018) https://doi.org/10.1051/matecconf/201821004007 CSCC 2018 rated from our every-day reality, the realm to which we are gradually directed by the process of mathematical education. As such, it does not suffer from our tendency to forget what we have learned in such an extent as other competencies do. The quantitative representation of our tendency to forget, known as the forgetting curve, has been long studied and is the subject of an ongoing research even today [1]. How exactly does a proper development of mathematical intuition help us fight the forgetting curve remains an open problem to be solved in the future.

Summary and final remarks
As we have seen, both experience from the classroom and the analysis of students' results on the final test support the hypothesis that the usage of game-theoretical concepts in teaching of predicate logic to undergraduate students is helpful for their mastery of the subject. In particular, our data suggest that it is especially the average-performing students who seem to benefit most from game semantics. Our research was performed only on students of computer science; the question whether we would see similar effects of including game semantics in syllabus of an introductory logic course with students in different fields remains open. It might be argued that students of computer science have a better developed intuition for game theory then average students. Further research in this direction would be helpful.
The following factors seem to contribute to the pedagogical usefulness of game semantics. From the reactions during recitations, it is clear that game semantics gets students personally invested in the topic and discussions about different possible solutions to problems they are presented with. It also provides a dynamic and story-like perspective to otherwise purely abstract topic of semantics of predicate logic. A combination of all those factors helps students develop proper intuition for the semantics of predicate logic. Any long-term effects on students ability to remember their newly attained knowledge of predicate logic are to be subject of other research efforts.