# Boolean Operators

## The AND Operator

{% hint style="success" %}
The (^) AND Boolean operator is a way to ask if two values are true, and can be summarized as “Is condition 1 true AND condition 2 true?”. Some people find it easier to remember, when they think it works like a arithmetic multiplication. There are four possibilities:

* true ^ true = true
* true ^ false = false
* false ^ true = false
* false ^ false = false

The above list shows that the results of an AND can only be true if both operands are true. If any of the operands are false, the result is false. If we encoded true to 1 and false to 0, we would have the analogy with the arithmetic multiplication:

* 1 \* 1 = 1
* 1 \* 0 = 0
* 0 \* 1 = 0
* 0 \* 0 = 0
  {% endhint %}

## The OR Operator

{% hint style="success" %}
The (v) OR Boolean operator is a way to ask if at least one of two values is true, and can be summarized as “Is condition 1 true OR condition 2 true?”. Some people find it easier to remember, when they think it works like an arithmetic addition. There are four possibilities:

* true v true = true
* true v false = true
* false v true = true
* false v false = false

The above list shows that the results of an OR are true if any or both operands are true. The only way the result is false is if both operands are false. If we encoded true to 1 and false to 0, we would have the analogy with the arithmetic addition:

* 1 + 1 = 1
* 1 + 0 = 1
* 0 + 1 = 1
* 0 + 0 = 0
  {% endhint %}

## The NOT Operator

{% hint style="success" %}
The (¬) NOT Boolean operator is a way to invert the operand, and can be summarized as “Is condition NOT true?”. There are only two possibilities:

* ¬ true = false
* ¬ false = true

The above list shows that the results of an NOT switches the result, so a false becomes true and a true becomes false.
{% endhint %}

## Quantifiers?

{% hint style="info" %}
To quantify an expression means to express to which extend a predicate is true over a set of elements. There are two of them:

* ∀ (FOR ALL/FOR ANY/FOR EACH): It is the <mark style="color:blue;">universal</mark> (tổng quan) quantifier. It can be translated to "for every element in our domain, the predicate is true"
* ∃ (THERE EXISTS): It is the <mark style="color:blue;">existencial</mark> (tồn tại) quantifier. It can be translated to "for some elements in our domain, the predicate is true"
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viettaliii.gitbook.io/home/education/reverse-engineering/symbolic-analysis/sat-and-constraints/boolean-operators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
