![Page 1: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/1.jpg)
Logic in Computer Science
Yu “Tony” Zhang, Ph.D.Assistant Professor
Arizona State University
![Page 2: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/2.jpg)
“The Calculus of Computer Science”
| Logic’s role in Computer Science- Computer Architecture- Software Engineering & Robotics- Programming languages- Databases- AI & Robotics- Computation Theory- ...
Logic
�♢Φ⟶�Ө
main() {if (i > 5) i++;
}
P = NP?
![Page 3: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/3.jpg)
| Propositional logic
| First-order logic
| Logic programming
Topics covered in this class
![Page 4: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/4.jpg)
| What are the current trends in Logic Modeling and/or AI?- Incorporating uncertainty into logic modeling
-Knowledge augmented learning systems
-Model retrieval (learning) for common sense reasoning- Magellan, the explorer, went around the world three times. On one of his trips, he died. Which
trip did he die?
Trends in logic
![Page 5: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/5.jpg)
Knight’s TourGary Chen and Drew Nibeck
![Page 6: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/6.jpg)
What is Knight’s Tour?
A game where you play as a chess knight.
Goal:
● Go to every square.
Restrictions:
● You may not revisit a square.
![Page 7: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/7.jpg)
Solutions
Solutions:
● Open Tour● Closed Tour● No Tour
Open Tour
![Page 8: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/8.jpg)
A Heuristical Approach
Warnsdorff’s Rule:
Choose the tile with the least number
of possible moves.
![Page 9: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/9.jpg)
Our Solution
2. Filter moves
1. Find Moves
3. Count
3
3
2
2
7
7
4. Pick best
![Page 10: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/10.jpg)
Improvements
Resolving Ties:
Arnd Roth Hypothesis:
- Take the position furthest from the center
Ira Pohl Hypothesis:
- Sum the neighbors of the neighbors, then choose the least
2
2
36
32
9
5
![Page 11: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/11.jpg)
![Page 12: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/12.jpg)
![Page 13: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/13.jpg)
![Page 14: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/14.jpg)
Sources
https://en.wikipedia.org/wiki/Knight%27s_tour
Douglas Squirrel and Paul Coll, A Warnsdorff-Rule Algorithm for Knight’s Tour on a Square Chessboard
![Page 15: Logic in Computer Science - Arizona State University](https://reader031.vdocuments.us/reader031/viewer/2022012500/6179e4ef6f0fc44f25399561/html5/thumbnails/15.jpg)