# Do I need Prolog to teach logic concepts?

I think that the use of some logic programing language like Prolog, for example, could be a good way to explain the symbolic/mathematical logic concepts but also apply this concepts in a real programming world, however, but I'm not getting it.

The problem is that Prolog are not largely used in real applications. I tried to use this IBM's NLP as an example, but this pattern matching exercise does not covers much concepts from mathematical logic.

The question is: How can I use programming to instruct students in topics related to symbolic/mathematical logic?

• prolog (or languages like it) are use in real world applications, they can be used for anything that imperative languages are used for, however declarative languages are not always the best language for the job. Although prolog is described as logical it is also declarative. There are other ways to teach logic. – ctrl-alt-delor May 25 '17 at 19:36
• Not really. There are resources for doing logic programming in functional languages like Racket. I'll post the links when I find them. – xuq01 May 25 '17 at 21:30
• Do you want to teach about logic in general, or about logical programming in particular? – Discrete lizard May 25 '17 at 22:19
• Have you heard of the course Nand2Tetris? It's not logical programming per se, but the first three chapters are all logic-focused using HDL (Hardware Description Language). If your goal is logical concepts in general using programming, I will elaborate below. It might be helpful to rephrase your question as a few of us are on the fence here as to what you might be seeking. – Peter May 25 '17 at 23:40
• This talk about real world applications really becomes annoying. I fail to see how it pertains to your question. – beroal May 27 '17 at 12:27

Logic is a tool for distinguishing true and false statements. If a statement is proved, then it is true. If its negation is proved, then it is false. Hence the core skill is checking whether a proof is correct and finding/inventing a proof of a statement.

Prolog is based on a subset of logic. A Prolog implementation finds proofs automatically. IMHO, anybody should learn how to find proofs by hand and have a bit of practice before using any automatic prover. Prolog is so weak that it can't find even simple theorems that are of interest, like theorems of Peano's Arithmetic. Moderately complex statements, like the axiom of induction, can't even be expressed in Prolog. No wonder that

I tried to use this IBM's NLP as an example, but this pattern matching exercise does not covers much concepts from mathematical logic.

Prolog surely is an example application of logic, but it is too weak to show what mathematical logic is. A proof assistant is a better way. Prolog is not the only application of logic. Other options are reasoning about programs, hardware, and computer systems, proof assistants and provers, and Artificial Intelligence.

If the goal is to "explain the symbolic/mathematical logic concepts" which underlie computers and computing, then I cannot recommend enough the opening chapters of Nand2Tetris.

The goal of the book/course is to understand every layer of abstraction from a program written in a Java-like language down to the fundamental logic gates upon which everything else is built. The opening chapter spends time discussing the most common logic gates and their respective truth tables. The initial challenge involves forming a Not gate using only Nand gates. From there, students must build And, Or, and Xor along with Mux and Dmux. The relevance to "real application" is immediate: these are the most foundation for understanding how things work at the absolute lowest level of computer hardware. The assignment is certainly one that stresses symbolic and mathematical logic in a real-world context.

The book is split into two parts, each of which has a corresponding course on Coursera. You can also read the first six chapters of the book here, so the first three chapters, which focus heavily on logic and low-level hardware, are all available at no cost.

It's very difficult to answer this question without more context, like grade level/age/etc. At Brown some years ago we introduced a class called Logic for Systems that offers a variety of tools for teaching logic very effectively, with the express goal of enticing students who are otherwise uninterested in theory, formalism, and so on. We did this by, in essence, inverting the traditional "logic in computer science" course on its head and (roughly speaking) doing its material in reverse order. The class has been a huge success. However, these materials may be of no use to you depending on the level at which you work.