Clause (logic)
Encyclopedia
In logic
, a clause is a finite disjunction
of
literals
. Clauses
are usually written as follows, where the symbols are
literals:
In some cases, clauses are written (or defined) as sets of literals, so that clause above
would be written as . That this set is to be
interpreted as the disjunction of its elements is implied by the
context. A clause can be empty; in this case, it is an empty set of literals.
The empty clause is denoted by various symbols such as ,
, or . The truth evaluation of an empty
clause is always .
In first-order logic
, a clause is interpreted as the universal closure of the disjunction of literals. Formally, a first-order
atom is a formula of the kind of , where
is a predicate of arity and each
is an arbitrary term, possibly containing variables. A first-order literal is either an atom or a negated atom . If
are literals, and are
their (free) variables, then is a clause, implicitly read as the closed first-order formula .
The usual definition of satisfiability assumes free variables to be existentially quantified, so the omission of a quantifier is to be taken as a convention and not as a consequence of how the semantics deal with free variables.
In logic programming
, clauses are usually written as the implication of a
head from a body. In the simplest case, the body is a conjunction of literals
while the head is a single literal. More generally, the head may be a
disjunction of literals. If are the literals in the
body of a clause and are those of its head, the clause
is usually written as follows:
In computer programming, a clause is a series of statements executed upon the evaluation of a conditional expression. A condition may not always be explicitly applied to a clause; these are usually called non-conditional, main, or functional clauses. A clause may also be referenced by the structure of the conditional expression, for example I am inserting a case-clause where $type is equal to 'auto'. Modifications are necessary to the if-then clause where the ninth subscript of $array ($array[9]) is equal to 'Sam'.
Logic
In philosophy, Logic is the formal systematic study of the principles of valid inference and correct reasoning. Logic is used in most intellectual activities, but is studied primarily in the disciplines of philosophy, mathematics, semantics, and computer science...
, a clause is a finite disjunction
Logical disjunction
In logic and mathematics, a two-place logical connective or, is a logical disjunction, also known as inclusive disjunction or alternation, that results in true whenever one or more of its operands are true. E.g. in this context, "A or B" is true if A is true, or if B is true, or if both A and B are...
of
literals
Literal (mathematical logic)
In mathematical logic, a literal is an atomic formula or its negation.The definition mostly appears in proof theory , e.g...
. Clauses
are usually written as follows, where the symbols are
literals:
In some cases, clauses are written (or defined) as sets of literals, so that clause above
would be written as . That this set is to be
interpreted as the disjunction of its elements is implied by the
context. A clause can be empty; in this case, it is an empty set of literals.
The empty clause is denoted by various symbols such as ,
, or . The truth evaluation of an empty
clause is always .
In first-order logic
First-order logic
First-order logic is a formal logical system used in mathematics, philosophy, linguistics, and computer science. It goes by many names, including: first-order predicate calculus, the lower predicate calculus, quantification theory, and predicate logic...
, a clause is interpreted as the universal closure of the disjunction of literals. Formally, a first-order
atom is a formula of the kind of , where
is a predicate of arity and each
is an arbitrary term, possibly containing variables. A first-order literal is either an atom or a negated atom . If
are literals, and are
their (free) variables, then is a clause, implicitly read as the closed first-order formula .
The usual definition of satisfiability assumes free variables to be existentially quantified, so the omission of a quantifier is to be taken as a convention and not as a consequence of how the semantics deal with free variables.
In logic programming
Logic programming
Logic programming is, in its broadest sense, the use of mathematical logic for computer programming. In this view of logic programming, which can be traced at least as far back as John McCarthy's [1958] advice-taker proposal, logic is used as a purely declarative representation language, and a...
, clauses are usually written as the implication of a
head from a body. In the simplest case, the body is a conjunction of literals
while the head is a single literal. More generally, the head may be a
disjunction of literals. If are the literals in the
body of a clause and are those of its head, the clause
is usually written as follows:
- If m=0 and n=1, the clause is called a (PrologPrologProlog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of...
) fact. - If m>0 and n=1, the clause is called a (Prolog) rule.
- If m>0 and n=0, the clause is called a (Prolog) query.
- If n>1, the clause is no longer HornHorn clauseIn mathematical logic, a Horn clause is a clause with at most one positive literal. They are named after the logician Alfred Horn, who first pointed out the significance of such clauses in 1951...
.
In computer programming, a clause is a series of statements executed upon the evaluation of a conditional expression. A condition may not always be explicitly applied to a clause; these are usually called non-conditional, main, or functional clauses. A clause may also be referenced by the structure of the conditional expression, for example I am inserting a case-clause where $type is equal to 'auto'. Modifications are necessary to the if-then clause where the ninth subscript of $array ($array[9]) is equal to 'Sam'.