离散数学基础

· · 个人记录

Set Theory & Logic

Naive Set Theory

The cardinality of a (finite and infinite) set S is written as |S|.

Definition. Given 2 sets S and T, the comparison of cardinalities of sets are defined as follow:

Property. Given a set S, |S|<|2^S| holds where |2^S| is defined as \{f:S\to\{0,1\}\}.

Obviously S\hookrightarrow 2^S, s\mapsto\delta_s gives a injection.

If there exists a bijection, then there exists a surjection f:S\twoheadrightarrow 2^S as bijections are surjections.

Consider the projection g:S\to\{0,1\} mapping s\mapsto 1-f(s)(s), then g differs from any f(s) and lands in 2^S. Therefore there does not exist such bijection. That is, |S|<|2^S| holds.

Theorem. Given 2 sets S and T that holds both |S|\le |T| and |T|\le |S|, |S|=|T| holds.

Consider injections as edges, then for each s\in S and t\in T, the out degree of each node is exactly 1 while the in degree is at most 1.

Consider all paths of the graph. There are 2 types of paths:

  • Those with a starting point. We pick the edges with the same direction as the first edge.
  • Those without a starting point. We pick all edges from S to T.

Each node is paired exactly once, hence there exists a bijection.

Here are some examples:

Theorem (Continuum Hypothesis). The following statement is independent from ZFC:

There are some non-trival proporties of cardinities over infinite sets. By acknowledging the Axiom of Choise (AC), the following statements all holds.

Definition: A set S is called Dedekind-finite iff all of its subsets T\subsetneq S have cardinality strictly smaller than S (that is, |T|<|S|).

Poposition. A non-empty set is Dedekind-finite iff it is finite.

Poposition. For 2 arbitary sets S and T, either |S|\le |T| or |T|\le |S| holds.

Poposition. For an infinite set S, |S|=|S|\times |S|.

Many of the statments above are equivlant to the Well-Ordering Theorem, which is equivlant to the Axiom of Choise.

Theorem (Well-Ordering Theorem): Every set S can be well-ordered. That is, exists a well-order (binary relation) \le over S such that the following holds:

Well-order is kind of like the order of natural numbers. A well-order over \R cannot be constructed without using the Axiom of Choise.

Proposition Logic (谓词逻辑)

Sementics

Proposition \approx Sentence \approx Statement.

Alphabets in proposition logic:

We can define some kind of "isomorphism" F: PROP \to\Omega over PROP by giving its value on atomic propositions, and on operations as PROP can be written as a infix notation (中缀表达) by looking at brackets.

Now we can define an evaluation as a "isomorphism" v: PROP \to\{0,1\} over PROP:

Note that $v(P_i)$ is not limited. If all evaluations $v$ satisfying $[[\psi]]_v=1$ for all $\psi\in\Gamma$, holds $[[\varphi]]_v=1$, then we say $\Gamma\vDash\varphi$, that is, in human language, . If $[[\varphi]]_v=1$ holds for all $v$, (that is, $\emptyset\vDash\varphi$), we call $\varphi$ a *tautology (重言式)*. Many propositions are "equivlant", which means they has the same behavior over evaluations. $\varphi$ and $\psi$ are called equivlant iff $\varphi\vDash\psi$ and $\psi\vDash\varphi$. A trival propoty is that if $\vDash\varphi$ then $\vDash\varphi[\psi/P]$ (replacing all P with $\psi$). #### Syntax **Natural Deduction** The character $\vdash$ stands for some deduction, or some logistic steps. We can reduce $\lor$ to $\lnot$ and $\land$ and reduce $\lnot\varphi$ to $\varphi\rightarrow\perp

The following are some appearent rules.

Example. Proof \vdash (P\rightarrow Q)\rightarrow(\lnot Q\rightarrow\lnot P).

System K

A different system.

System K is based on "possibility". The syntax \varphi_1,\ldots,\varphi_k\implies \psi_1,\ldots,\psi_m is the base unit of the system. Semantically it means "if all \varphi_i holds, at least one of \psi_i holds". The axioms are defined based on it. (See textbook).

The system is "better" than natural deduction because it no longer depend on big steps (as natural deduction uses deduction itself as steps), in the contrary, it can store mass information on \psi_i.

Another important proporty is that by applying axioms in the system, the length of the statement only increases. Therefore there exists an algorithm that only use finite time to decide whether a statement holds.

Syntax and Semantic

One can observe the similarity between \Gamma\vDash\varphi and \Gamma\vdash\varphi.

We care about 2 things between the systems:

Soundness is trival while completeness is more interesting.

Lemma. if \Gamma, \psi\vdash\varphi and \Gamma,\lnot\psi\vdash\varphi, then \Gamma\vdash\varphi.

