Module Set
Manipulates key->value Sets.
All functions in this module also work on PseudoSets. For further info read Wikipadia on Sets and List of logic symbols. In unions and intersections of PseudoSets the values of Set B take precedence.
Note: This module inherits all Table module methods.
Module Status: Stable.
Usage:
local Set = require('__eradicators-library__/erlib/lua/Set')()
    
Module
| Set(set) | Attaches this Set module as metatable to a table. | 
Conversion
| of_values(tbl) | Creates a set that maps all values from the input table to true. | 
| of_keys(tbl) | Creates a set that maps all keys from the input table to true. | 
Metamethods
| __add() | Addition with + is Set.union(). | 
| __sub() | Substraction with - is Set.complement(). | 
Creation
| union(A, B, keep_meta) | →∀x (Ax ∨ Bx) | 
| intersection(A, B, keep_meta) | →∀x (Ax ∧ Bx) | 
| complement(A, B, keep_meta) | →∀x (Ax ∧ ¬Bx) | 
| difference(A, B, keep_meta) | →∀x (¬(Ax ∧ Bx)) | 
Comparison
| contains(A, e) | →∃e (Ae) | 
| is_superset(A, B) | A⊃B, ∀xBx (Ax) ∧ ∃xAx (¬Bx) | 
| is_subset(A, B) | A⊂B, ∀xAx (Bx) ∧ ∃xBx (¬Ax) | 
| is_equal(A, B) | A⇔B, ∀xAx (Bx) ∧ ∀xBx (Ax) | 
| is_disjoint(A, B) | A∩B==∅, ¬∃xAx (Bx) ∧ ¬∃xBx (Ax), ∀xAx (¬Bx) ∧ ∀xBx (¬Ax). | 
Module
- Set(set)
 - 
    Attaches this Set module as metatable to a table. 
Alias forsetmetatable(set, {__index = Set}).Parameters:
- set table
 
Returns:
- 
           PseudoSet
        The unchanged input table, now with metatable attached.
    
 
 
Conversion
- of_values(tbl)
 - 
    Creates a set that maps all values from the input table to true.
    
Parameters:
- tbl table
 
Returns:
 - of_keys(tbl)
 - 
    Creates a set that maps all keys from the input table to true.
    
Parameters:
- tbl table
 
Returns:
 
Metamethods
Creation
           For all of these functions: If the input set 
    A had the module metatable
 attached by calling Set(A) then the resulting set will automatically
 inherit the metatable. This behavior can be disabled by passing false
 as a third parameter. Any metatable not created by Set() will never be
 inherited.
          - union(A, B, keep_meta)
 - 
    →∀x (Ax ∨ Bx)
    
Parameters:
- A
 - B
 - keep_meta
 
Returns:
 - intersection(A, B, keep_meta)
 - 
    →∀x (Ax ∧ Bx)
    
Parameters:
- A
 - B
 - keep_meta
 
Returns:
 - complement(A, B, keep_meta)
 - 
    →∀x (Ax ∧ ¬Bx)
    
Parameters:
- A
 - B
 - keep_meta
 
Returns:
 - difference(A, B, keep_meta)
 - 
    →∀x (¬(Ax ∧ Bx))
    
Parameters:
- A
 - B
 - keep_meta
 
Returns:
 
Comparison
- contains(A, e)
 - 
    →∃e (Ae)
    
Parameters:
- A
 - e
 
Returns:
 - is_superset(A, B)
 - 
    A⊃B, ∀xBx (Ax) ∧ ∃xAx (¬Bx)
    
Parameters:
- A
 - B
 
Returns:
 - is_subset(A, B)
 - 
    A⊂B, ∀xAx (Bx) ∧ ∃xBx (¬Ax)
    
Parameters:
- A
 - B
 
Returns:
 - is_equal(A, B)
 - 
    A⇔B, ∀xAx (Bx) ∧ ∀xBx (Ax)
    
Parameters:
- A
 - B
 
Returns:
 - is_disjoint(A, B)
 - 
    A∩B==∅, ¬∃xAx (Bx) ∧ ¬∃xBx (Ax), ∀xAx (¬Bx) ∧ ∀xBx (¬Ax). 
The empty set is disjoint from every set, including from itself.Parameters:
- A
 - B
 
Returns: