Disclaimer: The notes below are fully/partially NOT created by myself. They are from slides and/or wikipedia and/or textbook. The purpose of this post is simply to learn and review for the course. If you think something is inappropriate, please contact me at “ryan_yrs [at] hotmail [dot] com” immediately and I will remove it as soon as possible.
Logic Programming 邏輯編程
- Determining the truth or falsehood of statements.
- A type of programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain.
- e.g. Prolog
- A statement that is unconditionally true.
- These are expressed using PREDICATES, which can take >= 1 TERMS.
- A rule with no goals on the right side.
- Unlike functions, predicates are never “called”.
- Unlike functions, predicates cannot be “evaluated” to be replaced by a simpler result.
- Unlike functions, predicates can be compared for equality at a purely structural level.
- A predicate in a query.
- Which can either succeed or fail.
A predicate is true if some related predicate holds.
Unlike facts, rules represent CONDITIONAL truths. We interpret these rules by replacing “:-“ with “if”.