vault backup: 2025-04-14 19:38:20
This commit is contained in:
55
Languages & Machines/Introduction.md
Normal file
55
Languages & Machines/Introduction.md
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
type: theoretical
|
||||
ty:
|
||||
---
|
||||
|
||||
## The foundations of computation
|
||||
Looking for answers for basic questions like:
|
||||
- Computability?
|
||||
- Power $\leftrightarrow$ Programming constructs?
|
||||
|
||||
Which leads us to fundamental concepts like:
|
||||
- State
|
||||
- Transitions
|
||||
- Non-determinism
|
||||
- Undecideability
|
||||
|
||||
|
||||
## Models
|
||||
### Finite memory
|
||||
Finite automata, regexp
|
||||

|
||||
### Finite memory with stack
|
||||
Push down automata
|
||||

|
||||
### Unrestricted
|
||||
Turing machines
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## Grammars
|
||||
|
||||

|
||||
|
||||
|
||||
On a higher level, it seems like grammars and machines are very different, but parsing a language (a set of strings) is quite similar to computation.
|
||||
|
||||
## State-based systems and glossary
|
||||
An FSM can be a specification for OOP.
|
||||
|
||||
- States ($q_0,\ldots, q_n$)
|
||||
- Transitions ($a,b,c,\ldots,z$)
|
||||
- We can interpret the transitions as class methods and specify the sequences of allowed invocations - **typestate**
|
||||
|
||||
|
||||
|
||||
## Notation
|
||||
- $x \in X, X\subseteq Y$
|
||||
- $\forall x \in X: P(x), \exists x \in X: P(x)$
|
||||
- $R \subseteq X \times Y$ is a relation between $X$ and $Y$
|
||||
- $xRy \equiv (x,y) \in R$
|
||||
- $G = (V, E)$, where $E \subseteq V\times V$ is a directed graph
|
||||
|
||||
Part of [Relations and Digraphs](Relations%20and%20Digraphs.md)
|
36
Languages & Machines/Regular languages.md
Normal file
36
Languages & Machines/Regular languages.md
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
type: math
|
||||
---
|
||||
## Induction
|
||||
Similar (if not the same) to:
|
||||
- [Mathematical Proofs (Induction)](Mathematical%20Proofs%20(Induction).md)
|
||||
- [Structural Proofs](Proofs.md)
|
||||
|
||||
|
||||
- Base case $0\in \mathbb{N}$
|
||||
- Inductive step - if $n\in \mathbb{N} \implies n+1\in \mathbb{N}$
|
||||
- We allow a finite number of steps
|
||||
|
||||
|
||||
I.e.
|
||||
Given $f (n) = n(n + 1)$ for all $n\in N$, then $f (n)$ is even.
|
||||
|
||||
**Base case:** $f(0) = 0\times 1 = 0$, which is even
|
||||
**I.S.:**
|
||||
$$
|
||||
f(n+1) = (n+1)(n+2)= n(n+1)+2(n+1) = f(n) + 2(n+1) \blacksquare
|
||||
$$
|
||||
|
||||
## Strings and Languages
|
||||
Literally the same as [Mathematical Data Structures](Mathematical%20Data%20Structures.md), but on strings
|
||||
|
||||
How to define the reversal of a string, inductively?
|
||||
|
||||
|
||||
Let $w$ be a finite string. We define $w^R$ by induction on $|w|$:
|
||||
|
||||
**B.C.:**
|
||||
$|w| = 0$, then, trivially, $w = \epsilon \therefore w^R = \epsilon$
|
||||
|
||||
**I.S.:**
|
||||
$|w| = n \geq 1$, so $w = u a$ with $|u| = n-1$,
|
BIN
Languages & Machines/assets/Pasted image 20250113151159.png
Normal file
BIN
Languages & Machines/assets/Pasted image 20250113151159.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
Languages & Machines/assets/Pasted image 20250414190100.png
Normal file
BIN
Languages & Machines/assets/Pasted image 20250414190100.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
BIN
Languages & Machines/assets/Pasted image 20250414190119.png
Normal file
BIN
Languages & Machines/assets/Pasted image 20250414190119.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
BIN
Languages & Machines/assets/Pasted image 20250414190144.png
Normal file
BIN
Languages & Machines/assets/Pasted image 20250414190144.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
BIN
Languages & Machines/assets/Pasted image 20250414190229.png
Normal file
BIN
Languages & Machines/assets/Pasted image 20250414190229.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 894 KiB |
Reference in New Issue
Block a user