# Logic

Logic (from Greek *logos* -- thought/reason/word) is the study of rational reasoning. Logic as such is a term very general -- there is common sense logic, philosophical logic, formal and [mathematical](math.md) logic, deductive and inductive logic, logic in [circuits](logic_circuit.md), [programming](programming.md), [fuzzy](fuzzy.md) logic and many other kinds of logic. Logic is closely intertwined with [mathematics](math.md) because mathematics is built on top of logic and adopts many of its tools and concepts, for example axiomatic systems, and in turn mathematicians help further develop deeper knowledge about logic with tools they obtained. As always, here we will focus mainly on logic from programmer's point of view.

TODO: moar stuff here, different orders of logic etc.

Formal logic is also usable as one of many **programming [paradigms](paradigm.md)** -- a typical example of logic programming language is [Prolog](prolog.md).

**Power of logic is limited** (for more please read this excellent resource: http://humanknowledge.net/Thoughts.html) -- though logic is the strongest, most stable platform our knowledge can ever stand on, it is still not infinitely powerful and has its limits, despite what any reddit [atheist](atheism.md) tells you or even what he believes. This sadly [dooms](doom.md) us to certain eternal inability to uncover all there is, we just have to accept from a certain point we are blind and not even logic will help us. [Kurt Godel](godel.md) (along with others, e.g. Tarski) mathematically proved with his [incompleteness theorems](incompleteness.md) that we simply won't be able to prove everything, not even the validity of formal tools we use to prove things. See also [knowability](knowability.md). Even in just intuitive terms: on the lowest level we start using logic to talk about itself, i.e. if we e.g. try to prove that "logic works" using logical arguments, we cannot ever succeed, because if we succeed, the proven fact that "logic works" relies on the fact that logic indeed works; if it perhaps doesn't work and we used it to prove its own validity, we might have simply gotten a wrong result (it's just as if we trust someone saying "I am not a liar", he may as well be lying about not being a liar). By this logic even the previous sentence may or may not actually be true, we simply don't know, sometimes the best we can do is simply hold on to stronger or weaker beliefs. Imagine we have a function *isTrue(x)* that automatically checks if statement *x* is true (returns *true* or *false*), now image we have statement *y* that says *isTrue(y) = false*; our *isTrue* function will fail to correctly evaluate statement *y* (it can't return neither *true* nor *false*, both will lead to contradiction) -- this is a proof that there can never be a computable function that decides whether something is true or not. Logic furthermore cannot talk about many things; it can tell us how the world works but e.g. not WHY it works like it does. Checkmate [atheists](atheist.md).

Are laws of logic inherent to every kind of existence, constant and unchanging under all possible conditions or are they specific to our [Universe](universe.md) and something we simply learn empirically? I.e. it seems logical that for example if *A* implies *B* and *A* holds, *B* will hold too -- but does it always have to be so or is it just so around our specific spacetime coordinates and we simply LEARN this rule, accepting it as a general interdimensional law? It seems logical that putting two individual [rocks](rock.md) together forms a single pair of rocks, but maybe in another universe putting two rocks together forms three rocks -- would beings in this universe have different laws of logic and different mathematics? This is probably a great philosophical question we can't satisfyingly answer here, but quite likely it may be the case that such questions [cannot be answered](knowability.md) at all.

## See Also

- [math](math.md)
- [philosophy](philosophy.md)
- [epistemology](epistemology.md)
- [knowability](knowability.md)
- [science](science.md)