MENTAL
 Main Menu
 Language
 Derivatives
 Operations with Sets


Operations with Sets
 OPERATIONS
WITH SETS

"A set is a simultaneous consideration of entities" (Bertrand Russell).

"A set is Several that can be considered as One" (Cantor).



Belonging and Inclusion

Belonging

The condition that must exist for an element x to belong to a set C, x∈C, is:

⟨( xC =: (x⨂[C↓]= x) )⟩

where is the general operation of intersection of two expressions:

⟨( xy = (xx=y → θ) )⟩

And the opposite (non-membership):

⟨( xC =: (x⨂[C↓]= θ) )⟩

being (∉ ≡ ∈').

The symbol , a derivation of the Greek letter ε (epsilon), was introduced by Peano in 1888.

Examples:
  1. (C = {a b c})
    (a∈C)? // ev. α
    (d∈C)? // ev. θ
    ({a b}∈C)? // ev. θ


  2. (C = {a {b c} d})
    (a∈C)? // ev. α
    ({b c}∈C)? // ev. α
Properties:
  1. The condition that C be a set is ({C↓} = C).

  2. The empty set {} (or )does not belong to any set, unless the set explicitly includes it.

  3. A set may include itself. For example, (C =: {a b C}).

    If a set C includes itself, it is satisfied: (C/(C = θ) ≠  C).
    In the case of the example, you have that ({a b} ≠ {a b C}).

Inclusion

⟨( CD =: {[[[C↓]⨂[D↓]]} = C )⟩

And the opposite condition is:

⟨( (C ⊂' D) =: {[[[C↓]⨂[D↓]]} = θ )⟩

By definition:

⟨( CD =: (CDC=D) )⟩

Properties:
  1. ⟨( (CDDC) → C=D )⟩
  2. ⟨( (CDDE) → CE )⟩
  3. ⟨( (aBBC) → A )⟩
Examples:
  1. (C = {a b c})
    ({a b}⊂C)? // ev. α
    (a⊂C)? // ev. θ


  2. (C = {a {b c} d})
    ({a d}⊂C)? // ev. α
    (b⊂C)? // ev. θ
    ({b c}⊂C)? // ev. θ

Union, Intersection and Difference of Sets

Union of sets

This operation was already defined, in general, as the "Union" derivative, but in this case we specify that the two parameters must be sets.

⟨( (CD = {CD↓}) ← ({C↓} = C) ← ({D↓} = D) )⟩

This definition can be simplified by the generic expression

⟨( C/conj =: {C↓} = C) )⟩

which indicates the condition that C is a set. The new definition is:

⟨( (CD = {CD↓}) ← C/conj ← D/conj )&⟩

Repeated items disappear automatically. Examples:
  1. {a b c}∪{d c} // ev. {a b c d}
  2. {1 2}∪{2 3}∪{3 4} // ev. {1 2 3 4}
  3. {u v}∪{} // ev. {u v}
Properties:
  1. ⟨( CC = C )⟩
  2. ⟨( C∪∅ = C )⟩

Intersection of sets

It is also defined under the condition that the two parameters are sets:

⟨( (CD = {[[C↓]⨂[D↓]]} ← C/conj ← D/conj )⟩

Examples:
  1. {a b c}∩{a b c} // ev. {a b c}
  2. {a b c}∩{a b} // ev. {a b}
  3. {a b c}∩{a} // ev. {a}
  4. {a b c}∩{} // ev. {}
  5. a∩{a b c} // ev. {a}
Properties:
  1. ⟨( CC = C )⟩

  2. ⟨( C∩∅ = ∅ )⟩

  3. ⟨( (CD = D) ↔ CD)⟩

Difference between two sets

It is defined as the contravariant union. The contravariant union on the left and on the right are equivalent.

⟨( (C ∪' D)) = {xx∈C ← x∉D} )⟩

Here we do not use the symbol "" because it already has an arithmetic meaning (subtraction). We thus avoid polymorphism with overloading [see MENTAL Language - Principles - Polymorphism].

Examples:
  1. ({a b c d} ∪' {c d}) // ev. {a b}
  2. ({a b c d} ∪' {u v}) // ev. {a b c d}
  3. ({a b c d} ∪' {}) // ev. {a b c d}

Universal and complementary set

The universal set U is a meta-set: the set of all possible sets but excluding itself.

The complementary set of a set C, denoted by CC, is defined as follows: The properties are checked:
  1. ⟨( (CCC) = U)) )⟩
  2. ⟨( (CU) = U) )⟩
  3. ⟨( (CU) = C) )⟩
  4. (U ⊂ Ω)
  5. (∅C = U)
  6. (UC = ∅)

Empty sets of higher order

{} // empty set
{{}} // empty set of order 2
{{{}}}} // empty set of order 3

(C =: {C})/(C := {}) // conjunto vacío de orden infinito, representa a {{{...}}}


Cartesian Product of Sets

Definition

The Cartesian product of n sets C1 ... Cn is the set of all possible sequences formed by the elements of the sets, such that the element i of each sequence is an element of the set Ci.

For two sets C1 and C2, the descriptive definition is:

⟨( C1×C2 = {⟨ (x y) ← (xC1yC2) ⟩} )⟩

And the operational definition is:

⟨( C1×C2 = { [([C1↓] [C2↓])] } )⟩

For n sets C1, ... , Cn, the recursive definition is:

⟨( C1×...×Cn = ({[[C1↓] ∪ [C2×.... ×Cn↓]]}) ← n>2 →' C1×C2 )⟩

Here we use the operating range of the Cartesian product. Example:

C1={a b} C2={u v} C3={x y}
C1×C2×C3 = {[[[a b] ∪ [C2×C3↓]]} = =
{[[a b] ∪ [{u v}×{x y}↓]]} =
{[[a b] ∪ [(u x) (u y (v x) (v y)]]} =
{(a u x) (a u y) (a v x) (a v y)
(b u x) (b u y) (b v x) (b v y)}



Examples
  1. (C1 = {a b})
    (C2 = {u v})
    (C1 × C2) // ev. { [([a b] [u v])] } ev. {(a u) (a v) (b u) (b v) }


  2. (C1 = {a b})
    (C2 = {u v})
    (C3 = {w})
    (C1 × C2 × C3) // ev. { [([a b] [u v] [w])] }] {(a u w) (a v w) (b u w) (b v w) }

Power Set

Definition

The power set of a set C is the set of all subsets that can be formed from that set. It is described as follows:

⟨( Pot(C) = {⟨ DD/conj ← DC ⟩} )⟩

Operationally, the power set can be defined as follows:

⟨( Pot(C) = { [ { [C↓]"(C#) } ] } )⟩

That is, all permutations with repetition are generated, each within a set. The repeated elements disappear and at the end all subsets are obtained.


Examples
  1. For C={a b c} we have:

    { { { a a a } { { a a b } { { a a c } { a b a } { a b b }
    { a b c } { a c a } { a c b } { a c c } { b a a a }
    { b a b } { b a c } { b b a } { b b b b } { b b b c }
    { b c a } { b c b } { b c c } { c a a a } { c a b }
    { c a c } { c b a } { c b b } { c b c } { c c a }
    { c c b } { { c c c c } } }
    ev.

    { { a } { a b } { a c } { a b } { a b } { a b c }
    { a c } { a c b } { a c }
    { b a } { b a } { b a c }
    { b a } { b } { b c } { b c a } { b c } { b c }
    { c a } { c a b } { c a } { c b a }
    { c b } { c b } { c a } { c b } { c } }
    ev.

    { { a } { a b } { a c } { a b c } { b } { b c } { c } }

  2. Pot{a} // ev. {{a}}

  3. Pot{a b} // ev. {{a} {b} {a b}}

Number of elements

Since by the definition the empty set is not included, the length of the power set is (2∧n - 1), where n is the length of the set:

⟨( (Pot(C))# = (2∧(C# - 1) )⟩

In particular, when C is the sequence of the n first natural numbers, the property is satisfied:

⟨( (Pot( ( 1...n ) ) ))# = 2∧(n−1) )⟩


Powers of higher order (superpowers)

Level 2 superpower (power potency): Pot(Pot(Pot(x))

Level 3 superpower: Pot(Pot(Pot(x)))

Superpower of level n (recursive definition):

⟨( Spot(n C) = (Pot(Spot(n−1 C)) ← n>1 →' Pot(C))) )⟩

A simpler, more compact definition is:

⟨( Spot(n C) = (Pot↔n C)Δ) )⟩

where Δ is the monadic associativity derivative (in this case, from the right).


Analogies between Logic and Sets

Summary of analogies

LógicaConjuntos
¬C
θ
α'


Declarative Expressions

Declarative Belonging

The expression x∈{a b c} indicates that x is an element of the set {a b c} and that it is therefore a, b or c.

The expression ∈{a b c} indicates an element of the set {a b c}, i.e., that is a, b or c. Not to be confused with a∨b∨c, which is an existential expression, the result of which is α or θ.


Declarative inclusion

The expression x⊂{a b c} indicates that x is a proper subset of {a b c}, i.e., that x is one of the following sets: {a}, {b}, {c}, {a b}, {a c}, {b c}. That is:

x∈{{a} {b} {c} {a b} {a c} {b c} {b c}}

The expression ⊂{a b c} indicates a proper subset of {a b c}, i.e., it is one of the following sets: {a}, {b}, {c}, {a b}, {a c}, {b c}. That is:

∈{{a} {b} {c} {a b} {a c} {b c} {b c}}


Operations with declarative expressions

It is possible to operate with declarative expressions. For example:

3*(∈{a b c}) = (∈{3*a 3*b 3*c})

(⊂{a b c})∪{u v} =.
∈{{a u v} {b u v} {c u v} {a b u v} {a c u v} {b c u v}} {b c u v}}