# AndLink

The **AndLink** is a kind of Link used to conjoin truth values. The precise semantics depends on the context in which it is used. There are three basic ways in which AndLink is used in opencog:

- By PLN, during logical reasoning, to determine the truth or falsehood of something;
- By cog-evaluate! to evaluate the truth of expressions containing proceedural elements
- By the pattern matcher, to combine the presence or absence of subgraphs during a subgraph query. This may include evaluation as well.

There are a variety of related logic operation links, including SequentialAndLink, OrLink, SequentialOrLink, ChoiceLink, NotLink, AbsentLink, JoinLink and ParallelLink.

## Evaluation semantics

If invoked by the evaluator, either directly with cog-evaluate, or indirectly, via pattern matching, the AndLink evaluates to true only if all the atoms in it's outgoing set evaluate to true. For sequential evaluation, the SequentialAndLink can be used. For parallel, multi-threaded evaluation, the JoinLink can be used.

## PLN Semantics

AndLink can join N predicates or N concepts, but it can't join a concept with a predicate. For examples, see OpenCog Atom types.

In PLN the AndLink semantics corresponds to a fuzzy set intersection (accounting for confidence).

AndLink <TV> A B

with

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle TV.s = \frac{\sum_x f_\wedge(A(x).s, B(x).s) \times x.s}{\sum_x x.s}}**

where **Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle f_\wedge}**
denotes the function associated to the fuzzy connector **Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \wedge}**
, usually **Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \min}**
.

Initially the AndLink is defined over concepts, but is overloaded to predicates as well, in that case the intersection is applied over the corresponding satisfying sets.

## Example

For instance one may express the AndLink between predicates like

AndLink <TV> PredicateNode "tasty" PredicateNode "colorful"

or concepts

AndLink <TV> ConceptNode "tasty_things" ConceptNode "colorful_things"