By applying the lemma recursively over all atomic propositions. We need to prove \Gamma, (\lnot)P_1,(\lnot)P_2,\ldots,(\lnot)P_n\vdash\varphi. This gives a unique valuation [[\cdot]]_v.

If [[\psi]]_v=0 holds for some \psi\in\Gamma, we would have to prove v\vdash\lnot\varphi. By doing this, we get \perp, thus implying \varphi.

If [[\psi]]_v=1 holds for all \psi\in\Gamma, we need to prove V\vdash\varphi.

It all boils down to "evaluate" a proposition in proposition logic.

Lemma. Let P_1,\ldots,P_n be atomoc proposition sympols in \varphi. Let v be a evalueation and P_i\in V iff [[P_i]]_v=1, \lnot P_i\in V iff [[P_i]]_v=0. Then [[\varphi]]_v=1 iff V\vdash\varphi.

We proof this using reduction.

Appearentally the statement holds for all atomic propositions (including \perp).

Note that the length of the proposition $|\psi_1|,|\psi_2|<|\varphi|$. The mathmatical induction gives the correctness of the lemma. $\square

As semantics are consistant, Natural Deduction is also consistant.

In the section above we treat ors (\lor) as combinations of nots(\lnot) and ands(\land). We can also introduce axioms involving \lor as if the way we introduce \land.

Intuitionistic Logic and Kripke model

Intuitionistic Logic, or Constructive Logic, is a different system that does not acknowledge RAA (or its equivlent form, such as law of excluded middle).

It is not easy to prove that some propositions cannot be applied without RAA until the emergence of Pripke model.

Definition. A Kripke model is a partially-ordered set (W,\le) paired with a evaluation V:W\times Atomic Prop. \to\{0,1\} satisfying the following:

The evaluation of a statement \psi\to\varphi is defined as:

V(w,\psi\to\varphi)= \begin{cases} 1 & v(w',\varphi)\ge v(w',\psi)\, \forall w'\ge w\\ 0 & \text{oth.} \end{cases}

Theorem. Intuitionistic logic is consistent with the Kripke model.

Type Theory

胡振江最喜欢的。

Dependent Type Theory 和程序性证明。

Preidcate Logic

Alphabet:

Definition: TERM is the set that describes all "valid" value sentences generated by the alphabet as the rules following:

Definition: FORM is the set that describes all "valid" formulas generated by the following ruls:

Note the subtle difference between the x in \forall x,x=x and x=x where the first one is "bounded" and the second one is "free".

Note: a variable is free iff there is no quantifier to describe it.

Definition. A structure is a tuple of the following:

A structure is written as \mathfrak A=\left<\Omega; f_1,\ldots,f_n; P_1,\ldots,P_m; c_1,\ldots,c_k\right>

In real life, one have to "fill in the blanks", that is, use predicates, functions and variables with "real" meanings.

An example is the structure \left<\R; \times_{\R}, -1; =,<; \{0,1\}\right> where one can do multiplications and -1, use 0 and 1 as constants.

Note: we use a overlined symbol to indicate the character in FOR and TERM like x_1\to \overline{x_1}.

Definition: An evaluation of a structure \mathfrak A is defined as follow:

Definition. let x_1,x_2,\ldots,x_n be free variables in \varphi, \mathfrak A\vDash\varphi means \forall x_1\forall x_2\ldots\forall x_n\,\varphi; \vDash\varphi means \mathfrak A\vDash\varphi holds for all \mathfrak A with the same type; \Gamma\vDash\varphi if \mathfrak A\vDash\Gamma\implies\mathfrak A\vDash\varphi for all \mathfrak A.

Natural Deduction over Predicate Logic

Peano Axioms

Axioms:

Consistency

Given a set of axioms \Gamma (like Peano Axioms). We call \Gamma consistent iff \Gamma\not\vdash\perp.

Theorems T over \Gamma are defined as all sentences \varphi that \Gamma\vdash\varphi.

Let $T'\supset T$ be an extension of $T$ (here $\Sigma$ is also extended). $T'$ is a *conservative extension* over $T$ iff $T'\cap L=T$ (that is, new theorems contain new constants). In the old system we sometimes cannot introduce a $x_0$ that satisfies "$\exists x$ $\varphi(x)$". We can extende this by adding these $x_0$ into the constants' set. Formally, let $T^*$ be theorems over language $L^*$ where $L^*$ introduced constants $c_\varphi$ for all "$\exists x$ $\varphi(x)$" $\in T$. We claim $T^*$ is a conservative extension. This is to say $T,\exists\varphi(x)\to\varphi(c_\varphi)\vdash\psi$ and $\psi\in L$, then $\psi\in T$. As there is no $c_\varphi$ in $\psi$, we can replace all $c_\varphi$ with another variable $y$, after which one can say: - $T\vdash (\exists\varphi(x)\to\varphi(c_\varphi))\to\psi

which appearentally holds.

