Multi-Set Manipulator/Subset

From Esolang
Jump to navigation Jump to search
Multi-Set Manipulator/Subset
Paradigm(s) Imperative
Designed by Mathematical Notation
Appeared in <1993
Memory system set-based
Dimensions one-dimensional
Computational class
Reference implementation
Influenced by Naive set theory
File extension(s) .msm

User:A attempts to make Multi-Set Manipulator a pure set-based language. All sets in Set Manipulator are multi-sets, although they can occasionally be treated as normal sets.

Set-manipulational instructions

A∩B A with all items not in B removed; Intersection
A∪B A with all B items appended; Union
AΔB (A-B)∪(B-A)
^A or ~A or ¯A All items that don't belong to A
A-B or A\B A with all B items removed
|a| a's absolute value; if a is a set, returns the length of the set a.
() Grouping operator
"abcde..." define a set that has 1-byte characters
"a" one-character multi-set
{1,2,"a"} define a multi-set, allowing numbers.
I The set that results from 1 line of input; all expressions are outputted by default.
← initializing

Set-comparison instructions

∈ ELEMENT OF
∉ NOT AN ELEMENT OF
∋ CONTAINS AS MEMBER
∌ DOES NOT CONTAIN AS MEMBER
⊂ STRICT SUBSET OF
⊃ STRICT SUPERSET OF
⊄ NOT A SUBSET OF
⊅ NOT A SUPERSET OF
⊆ SUBSET OF OR EQUAL TO
⊇ SUPERSET OF OR EQUAL TO

Integer comparision instructions

≠ NOT EQUAL TO; compares both values and multi-sets 
= equals sign; compares both values and multi-sets
< Less than
> Greater than
≤ LESS-THAN OR EQUAL TO
≥ GREATER-THAN OR EQUAL TO
a∣b Whether a Divides b
a∤b Whether a does not divide b

Logical instructions

⊻ XOR
⊼ NAND
⊽ NOR
∧ LOGICAL AND
∨ LOGICAL OR
¬ not sign
⊭ NOT TRUE
⊨ TRUE

Integer manipulational instructions

÷ Division
· Multiplication
+ Addition

Miscellaneous instructions

… Eclipsis to describe an obvious pattern
: Such that, used to describe a set

Built-in Sets

N Natural numbers
N* or N+ Positive integers
Z Integers {…-3,-2,-1,0,1,2,3,…}
Q:Rational numbers; {a÷b:a,b∈Z∧b≠0}; All integers can be represented as a÷1.
Q+ Positive rational numbers
Q- Negative rational numbers
R Set of real numbers
R+ Positive real numbers
R- Negative real numbers
C Composite numbers {a + bi:a, b ∈ R}
P All prime numbers {2, 3, 5, 7, 11, 13, 17, …}
Ñ All quaternions; {a + bi + cj + dk:a, b, c, d ∈ R}
T All transcendental numbers
U Universal set
∅ null set

Square root functions are unneccecary, because:

√ Square root sign; simply to the power of 1÷2.
∛ Cube root; simply to the power of 1÷3.
∜ Fourth root; simply to the power of 1÷4.

Set descriptions

ans←(a∩b)∪(b∩c)∪(c∩a)
O←O∪"Hello, world!"

Max function and Min function

(a+b+|a-b|)÷2
(a+b-|a-b|)÷2

Natural numbers set not using the built-in N

N←{n:n>0∧n∣1}

Cartesian product

A × B ← {{a,b} : a∈A∧b∈B}

The set F of the twenty smallest integers that are four less than a perfect square

F←{n2-4:n∈Z∧0≤n≤19}

Average of all numbers in a set

(A0+A1+...+A|A|)÷|A|

All prime numbers less than I

T←{n:n∈R∧n≤I}

Proof as a programming language

Primality checker

I∈P

Unary Adder

I∪I