Logic (from Classical Greek λόγος logos; meaning 'speech/word') is the study of the principles and criteria of valid inference and demonstration. The term "logos" was also believed by the Greeks to be the universal power by which all reality was sustained and made coherent and consistent.
As a formal science, logic investigates and classifies the structure of statements and arguments, both through the study of formal systems of inference and through the study of arguments in natural language. The field of logic ranges from core topics such as the study of fallacies and paradoxes, to specialized analysis of reasoning using probability and to arguments involving causality. Logic is also commonly used today in argumentation theory. 
Traditionally, logic is studied as a branch of philosophy, one part of the classical trivium, which consisted of grammar, logic, and rhetoric. Since the mid-nineteenth century formal logic has been studied in the context of the foundations of mathematics. In 1910 Bertrand Russell and Alfred North Whitehead attempted to establish logic as the cornerstone of mathematics formally with the publication of Principia Mathematica. However, the system of Principia is no longer much used, having been largely supplanted by set theory. The development of formal logic and its implementation in computing machinery is the foundation of computer science.
In the formal languages
used in mathematical logic
and computer science
, a well-formed formula
or simply formula
(often abbreviated wff
, pronounced "wiff" or "wuff") is an idea
which is expressed using the symbols
and formation rules
(also called the formal grammar
) of a particular formal language. To say that a string
is a wff with respect to a given formal grammar
is equivalent to saying that
belongs to the language generated by
. A formal language can be identified with the set of its wffs.