Back to consistency. If \Gamma is consistent, then there exists a model \mathfrak A s.t. \mathfrak A\vDash\Gamma.

Extend T to T_e as above.

This can be given where \Omega=\{closed term t\in L_e\} (that is, a term that only contains constants and functions) and evaluations are given as [[f(t_1,\ldots,t_n)]]=f(t_1,\ldots,t_m) and [[P(t_1,t_2)]]=[P(t_1,t_2)\in T_e].

This might cause problem when neither \Gamma\vdash\varphi nor \Gamma\vdash\lnot\varphi holds. But in this case adding one of them will not give \perp.

By applying Zorn's Lemma or by lining up and examing sentences one at a time, one can get T^*_e where either \varphi or \lnot\varphi holds.

There will be more problems with "=". We say t_1\sim t_2 iff t_1=t_2\in T^*_e, by making \Omega'=\Omega/\sim we solve the problem of "="s.

We mainly talk about countable sentences. An interesting fact about this is that almost all real numbers cannot be described(as languages are countable).

ZFC set theory

Cartesian product: for all sets S,T there exists a set S\times T:=\{(x,y):x\in S,y\in T\} where (x,y):=\{\{x\}, \{x,y\}\}. This is because S\times T\subset 2^{S\cup T}.

Given the cartesian product, we can define a relationship R\subset S\times T where aRb\iff (a,b)\in R. A function if defined as a relationship where \forall a \exists !b aRb

However, ZFC is incomplete, meaning some true statements cannot be proved.

Imcomplete theorem

We can encode statements (which are finite strings) into integers as there will only be finite variables in a statement.

Note that ZFC is strong enough to hold natural numbers(or Peano Axioms).

Consider a statement that decides whether a encoded sentence is a TERM

Discrete Fourier Transform

Get G\cong (\Z/n_1\Z)\times\ldots\times(\Z/n_k\Z) where n_1\mid \ldots\mid n_k be a finite Abelian goup, a character \chi_a:G\to\mathbb S is defined as

\chi_a:(x_1,\ldots,x_k)\mapsto \prod_{i=1}^k\omega_{n_i}^{a_ix_i}

Its easy to see that \{\chi_a\} forms a group as \chi_a=1\iff a=0 and \chi_a\chi_a=\chi_{a+b} and \chi_a^{-1}=\chi_{-a}=\overline{\chi_a}.

We claim \chi_a (called a character) gives all homomorphisms \text{Hom}(G,\mathbb S). Because G is written as a direct product, so a homomorphism \varphi:G\to\mathbb S is decided only by every dimension, where the generator of the i-th dimension has to have order n_i, so it maps to w_{n_i}^{a_i} for some a_i.

Note that \{\chi_a\} gives a set of bases over \mathbb C- vector space G^{\mathbb C} (without the structure of group homs).

Consider \sum_{x\in G}\chi_a(x), its dimensions are independent, and it is n_i when a_i=0, 0 when a_i\neq 0.

Therefore, \sum_{x\in G}\chi_a(x)=[a=0]|G|. This gives orthogonality of all characters with inner products defined as (\chi_a|\chi_b)=\sum_{x\in G}\chi_a(x)\overline{\chi_b(x)}=\sum_{x\in G}\chi_{a-b}(x).

Knowing this, using knowledge in algebra, linear map $\mathbb C^G\to\mathbb C$, $f\mapsto (f|\chi_a)\chi_a$ gives coefficient on $\chi_a$. Formally, $\text{DFT}:\mathbb C^G\to\mathbb G^{|G|}$, $f\mapsto \hat f$, $\hat f(a)=(f|\chi_a)$ is called **Descrete Fourier Transformation**, its reverse is given by $\text{iDFT}:\mathbb C^{|G|}\to \mathbb C^G$ $\hat f\mapsto f$, $f=\frac 1{|G|}\sum_a \hat f(a)\chi_a$, which is called **Inversed Descrete Fourier Transformation**. Its easy to see both DFT and iDFT are linear. The important feature being that $\text{DFT}(f*g)=\text{DFT}(f)\cdot \text{DFT}(g)$. iDFT can also be written as $f(x)=(\hat f|\psi_x)$ where $\psi_x(a)=\chi_a(x)$. Note that both are on $\text{Hom}(G,\mathbb S)\to\mathbb C^G$. ### Boolean Function Analysis Function $\{0,1\}^n\to \{0,1\}$ or equivalently, $\{-1,1\}$. ### Channel Encoding In real life, channels contain noises. Formally, when sending a bit, it has a probability $\epsilon$ to become invaild (e.g. unreadable). How should I encode my binary code? An approach is to use repeatation code. A bit is repeated many times and take the mode of these bits when recieved. The probability of successfully is $1-\epsilon^k$ when repeaded $k$ times. Another approach is to use a random linear encoding function Enc. After the channel