For people, one way to understand natural numbers is counting
For computers (cf. #link(<logic.typ>)[]
), the ways to represent natural numbers are
- Periodic circuit
- Arithmetic component
- Binary
However, the number of elements in the set of natural numbers is infinite, while bits and computer memory are finite. Human memory is also finite
The problem of infinite space: Reality cannot build circuits and memory with infinite space. Even if it could, it would be limited by the finite speed of electricity.
But potentially infinite time can be used to achieve "potential infinity"
However, there are even sets with an #link(<uncountable>)[uncountable]
number of elements. Example
- the set of all subset of ,
- all function from to itself,
Verifying the correctness of set theory language requires a parser, memory data structures, and functions. The implementation of the generated computer instruction stream is not the focus of this goal.
Motivation for sets/types
-
Modularization and multiplicative decomposition to simplify cognition
Example Natural language's Subject-Verb-Object SVO (subject, predicate, object). Suppose there are 10 nouns and 10 verbs. Suppose we "forget the SVO rule", then verifying the grammatical correctness of a three-word sentence requires at most times. If we understand and use the SVO rule, it requires at most times.
-
If the number of elements in a set is infinite, then the set/type limits the concept, making it possible to say it in a finite amount of time
Complex set theory objects, propositions are stored in variable names, so humans still need to check all the complex definitions stored in variable names, so readability is very important
Parser or proof assistants can allow humans to reduce from reviewing all steps to reviewing definitions, skipping a large number of detailed proof steps, and then determine the correctness of the proof result. This is like the case of APIs
The human brain compiler can omit and supplement omissions, trading temporary efficiency for error-proneness and forgetfulness
Assistance also has other functions, like the case of, Programming before the era of IDE/LSP/friendly-and -interactive-compiler-error-messages/documentation was painful. The organization, structuring and reuse of data and information were not done well, and the powerful capacity and time of memory were not used well.
proposition
_(tag) proposition is a special (string, bool) product struct computer data structure. For mathematical language, the string field uses special construction rules to restrict it, and this restricted version of the string is called a formula
Because we cannot directly judge the truth or falsehood of a guess, we need a language with undefined truth values.
from proposition to unknown proposition, its truth value part is modified to (bool, unknow) sum struct
Abbreviation true proposition and proposition are often used interchangeably
Many propositions cannot be automatically derived by computers, and humans need to find possible paths, input them into the computer for verification, or develop more new automated proof methods.
We will assume some initial propositions that do not need to be proven. And assume rules for constructing new propositions using existing propositions.
Abbreviation Use the same symbol for formula and proposition, " is true/false/unknow",
formula
_(tag)
- in
let symbol be type of math object, then is a formula
is similar to value : type
or variable_name : type
in programming language
symbol is not math object
- equal
- and, or, not
let be formula, then
is formula
- forall, exists
let be formula built with i.e. read in memory, used by some specific function call, then
is formula
- inference , equivalent is formula
The following discusses math-object-construct-rule alias set-theory
natural-number
_(tag)
natrual number and natrual number set is object. is true proposition
But computers cannot handle infinity. In order to allow computers to use limited characters and memory to represent natural numbers, let and functions be finite symbols in the memory address, and define the following as true proposition
Equivalent to telling the computer how to continuously with instruction streams? Also related to induction
The cost of finite characters is potentially infinite time, always relying on counting or periodic circuits.
empty
_(tag)
empty is object. let be a object, is false proposition
The definition of is convenient for intersections e.g. the intersection is empty, and the number of elements of of a finite set , is more convenient than
Define language expansion
Because “define language expansion” is very long, it is usually abbreviated to "definition" "def"
In fact, the symbol is also commonly used to represent defining language expansion or specifying language transformation. Specifically, the of natural numbers can be directly defined as comparing the value of memory with computer circuits.
declare-element-of-set
_(tag)
If is non empty (this information comes from the definition of ), we can define symbol and construct true proposition (let)
A finite number of declare statements can be constructed
enum
_(tag) enumerate
is object then is a set
Represented as a sequence of numbers in memory
The entire set can be called in this way: record the address of the first element + the length of the array as the number of circuit cycles, and read one element per circuit cycle
formulas are true propositions
Specifically, a single-element set
define
equivalent
_(tag)
Some equivalent uses. For computer data, it can be proved by exhaustion that the following calculation results are equal
Similarly, in order to represent the case of "infinite elements", define language expansion or specify language transformation. For example, De Morgan law of infinite elements
The concept of "infinity" is limited by using the symbol string of #link(<declare-element-of-set>)[]
formula, proposition is a special data structure in memory. It can be considered that math_object, formula, proposition are the type of programming language
Many propositions are equivalent, so we can consider the "quotient" type of propositions, but the possibility of equivalence is infinite, whether it is possible to have an exhaustive algorithm, first depends on whether it is #link(<countable>)[]
…
Similar to the redundancy of , set theory construction rules may also have redundancy, or there are many equivalent definitions
Specify (finite)
transitive :=
transitive :=
follow #link(<bool-algebra>)[various rules of bool in the finite case]
, define language transformation rules: let is formula built with independent/parallel i.e. independent/parallel in memory read and used by specific cuntion, then
commutative-forall-exists
_(tag)
same for
distributive-forall-exists
_(tag)
Note that I myself also feel that I cannot completely clearly handle the concepts of derivation and proof below
Natural language example of derivation
It's raining
So I won't go out
This example is similar to a conditional branch
rain : bool;
out : bool;
switch (rain) {
true => out = false,
false => out = undefined
};
inference
_(tag) For mathematical language, that is
- The compiler reads the formula
- The compiler reads the formula is true proposition (may be custom)
- The compiler reads the formula is true proposition
- Then the language rule setting is that the compiler, according to this condition (from memory), assigns the bool value of the formula to true i.e. sets is true proposition
proof
_(tag) The proof is that compiling passes is true proposition
Another kind of equivalence
reverse-inference
_(tag) Reverse inference. If the result is that I went out, then it is definitely not the result of rain. If the result of the conditional branch is out = true
, this is not the result of rain = true
. Since the bool value of an ideal binary computer must be one of two, it can only be the result of rain = false
. This can be written as a conditional branch
switch (out) {
true => rain = false,
false => rain = undefined
};
Mathematically, reverse inference is written as formula , and defined equivalent to
reverse-proof
_(tag) Proof by contradiction is that compiling passes is true proposition
Deductive proof also requires syllogism
- All living things die
- Humans are living things
- Therefore, all humans will die
Where "all living things die" is a specially constructed proposition
syllogism
_(tag) Syllogistic reasoning is a language rule
- The compiler reads the formula is true proposition (possibly from a definition e.g.
#link(<union>)[]
)) - The compiler reads the declaration let is true proposition
- The compiler reads the formula
- Then the compiler sets is true proposition according to this condition (from memory)
That is, the compiler implements the specific construction of data (finite) according to the declaration (possibly "infinite")
Or understand it as, this rule and behavior are defining the concept of itself
It is also usually written as the equivalent rule let , then the special inference formula is always true proposition. This form is often used in what #link(<proof>)[previously]
said, "proving is compiling passes is true proposition"
Reverse syllogism: let , then the equivalent formula is true proposition
We may never know whether a proposition of bool unknow can be constructively proved, i.e. compiled successfully in a limited number of steps
Where does the target proposition come from? It may be related to a model of the real world
The proof requires expanding a large number of sentences, although computers are very fast at processing strings. In any case, performance optimization? Use only when needed (lazy load)? Parallel (parallel) when two propositions are not interdependent? Assume already proven results (incremental compilation)?
A proposition has many proofs with different runtime data flow, which can be considered to belong to the same quotient proof of this proposition
The following object construction rules, except for the intersection, generally give non-empty sets
union
_(tag)

