"Die Anzahl der Elemente einer Menge $x$ schreiben wir als \n",
"* $\\mid x\\mid$ oder auch als $card(x)$ (B Schreibweise)."
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$3$"
],
"text/plain": [
"3"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"card({1,2,3})"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$3$"
],
"text/plain": [
"3"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"card({1,1,2,3,2})"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$0$"
],
"text/plain": [
"0"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"card(∅)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Achtung, die Kardinalität kann auch unendlich sein: je nach Formalismus, ist folgender Ausdruck entweder unendlich oder nicht wohl definiert: $\\mid \\{x \\mid x>0\\} \\mid$"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"ename": "CommandExecutionException",
"evalue": ":eval: NOT-WELL-DEFINED: \ncard applied to very large set, cardinality not representable in ProB: closure([x],[integer],b(greater(b(identifier(...),integer,[...]),b(value(...),integer,[...])),pred,[nodeid(pos(...))]))\n\n",
"\u001b[1m\u001b[31mcard applied to very large set, cardinality not representable in ProB: closure([x],[integer],b(greater(b(identifier(...),integer,[...]),b(value(...),integer,[...])),pred,[nodeid(pos(...))]))\u001b[0m"
]
}
],
"source": [
"card({x|x>0})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SEND+MORE=MONEY\n",
"\n",
"Klassisches arithmetisches Puzzle wo acht unterschiedliche Ziffern gefunden werden sollen die folgende Gleichung erfüllen:\n",
"\n",
"| | | | | |\n",
"|---|---|---|---|---|\n",
"| | S | E | N | D |\n",
"| + | M | O | R | E |\n",
" |\n",
"|= M| O | N | E | Y |\n",
"| | | | | |\n",
"\n",
"Wir können dies nun in Logik, Mengentheorie und Arithmetik modellieren und lösen.\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Wir haben acht Ziffern:"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\mathit{TRUE}$\n",
"\n",
"**Solution:**\n",
"* $\\mathit{R} = 0$\n",
"* $\\mathit{S} = 0$\n",
"* $\\mathit{D} = 0$\n",
"* $\\mathit{E} = 0$\n",
"* $\\mathit{Y} = 0$\n",
"* $\\mathit{M} = 0$\n",
"* $\\mathit{N} = 0$\n",
"* $\\mathit{O} = 0$"
],
"text/plain": [
"TRUE\n",
"\n",
"Solution:\n",
"\tR = 0\n",
"\tS = 0\n",
"\tD = 0\n",
"\tE = 0\n",
"\tY = 0\n",
"\tM = 0\n",
"\tN = 0\n",
"\tO = 0"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"{S,E,N,D,M,O,R,Y} ⊆ 0..9"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"diese Ziffern sind alle unterschiedlich:"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\mathit{TRUE}$\n",
"\n",
"**Solution:**\n",
"* $\\mathit{R} = 1$\n",
"* $\\mathit{S} = 7$\n",
"* $\\mathit{D} = 4$\n",
"* $\\mathit{E} = 6$\n",
"* $\\mathit{Y} = 0$\n",
"* $\\mathit{M} = 3$\n",
"* $\\mathit{N} = 5$\n",
"* $\\mathit{O} = 2$"
],
"text/plain": [
"TRUE\n",
"\n",
"Solution:\n",
"\tR = 1\n",
"\tS = 7\n",
"\tD = 4\n",
"\tE = 6\n",
"\tY = 0\n",
"\tM = 3\n",
"\tN = 5\n",
"\tO = 2"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"{S,E,N,D,M,O,R,Y} ⊆ 0..9 ∧\n",
"card({S,E,N,D,M,O,R,Y}) = 8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"und wobei die zwei führenden Ziffern S und M ungleich 0 sind:"
Die Anzahl der Elemente einer Menge $x$ schreiben wir als
* $\mid x\mid$ oder auch als $card(x)$ (B Schreibweise).
%% Cell type:code id: tags:
``` prob
card({1,2,3})
```
%% Output
$3$
3
%% Cell type:code id: tags:
``` prob
card({1,1,2,3,2})
```
%% Output
$3$
3
%% Cell type:code id: tags:
``` prob
card(∅)
```
%% Output
$0$
0
%% Cell type:markdown id: tags:
Achtung, die Kardinalität kann auch unendlich sein: je nach Formalismus, ist folgender Ausdruck entweder unendlich oder nicht wohl definiert: $\mid \{x \mid x>0\}\mid$
%% Cell type:code id: tags:
``` prob
card({x|x>0})
```
%% Output
:eval: NOT-WELL-DEFINED:
card applied to very large set, cardinality not representable in ProB: closure([x],[integer],b(greater(b(identifier(...),integer,[...]),b(value(...),integer,[...])),pred,[nodeid(pos(...))]))
%% Cell type:markdown id: tags:
# SEND+MORE=MONEY
Klassisches arithmetisches Puzzle wo acht unterschiedliche Ziffern gefunden werden sollen die folgende Gleichung erfüllen:
| | | | | |
|---|---|---|---|---|
| | S | E | N | D |
| + | M | O | R | E |
|
|= M| O | N | E | Y |
| | | | | |
Wir können dies nun in Logik, Mengentheorie und Arithmetik modellieren und lösen.
%% Cell type:markdown id: tags:
Wir haben acht Ziffern:
%% Cell type:code id: tags:
``` prob
{S,E,N,D,M,O,R,Y} ⊆ 0..9
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{R} = 0$
* $\mathit{S} = 0$
* $\mathit{D} = 0$
* $\mathit{E} = 0$
* $\mathit{Y} = 0$
* $\mathit{M} = 0$
* $\mathit{N} = 0$
* $\mathit{O} = 0$
TRUE
Solution:
R = 0
S = 0
D = 0
E = 0
Y = 0
M = 0
N = 0
O = 0
%% Cell type:markdown id: tags:
diese Ziffern sind alle unterschiedlich:
%% Cell type:code id: tags:
``` prob
{S,E,N,D,M,O,R,Y} ⊆ 0..9 ∧
card({S,E,N,D,M,O,R,Y}) = 8
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{R} = 1$
* $\mathit{S} = 7$
* $\mathit{D} = 4$
* $\mathit{E} = 6$
* $\mathit{Y} = 0$
* $\mathit{M} = 3$
* $\mathit{N} = 5$
* $\mathit{O} = 2$
TRUE
Solution:
R = 1
S = 7
D = 4
E = 6
Y = 0
M = 3
N = 5
O = 2
%% Cell type:markdown id: tags:
und wobei die zwei führenden Ziffern S und M ungleich 0 sind: