Documentation
  • Introduction
  • Why Ampersand?
    • The Business Rules Manifesto and Ampersand
  • Tutorial
    • Example system: Enrollment
    • Conceptual Model: Enrollment
    • Your tool: RAP4
    • Making your first Ampersand script
  • Reactive programming
  • The language Ampersand
    • How to read syntax statements
    • Truth
    • Atoms
    • The CONCEPT statement
    • The RELATION statement
    • The MEANING statement
    • The PURPOSE statement
    • The CLASSIFY statement
    • The RULE statement
    • Terms
      • Semantics
      • Semantics in logic
        • Primitive terms
        • Boolean operators
        • Relational operators
        • Residual operators
      • Semantics in natural language
        • Primitive terms in natural language
        • Boolean operators in natural language
        • Relational operators in natural language
        • Residual operators in natural language
      • Semantics in sets
        • Primitive terms in set theory
        • Boolean operators in set theory
        • Relational operators in set theory
      • Semantics of terms, defined algebraically
        • Boolean operators in algebra
        • Relational operators in algebra
      • Semantics visualized
        • Semantics of boolean operators visualized
        • Semantics of relational operators visualized
        • Semantics of residuals visualized
    • Context
    • Module
    • Best Practices
    • Syntactical Conventions
      • The CONCEPT statement
      • The RELATION statement
      • The RULE statement
      • The CONTEXT statement
      • The INCLUDE statement
      • Explanation
      • Patterns
      • Population
        • Population in spreadsheets
      • The PURPOSE statement
      • The IDENT statement
      • The TABLE statement
      • Language support
    • The INCLUDE statement
    • Patterns
    • Services
      • Example: Client
      • Example: Login
      • Syntax and meaning
      • Explanation
      • Layout of user interfaces
        • Your own widgets (HTML and CSS)
      • CRUD
    • Population
      • Population in spreadsheets
    • The ENFORCE statement
    • The IDENT statement
    • The TABLE statement
    • Language support
    • Current date
    • The Preprocessor
    • Design considerations
  • Running the Ampersand compiler
    • Configuration
    • Commands (vs. 4.0.0 and later)
    • Options (up to vs. 3.17.4)
  • Architecture of an Ampersand Application
    • Backend framework
    • Hooks
    • Extensions
      • The ExecEngine
  • Deploying your Ampersand script
    • Compiler
    • Deploy your own web application on your laptop
    • Prototype multi-stage build
    • Prototype database
  • Reusing Available Modules
    • Modules
    • Security
    • SIAM (Sessions, Identity and Access Management) Module
  • Exercises
    • Delivery
    • VOG (in Dutch)
  • Installing Ampersand
    • Deploying your Prototype
    • Installing the tools manually
  • Modeling
    • Domain Driven Design
    • Data modeling
    • Legal modeling
    • Architecture modeling
    • Metamodeling
    • Limitations of Ampersand
  • Configuring your application
  • The Excel Importer
  • Plans
    • Current State
    • NoSQL storage
    • API documentation
    • OWL and RDFS input
    • Refactor the front-end
  • Research
Powered by GitBook
On this page
  • How to type boolean operators in your script
  • Other explanation
Export as PDF
  1. The language Ampersand
  2. Terms
  3. Semantics in sets

Boolean operators in set theory

PreviousPrimitive terms in set theoryNextRelational operators in set theory

Last updated 6 years ago

A relation is by definition a subset of the Cartesian Product of the source and target sets. So, if two different relations r and s are defined on the same source A and target B, then the ordinary set operators can be applied to produce a new relation.

  • intersection : r∩sr ∩ sr∩s is the set that contains the elements that are contained in relation rrr as well as in sss, or r∩s = {(x,y) ∣ (x,y)∈r∧(x,y)∈s}r ∩ s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∧ (x,y) ∈ s \}r∩s = {(x,y) ∣ (x,y)∈r∧(x,y)∈s}

  • union : r∪sr ∪ sr∪s is the set that contains all elements that are contained either in relation rrr or in sss, or r∪s = {(x,y) ∣ (x,y)∈r∨(x,y)∈s}r ∪ s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∨ (x,y) ∈ s \}r∪s = {(x,y) ∣ (x,y)∈r∨(x,y)∈s}

  • difference : r−sr - sr−s is the set that contains the elements of relation rrr that are not contained in sss, or r−s = {(x,y) ∣ (x,y)∈r∧(x,y)∉s}r - s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∧ (x,y) ∉ s \}r−s = {(x,y) ∣ (x,y)∈r∧(x,y)∈/s}

The complement (or negation) of a relation r[AxB]r_{[A x B]}r[AxB]​ is defined by means of the difference operator:

  • complement : If rrr is defined as rA×Br_{A\times B}rA×B​, then r‾\overline{r}r is the set of all tuples in A×BA\times BA×B (the Cartesian product) that are not contained in rrr. So r‾=V[A×B]−r\overline{r} = V_{[A\times B]} - rr=V[A×B]​−r

Note that the complement is defined in terms of AAA and BBB. So, two relations with the identical population yet a different type may have different complements.

How to type boolean operators in your script

shows how you can write these things in your Ampersand script.

Other explanation

Would you like a different explanation of the boolean operators? This page explains the boolean operators in logic.

This page