<p>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.</p>

<p>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</p>

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

<p>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.</p>

CC BY-SA 3.0
2017-05-27T12:52:20.003Z
2017-05-27T16:29:39.647Z
2017-05-27T16:29:39.647Z
beroal
<p>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 <a href="http://cs.brown.edu/courses/cs195y/" rel="nofollow noreferrer">Logic for Systems</a> 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.</p>

CC BY-SA 3.0
2017-06-03T00:33:53.617Z
2017-06-03T00:33:53.617Z
Shriram Krishnamurthi
<p>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 <a href="http://nand2tetris.org/" rel="nofollow noreferrer">Nand2Tetris</a>.</p>

<p>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 <code>Not</code> gate using only <code>Nand</code> gates. From there, students must build <code>And</code>, <code>Or</code>, and <code>Xor</code> along with <code>Mux</code> and <code>Dmux</code>. 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.</p>

<p>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 <a href="http://nand2tetris.org/course.php" rel="nofollow noreferrer">here</a>, so the first three chapters, which focus heavily on logic and low-level hardware, are all available at no cost.</p>

CC BY-SA 3.0
2017-05-29T23:47:55.023Z
2017-05-29T23:47:55.023Z
Peter
<p>I think that the use of some logic programing language like Prolog, for example, could be a good way to explain the <a href="https://en.wikipedia.org/wiki/Logic_in_computer_science" rel="nofollow noreferrer">symbolic/mathematical logic</a> concepts but also apply this concepts in a real programming world, however, but I'm not getting it.</p>

<p>The problem is that Prolog <a href="https://www.quora.com/What-are-the-real-life-uses-of-Prolog" rel="nofollow noreferrer">are not largely used in real applications</a>. I tried to use <a href="https://www.cs.nmsu.edu/ALP/2011/03/natural-language-processing-with-prolog-in-the-ibm-watson-system/" rel="nofollow noreferrer">this IBM's NLP</a> as an example, but this pattern matching exercise does not covers much concepts from mathematical logic.</p>

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

CC BY-SA 3.0
2017-05-25T19:36:31.203Z
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
CC BY-SA 3.0
2017-05-25T21:30:54.007Z
Not really. There are resources for doing logic programming in functional languages like Racket. I'll post the links when I find them.
xuq01
CC BY-SA 3.0
2017-05-25T22:19:30.683Z
Do you want to teach about logic in general, or about [logical programming](https://en.wikipedia.org/wiki/Logic_programming) in particular?
Discrete lizard
CC BY-SA 3.0
2017-05-25T23:40:21.087Z
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
CC BY-SA 3.0
2017-05-26T15:07:51.227Z
Thanks for the comments. I'll try to improve the question for clarity.
James
CC BY-SA 3.0
2017-05-27T02:02:16.327Z
@James I made a suggestion. See if it is in the spirit of what you are seeking.
Peter
CC BY-SA 3.0
2017-05-27T12:27:19.237Z
This talk about real world applications really becomes annoying. I fail to see how it pertains to your question.
beroal
<language-choice>
Do I need Prolog to teach logic concepts?
# Do I need Prolog to teach logic concepts?

(Asked by: username_0 on 2017-05-25)

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](https://en.wikipedia.org/wiki/Logic_in_computer_science) 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](https://www.quora.com/What-are-the-real-life-uses-of-Prolog). I tried to use [this IBM's NLP](https://www.cs.nmsu.edu/ALP/2011/03/natural-language-processing-with-prolog-in-the-ibm-watson-system/) 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?

**Tags:** language-choice

> **Comments:**
> **username_1**: 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.  
> **username_2**: Not really. There are resources for doing logic programming in functional languages like Racket. I'll post the links when I find them.  
> **username_3**: Do you want to teach about logic in general, or about [logical programming](https://en.wikipedia.org/wiki/Logic_programming) in particular?  
> **username_4**: 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.  
> **username_0**: Thanks for the comments. I'll try to improve the question for clarity.  
> **username_4**: @username_0 I made a suggestion. See if it is in the spirit of what you are seeking.  
> **username_5**: This talk about real world applications really becomes annoying. I fail to see how it pertains to your question.  

---

## 3 answers

### Answer by username_5 on 2017-05-27. Score: 7 | Accepted answer

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.


---

### Answer by username_6 on 2017-06-03. Score: 3

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](http://cs.brown.edu/courses/cs195y/) 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.


---

### Answer by username_4 on 2017-05-29. Score: 3

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](http://nand2tetris.org/).

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](http://nand2tetris.org/course.php), so the first three chapters, which focus heavily on logic and low-level hardware, are all available at no cost.


---

