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
  • Union
  • Difference
  • Intersection
  • Complement
  • How to type boolean operators in your script
  • Other explanation
Export as PDF
  1. The language Ampersand
  2. Terms
  3. Semantics of terms, defined algebraically

Boolean operators in algebra

PreviousSemantics of terms, defined algebraicallyNextRelational operators in algebra

Last updated 2 years ago

The boolean operators of Ampersand behave as one would expect in any boolean algebra. Union (∪\cup∪) and intersection (∩\cap∩) are both idempotent, commutative, and associative operators. In Ampersand we use a binary difference operator over with the usual semantics: (r−s)∪(r∩s)=r(r-s)\cup(r\cap s) = r(r−s)∪(r∩s)=r. The (more customary) complement operator is a partial function, because Ampersand supports heterogeneous relation algebra.

Union

The operator ∪\cup∪ (union) satisfies the following axioms:

  1. (commutativity of ∪\cup∪) r∪s = s∪rr\cup s\ =\ s\cup rr∪s = s∪r

  2. (associativity of ∪\cup∪) r∪(s∪t) = (r∪s)∪tr\cup (s\cup t)\ =\ (r\cup s)\cup tr∪(s∪t) = (r∪s)∪t

  3. (idempotence of ∪\cup∪) r∪r = rr\cup r\ =\ rr∪r = r

Difference

The difference r−sr-sr−s is the smallest relation ttt that satisfies r ⊆ s∪tr\ \subseteq\ s\cup tr ⊆ s∪t. Smallest means: If there is a t′t't′ for which s∪t′=rs\cup t'=rs∪t′=r, this implies that t∪t′=t′t\cup t'=t't∪t′=t′.

Intersection

The intersection ∩\cap∩ is defined as: r∩s=r−(r−s)r \cap s = r-(r-s)r∩s=r−(r−s)

Complement

The complement operator is defined as t‾=V[A×B]−t\overline{t} = V_{[A\times B]} - tt=V[A×B]​−t. The type [A×B][A\times B][A×B] comes from the term(s) in which ttt is embedded. If that type does not exist or if it is ambiguous, Ampersand will refuse to compile with an appropriate error message.

How to type boolean operators in your script

Other explanation

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

This page