Loading...

Logical Functions

RelationsSets and Logic

A logical function is an expression that takes logical variables (true or false values) as input and computes the output from them.

Definition

Formally, an n-variable logical function is a mapping from the set {0,1}^n to {0,1}. That is, the input is 0 (false) or 1 (true), and the output is also 0 or 1.

Simple Examples

  • f(p) = ¬p → assigns 0 to input 1, 1 to input 0.
  • f(p,q) = p ∧ q → outputs 1 only if both p and q are 1.
  • f(p,q) = p ∨ q → outputs 1 if at least one is 1.

Truth Tables

The operation of logical functions can be most simply demonstrated with truth tables. These list all possible inputs and the corresponding outputs.

Number of Logical Functions

An n-variable logical function has 2^(2^n) different forms. For example:

  • For 1 variable: 4 possible functions.
  • For 2 variables: 16 possible functions.
  • For 3 variables: 256 possible functions.

Why Are They Important?

  • They are the basis of digital circuits (AND, OR, NOT gates).
  • They help model logical problems.
  • They play a fundamental role in computer science and artificial intelligence.

Summary

A logical function has truth values as input and always returns a truth value. Every logical operation can be interpreted as such a function.

Practice Exercise

We have reviewed and checked the materials, but errors may still occur. The content is provided for educational purposes only, so use it at your own responsibility and verify with other sources if needed.

✨ Ask Lara

Please sign in to ask Lara about Logical Functions.

Track Your Progress 🚀

Learn more easily by tracking your progress completely for free.


Top tools

CodeHubBoardly NEWLinksy NEWChromo NEW

Select Language

Set theme

© 2025 ReadyTools. All rights reserved.