58 lines
4.6 KiB
Markdown
58 lines
4.6 KiB
Markdown
# First Order Logic
|
||
|
||
### Before we Start
|
||
To be frank, this is kind of an off the wall paper. First order logic is not something you would normally
|
||
come across unless you are doing rather advanced mathematics or AI theory. I have always been fascinated by it
|
||
and ever since I learned it I feel that my problem solving and deduction skills have improved greatly. I will
|
||
also admit I do not expect many people to actually read all of this and take away everything, it is a complicated
|
||
topic and I plan on only scratching the surface. My hope really is to just plant a seed, and if you are someone
|
||
who lets the seed grow and runs with it then thats great, if not thats fine. I will have fun writing this paper
|
||
none the less.
|
||
|
||
### What is First Order Logic (FoL)
|
||
In short, it's a refined and strict language that allows you to write logical formulas that allows for both quantifiers and predicates. Already this may seem like a lot but
|
||
we can break this down. By strict language I specifically mean that it has very strict rules. The syntax is either correct or it is not, down to a computer being able to det
|
||
ermine if it is well formed easily. Quantifiers are just ways of saying the scope some given set, and there really are only 2, either ALL OF or AT LEAST ONE OF. I will get i
|
||
nto examples of that next. Predicates can be thought of as functions, it takes in a variable and returns a value. Most of the time when you look at simple FoL you will see e
|
||
xamples where the predicate is logical, there is no defined function, but rather the word used as the function is the definition. For example round(ball) would be true vs ro
|
||
und(square) is false. We don't need to define the function for round() since the reader knows what that means. Now you can define predicates if you wish, that is up to you.
|
||
|
||
### What does the language look like?
|
||
The language can get very messy if you are not prepared for it, and I find a lot of papers and wikis on FoL gloss over the symbols before just shoving formulas down your nec
|
||
k. So lets table out the main ones we will be working with
|
||
|
||
#### Quantifiers
|
||
|Symbol | Formal Name | Meaning |
|
||
|--:|:---------------------------|:-----------|
|
||
| `∀` | universal quantification |For All of |
|
||
| `∃` | existential quantification |There exists|
|
||
|
||
The upside down A and backwards E really are very simple once you get past the fact that they are very abnormal characters. Simply put the `∀` just means that all values it'
|
||
s referring to are considered where as with `∃` only 1 needs to be taken into account. A good example would be `∀food tastes good` vs `∃food tastes good`, which is like sayi
|
||
ng "All food tastes good" verses "Some food tastes good". In the first we are saying all food must taste good for the statement to be true and in the second technically we a
|
||
re saying that only one food needs to taste good for it to be true.
|
||
|
||
I do want to call out 1 more, we will not be using it but it does exist and it is `∃!` which just means "there exists 1 and only 1". Sticking with our last example of food y
|
||
ou could assume a really picky child would say `∃!food tastes good` and they could be referring to like chocolate or something. Not the best example but you get the point.
|
||
|
||
#### Predicates
|
||
Predicates are evaluations we make to objects. As I stated before, and for this paper, we will stick to using words that already have meaning to be our predicates. Using our
|
||
last example we can just turn `tastes good` into a predicate by treating it like a function, for example `∀food goodTaste(food)` vs `∃food goodTaste(food)`. Now we can star
|
||
t to look at this as a computable test in that for the `∀` we could loop through all foods and if we find a single one where goodTaste(food) returns false it is then false w
|
||
here as with `∃` we could loop through all food and if a single one returns true for the same function then the statement is true.
|
||
|
||
#### Logical Connectives
|
||
This is the first time I brought these up but they are used in every language from speech to computers. They are your ANDs, ORs, and NOTs for the most part. Since this is a
|
||
well defined language they had to make it fun and use their own symbols for Everything so lets table them out
|
||
|
||
|Symbol | Meaning |
|
||
|--:|------------|
|
||
| `¬` | NOT |
|
||
| `∧` | AND|
|
||
| `∨` | OR |
|
||
|
||
There are more and you can see them [here](https://en.wikipedia.org/wiki/List_of_logic_symbols) but for what we will be doing these are all we need.
|
||
|
||
#### Some extra symbols
|
||
I plan on doing a whole paper on set theory as well some day, but basically it is the study of sets and it also has its own set of symbols. I will be using one main one from
|