define object and language expansion
is non-emtpy unless
We do not define the union for . Same below. The reason is that let is always a false proposition, which makes many things unusable
sum
_(tag)

is non-emtpy unless
in finite case, number of element
enum is special case of sum/union?
intersection
_(tag)

product
_(tag)

is non-emtpy unless (related to axiom-of-choice
_(tag) )
Abbreviation . in finite case, number of elements
means reading two symbols as a combined symbol
map
_(tag)

let is math object. The rule for defining map space , map as math object is
denoted by
denoted by . in finite case, number of elements
Although the usage of seems problematic, they can still be defined in terms of symbol & symbol strings
If we talk about what the map specifically represents, due to non-concrete constructiveness, there is no specific return
like in general programming languages, or what return
is a newly defined symbol, math object, language expansion
subset
_(tag)

denoted by . According to #link(<proposition-function>)[]
equivalent to map space . in finite case, number of elements
define be true proposition
map space and subset introduce high-level infinity
One seemingly counterintuitive thing at first glance is that we seemingly know all or all , but cannot count them #link(<cardinal-increase>)[]
#link(<uncountable>)[]
. However, what exactly does "know all " mean? In fact, trying to consider the question of "finding an infinite subset of in a general way" reveals that this is not simple.
Similarly, although countable can already define some real numbers e.g. , if not with the help of subset or map, countable construction cannot obtain all
proposition-function
_(tag)
let , is already constructed
is object
define
Other usages of
- Alias of identifier in memory
- Return value of function in memory. so should be understood as the return value of the add function is
hierarchy-order-of-set
_(tag)
The set constructed above is called a zero (hierarchy) order set
or
then let be math object, in first order set
Using object construction rules again, what we get is also defined as belonging to
Anyway, we can always construct such a language with types and bool and various rules in the compiler. Although there are compilers for compilers, the number of compiler layers can also be infinite …
let be math object, . And so on …
Example
-
Can be divided into multiple sentences, so that it is convenient to add/remove properties to get different structs
looks like the set of natural numbers , so should we assume a new hierarchy again? Then for , continue to use the object construct rule …
Will the above construction rules lead to contradictions or computer deadlocks?
If we keep constructing infinitely, does this language have an end?
universal-set
_(tag)
Does there exist a "set of every set", a "universal set", a "universal-type"?
Defined using set theory rules
Then let the compiler calculate the bool of the proposition . Since = true
, the compiler only calculates the bool of , and then discovers the not
function, so it calculates the bool inside not
, but this returns to calculating the bool of . The compiler may choose to enter a circuit dead loop.
For finite sets, or cannot be judged, e.g. , because , or there is no definition that is a true proposition.
Related to self-referential paradox. Example "This sentence is wrong" gives a computer dead loop
this_sentence_is_false : bool = false;
loop:
switch (this_sentence_is_false) {
false => this_sentence_is_false = true,
true => this_sentence_is_false = false
}
goto loop
};
Or use layering to bypass the self-referential paradox (this_sentence = false) = true
. We consider them to be different sentences and judgments, believing that it cannot be self-referential.
If we can count a number, we consider it a natural number.
If language rules can be written and language objects constructed in a finite number of steps, we consider it constructible and expressible. For set theory, what can be constructed in such a finite number of steps is called a math object.
Regarding the problem of infinite natural numbers, if natural numbers are defined by counting or induction or periodic circuits, then the problem of infinity is pushed to infinite time.
For set theory language, assume that universal-set or universal-type leads to the construction of something that causes the circuit to enter an infinite loop.
dependent-distributive
_(tag)
union & interset
sum and product
draft of proof: expand, use parallel distributive cf. #link(<distributive-forall-exists>)[]
set-minus
_(tag)

. if then define
symmetric-set-minus
_(tag)

coordinate-component
_(tag)
-
product component
-
sum component