├── .gitignore ├── Aufgaben ├── A-Star │ ├── aStar-save.stlx │ └── aStar.stlx ├── Blatt-01 │ ├── aufgaben.pdf │ └── aufgaben.tex ├── Blatt-02 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ ├── missionare-frame.stlx │ └── missionare.pdf ├── Blatt-03 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ ├── japanese-frame.stlx │ └── japanese.pdf ├── Blatt-04 │ ├── aufgabe.pdf │ └── aufgabe.tex ├── Blatt-05 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ ├── rangierProblem.eps │ ├── shunting-frame.stlx │ └── shunting.pdf ├── Blatt-06 │ ├── 8-puzzle.eps │ ├── 8-puzzle.png │ ├── T1-WGL4.enc │ ├── aufgabe.pdf │ ├── aufgabe.tex │ ├── inconsolatag.tfm │ ├── inconsolatag.ttf │ ├── sliding-frame.stlx │ └── t1inconsolatag.fd ├── Blatt-07 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ └── logelei-frame.stlx ├── Blatt-08 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ └── logelei-frame.stlx ├── Blatt-09 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ └── prince-frame.stlx ├── Blatt-10 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ └── tunnel-frame.stlx ├── Blatt-11 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ └── zebra-frame.stlx ├── Blatt-12 │ ├── aufgabe.pdf │ ├── aufgabe.tex │ ├── inconsolatag.tfm │ ├── inconsolatag.ttf │ ├── korb-frame.stlx │ └── korb.pdf └── isSublist.stlx ├── LICENSE ├── Lecture-Notes-SetlX ├── Figures │ ├── break-eps-converted-to.pdf │ ├── break.eps │ ├── break.pdf │ ├── continue-eps-converted-to.pdf │ ├── continue.eps │ ├── continue.pdf │ ├── debug-eps-converted-to.pdf │ ├── debug.eps │ ├── debug.pdf │ ├── debug.xwd │ ├── down-eps-converted-to.pdf │ ├── down.eps │ ├── down.pdf │ ├── finish-eps-converted-to.pdf │ ├── finish.eps │ ├── finish.pdf │ ├── graph-zykl.dot │ ├── graph-zykl.eps │ ├── graph-zykl.pdf │ ├── graph.dot │ ├── graph.eps │ ├── graph.pdf │ ├── graph0-eps-converted-to.pdf │ ├── graph0.dot │ ├── graph0.eps │ ├── graph2.dot │ ├── graph2.eps │ ├── graph2.pdf │ ├── nodebug-eps-converted-to.pdf │ ├── nodebug.eps │ ├── nodebug.pdf │ ├── redo-eps-converted-to.pdf │ ├── redo.eps │ ├── redo.pdf │ ├── skip-eps-converted-to.pdf │ ├── skip.eps │ ├── skip.pdf │ ├── step-eps-converted-to.pdf │ ├── step.eps │ └── step.pdf ├── T1-WGL4.enc ├── aussagenlogik.tex ├── chess10.mf ├── chess20.300pk ├── chess20.600pk ├── chess20.mf ├── chess20.tfm ├── chess30.300pk ├── chess30.600pk ├── chess30.mf ├── chess30.tfm ├── chessbase.mf ├── chessdiag.mf ├── chessf10.mf ├── chessf10.tfm ├── chesspieces.mf ├── compact-barwise.tex ├── compact.tex ├── cs.bib ├── depth-first-eps-converted-to.pdf ├── depth-first.dot ├── depth-first.eps ├── dhbw-logo-eps-converted-to.pdf ├── dhbw-logo.eps ├── empty.mf ├── grenzen.tex ├── grundlagen.tex ├── hoare.tex ├── inconsolatag.tfm ├── inconsolatag.ttf ├── introduction.tex ├── logic.pdf ├── logic.tex ├── overview.tex ├── pl-complete.tex ├── pl.pdf ├── pr-slides.tex ├── praedikatenlogik.tex ├── prolog-cut.tex ├── prolog-not.tex ├── prolog-old.tex ├── prolog-rest.tex ├── prolog.tex ├── setlx.tex └── t1inconsolatag.fd ├── Lecture-Notes ├── Figures │ ├── 8-queens.pdf │ ├── 8-queens.png │ ├── australia.pdf │ ├── australia.png │ ├── break-eps-converted-to.pdf │ ├── break.eps │ ├── break.pdf │ ├── continue-eps-converted-to.pdf │ ├── continue.eps │ ├── continue.pdf │ ├── debug-eps-converted-to.pdf │ ├── debug.eps │ ├── debug.pdf │ ├── debug.xwd │ ├── down-eps-converted-to.pdf │ ├── down.eps │ ├── down.pdf │ ├── finish-eps-converted-to.pdf │ ├── finish.eps │ ├── finish.pdf │ ├── graph-zykl.dot │ ├── graph-zykl.eps │ ├── graph-zykl.pdf │ ├── graph.dot │ ├── graph.eps │ ├── graph.pdf │ ├── graph0-eps-converted-to.pdf │ ├── graph0.dot │ ├── graph0.eps │ ├── graph2.dot │ ├── graph2.eps │ ├── graph2.pdf │ ├── knight-moves.png │ ├── knights-problem.png │ ├── nodebug-eps-converted-to.pdf │ ├── nodebug.eps │ ├── nodebug.pdf │ ├── redo-eps-converted-to.pdf │ ├── redo.eps │ ├── redo.pdf │ ├── send-more-money.pdf │ ├── skip-eps-converted-to.pdf │ ├── skip.eps │ ├── skip.pdf │ ├── step-eps-converted-to.pdf │ ├── step.eps │ ├── step.pdf │ ├── sudoku.png │ ├── wolf-goat-cabbage.pdf │ ├── xEqualsCosX.pdf │ └── zebra.png ├── atp.tex ├── case-studies.tex ├── chess10.mf ├── chess20.300pk ├── chess20.600pk ├── chess20.mf ├── chess20.tfm ├── chess30.300pk ├── chess30.600pk ├── chess30.mf ├── chess30.tfm ├── chessbase.mf ├── chessdiag.mf ├── chessf10.mf ├── chessf10.tfm ├── chesspieces.mf ├── compact-barwise.tex ├── compact.tex ├── correctness.tex ├── cs.bib ├── depth-first-eps-converted-to.pdf ├── depth-first.dot ├── depth-first.eps ├── dhbw-logo-eps-converted-to.pdf ├── dhbw-logo.eps ├── empty.mf ├── fol.tex ├── grenzen.tex ├── grundlagen.tex ├── hoare.tex ├── inconsolatag.tfm ├── inconsolatag.ttf ├── introduction.tex ├── limits.tex ├── logic.pdf ├── logic.tex ├── overview.tex ├── pl-complete.tex ├── pl.pdf ├── pr-slides.tex ├── propositional-logic.tex ├── python.tex ├── sets.tex ├── t1inconsolatag.fd └── zebra.png ├── Mace4 ├── dragon.in ├── group.in ├── group3.in └── insel.in ├── Prover9 ├── barbier.in ├── group-commutative.in ├── group.in ├── group2.in ├── robbin.in ├── russell.in └── transitive.in ├── Python ├── Breadth-First-Search.ipynb ├── CSP-Solver-All-Solutions.ipynb ├── Chapter-2 │ ├── .gitignore │ ├── Legendre-Conjecture.ipynb │ ├── Rational-Numbers.ipynb │ └── Turing.ipynb ├── Chapter-3 │ ├── Binomial.ipynb │ ├── Euclidean-Algorithm.ipynb │ ├── Euclidean-Division.ipynb │ ├── Integer-Square-Root-Iterative.ipynb │ ├── Integer-Square-Root-Recursive.ipynb │ ├── Power-Iterative.ipynb │ └── Power.ipynb ├── Chapter-4 │ ├── .gitignore │ ├── 01-Evaluate.ipynb │ ├── 02-Usual-Suspects.ipynb │ ├── 03-Tautology.ipynb │ ├── 04-CNF.ipynb │ ├── 05-Completeness.ipynb │ ├── 06-Davis-Putnam.ipynb │ ├── 07-Davis-Putnam-JW.ipynb │ ├── 08-N-Queens.ipynb │ ├── 09-Zebra.ipynb │ ├── 10-Sudoku.ipynb │ ├── 11-PicoSat-Sudoku.ipynb │ ├── Onkologie.ipynb │ ├── Prince-Tiger.ipynb │ ├── Propositional-Logic-Parser.ipynb │ ├── Symbolic-Differentiation.ipynb │ ├── The-Visit.ipynb │ ├── Zweistein.ipynb │ ├── queen-captures.png │ ├── queens-vars.png │ └── sudoku.png ├── Chapter-5 │ ├── .gitignore │ ├── 00-Odd-Perfect-Number.ipynb │ ├── 01-FOL-Evaluation.ipynb │ ├── 02-Backtracking-Constraint-Solver.ipynb │ ├── 03-MapColoring.ipynb │ ├── 04-N-Queens-CSP.ipynb │ ├── 05-Missionaries-STS.ipynb │ ├── 06-Brothers-and-Sisters.ipynb │ ├── 07-Knight's-Tour-Z3.ipynb │ ├── 08-Missionaries-Z3.ipynb │ ├── 09-FOL-CNF.ipynb │ ├── 10-Unification.ipynb │ ├── 11-Prover.ipynb │ ├── Backtrack-Solver-Animate.ipynb │ ├── Bridge-Torch.ipynb │ ├── Crypto-Arithmetic.ipynb │ ├── FOL-Parser.ipynb │ ├── Group-Theory-Z3.ipynb │ ├── Japanese-Z3.ipynb │ ├── Jealous-Couples-Z3.ipynb │ ├── Missionaries-CSP.ipynb │ ├── Onkologie-CSP.ipynb │ ├── Parrot-and-Penguin.ipynb │ ├── Sudoku-Z3.ipynb │ ├── Train-Z3.ipynb │ ├── Wolf-Goat-Cabbage-STS.ipynb │ ├── Zebra-CSP.ipynb │ ├── australia.png │ ├── folCNF.py │ ├── folParser.py │ ├── knight-moves.png │ ├── queen-captures.png │ ├── send-more-money.png │ └── sudoku.png ├── Dictionaries.ipynb ├── Directed-Graph.ipynb ├── Exercises │ ├── 8-puzzle.png │ ├── Blatt-01.ipynb │ ├── Blatt-02.ipynb │ ├── Blatt-03.ipynb │ ├── Blatt-04.ipynb │ ├── Blatt-05.ipynb │ ├── Blatt-06.ipynb │ ├── Blatt-08.ipynb │ ├── Blatt-10.ipynb │ ├── Blatt-11-CSP.ipynb │ ├── Blatt-11-Davis-Putnam.ipynb │ ├── Blatt-12.ipynb │ ├── Breadth-First-Fast.ipynb │ ├── Breadth-First-Search.ipynb │ ├── Graphviz.ipynb │ ├── Jindosh-Riddle-CSP.ipynb │ ├── Jindosh-Riddle.ipynb │ ├── Knights-and-Squires.ipynb │ ├── cnf.py │ ├── cspSolver.py │ ├── davisPutnam.py │ ├── extractVariables.py │ ├── propLogParser.py │ ├── rangierProblem.png │ └── style.css ├── Find-Perfect.ipynb ├── Fixed-Point-Iteration.ipynb ├── Graphviz.ipynb ├── Introduction.ipynb ├── Logical-Symbols.ipynb ├── Lucifer's-Puzzle.ipynb ├── Min-Sort.ipynb ├── Poker.ipynb ├── Resolution.ipynb ├── Rich-Output.ipynb ├── Selection-Sort.ipynb ├── Strings.ipynb ├── Test-Breadth-First-Search.ipynb ├── Unlimited-Precision.ipynb ├── Wolf-Goat-Cabbage.ipynb ├── cnf.py ├── cspSolver.py ├── davisPutnam.py ├── diff.py ├── fixed-point.py ├── graphics.py ├── logic.sh ├── min_sort.py ├── path-cyclic.py ├── path.py ├── poker.py ├── prover.py ├── send-more-money.pdf ├── solve.py ├── style.css ├── sum-recursive.py ├── sum.py ├── tautology.py ├── transitive-closure.py ├── unify.py ├── updates.py ├── watson.py └── wolf-goat-cabbage.py ├── README.md ├── SetlX ├── allValuations.stlx ├── append-match.stlx ├── append.stlx ├── arb.stlx ├── bug.stlx ├── buggy-function.stlx ├── check-equivalence.stlx ├── completeness.stlx ├── count.stlx ├── davis-putnam.stlx ├── dempster-shafer.stlx ├── diff.stlx ├── evaluate.stlx ├── evaluateOld.stlx ├── fibonacci-combinatorics.stlx ├── find-path.stlx ├── find-perfect.stlx ├── fixpoint.stlx ├── fol-evaluate.stlx ├── from.stlx ├── function.stlx ├── ggt-fast.stlx ├── ggt-loop.stlx ├── graph-2-dot.stlx ├── gruppen.stlx ├── hanoi-frame.stlx ├── knf.stlx ├── legendre.stlx ├── min-sort.stlx ├── mySort.stlx ├── parse-propositional.stlx ├── path-cyclic.stlx ├── path.stlx ├── poker-triple.stlx ├── power.stlx ├── primes-eratosthenes.stlx ├── primes-for.stlx ├── primes-forall.stlx ├── primes-recursive.stlx ├── primes-sieve.stlx ├── primes-slim.stlx ├── primes-tuple.stlx ├── primes-while.stlx ├── queens-backtrack.stlx ├── queens-search.stlx ├── queens.stlx ├── quine.stlx ├── quone.stlx ├── reverse.stlx ├── simple-tuple.stlx ├── simple.stlx ├── solve.stlx ├── sort.stlx ├── stops.stlx ├── sum-recursive.stlx ├── sum.stlx ├── switch.stlx ├── tautology.stlx ├── tautologyOld.stlx ├── test-completeness.stlx ├── test-davis-putnam.stlx ├── test-knf.stlx ├── transitive-closure.stlx ├── transitive-recursive.stlx ├── tunnel-frame.stlx ├── turing.stlx ├── watson.stlx ├── wolf-goat-cabbage.stlx └── zebra-frame.stlx └── Vampire ├── barbier.tptp ├── dragon.tptp ├── group-commutative.tptp ├── group-inverse-unique.tptp ├── group-right-identity.tptp ├── group-right-inverse.tptp ├── non-commutative-group.tptp ├── proof.txt ├── transitive.tptp └── who-killed-agatha.tptp /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *~ 3 | *.aux 4 | *.bbl 5 | *.blg 6 | *.dvi 7 | *.log 8 | *.out 9 | *.toc 10 | *.class 11 | *.el 12 | *.synctex.gz 13 | .DS_STORE 14 | _region_.tex 15 | auto/ 16 | Haskell/ 17 | .DS_Store 18 | Literature/ 19 | Lecture-Notes/TAGS 20 | Lecture-Notes/_region_.prv 21 | Lecture-Notes/_minted-_region_/* 22 | Lecture-Notes/_minted-logic/* 23 | Lecture-Notes/logik.synctex.gz 24 | Lecture-Notes-SetlX/TAGS 25 | Lecture-Notes/logic.prv/ 26 | Lecture-Notes/logic.idx 27 | Lecture-Notes/logic.ilg 28 | Lecture-Notes/logic.ind 29 | Lecture-Notes/logik.prv/* 30 | Lecture-Notes/dhbw-logo-eps-converted-to.pdf 31 | Lecture-Notes/Figures/graph0-eps-converted-to.pdf 32 | Lecture-Notes/praedikatenlogik.ilg 33 | Lecture-Notes/praedikatenlogik.ind 34 | .dropbox 35 | Solutions/ 36 | Klausuren/ 37 | Lean/ 38 | Julia/ 39 | Python/Solutions/ 40 | Python/.ipynb_checkpoints/* 41 | Python/Exercises/.ipynb_checkpoints/* 42 | Python/__pycache__/* 43 | Python/Untitled.ipynb 44 | Python/Exercises/__pycache__/* 45 | Python/Loesung-01.ipynb 46 | Python/Loesung-03.ipynb 47 | Python/Loesung-04.ipynb 48 | Python/Loesung-05.ipynb 49 | Python/Loesung-06.ipynb 50 | Python/Loesung-07.ipynb 51 | Python/Loesung-08.ipynb 52 | Python/Loesung-09.ipynb 53 | Python/Loesung-10.ipynb 54 | Python/Loesung-11.ipynb 55 | Python/Loesung-12.ipynb 56 | Python/Loesung-13.ipynb 57 | Aufgaben/Blatt-01/_region_.prv/* 58 | Python/Exercises/* 59 | Python/Chapter-2/.ipynb_checkpoints/* 60 | Python/Chapter-3/.ipynb_checkpoints/* 61 | Python/Chapter-4/.ipynb_checkpoints/* 62 | Python/Chapter-4/__pycache__/* 63 | TINF22AI1.pdf 64 | TINF22AI2.pdf 65 | TINF22CS1.pd 66 | AI1_Logik.pdf 67 | AI2_Logik.pdf 68 | CS1_Logik.pdf -------------------------------------------------------------------------------- /Aufgaben/A-Star/aStar-save.stlx: -------------------------------------------------------------------------------- 1 | /* algorithm */ 2 | aStar := procedure(start, goal, relation, heuristic) { 3 | distanceStart := {}; // The distance from the start state. 4 | predecessor := {}; // The predecessor relation. 5 | estimate := {}; // A conservative approximation of the distance to the goal. 6 | 7 | distanceStart[start] := 0; 8 | estimate [start] := heuristic[state]; 9 | openQueue := { [distanceStart[start], start] }; 10 | print(openQueue); 11 | while(openQueue != {}) { 12 | [fx, x] := fromB(openQueue); 13 | if (x == goal) { 14 | return buildPath(start, goal, predecessor); 15 | } 16 | for (y in relation{x} | distanceStart[y] == om || distanceStart[x] + 1 < distanceStart[y]) { 17 | predecessor[y] := x; 18 | distanceStart[y] := distanceStart[x] + 1; 19 | openQueue -= { [estimate[y], y] }; 20 | estimate[y] := distanceStart[y] + heuristic[y]; 21 | openQueue += { [estimate[y], y] }; 22 | } 23 | print(openQueue); 24 | } 25 | }; 26 | 27 | heuristic := {[1, 22], [2, 94], [3, 98], [4, 34], [5, 88], [6, 4], [7, 8], [8, 5], [9, 1], [10, 0]}; 28 | connections := { [ 1, 4], // there is a connection from point 1 to point 4 29 | [ 1, 5], 30 | [ 1, 10], 31 | [ 2, 9], 32 | [ 3, 2], 33 | [ 3, 4], 34 | [ 3, 9], 35 | [ 4, 3], 36 | [ 5, 7], 37 | [ 5, 10], 38 | [ 6, 5], 39 | [ 7, 4], 40 | [ 7, 8], 41 | [ 8, 9], 42 | [ 8, 6], 43 | [10, 6], 44 | [10, 7], 45 | [10, 8] 46 | }; 47 | 48 | /* print the path */ 49 | buildPath := procedure(start, goal, predecessor) { 50 | p := goal; 51 | path := [goal]; 52 | while (p != start) { 53 | p := predecessor[p]; 54 | path := [p] + path; 55 | } 56 | return path; 57 | }; 58 | 59 | /* query */ 60 | print(aStar(1, 9, connections, heuristic)); 61 | print(aStar(3, 7, connections, heuristic)); 62 | 63 | -------------------------------------------------------------------------------- /Aufgaben/Blatt-01/aufgaben.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-01/aufgaben.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-01/aufgaben.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-01/aufgaben.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-02/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-02/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-02/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-02/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-02/missionare-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-02/missionare-frame.stlx -------------------------------------------------------------------------------- /Aufgaben/Blatt-02/missionare.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-02/missionare.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-03/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-03/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-03/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-03/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-03/japanese-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-03/japanese-frame.stlx -------------------------------------------------------------------------------- /Aufgaben/Blatt-03/japanese.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-03/japanese.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-04/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-04/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-04/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-04/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-05/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-05/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-05/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-05/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-05/shunting-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-05/shunting-frame.stlx -------------------------------------------------------------------------------- /Aufgaben/Blatt-05/shunting.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-05/shunting.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/8-puzzle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-06/8-puzzle.png -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-06/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-06/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/inconsolatag.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-06/inconsolatag.tfm -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/inconsolatag.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-06/inconsolatag.ttf -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/sliding-frame.stlx: -------------------------------------------------------------------------------- 1 | // This program solves the eight puzzle. 2 | 3 | // The function stateToString converts the current state of the puzzle to a string. 4 | stateToString := procedure(state) { 5 | indent := " " * 4; 6 | line := indent + "+-+-+-+\n"; 7 | result := "\n" + line; 8 | for (row in [1 .. 3]) { 9 | result += indent + "|"; 10 | for (col in [1 .. 3]) { 11 | cell := state[row][col]; 12 | if (cell > 0) { 13 | result += cell; 14 | } else { 15 | result += " "; 16 | } 17 | result += "|"; 18 | } 19 | result += "\n"; 20 | result += line; 21 | } 22 | return result; 23 | }; 24 | 25 | // This function finds a path from start to goal using the function nextState. 26 | // 1. start is the state where the search starts. 27 | // 2. goal is the state we want to reach. 28 | // 3. nextState is a function that takes a state s and computes the set of all 29 | // states that are reachable from s in one step. 30 | findPath := procedure(start, goal, nextStates) { 31 | count := 1; 32 | paths := { [start] }; 33 | states := { start }; // states known to be reachable 34 | explored := {}; // states that have already been explored 35 | while (states != explored) { 36 | print("iteration number $count$"); 37 | count += 1; 38 | explored := states; 39 | paths := { l + [s]: l in paths, s in nextStates(l[-1]) | !(s in states) }; 40 | states += { p[-1] : p in paths }; 41 | print("number of states: $#states$"); 42 | if (goal in states) { 43 | // success, return an arbitrary path leading to the goal 44 | return arb({ l : l in paths | l[-1] == goal }); 45 | } 46 | } 47 | }; 48 | 49 | // Given a state s, compute the set of all states reachable from s. 50 | // The state is represented as an 3 times 3 array of numbers, where the empty 51 | // place is represented as the number 0. The array is itself represented as 52 | // a list of lists, where each inner list represents a row of the array. 53 | findSpace := procedure(state) { 54 | coord :={[i,j]: i in [1..3], j in [1..3] | state[i][j] == 0}; 55 | return arb(coord); 56 | }; 57 | 58 | nextStates := procedure(state) { 59 | result := "???"; 60 | }; 61 | 62 | 63 | start := [ [8, 0, 6], 64 | [5, 4, 7], 65 | [2, 3, 1] ]; 66 | 67 | goal := [ [0, 1, 2], 68 | [3, 4, 5], 69 | [6, 7, 8] ]; 70 | 71 | path := findPath(start, goal, nextStates); 72 | if (path != om) { 73 | print("number of steps to solve the puzzle: $#path - 1$"); 74 | for (state in path) { 75 | print(stateToString(state)); 76 | } 77 | } else { 78 | print("No solution found."); 79 | } 80 | 81 | -------------------------------------------------------------------------------- /Aufgaben/Blatt-06/t1inconsolatag.fd: -------------------------------------------------------------------------------- 1 | \ProvidesFile{t1inconsolatag.fd} 2 | \DeclareFontFamily{T1}{inconsolatag}{} 3 | \DeclareFontShape{T1}{inconsolatag}{m}{n}{ <-> inconsolatag}{} 4 | \pdfmapline{+inconsolatag\space h: return evaluate(g, I) => evaluate(h, I); 15 | case g <==> h: return evaluate(g, I) == evaluate(h, I); 16 | default: abort("syntax error in evaluate($f$, $I$)"); 17 | } 18 | }; 19 | // This procedure turns a subset M of the set of all variables V into a 20 | // propositional valuation I, such that for a propositional variable x, 21 | // I(x) is true iff x is an element of M. Technically, V and M are sets 22 | // of strings and x is a string. 23 | createValuation := procedure(M, V) { 24 | return { [ x, x in M ] : x in V }; 25 | }; 26 | 27 | // Wenn Herr Meier kommt, bringt er auch Frau Meier mit. 28 | f1 := parse("???"); 29 | // Mindestens eines der beiden Kinder Walter und Katrin wird kommen. 30 | f2 := parse("???"); 31 | // Entweder kommt Frau Meier oder Franziska, aber nicht beide. 32 | f3 := parse("???"); 33 | // Entweder kommen Fransizka und Katrin zusammen oder beide kommen nicht. 34 | f4 := parse("???"); 35 | // Wenn Walter kommt, dann kommen auch Katrin und Herr Meier. 36 | f5 := parse("???"); 37 | 38 | Fs := {f1, f2, f3, f4, f5}; 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Aufgaben/Blatt-08/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-08/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-08/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-08/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-09/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-09/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-09/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-09/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-09/prince-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-09/prince-frame.stlx -------------------------------------------------------------------------------- /Aufgaben/Blatt-10/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-10/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-10/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-10/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-11/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-11/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-11/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-11/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/aufgabe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/aufgabe.pdf -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/aufgabe.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/aufgabe.tex -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/inconsolatag.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/inconsolatag.tfm -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/inconsolatag.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/inconsolatag.ttf -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/korb-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/korb-frame.stlx -------------------------------------------------------------------------------- /Aufgaben/Blatt-12/korb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Aufgaben/Blatt-12/korb.pdf -------------------------------------------------------------------------------- /Aufgaben/isSublist.stlx: -------------------------------------------------------------------------------- 1 | delete := procedure(K, i) { 2 | return K[.. i-1] + K[i+1 ..]; 3 | }; 4 | isSublist := procedure(L, K) { 5 | if (L == K) { 6 | return true; 7 | } 8 | for (i in [1 .. #K]) { 9 | if (isSublist(L, delete(K, i))) { 10 | return true; 11 | } 12 | } 13 | return false; 14 | }; 15 | allSublists := procedure(L) { 16 | if (L == []) { 17 | return { [] }; 18 | } 19 | return allSublists(L[2..]) + { [L[1]] + K: K in allSublists(L[2..]) }; 20 | }; 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Karl Stroetmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/break-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/break-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/break.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/break.eps 4 | %%CreationDate: Tue Mar 8 16:00:30 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1558 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !WRN7mK.b's*t~> 38 | !WRT9ncF71s*t~> 39 | !WRN7mK.b's*t~> 40 | !rmW8n'(o\mf.e~> 41 | !rm]>n'1u_o)F4~> 42 | !rmW8n'(o\mf.e~> 43 | !rmW8r6>%ir65:imf.e~> 44 | !rm]>r6G+hr6>@lo)F4~> 45 | !rmW8r6>%ir65:imf.e~> 46 | !rmW8rQP=pq>UGIrQPCjmf.e~> 47 | !rm]>rQYCoq#CDGrQYImo)F4~> 48 | !rmW8rQP=pq#CDIrQPCjmf.e~> 49 | !rmW8rlkFqp\t5GrlkLkmf.e~> 50 | !rm]>rltLppAb2ErltRno)F4~> 51 | !rmW8rlkFqpAb2GrlkLkmf.e~> 52 | "oir;c-:n6rrn&"c$SmYJ,~> 53 | "oj#AcH_"6!!Rr!c@,9`J,~> 54 | "oir;c-:n6!!S#"c$SmYJ,~> 55 | "TNi:c%GWf"G=sGmf.e~> 56 | "TNo@c@PQe"G+jHo)F4~> 57 | "TNi:c%GTf"G=sGmf.e~> 58 | "TNi:c%GWf"9?\nmf.e~> 59 | #60,Bc@Grqr;R-)rr<'!rr<&EIIdDg~> 60 | #60&urr;R-)rr<'!rr<&DHg^oa~> 61 | "TNi:c%GWf"9?\nmf.e~> 62 | #60,Bc@GuqrW!E-!<3'!!<3'!!7$#`s*t~> 63 | #60& 64 | "TNi:c%GWf"9?\nmf.e~> 65 | (]SpSc@Grqrr<'!!<3'!!<<'!!7$#`s*t~> 66 | (]SjMc%>urrr<'!!<3'!!<<'!!6olYs*t~> 67 | "TNi:c%GWf"9?\nmf.e~> 68 | "TNo@c@Prp#lao)!<3'!!<<#u"3u>cs*t~> 69 | "TNi:c%Guq#lao)!<3'!!<<#u"3l2\s*t~> 70 | "TNi:c%GWf"9?\nmf.e~> 71 | &H@1Lc@Guqrr<'!!!*$!!<<#u"3u>cs*t~> 72 | &H@+Fc%?#rrr<'!!!*$!!<<#u"3l2\s*t~> 73 | "TNi:c%GWf"9?\nmf.e~> 74 | "TNo@c@PNd"3u>cs*t~> 75 | "TNi:c%GQe"3l2\s*t~> 76 | "TNi:c%GWf"9?\nmf.e~> 77 | "TNo@c@PNd"3u>cs*t~> 78 | "TNi:c%GQe"3l2\s*t~> 79 | "oir;c-:n6rriCTc$SmYJ,~> 80 | "oj#AcH_"5!!IkuIIdDg~> 81 | "oir;c-:n5!!Ir!Hg^oa~> 82 | !rmW8rlkFqp\tEtK?_Yfmf.e~> 83 | !rm]>rltLpp&G8IcH^k/s*t~> 84 | !rmW8rlkFqp&G8Kc-:V's*t~> 85 | !rmW8rQP=pq>UHqKDs*sHg^oa~> 86 | !rm]>rQYCop](;FrltRno)F4~> 87 | !rmW8rQP=pp](;HrlkLkmf.e~> 88 | !rmW8r6>$;!/(6p!djA8J,~> 89 | !rm]>r6G*J,~> 90 | !rmW8r6>$;!/(6p!djA8J,~> 91 | !rmW8n'(o\mf.e~> 92 | !rm]>n'1u_o)F4~> 93 | !rmW8n'(o\mf.e~> 94 | !<;A3!<7Q~> 95 | !<;A5!<7Q~> 96 | !<;A3!<7Q~> 97 | !<;B0!<7Q~> 98 | !<;B1!<7Q~> 99 | !<;B0!<7Q~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/break.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/break.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/continue-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/continue-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/continue.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/leap.eps 4 | %%CreationDate: Tue Mar 8 15:59:44 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1393 ASCII Bytes 33 | colorimage 34 | !<;?/J,~> 35 | !<;?0J,~> 36 | !<;?/J,~> 37 | !rpNimd:+&mXP~> 38 | !rpQkmd^C,npg~> 39 | !rpNimd:+&mXP~> 40 | "96WjmdJC$HgZC~> 41 | "96Zlo'aj)II_m~> 42 | "96WjmdJC$HgZC~> 43 | "96WjmdeX&!!:DlmXP~> 44 | "96Zlo((*+!!:Gonpg~> 45 | "96WjmdeX&!!:DlmXP~> 46 | "96WjmdeX&!!:DlmXP~> 47 | "96Zlo((*+!!:Gonpg~> 48 | "96WjmdeX&!!:DlmXP~> 49 | "96Wjmdn^&!!:DlmXP~> 50 | "96Zlo(10+!!:Gonpg~> 51 | "96Wjmdn^&!!:DlmXP~> 52 | "96Wjmdn^&!!:DlmXP~> 53 | "96Zlo(10+!!:Gonpg~> 54 | "96Wjmdn^&!!:DlmXP~> 55 | "96Wjme+j&!!:DlmXP~> 56 | "96Zlo(C<+!!:Gonpg~> 57 | "96Wjme+j&!!:DlmXP~> 58 | "96Wjme+g)!<)p!c$Sl/~> 59 | "96Zlo(C9/!<<&\!mZ5bJ,~> 60 | "96Wjme+g*!<<&;!mQ)[J,~> 61 | "96WjmeY0.!<(1@!!E8GHgZC~> 62 | "96Zlo(pW3!<(4A!!DB/II_m~> 63 | "96WjmeY0.!<(1@!!C3bHgZC~> 64 | "96WjmeY3.!<14C!<)p!c$Sl/~> 65 | "96Zlo(pZ3!<17E!<<&\!mZ5bJ,~> 66 | "96WjmeY3.!<14D!<<&;!mQ)[J,~> 67 | "TQ`km`kM,rltEA!mQ)[J,~> 68 | "TQcmo$7"1rm(K)!mZ5bJ,~> 69 | "TQ`km`kM,rltD\!mQ)[J,~> 70 | "TQ`km`kM,s3:KA!mQ)[J,~> 71 | "TQcmo$7"1s3CQ)!mZ5bJ,~> 72 | "TQ`km`kM,s3:J\!mQ)[J,~> 73 | "96WjmeY3.!;t(F!<<)DHgZC~> 74 | "96Zlo(pZ3!;t+G!9WFhII_m~> 75 | "96WjmeY3.!;t(F!6)q%HgZC~> 76 | "96WjmeY0.!;t+A!<<'#c$Sl/~> 77 | "96Zlo(pW3!;t+H!7'`hc@,86~> 78 | "96WjmeY0.!;t(G!<:$Wc$Sl/~> 79 | "96Wjme"d&!!:DlmXP~> 80 | "96Zlo(:3-!<(1DII_m~> 81 | "96Wjme"a(!<3!"c$Sl/~> 82 | "96Wjme"d&!!:DlmXP~> 83 | "96Zlo'aj)II_m~> 84 | "96Wjme"d&rrUGlmXP~> 85 | "96Wjme+j&!!:DlmXP~> 86 | "96Zlo'aj)II_m~> 87 | "96Wjme+j&rrUGlmXP~> 88 | "96Wjme+j&!!:DlmXP~> 89 | "96Zlo'aj)II_m~> 90 | "96Wjme+j&rrUGlmXP~> 91 | "96WjmdJC$HgZC~> 92 | "96Zlo'aj)II_m~> 93 | "96WjmdJC$HgZC~> 94 | !rpNim!F6~> 95 | !rpQkm!XB~> 96 | !rpNim!F6~> 97 | !<;?/J,~> 98 | !<;?0J,~> 99 | !<;?/J,~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/continue.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/continue.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/debug-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/debug-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/debug.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/debug.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/debug.xwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/debug.xwd -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/down-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/down-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/down.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/down.eps 4 | %%CreationDate: Tue Mar 8 15:46:11 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1217 ASCII Bytes 33 | colorimage 34 | l-4_~> 35 | l-=e~> 36 | l-4_~> 37 | l-4_~> 38 | l-=e~> 39 | l-4_~> 40 | rlsm!!IO6b~> 41 | rm's&!IaNh~> 42 | rlsm!!IO6b~> 43 | rlkH2n'(l[mXP~> 44 | rltN7n'1r^npg~> 45 | rlkH2n'(l[mXP~> 46 | rlkH2n'(l[mXP~> 47 | rltN7n'1r^npg~> 48 | rlkH2n'(l[mXP~> 49 | rlkH2qT\s=qTT%fmXP~> 50 | rltN7qTf$>qT]+inpg~> 51 | rlkH2qT\s=qTT%fmXP~> 52 | rlkH2qT\s=qTT%fmXP~> 53 | rltN7qTf$>qT]+inpg~> 54 | rlkH2qT\s=qTT%fmXP~> 55 | rlkH2qT\s=qTT%fmXP~> 56 | rltN7qTf$>qT]+inpg~> 57 | rlkH2qT\s=qTT%fmXP~> 58 | rlkH2qT\s=qTT%fmXP~> 59 | rltN7qTf$>qT]+inpg~> 60 | rlkH2qT\s=qTT%fmXP~> 61 | rlkH2qT\s=qTT%fmXP~> 62 | rltN7qTf$>qT]+inpg~> 63 | rlkH2qT\s=qTT%fmXP~> 64 | rlkH2qT\s=qTT%fmXP~> 65 | rltN7qTf$>qT]+inpg~> 66 | rlkH2qT\s=qTT%fmXP~> 67 | rlkH2qT\s=qTT%fmXP~> 68 | rltN7qTf$>qT]+inpg~> 69 | rlkH2qT\s=qTT%fmXP~> 70 | rlkH2qT\s=qTT%fmXP~> 71 | rltN7qTf$>qT]+inpg~> 72 | rlkH2qT\s=qTT%fmXP~> 73 | rlkH2qT\s=qTT%fmXP~> 74 | rltN7qTf$>qT]+inpg~> 75 | rlkH2qT\s=qTT%fmXP~> 76 | rlkH2rQY':rQP@imXP~> 77 | rltN7rQb-;rQYFlnpg~> 78 | rlkH2rQY':rQP@imXP~> 79 | rlkH2r6>$;r657hmXP~> 80 | rltN7r6G*=knpg~> 81 | rlkH2r6>$;r657hmXP~> 82 | rlkH2qp#! 83 | rltN7qp,'=qp#4jnpg~> 84 | rlkH2qp#! 85 | rlkH2qT\s=qTT%fmXP~> 86 | rltN7qTf$>qT]+inpg~> 87 | rlkH2qT\s=qTT%fmXP~> 88 | rlkH2q9Ap>q98qemXP~> 89 | rltN7q9K!?q9B"hnpg~> 90 | rlkH2q9Ap>q98qemXP~> 91 | rlkH2n'(l[mXP~> 92 | rltN7n'1r^npg~> 93 | rlkH2n'(l[mXP~> 94 | rlkH2n'(l[mXP~> 95 | rltN7n'1r^npg~> 96 | rlkH2n'(l[mXP~> 97 | rlseVJ,~> 98 | rm'kYJ,~> 99 | rlseVJ,~> 100 | l-4_~> 101 | l-=e~> 102 | l-4_~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/down.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/down.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/finish-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/finish-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/finish.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/finish.eps 4 | %%CreationDate: Tue Mar 8 15:56:40 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1547 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !<;B0!<7Q~> 38 | !<;B1!<7Q~> 39 | !<;B0!<7Q~> 40 | !WRN7mK.a[s*t~> 41 | !WRT9ncF6bs*t~> 42 | !WRN7mK.a[s*t~> 43 | !rmW8n'(o\c2W:~> 44 | !rm]>n'1u_cMrC~> 45 | !rmW8n'(o\c2W:~> 46 | !rmW8n'(o\c2W:~> 47 | !rm]>n'1u_cMrC~> 48 | !rmW8n'(o\c2W:~> 49 | !rmW8rlt?@pWWbdc2W:~> 50 | !rm]>rm(EApW`hgcMrC~> 51 | !rmW8rlt?@pWWbdc2W:~> 52 | !rmW8rltEBs8W#tqoo1hc2W:~> 53 | !rm]>rm(KCs8W#tqp#7kcMrC~> 54 | !rmW8rltEBs8W#tqoo1hc2W:~> 55 | !rmW8rltEBrr;rts8W&B!di2lJ,~> 56 | !rm]>rm(KCrr;rts8W&C!e&AoJ,~> 57 | !rmW8rltEBrr;rts8W&B!di2lJ,~> 58 | !rmW8rlkKEs8W&u"oeQ&s8N)ublW7:s*t~> 59 | !rm]>rltQFs8W&u"oeQ&s8N)uc2rF>s*t~> 60 | !rmW8rlkKEs8W&u"oeQ&s8N)ublW7:s*t~> 61 | !rmW8rltHCs8W&us8W&u"olilHd2S@~> 62 | !rm]>rm(NDs8W&us8W&u"ollnIEqkC~> 63 | !rmW8rltHCs8W&us8W&u"olilHd2S@~> 64 | !rmW8rQPBDs8W&us8W&u"olilHd2S@~> 65 | !rm]>rQYHEs8W&us8W&u"ollnIEqkC~> 66 | !rmW8rQPBDs8W&us8W&u"olilHd2S@~> 67 | !rmW8rQY9@s8Vrrs31Ulc2W:~> 68 | !rm]>rQb?As8Vrrs3:[ocMrC~> 69 | !rmW8rQY9@s8Vrrs31Ulc2W:~> 70 | !rmW8rQY9@s8W&us8N6&c-:U[s*t~> 71 | !rm]>rQb?As8W&us8N6&cH^j`s*t~> 72 | !rmW8rQY9@s8W&us8N6&c-:U[s*t~> 73 | !rmW8rQY 74 | !rm]>rQbBBrm(KCrr<#D!e&AoJ,~> 75 | !rmW8rQY 76 | !rmW8rQP 77 | !rm]>rQYBCq9Js>s3:[ocMrC~> 78 | !rmW8rQP 79 | !rmW8r653Ap!!Pbc2W:~> 80 | !rm]>r6>9Bp!*VecMrC~> 81 | !rmW8r653Ap!!Pbc2W:~> 82 | !rmW8r653Ap!!Pbc2W:~> 83 | !rm]>r6>9Bp!*VecMrC~> 84 | !rmW8r653Ap!!Pbc2W:~> 85 | !rmW8r653Ap!!Pbc2W:~> 86 | !rm]>r6>9Bp!*VecMrC~> 87 | !rmW8r653Ap!!Pbc2W:~> 88 | !rmW8r653Ap!!Pbc2W:~> 89 | !rm]>r6>9Bp!*VecMrC~> 90 | !rmW8r653Ap!!Pbc2W:~> 91 | !rmW8n'(o\c2W:~> 92 | !rm]>n'1u_cMrC~> 93 | !rmW8n'(o\c2W:~> 94 | !rmW8n'(o\c2W:~> 95 | !rm]>n'1u_cMrC~> 96 | !rmW8n'(o\c2W:~> 97 | !<;D4!R:Xp~> 98 | !<;D6!RC^q~> 99 | !<;D4!R:Xp~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/finish.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/finish.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph-zykl.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 1 -> 2; 3 | 2 -> 3; 4 | 1 -> 3; 5 | 2 -> 4; 6 | 4 -> 1; 7 | 4 -> 5; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph-zykl.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/graph-zykl.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | a -> b; 3 | a -> c; 4 | b -> e; 5 | e -> f; 6 | c -> f; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/graph.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph0-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/graph0-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph0.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 1 -> 2; 3 | 2 -> 3; 4 | 1 -> 3; 5 | 2 -> 4; 6 | 4 -> 5; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph2.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | a -> b; 3 | a -> c; 4 | b -> e; 5 | e -> a; 6 | e -> f; 7 | c -> f; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/graph2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/graph2.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/nodebug-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/nodebug-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/nodebug.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/nodebug.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/redo-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/redo-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/redo.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/redo.eps 4 | %%CreationDate: Tue Mar 8 15:57:24 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1310 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !WUF4mK.a[s*t~> 38 | !WUI5ncF6bs*t~> 39 | !WUF4mK.a[s*t~> 40 | !rpO5n'(o\c2W:~> 41 | !rpR:n'1u_cMrC~> 42 | !rpO5n'(o\c2W:~> 43 | !rpO5n'(o\c2W:~> 44 | !rpR:n'1u_cMrC~> 45 | !rpO5n'(o\c2W:~> 46 | !rpO5n'(o\c2W:~> 47 | !rpR:n'1u_cMrC~> 48 | !rpO5n'(o\c2W:~> 49 | !rpO5n'(o\c2W:~> 50 | !rpR:n'1u_cMrC~> 51 | !rpO5n'(o\c2W:~> 52 | !rpO5qT\m;r65:ic2W:~> 53 | !rpR:qTes@lcMrC~> 54 | !rpO5qT\m;r65:ic2W:~> 55 | !rpO5r6=s9rlkLkc2W:~> 56 | !rpR:r6G$:rltRncMrC~> 57 | !rpO5r6=s9rlkLkc2W:~> 58 | !rpO5r6>6Ar6>0?s31Ulc2W:~> 59 | !rpR:r6G 60 | !rpO5r6>6Ar6>0?s31Ulc2W:~> 61 | !rpO5rQY"3l2;s*t~> 62 | !rpR:rQbBBqTf'?"3u>?s*t~> 63 | !rpO5rQY"3l2;s*t~> 64 | !rpO5rQY?Bps&g="3l2;s*t~> 65 | !rpR:rQbECps/m>"3u>?s*t~> 66 | !rpO5rQY?Bps&g="3l2;s*t~> 67 | "96X6c1qA:c2RbGc$R_8J,~> 68 | "96[;cM7J;cMmkHc@+" 69 | "96X6c1qA:c2RbGc$R_8J,~> 70 | "TQa7c-?+cqT]$?"3l2;s*t~> 71 | "TQd?s*t~> 72 | "TQa7c-?+cqT]$?"3l2;s*t~> 73 | !rpO5rltBAp< 74 | !rpR:rm(HBp 75 | !rpO5rltBAp< 76 | !rpO5rQY?Bp!!Pbc2W:~> 77 | !rpR:rQbECp!*VecMrC~> 78 | !rpO5rQY?Bp!!Pbc2W:~> 79 | !rpO5n'(o\c2W:~> 80 | !rpR:n'1u_cMrC~> 81 | !rpO5n'(o\c2W:~> 82 | !rpO5n'(o\c2W:~> 83 | !rpR:n'1u_cMrC~> 84 | !rpO5n'(o\c2W:~> 85 | !rpO5n'(o\c2W:~> 86 | !rpR:n'1u_cMrC~> 87 | !rpO5n'(o\c2W:~> 88 | !rpO5n'(o\c2W:~> 89 | !rpR:n'1u_cMrC~> 90 | !rpO5n'(o\c2W:~> 91 | !rpO5n'(o\c2W:~> 92 | !rpR:n'1u_cMrC~> 93 | !rpO5n'(o\c2W:~> 94 | !WUF3HNDCkJ,~> 95 | !WUI4I0%XnJ,~> 96 | !WUF3HNDCkJ,~> 97 | !<;B0!<7Q~> 98 | !<;B1!<7Q~> 99 | !<;B0!<7Q~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/redo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/redo.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/skip-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/skip-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/skip.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/skip.eps 4 | %%CreationDate: Tue Mar 8 15:55:37 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1274 ASCII Bytes 33 | colorimage 34 | l2Q8~> 35 | l2Q8~> 36 | l2Q8~> 37 | !<;?/J,~> 38 | !<;?0J,~> 39 | !<;?/J,~> 40 | !rq\8md:+&mXP~> 41 | !rqh>md^C,npg~> 42 | !rq\8md:+&mXP~> 43 | "96VmmdJC$HgZC~> 44 | "96Ypo'aj)II_m~> 45 | "96VmmdJC$HgZC~> 46 | "96VmmdJC$HgZC~> 47 | "96Ypo'aj)II_m~> 48 | "96VmmdJC$HgZC~> 49 | "96VmmdJC$HgZC~> 50 | "96Ypo'aj)II_m~> 51 | "96VmmdJC$HgZC~> 52 | "96VmmdJC$HgZC~> 53 | "96Ypo'aj)II_m~> 54 | "96VmmdJC$HgZC~> 55 | "96Vmmek?,!;aq@HgZC~> 56 | "96Ypo)-f1!;atAII_m~> 57 | "96Vmmek?,!;aq@HgZC~> 58 | "96Vmmf(K*!;t(BHgZC~> 59 | "96Ypo)?r/!;t+CII_m~> 60 | "96Vmmf(K*!;t(BHgZC~> 61 | "olhom`j#T!;t+A!;t(BHgZC~> 62 | "olkro$5PZ!;t.B!;t+CII_m~> 63 | "olhom`j#T!;t+A!;t(BHgZC~> 64 | "TQ_nm`k_2qT]!>rQP@imXP~> 65 | "TQbqo$747qTf'?rQYFlnpg~> 66 | "TQ_nm`k_2qT]!>rQP@imXP~> 67 | #62qpm`b_3ps&g=rQP@imXP~> 68 | #62tso$.48ps/m>rQYFlnpg~> 69 | #62qpm`b_3ps&g=rQP@imXP~> 70 | #62qpm`b_3qp"p:!mQ)[J,~> 71 | #62tso$.48qp,!;!mZ5bJ,~> 72 | #62qpm`b_3qp"p:!mQ)[J,~> 73 | #62qpm`b_3qT\m;s31RkmXP~> 74 | #62tso$.48qTes 75 | #62qpm`b_3qT\m;s31RkmXP~> 76 | "96Vmme4p(!<14DHgZC~> 77 | "96Ypo(LB-!<17EII_m~> 78 | "96Vmme4p(!<14DHgZC~> 79 | "96Vmme+j)!<(.CHgZC~> 80 | "96Ypo(C<.!<(1DII_m~> 81 | "96Vmme+j)!<(.CHgZC~> 82 | "96VmmdJC$HgZC~> 83 | "96Ypo'aj)II_m~> 84 | "96VmmdJC$HgZC~> 85 | "96VmmdJC$HgZC~> 86 | "96Ypo'aj)II_m~> 87 | "96VmmdJC$HgZC~> 88 | "96VmmdJC$HgZC~> 89 | "96Ypo'aj)II_m~> 90 | "96VmmdJC$HgZC~> 91 | "96VmmdJC$HgZC~> 92 | "96Ypo'aj)II_m~> 93 | "96VmmdJC$HgZC~> 94 | "96VmmdJC$HgZC~> 95 | "96Ypo'aj)II_m~> 96 | "96VmmdJC$HgZC~> 97 | !<;>2J,~> 98 | !<;>4J,~> 99 | !<;>2J,~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/skip.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/skip.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/step-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/step-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/step.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/step.eps 4 | %%CreationDate: Tue Mar 8 15:48:11 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1211 ASCII Bytes 33 | colorimage 34 | l2Q8~> 35 | l2Q8~> 36 | l2Q8~> 37 | l2Q8~> 38 | l2Q8~> 39 | l2Q8~> 40 | s8N(Gmd:+&s*t~> 41 | s8N(Imd^C,s*t~> 42 | s8N(Gmd:+&s*t~> 43 | s8N+HmdJC$HiJT~> 44 | s8N+Jo'aj)IK+f~> 45 | s8N+HmdJC$HiJT~> 46 | s8N+HmdJC$HiJT~> 47 | s8N+Jo'aj)IK+f~> 48 | s8N+HmdJC$HiJT~> 49 | s8N+HmdJC$HiJT~> 50 | s8N+Jo'aj)IK+f~> 51 | s8N+HmdJC$HiJT~> 52 | s8N+HmdJC$HiJT~> 53 | s8N+Jo'aj)IK+f~> 54 | s8N+HmdJC$HiJT~> 55 | s8N+Hme=s+!;aq@HiJT~> 56 | s8N+Jo(UE0!;atAIK+f~> 57 | s8N+Hme=s+!;aq@HiJT~> 58 | s8N+Hme>!+!;k"AHiJT~> 59 | s8N+Jo(UH0!;k%BIK+f~> 60 | s8N+Hme>!+!;k"AHiJT~> 61 | s8N+Hme>!*!;t(BHiJT~> 62 | s8N+Jo(UH/!;t+CIK+f~> 63 | s8N+Hme>!*!;t(BHiJT~> 64 | s8N1Jm`j#L!<(.CHiJT~> 65 | s8N1Lo$5PR!<(1DIK+f~> 66 | s8N1Jm`j#L!<(.CHiJT~> 67 | s8N1Jm`j#K!<14DHiJT~> 68 | s8N1Lo$5PQ!<17EIK+f~> 69 | s8N1Jm`j#K!<14DHiJT~> 70 | s8N1Jm`j#K!<14DHiJT~> 71 | s8N1Lo$5PQ!<17EIK+f~> 72 | s8N1Jm`j#K!<14DHiJT~> 73 | s8N1Jm`j#L!<(.CHiJT~> 74 | s8N1Lo$5PR!<(1DIK+f~> 75 | s8N1Jm`j#L!<(.CHiJT~> 76 | s8N+Hme>!*!;t(BHiJT~> 77 | s8N+Jo(UH/!;t+CIK+f~> 78 | s8N+Hme>!*!;t(BHiJT~> 79 | s8N+Hme>!+!;k"AHiJT~> 80 | s8N+Jo(UH0!;k%BIK+f~> 81 | s8N+Hme>!+!;k"AHiJT~> 82 | s8N+Hme=s+!;aq@HiJT~> 83 | s8N+Jo(UE0!;atAIK+f~> 84 | s8N+Hme=s+!;aq@HiJT~> 85 | s8N+HmdJC$HiJT~> 86 | s8N+Jo'aj)IK+f~> 87 | s8N+HmdJC$HiJT~> 88 | s8N+HmdJC$HiJT~> 89 | s8N+Jo'aj)IK+f~> 90 | s8N+HmdJC$HiJT~> 91 | s8N+HmdJC$HiJT~> 92 | s8N+Jo'aj)IK+f~> 93 | s8N+HmdJC$HiJT~> 94 | s8N+HmdJC$HiJT~> 95 | s8N+Jo'aj)IK+f~> 96 | s8N+HmdJC$HiJT~> 97 | l2Q8~> 98 | l2Q8~> 99 | l2Q8~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/Figures/step.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/Figures/step.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/aussagenlogik.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/aussagenlogik.tex -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess10.mf: -------------------------------------------------------------------------------- 1 | % This is `chess10.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 10 points chess font. 5 | % A complete chess diagram is 80 X 80 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=10pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess20.300pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess20.300pk -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess20.600pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess20.600pk -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess20.mf: -------------------------------------------------------------------------------- 1 | % This is `chess20.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 20 points chess font. 5 | % A complete chess diagram is 160 X 160 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=20pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess20.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess20.tfm -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess30.300pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess30.300pk -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess30.600pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess30.600pk -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess30.mf: -------------------------------------------------------------------------------- 1 | % This is `chess30.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 30 points chess font. 5 | % A complete chess diagram is 240 X 240 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=30pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chess30.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chess30.tfm -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chessdiag.mf: -------------------------------------------------------------------------------- 1 | % This is `chessdiag.mf' version 1.1 as of 11/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % file generates a complete chess diagram 5 | 6 | % most versions of METAFONT have memorylimits so generating a complete 7 | % diagram of 160 X 160 points for a 300 DPI printer is not possible 8 | 9 | mode_setup; 10 | input chessbase; 11 | 12 | def draw_pieces(text piece_list) = 13 | string piece, location; 14 | for p=piece_list: 15 | l:=length p; 16 | exitunless (l=2) or (l=3); 17 | if l=2: piece:="p"; i:=0; 18 | else: piece:=substring(0,1) of p; i:=1; fi; 19 | column:=ASCII substring(i,i+1) of p - ASCII "a"; 20 | row:=ASCII substring(i+1,i+2) of p - ASCII "1"; 21 | if not odd(column+row): background:=dark; else: background:=light; fi; 22 | scantokens piece(d, column,row); 23 | endfor; 24 | enddef; 25 | 26 | def w(text piece_list) = 27 | color:=white; 28 | empty_board(d); draw_pieces(piece_list); 29 | enddef; 30 | 31 | def b(text piece_list) = 32 | color:=black; 33 | draw_pieces(piece_list); 34 | enddef; 35 | 36 | M=8; % number of squares 37 | d#:=100pt#/M; % size per square 38 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 39 | define_blacker_pixels(fine, thin, thick, border); 40 | define_whole_pixels(d); 41 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 42 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 43 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 44 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 45 | light=0; dark=1; white=0; black=1; 46 | 47 | % put here the wanted diagram (ex.: mate in three problem) 48 | 49 | w("Kc2","Nb4","Bf8","b3","g7"); 50 | b("Ka3","b6"); 51 | showit; 52 | 53 | message("White mates in three moves. Do you see how?"); 54 | StopMe; 55 | 56 | end; 57 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chessf10.mf: -------------------------------------------------------------------------------- 1 | % This is `chessf10.mf' version 1.2 as of 6/91 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % generates a font consisting of chess figurines 5 | 6 | mode_setup; 7 | input chessbase; 8 | 9 | def figurine(expr code) = 10 | beginchar(code, d#, .8d#, .2d#); 11 | pickup pencircle scaled thin; 12 | thin_pen:=savepen ; % for drawing pieces 13 | pickup pencircle scaled thick; 14 | thick_pen:=savepen; % for drawing inside pieces 15 | define_whole_pixels(d); 16 | scantokens code(d, 0, -.2); 17 | endchar; 18 | enddef; 19 | 20 | M=1; % number of squares 21 | d#:=10pt#/M; % size per square 22 | thin#:=1/3pt#; thick#:=5/6pt#; define_blacker_pixels(thin, thick); 23 | light=0; dark=1; white=0; black=1; 24 | background:=light; color:=white; 25 | 26 | figurine("K"); 27 | figurine("Q"); 28 | figurine("R"); 29 | figurine("B"); 30 | figurine("N"); 31 | figurine("p"); 32 | 33 | end; 34 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/chessf10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/chessf10.tfm -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/cs.bib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/cs.bib -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/depth-first-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/depth-first-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/depth-first.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 3 | size = "5,7"; 4 | 1 [ shape = Mrecord, label = "{ p(X) }" ] ; 5 | 6 | 1 -> 2; 7 | 8 | 1 -> 3; 9 | 10 | 2 [ shape = Mrecord, label = "{ q1(X) }" ] ; 11 | 12 | 2 -> 4; 13 | 14 | 2 -> 5; 15 | 16 | 3 [ shape = Mrecord, label = "{ q2(X) }" ] ; 17 | 18 | 3 -> 6; 19 | 20 | 3 -> 7; 21 | 22 | 4 [ shape = Mrecord, label = "{ r1(X) }" ] ; 23 | 5 [ shape = Mrecord, label = "{ r2(X) }" ] ; 24 | 6 [ shape = Mrecord, label = "{ r3(X) }" ] ; 25 | 7 [ shape = Mrecord, label = "{ r4(X) }" ] ; 26 | 27 | 4 -> 8; 28 | 8 [ shape = Mrecord, label = "{ r1(a) }" ] ; 29 | 5 -> 9; 30 | 9 [ shape = Mrecord, label = "{ r2(b) }" ] ; 31 | 6 -> 10; 32 | 10 [ shape = Mrecord, label = "{ r3(c) }" ] ; 33 | 7 -> 11; 34 | 11 [ shape = Mrecord, label = "{ r4(d) }" ] ; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/dhbw-logo-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/dhbw-logo-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/empty.mf: -------------------------------------------------------------------------------- 1 | % font with empty `a' to test if mode_def exists 2 | 3 | font_identifier:="NOTHING"; font_size 10pt#; 4 | 5 | mode_setup; % font_setup; 6 | 7 | beginchar("a",10pt#,10pt#,0); 8 | show pixels_per_inch; 9 | endchar; 10 | 11 | bye 12 | -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/grenzen.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/grenzen.tex -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/inconsolatag.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/inconsolatag.tfm -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/inconsolatag.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/inconsolatag.ttf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/logic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/logic.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/pl.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/pl.pdf -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/praedikatenlogik.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes-SetlX/praedikatenlogik.tex -------------------------------------------------------------------------------- /Lecture-Notes-SetlX/t1inconsolatag.fd: -------------------------------------------------------------------------------- 1 | \ProvidesFile{t1inconsolatag.fd} 2 | \DeclareFontFamily{T1}{inconsolatag}{} 3 | \DeclareFontShape{T1}{inconsolatag}{m}{n}{ <-> inconsolatag}{} 4 | \pdfmapline{+inconsolatag\space 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !WRN7mK.b's*t~> 38 | !WRT9ncF71s*t~> 39 | !WRN7mK.b's*t~> 40 | !rmW8n'(o\mf.e~> 41 | !rm]>n'1u_o)F4~> 42 | !rmW8n'(o\mf.e~> 43 | !rmW8r6>%ir65:imf.e~> 44 | !rm]>r6G+hr6>@lo)F4~> 45 | !rmW8r6>%ir65:imf.e~> 46 | !rmW8rQP=pq>UGIrQPCjmf.e~> 47 | !rm]>rQYCoq#CDGrQYImo)F4~> 48 | !rmW8rQP=pq#CDIrQPCjmf.e~> 49 | !rmW8rlkFqp\t5GrlkLkmf.e~> 50 | !rm]>rltLppAb2ErltRno)F4~> 51 | !rmW8rlkFqpAb2GrlkLkmf.e~> 52 | "oir;c-:n6rrn&"c$SmYJ,~> 53 | "oj#AcH_"6!!Rr!c@,9`J,~> 54 | "oir;c-:n6!!S#"c$SmYJ,~> 55 | "TNi:c%GWf"G=sGmf.e~> 56 | "TNo@c@PQe"G+jHo)F4~> 57 | "TNi:c%GTf"G=sGmf.e~> 58 | "TNi:c%GWf"9?\nmf.e~> 59 | #60,Bc@Grqr;R-)rr<'!rr<&EIIdDg~> 60 | #60&urr;R-)rr<'!rr<&DHg^oa~> 61 | "TNi:c%GWf"9?\nmf.e~> 62 | #60,Bc@GuqrW!E-!<3'!!<3'!!7$#`s*t~> 63 | #60& 64 | "TNi:c%GWf"9?\nmf.e~> 65 | (]SpSc@Grqrr<'!!<3'!!<<'!!7$#`s*t~> 66 | (]SjMc%>urrr<'!!<3'!!<<'!!6olYs*t~> 67 | "TNi:c%GWf"9?\nmf.e~> 68 | "TNo@c@Prp#lao)!<3'!!<<#u"3u>cs*t~> 69 | "TNi:c%Guq#lao)!<3'!!<<#u"3l2\s*t~> 70 | "TNi:c%GWf"9?\nmf.e~> 71 | &H@1Lc@Guqrr<'!!!*$!!<<#u"3u>cs*t~> 72 | &H@+Fc%?#rrr<'!!!*$!!<<#u"3l2\s*t~> 73 | "TNi:c%GWf"9?\nmf.e~> 74 | "TNo@c@PNd"3u>cs*t~> 75 | "TNi:c%GQe"3l2\s*t~> 76 | "TNi:c%GWf"9?\nmf.e~> 77 | "TNo@c@PNd"3u>cs*t~> 78 | "TNi:c%GQe"3l2\s*t~> 79 | "oir;c-:n6rriCTc$SmYJ,~> 80 | "oj#AcH_"5!!IkuIIdDg~> 81 | "oir;c-:n5!!Ir!Hg^oa~> 82 | !rmW8rlkFqp\tEtK?_Yfmf.e~> 83 | !rm]>rltLpp&G8IcH^k/s*t~> 84 | !rmW8rlkFqp&G8Kc-:V's*t~> 85 | !rmW8rQP=pq>UHqKDs*sHg^oa~> 86 | !rm]>rQYCop](;FrltRno)F4~> 87 | !rmW8rQP=pp](;HrlkLkmf.e~> 88 | !rmW8r6>$;!/(6p!djA8J,~> 89 | !rm]>r6G*J,~> 90 | !rmW8r6>$;!/(6p!djA8J,~> 91 | !rmW8n'(o\mf.e~> 92 | !rm]>n'1u_o)F4~> 93 | !rmW8n'(o\mf.e~> 94 | !<;A3!<7Q~> 95 | !<;A5!<7Q~> 96 | !<;A3!<7Q~> 97 | !<;B0!<7Q~> 98 | !<;B1!<7Q~> 99 | !<;B0!<7Q~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/break.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/break.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/continue-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/continue-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/continue.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/leap.eps 4 | %%CreationDate: Tue Mar 8 15:59:44 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1393 ASCII Bytes 33 | colorimage 34 | !<;?/J,~> 35 | !<;?0J,~> 36 | !<;?/J,~> 37 | !rpNimd:+&mXP~> 38 | !rpQkmd^C,npg~> 39 | !rpNimd:+&mXP~> 40 | "96WjmdJC$HgZC~> 41 | "96Zlo'aj)II_m~> 42 | "96WjmdJC$HgZC~> 43 | "96WjmdeX&!!:DlmXP~> 44 | "96Zlo((*+!!:Gonpg~> 45 | "96WjmdeX&!!:DlmXP~> 46 | "96WjmdeX&!!:DlmXP~> 47 | "96Zlo((*+!!:Gonpg~> 48 | "96WjmdeX&!!:DlmXP~> 49 | "96Wjmdn^&!!:DlmXP~> 50 | "96Zlo(10+!!:Gonpg~> 51 | "96Wjmdn^&!!:DlmXP~> 52 | "96Wjmdn^&!!:DlmXP~> 53 | "96Zlo(10+!!:Gonpg~> 54 | "96Wjmdn^&!!:DlmXP~> 55 | "96Wjme+j&!!:DlmXP~> 56 | "96Zlo(C<+!!:Gonpg~> 57 | "96Wjme+j&!!:DlmXP~> 58 | "96Wjme+g)!<)p!c$Sl/~> 59 | "96Zlo(C9/!<<&\!mZ5bJ,~> 60 | "96Wjme+g*!<<&;!mQ)[J,~> 61 | "96WjmeY0.!<(1@!!E8GHgZC~> 62 | "96Zlo(pW3!<(4A!!DB/II_m~> 63 | "96WjmeY0.!<(1@!!C3bHgZC~> 64 | "96WjmeY3.!<14C!<)p!c$Sl/~> 65 | "96Zlo(pZ3!<17E!<<&\!mZ5bJ,~> 66 | "96WjmeY3.!<14D!<<&;!mQ)[J,~> 67 | "TQ`km`kM,rltEA!mQ)[J,~> 68 | "TQcmo$7"1rm(K)!mZ5bJ,~> 69 | "TQ`km`kM,rltD\!mQ)[J,~> 70 | "TQ`km`kM,s3:KA!mQ)[J,~> 71 | "TQcmo$7"1s3CQ)!mZ5bJ,~> 72 | "TQ`km`kM,s3:J\!mQ)[J,~> 73 | "96WjmeY3.!;t(F!<<)DHgZC~> 74 | "96Zlo(pZ3!;t+G!9WFhII_m~> 75 | "96WjmeY3.!;t(F!6)q%HgZC~> 76 | "96WjmeY0.!;t+A!<<'#c$Sl/~> 77 | "96Zlo(pW3!;t+H!7'`hc@,86~> 78 | "96WjmeY0.!;t(G!<:$Wc$Sl/~> 79 | "96Wjme"d&!!:DlmXP~> 80 | "96Zlo(:3-!<(1DII_m~> 81 | "96Wjme"a(!<3!"c$Sl/~> 82 | "96Wjme"d&!!:DlmXP~> 83 | "96Zlo'aj)II_m~> 84 | "96Wjme"d&rrUGlmXP~> 85 | "96Wjme+j&!!:DlmXP~> 86 | "96Zlo'aj)II_m~> 87 | "96Wjme+j&rrUGlmXP~> 88 | "96Wjme+j&!!:DlmXP~> 89 | "96Zlo'aj)II_m~> 90 | "96Wjme+j&rrUGlmXP~> 91 | "96WjmdJC$HgZC~> 92 | "96Zlo'aj)II_m~> 93 | "96WjmdJC$HgZC~> 94 | !rpNim!F6~> 95 | !rpQkm!XB~> 96 | !rpNim!F6~> 97 | !<;?/J,~> 98 | !<;?0J,~> 99 | !<;?/J,~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/continue.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/continue.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/debug-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/debug-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/debug.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/debug.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/debug.xwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/debug.xwd -------------------------------------------------------------------------------- /Lecture-Notes/Figures/down-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/down-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/down.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/down.eps 4 | %%CreationDate: Tue Mar 8 15:46:11 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1217 ASCII Bytes 33 | colorimage 34 | l-4_~> 35 | l-=e~> 36 | l-4_~> 37 | l-4_~> 38 | l-=e~> 39 | l-4_~> 40 | rlsm!!IO6b~> 41 | rm's&!IaNh~> 42 | rlsm!!IO6b~> 43 | rlkH2n'(l[mXP~> 44 | rltN7n'1r^npg~> 45 | rlkH2n'(l[mXP~> 46 | rlkH2n'(l[mXP~> 47 | rltN7n'1r^npg~> 48 | rlkH2n'(l[mXP~> 49 | rlkH2qT\s=qTT%fmXP~> 50 | rltN7qTf$>qT]+inpg~> 51 | rlkH2qT\s=qTT%fmXP~> 52 | rlkH2qT\s=qTT%fmXP~> 53 | rltN7qTf$>qT]+inpg~> 54 | rlkH2qT\s=qTT%fmXP~> 55 | rlkH2qT\s=qTT%fmXP~> 56 | rltN7qTf$>qT]+inpg~> 57 | rlkH2qT\s=qTT%fmXP~> 58 | rlkH2qT\s=qTT%fmXP~> 59 | rltN7qTf$>qT]+inpg~> 60 | rlkH2qT\s=qTT%fmXP~> 61 | rlkH2qT\s=qTT%fmXP~> 62 | rltN7qTf$>qT]+inpg~> 63 | rlkH2qT\s=qTT%fmXP~> 64 | rlkH2qT\s=qTT%fmXP~> 65 | rltN7qTf$>qT]+inpg~> 66 | rlkH2qT\s=qTT%fmXP~> 67 | rlkH2qT\s=qTT%fmXP~> 68 | rltN7qTf$>qT]+inpg~> 69 | rlkH2qT\s=qTT%fmXP~> 70 | rlkH2qT\s=qTT%fmXP~> 71 | rltN7qTf$>qT]+inpg~> 72 | rlkH2qT\s=qTT%fmXP~> 73 | rlkH2qT\s=qTT%fmXP~> 74 | rltN7qTf$>qT]+inpg~> 75 | rlkH2qT\s=qTT%fmXP~> 76 | rlkH2rQY':rQP@imXP~> 77 | rltN7rQb-;rQYFlnpg~> 78 | rlkH2rQY':rQP@imXP~> 79 | rlkH2r6>$;r657hmXP~> 80 | rltN7r6G*=knpg~> 81 | rlkH2r6>$;r657hmXP~> 82 | rlkH2qp#! 83 | rltN7qp,'=qp#4jnpg~> 84 | rlkH2qp#! 85 | rlkH2qT\s=qTT%fmXP~> 86 | rltN7qTf$>qT]+inpg~> 87 | rlkH2qT\s=qTT%fmXP~> 88 | rlkH2q9Ap>q98qemXP~> 89 | rltN7q9K!?q9B"hnpg~> 90 | rlkH2q9Ap>q98qemXP~> 91 | rlkH2n'(l[mXP~> 92 | rltN7n'1r^npg~> 93 | rlkH2n'(l[mXP~> 94 | rlkH2n'(l[mXP~> 95 | rltN7n'1r^npg~> 96 | rlkH2n'(l[mXP~> 97 | rlseVJ,~> 98 | rm'kYJ,~> 99 | rlseVJ,~> 100 | l-4_~> 101 | l-=e~> 102 | l-4_~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/down.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/down.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/finish-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/finish-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/finish.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/finish.eps 4 | %%CreationDate: Tue Mar 8 15:56:40 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1547 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !<;B0!<7Q~> 38 | !<;B1!<7Q~> 39 | !<;B0!<7Q~> 40 | !WRN7mK.a[s*t~> 41 | !WRT9ncF6bs*t~> 42 | !WRN7mK.a[s*t~> 43 | !rmW8n'(o\c2W:~> 44 | !rm]>n'1u_cMrC~> 45 | !rmW8n'(o\c2W:~> 46 | !rmW8n'(o\c2W:~> 47 | !rm]>n'1u_cMrC~> 48 | !rmW8n'(o\c2W:~> 49 | !rmW8rlt?@pWWbdc2W:~> 50 | !rm]>rm(EApW`hgcMrC~> 51 | !rmW8rlt?@pWWbdc2W:~> 52 | !rmW8rltEBs8W#tqoo1hc2W:~> 53 | !rm]>rm(KCs8W#tqp#7kcMrC~> 54 | !rmW8rltEBs8W#tqoo1hc2W:~> 55 | !rmW8rltEBrr;rts8W&B!di2lJ,~> 56 | !rm]>rm(KCrr;rts8W&C!e&AoJ,~> 57 | !rmW8rltEBrr;rts8W&B!di2lJ,~> 58 | !rmW8rlkKEs8W&u"oeQ&s8N)ublW7:s*t~> 59 | !rm]>rltQFs8W&u"oeQ&s8N)uc2rF>s*t~> 60 | !rmW8rlkKEs8W&u"oeQ&s8N)ublW7:s*t~> 61 | !rmW8rltHCs8W&us8W&u"olilHd2S@~> 62 | !rm]>rm(NDs8W&us8W&u"ollnIEqkC~> 63 | !rmW8rltHCs8W&us8W&u"olilHd2S@~> 64 | !rmW8rQPBDs8W&us8W&u"olilHd2S@~> 65 | !rm]>rQYHEs8W&us8W&u"ollnIEqkC~> 66 | !rmW8rQPBDs8W&us8W&u"olilHd2S@~> 67 | !rmW8rQY9@s8Vrrs31Ulc2W:~> 68 | !rm]>rQb?As8Vrrs3:[ocMrC~> 69 | !rmW8rQY9@s8Vrrs31Ulc2W:~> 70 | !rmW8rQY9@s8W&us8N6&c-:U[s*t~> 71 | !rm]>rQb?As8W&us8N6&cH^j`s*t~> 72 | !rmW8rQY9@s8W&us8N6&c-:U[s*t~> 73 | !rmW8rQY 74 | !rm]>rQbBBrm(KCrr<#D!e&AoJ,~> 75 | !rmW8rQY 76 | !rmW8rQP 77 | !rm]>rQYBCq9Js>s3:[ocMrC~> 78 | !rmW8rQP 79 | !rmW8r653Ap!!Pbc2W:~> 80 | !rm]>r6>9Bp!*VecMrC~> 81 | !rmW8r653Ap!!Pbc2W:~> 82 | !rmW8r653Ap!!Pbc2W:~> 83 | !rm]>r6>9Bp!*VecMrC~> 84 | !rmW8r653Ap!!Pbc2W:~> 85 | !rmW8r653Ap!!Pbc2W:~> 86 | !rm]>r6>9Bp!*VecMrC~> 87 | !rmW8r653Ap!!Pbc2W:~> 88 | !rmW8r653Ap!!Pbc2W:~> 89 | !rm]>r6>9Bp!*VecMrC~> 90 | !rmW8r653Ap!!Pbc2W:~> 91 | !rmW8n'(o\c2W:~> 92 | !rm]>n'1u_cMrC~> 93 | !rmW8n'(o\c2W:~> 94 | !rmW8n'(o\c2W:~> 95 | !rm]>n'1u_cMrC~> 96 | !rmW8n'(o\c2W:~> 97 | !<;D4!R:Xp~> 98 | !<;D6!RC^q~> 99 | !<;D4!R:Xp~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/finish.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/finish.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph-zykl.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 1 -> 2; 3 | 2 -> 3; 4 | 1 -> 3; 5 | 2 -> 4; 6 | 4 -> 1; 7 | 4 -> 5; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph-zykl.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/graph-zykl.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | a -> b; 3 | a -> c; 4 | b -> e; 5 | e -> f; 6 | c -> f; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/graph.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph0-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/graph0-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph0.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 1 -> 2; 3 | 2 -> 3; 4 | 1 -> 3; 5 | 2 -> 4; 6 | 4 -> 5; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph2.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | a -> b; 3 | a -> c; 4 | b -> e; 5 | e -> a; 6 | e -> f; 7 | c -> f; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/graph2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/graph2.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/knight-moves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/knight-moves.png -------------------------------------------------------------------------------- /Lecture-Notes/Figures/knights-problem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/knights-problem.png -------------------------------------------------------------------------------- /Lecture-Notes/Figures/nodebug-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/nodebug-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/nodebug.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/nodebug.eps 4 | %%CreationDate: Tue Mar 8 15:58:57 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1594 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !WUF4mK.b's*t~> 38 | !WUI5ncF71s*t~> 39 | !WUF4mK.b's*t~> 40 | !rpO5n'(o\mf.e~> 41 | !rpR:n'1u_o)F4~> 42 | !rpO5n'(o\mf.e~> 43 | !rpO5n'(o\mf.e~> 44 | !rpR:n'1u_o)F4~> 45 | !rpO5n'(o\mf.e~> 46 | "96X6c1h; 47 | "96[;cM.D=cMmnDc2rFbs*t~> 48 | "96X6c1h; 49 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 50 | "TQdJ,~> 51 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 52 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 53 | "TQdJ,~> 54 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 55 | "olj8blIeB!<<'!!<17C!<14EHg^oa~> 56 | "olm=c2dnC!<<'!!<1:D!<17FIIdDg~> 57 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 58 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 59 | "TQdJ,~> 60 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 61 | #62s9blIeDr;Zlu!<17C!<14EHg^oa~> 62 | #63!>c2dnEr;Zlu!<1:D!<17FIIdDg~> 63 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 64 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 65 | "TQdJ,~> 66 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 67 | "olj8blIeB!<<'!!<17C!<14EHg^oa~> 68 | "olm=c2dnC!<<'!!<1:D!<17FIIdDg~> 69 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 70 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 71 | "TQdJ,~> 72 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 73 | #62s9blIeDr;Zp!!6tB@"3l2\s*t~> 74 | #63!>c2dnEr;Zp!!7(HA"3u>cs*t~> 75 | "TQa7blIV?! 76 | "TQa7blIV?!W^Kir;clB!djA8J,~> 77 | "TQdJ,~> 78 | "TQa7blIV?!W^Kir;clB!djA8J,~> 79 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 80 | "TQdJ,~> 81 | "TQa7blIV?!!*#CrrE&C!djA8J,~> 82 | "96X6c1h;7blW7[s*t~> 83 | "96[;cM.D8c2rFbs*t~> 84 | "96X6c1h;7blW7[s*t~> 85 | !rpO5n'(o\mf.e~> 86 | !rpR:n'1u_o)F4~> 87 | !rpO5n'(o\mf.e~> 88 | !rpO5n'(o\mf.e~> 89 | !rpR:n'1u_o)F4~> 90 | !rpO5n'(o\mf.e~> 91 | !rpO5n'(o\mf.e~> 92 | !rpR:n'1u_o)F4~> 93 | !rpO5n'(o\mf.e~> 94 | !WUF2HN=(r~> 95 | !WUI3I/s:t~> 96 | !WUF2HN=(r~> 97 | !<;B0!<7Q~> 98 | !<;B1!<7Q~> 99 | !<;B0!<7Q~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/nodebug.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/nodebug.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/redo-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/redo-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/redo.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/redo.eps 4 | %%CreationDate: Tue Mar 8 15:57:24 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1310 ASCII Bytes 33 | colorimage 34 | !<;B0!<7Q~> 35 | !<;B1!<7Q~> 36 | !<;B0!<7Q~> 37 | !WUF4mK.a[s*t~> 38 | !WUI5ncF6bs*t~> 39 | !WUF4mK.a[s*t~> 40 | !rpO5n'(o\c2W:~> 41 | !rpR:n'1u_cMrC~> 42 | !rpO5n'(o\c2W:~> 43 | !rpO5n'(o\c2W:~> 44 | !rpR:n'1u_cMrC~> 45 | !rpO5n'(o\c2W:~> 46 | !rpO5n'(o\c2W:~> 47 | !rpR:n'1u_cMrC~> 48 | !rpO5n'(o\c2W:~> 49 | !rpO5n'(o\c2W:~> 50 | !rpR:n'1u_cMrC~> 51 | !rpO5n'(o\c2W:~> 52 | !rpO5qT\m;r65:ic2W:~> 53 | !rpR:qTes@lcMrC~> 54 | !rpO5qT\m;r65:ic2W:~> 55 | !rpO5r6=s9rlkLkc2W:~> 56 | !rpR:r6G$:rltRncMrC~> 57 | !rpO5r6=s9rlkLkc2W:~> 58 | !rpO5r6>6Ar6>0?s31Ulc2W:~> 59 | !rpR:r6G 60 | !rpO5r6>6Ar6>0?s31Ulc2W:~> 61 | !rpO5rQY"3l2;s*t~> 62 | !rpR:rQbBBqTf'?"3u>?s*t~> 63 | !rpO5rQY"3l2;s*t~> 64 | !rpO5rQY?Bps&g="3l2;s*t~> 65 | !rpR:rQbECps/m>"3u>?s*t~> 66 | !rpO5rQY?Bps&g="3l2;s*t~> 67 | "96X6c1qA:c2RbGc$R_8J,~> 68 | "96[;cM7J;cMmkHc@+" 69 | "96X6c1qA:c2RbGc$R_8J,~> 70 | "TQa7c-?+cqT]$?"3l2;s*t~> 71 | "TQd?s*t~> 72 | "TQa7c-?+cqT]$?"3l2;s*t~> 73 | !rpO5rltBAp< 74 | !rpR:rm(HBp 75 | !rpO5rltBAp< 76 | !rpO5rQY?Bp!!Pbc2W:~> 77 | !rpR:rQbECp!*VecMrC~> 78 | !rpO5rQY?Bp!!Pbc2W:~> 79 | !rpO5n'(o\c2W:~> 80 | !rpR:n'1u_cMrC~> 81 | !rpO5n'(o\c2W:~> 82 | !rpO5n'(o\c2W:~> 83 | !rpR:n'1u_cMrC~> 84 | !rpO5n'(o\c2W:~> 85 | !rpO5n'(o\c2W:~> 86 | !rpR:n'1u_cMrC~> 87 | !rpO5n'(o\c2W:~> 88 | !rpO5n'(o\c2W:~> 89 | !rpR:n'1u_cMrC~> 90 | !rpO5n'(o\c2W:~> 91 | !rpO5n'(o\c2W:~> 92 | !rpR:n'1u_cMrC~> 93 | !rpO5n'(o\c2W:~> 94 | !WUF3HNDCkJ,~> 95 | !WUI4I0%XnJ,~> 96 | !WUF3HNDCkJ,~> 97 | !<;B0!<7Q~> 98 | !<;B1!<7Q~> 99 | !<;B0!<7Q~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/redo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/redo.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/send-more-money.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/send-more-money.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/skip-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/skip-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/skip.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/skip.eps 4 | %%CreationDate: Tue Mar 8 15:55:37 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1274 ASCII Bytes 33 | colorimage 34 | l2Q8~> 35 | l2Q8~> 36 | l2Q8~> 37 | !<;?/J,~> 38 | !<;?0J,~> 39 | !<;?/J,~> 40 | !rq\8md:+&mXP~> 41 | !rqh>md^C,npg~> 42 | !rq\8md:+&mXP~> 43 | "96VmmdJC$HgZC~> 44 | "96Ypo'aj)II_m~> 45 | "96VmmdJC$HgZC~> 46 | "96VmmdJC$HgZC~> 47 | "96Ypo'aj)II_m~> 48 | "96VmmdJC$HgZC~> 49 | "96VmmdJC$HgZC~> 50 | "96Ypo'aj)II_m~> 51 | "96VmmdJC$HgZC~> 52 | "96VmmdJC$HgZC~> 53 | "96Ypo'aj)II_m~> 54 | "96VmmdJC$HgZC~> 55 | "96Vmmek?,!;aq@HgZC~> 56 | "96Ypo)-f1!;atAII_m~> 57 | "96Vmmek?,!;aq@HgZC~> 58 | "96Vmmf(K*!;t(BHgZC~> 59 | "96Ypo)?r/!;t+CII_m~> 60 | "96Vmmf(K*!;t(BHgZC~> 61 | "olhom`j#T!;t+A!;t(BHgZC~> 62 | "olkro$5PZ!;t.B!;t+CII_m~> 63 | "olhom`j#T!;t+A!;t(BHgZC~> 64 | "TQ_nm`k_2qT]!>rQP@imXP~> 65 | "TQbqo$747qTf'?rQYFlnpg~> 66 | "TQ_nm`k_2qT]!>rQP@imXP~> 67 | #62qpm`b_3ps&g=rQP@imXP~> 68 | #62tso$.48ps/m>rQYFlnpg~> 69 | #62qpm`b_3ps&g=rQP@imXP~> 70 | #62qpm`b_3qp"p:!mQ)[J,~> 71 | #62tso$.48qp,!;!mZ5bJ,~> 72 | #62qpm`b_3qp"p:!mQ)[J,~> 73 | #62qpm`b_3qT\m;s31RkmXP~> 74 | #62tso$.48qTes 75 | #62qpm`b_3qT\m;s31RkmXP~> 76 | "96Vmme4p(!<14DHgZC~> 77 | "96Ypo(LB-!<17EII_m~> 78 | "96Vmme4p(!<14DHgZC~> 79 | "96Vmme+j)!<(.CHgZC~> 80 | "96Ypo(C<.!<(1DII_m~> 81 | "96Vmme+j)!<(.CHgZC~> 82 | "96VmmdJC$HgZC~> 83 | "96Ypo'aj)II_m~> 84 | "96VmmdJC$HgZC~> 85 | "96VmmdJC$HgZC~> 86 | "96Ypo'aj)II_m~> 87 | "96VmmdJC$HgZC~> 88 | "96VmmdJC$HgZC~> 89 | "96Ypo'aj)II_m~> 90 | "96VmmdJC$HgZC~> 91 | "96VmmdJC$HgZC~> 92 | "96Ypo'aj)II_m~> 93 | "96VmmdJC$HgZC~> 94 | "96VmmdJC$HgZC~> 95 | "96Ypo'aj)II_m~> 96 | "96VmmdJC$HgZC~> 97 | !<;>2J,~> 98 | !<;>4J,~> 99 | !<;>2J,~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/skip.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/skip.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/step-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/step-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/step.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%Creator: GIMP PostScript file plugin V 1.16 by Peter Kirchgessner 3 | %%Title: /home/stroetma/step.eps 4 | %%CreationDate: Tue Mar 8 15:48:11 2005 5 | %%DocumentData: Clean7Bit 6 | %%LanguageLevel: 2 7 | %%Pages: 1 8 | %%BoundingBox: 14 14 39 38 9 | %%EndComments 10 | %%BeginProlog 11 | % Use own dictionary to avoid conflicts 12 | 10 dict begin 13 | %%EndProlog 14 | %%Page: 1 1 15 | % Translate for offset 16 | 14.173228346456694 14.173228346456694 translate 17 | % Translate to begin of first scanline 18 | 0 23 translate 19 | 24 -23 scale 20 | % Image geometry 21 | 24 23 8 22 | % Transformation matrix 23 | [ 24 0 0 23 0 0 ] 24 | % Strings to hold RGB-samples per scanline 25 | /rstr 24 string def 26 | /gstr 24 string def 27 | /bstr 24 string def 28 | {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop} 29 | {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop} 30 | {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop} 31 | true 3 32 | %%BeginData: 1211 ASCII Bytes 33 | colorimage 34 | l2Q8~> 35 | l2Q8~> 36 | l2Q8~> 37 | l2Q8~> 38 | l2Q8~> 39 | l2Q8~> 40 | s8N(Gmd:+&s*t~> 41 | s8N(Imd^C,s*t~> 42 | s8N(Gmd:+&s*t~> 43 | s8N+HmdJC$HiJT~> 44 | s8N+Jo'aj)IK+f~> 45 | s8N+HmdJC$HiJT~> 46 | s8N+HmdJC$HiJT~> 47 | s8N+Jo'aj)IK+f~> 48 | s8N+HmdJC$HiJT~> 49 | s8N+HmdJC$HiJT~> 50 | s8N+Jo'aj)IK+f~> 51 | s8N+HmdJC$HiJT~> 52 | s8N+HmdJC$HiJT~> 53 | s8N+Jo'aj)IK+f~> 54 | s8N+HmdJC$HiJT~> 55 | s8N+Hme=s+!;aq@HiJT~> 56 | s8N+Jo(UE0!;atAIK+f~> 57 | s8N+Hme=s+!;aq@HiJT~> 58 | s8N+Hme>!+!;k"AHiJT~> 59 | s8N+Jo(UH0!;k%BIK+f~> 60 | s8N+Hme>!+!;k"AHiJT~> 61 | s8N+Hme>!*!;t(BHiJT~> 62 | s8N+Jo(UH/!;t+CIK+f~> 63 | s8N+Hme>!*!;t(BHiJT~> 64 | s8N1Jm`j#L!<(.CHiJT~> 65 | s8N1Lo$5PR!<(1DIK+f~> 66 | s8N1Jm`j#L!<(.CHiJT~> 67 | s8N1Jm`j#K!<14DHiJT~> 68 | s8N1Lo$5PQ!<17EIK+f~> 69 | s8N1Jm`j#K!<14DHiJT~> 70 | s8N1Jm`j#K!<14DHiJT~> 71 | s8N1Lo$5PQ!<17EIK+f~> 72 | s8N1Jm`j#K!<14DHiJT~> 73 | s8N1Jm`j#L!<(.CHiJT~> 74 | s8N1Lo$5PR!<(1DIK+f~> 75 | s8N1Jm`j#L!<(.CHiJT~> 76 | s8N+Hme>!*!;t(BHiJT~> 77 | s8N+Jo(UH/!;t+CIK+f~> 78 | s8N+Hme>!*!;t(BHiJT~> 79 | s8N+Hme>!+!;k"AHiJT~> 80 | s8N+Jo(UH0!;k%BIK+f~> 81 | s8N+Hme>!+!;k"AHiJT~> 82 | s8N+Hme=s+!;aq@HiJT~> 83 | s8N+Jo(UE0!;atAIK+f~> 84 | s8N+Hme=s+!;aq@HiJT~> 85 | s8N+HmdJC$HiJT~> 86 | s8N+Jo'aj)IK+f~> 87 | s8N+HmdJC$HiJT~> 88 | s8N+HmdJC$HiJT~> 89 | s8N+Jo'aj)IK+f~> 90 | s8N+HmdJC$HiJT~> 91 | s8N+HmdJC$HiJT~> 92 | s8N+Jo'aj)IK+f~> 93 | s8N+HmdJC$HiJT~> 94 | s8N+HmdJC$HiJT~> 95 | s8N+Jo'aj)IK+f~> 96 | s8N+HmdJC$HiJT~> 97 | l2Q8~> 98 | l2Q8~> 99 | l2Q8~> 100 | l2Q8~> 101 | l2Q8~> 102 | l2Q8~> 103 | %%EndData 104 | showpage 105 | %%Trailer 106 | end 107 | %%EOF 108 | -------------------------------------------------------------------------------- /Lecture-Notes/Figures/step.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/step.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/sudoku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/sudoku.png -------------------------------------------------------------------------------- /Lecture-Notes/Figures/wolf-goat-cabbage.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/wolf-goat-cabbage.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/xEqualsCosX.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/xEqualsCosX.pdf -------------------------------------------------------------------------------- /Lecture-Notes/Figures/zebra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/Figures/zebra.png -------------------------------------------------------------------------------- /Lecture-Notes/chess10.mf: -------------------------------------------------------------------------------- 1 | % This is `chess10.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 10 points chess font. 5 | % A complete chess diagram is 80 X 80 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=10pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes/chess20.300pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess20.300pk -------------------------------------------------------------------------------- /Lecture-Notes/chess20.600pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess20.600pk -------------------------------------------------------------------------------- /Lecture-Notes/chess20.mf: -------------------------------------------------------------------------------- 1 | % This is `chess20.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 20 points chess font. 5 | % A complete chess diagram is 160 X 160 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=20pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes/chess20.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess20.tfm -------------------------------------------------------------------------------- /Lecture-Notes/chess30.300pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess30.300pk -------------------------------------------------------------------------------- /Lecture-Notes/chess30.600pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess30.600pk -------------------------------------------------------------------------------- /Lecture-Notes/chess30.mf: -------------------------------------------------------------------------------- 1 | % This is `chess30.mf' version 1.0 as of 8/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % Parameters needed for a 30 points chess font. 5 | % A complete chess diagram is 240 X 240 points. 6 | 7 | mode_setup; 8 | input chessbase; 9 | 10 | M=1; % number of squares 11 | d#:=30pt#/M; % size per square 12 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 13 | define_blacker_pixels(fine, thin, thick, border); 14 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 15 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 16 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 17 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 18 | light=0; dark=1; white=0; black=1; 19 | 20 | input chesspieces; 21 | end; 22 | -------------------------------------------------------------------------------- /Lecture-Notes/chess30.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chess30.tfm -------------------------------------------------------------------------------- /Lecture-Notes/chessdiag.mf: -------------------------------------------------------------------------------- 1 | % This is `chessdiag.mf' version 1.1 as of 11/90 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % file generates a complete chess diagram 5 | 6 | % most versions of METAFONT have memorylimits so generating a complete 7 | % diagram of 160 X 160 points for a 300 DPI printer is not possible 8 | 9 | mode_setup; 10 | input chessbase; 11 | 12 | def draw_pieces(text piece_list) = 13 | string piece, location; 14 | for p=piece_list: 15 | l:=length p; 16 | exitunless (l=2) or (l=3); 17 | if l=2: piece:="p"; i:=0; 18 | else: piece:=substring(0,1) of p; i:=1; fi; 19 | column:=ASCII substring(i,i+1) of p - ASCII "a"; 20 | row:=ASCII substring(i+1,i+2) of p - ASCII "1"; 21 | if not odd(column+row): background:=dark; else: background:=light; fi; 22 | scantokens piece(d, column,row); 23 | endfor; 24 | enddef; 25 | 26 | def w(text piece_list) = 27 | color:=white; 28 | empty_board(d); draw_pieces(piece_list); 29 | enddef; 30 | 31 | def b(text piece_list) = 32 | color:=black; 33 | draw_pieces(piece_list); 34 | enddef; 35 | 36 | M=8; % number of squares 37 | d#:=100pt#/M; % size per square 38 | fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; 39 | define_blacker_pixels(fine, thin, thick, border); 40 | define_whole_pixels(d); 41 | pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares 42 | pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard 43 | pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces 44 | pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces 45 | light=0; dark=1; white=0; black=1; 46 | 47 | % put here the wanted diagram (ex.: mate in three problem) 48 | 49 | w("Kc2","Nb4","Bf8","b3","g7"); 50 | b("Ka3","b6"); 51 | showit; 52 | 53 | message("White mates in three moves. Do you see how?"); 54 | StopMe; 55 | 56 | end; 57 | -------------------------------------------------------------------------------- /Lecture-Notes/chessf10.mf: -------------------------------------------------------------------------------- 1 | % This is `chessf10.mf' version 1.2 as of 6/91 2 | % METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) 3 | 4 | % generates a font consisting of chess figurines 5 | 6 | mode_setup; 7 | input chessbase; 8 | 9 | def figurine(expr code) = 10 | beginchar(code, d#, .8d#, .2d#); 11 | pickup pencircle scaled thin; 12 | thin_pen:=savepen ; % for drawing pieces 13 | pickup pencircle scaled thick; 14 | thick_pen:=savepen; % for drawing inside pieces 15 | define_whole_pixels(d); 16 | scantokens code(d, 0, -.2); 17 | endchar; 18 | enddef; 19 | 20 | M=1; % number of squares 21 | d#:=10pt#/M; % size per square 22 | thin#:=1/3pt#; thick#:=5/6pt#; define_blacker_pixels(thin, thick); 23 | light=0; dark=1; white=0; black=1; 24 | background:=light; color:=white; 25 | 26 | figurine("K"); 27 | figurine("Q"); 28 | figurine("R"); 29 | figurine("B"); 30 | figurine("N"); 31 | figurine("p"); 32 | 33 | end; 34 | -------------------------------------------------------------------------------- /Lecture-Notes/chessf10.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/chessf10.tfm -------------------------------------------------------------------------------- /Lecture-Notes/depth-first-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/depth-first-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/depth-first.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 3 | size = "5,7"; 4 | 1 [ shape = Mrecord, label = "{ p(X) }" ] ; 5 | 6 | 1 -> 2; 7 | 8 | 1 -> 3; 9 | 10 | 2 [ shape = Mrecord, label = "{ q1(X) }" ] ; 11 | 12 | 2 -> 4; 13 | 14 | 2 -> 5; 15 | 16 | 3 [ shape = Mrecord, label = "{ q2(X) }" ] ; 17 | 18 | 3 -> 6; 19 | 20 | 3 -> 7; 21 | 22 | 4 [ shape = Mrecord, label = "{ r1(X) }" ] ; 23 | 5 [ shape = Mrecord, label = "{ r2(X) }" ] ; 24 | 6 [ shape = Mrecord, label = "{ r3(X) }" ] ; 25 | 7 [ shape = Mrecord, label = "{ r4(X) }" ] ; 26 | 27 | 4 -> 8; 28 | 8 [ shape = Mrecord, label = "{ r1(a) }" ] ; 29 | 5 -> 9; 30 | 9 [ shape = Mrecord, label = "{ r2(b) }" ] ; 31 | 6 -> 10; 32 | 10 [ shape = Mrecord, label = "{ r3(c) }" ] ; 33 | 7 -> 11; 34 | 11 [ shape = Mrecord, label = "{ r4(d) }" ] ; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Lecture-Notes/dhbw-logo-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/dhbw-logo-eps-converted-to.pdf -------------------------------------------------------------------------------- /Lecture-Notes/empty.mf: -------------------------------------------------------------------------------- 1 | % font with empty `a' to test if mode_def exists 2 | 3 | font_identifier:="NOTHING"; font_size 10pt#; 4 | 5 | mode_setup; % font_setup; 6 | 7 | beginchar("a",10pt#,10pt#,0); 8 | show pixels_per_inch; 9 | endchar; 10 | 11 | bye 12 | -------------------------------------------------------------------------------- /Lecture-Notes/inconsolatag.tfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/inconsolatag.tfm -------------------------------------------------------------------------------- /Lecture-Notes/inconsolatag.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/inconsolatag.ttf -------------------------------------------------------------------------------- /Lecture-Notes/logic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/logic.pdf -------------------------------------------------------------------------------- /Lecture-Notes/pl.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Lecture-Notes/pl.pdf -------------------------------------------------------------------------------- /Lecture-Notes/t1inconsolatag.fd: -------------------------------------------------------------------------------- 1 | \ProvidesFile{t1inconsolatag.fd} 2 | \DeclareFontFamily{T1}{inconsolatag}{} 3 | \DeclareFontShape{T1}{inconsolatag}{m}{n}{ <-> inconsolatag}{} 4 | \pdfmapline{+inconsolatag\space fliegt(y)) -> gl(x))). 3 | (all x (all y (kind(y, x) & fliegt(y)) -> gl(x))). 4 | end_of_list. 5 | -------------------------------------------------------------------------------- /Mace4/group.in: -------------------------------------------------------------------------------- 1 | formulas(theory). 2 | all x (e * x = x). % left neutral 3 | all x exists y (y * x = e). % left inverse 4 | all x all y all z ((x * y) * z = x * (y * z)). % associativity 5 | a * b != b * a. % a and b do not commute 6 | end_of_list. 7 | -------------------------------------------------------------------------------- /Mace4/group3.in: -------------------------------------------------------------------------------- 1 | formulas(theory). 2 | 3 | % Associativity 4 | 5 | all x all y all z ((x * y) * z = x * (y * z)). 6 | 7 | all x (x * e = x). 8 | all x (i(x) * x = e). 9 | 10 | % Is e also a left neutral element? 11 | 12 | exists x (e * x != x). 13 | 14 | end_of_list. 15 | -------------------------------------------------------------------------------- /Mace4/insel.in: -------------------------------------------------------------------------------- 1 | formulas(theory). 2 | -(all x exists y p(x,y) -> exists y all x p(x, y)). 3 | end_of_list. 4 | -------------------------------------------------------------------------------- /Prover9/barbier.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | all x (barber(x) -> all y (-shaves(y,y) -> shaves(x,y))). 3 | all x (barber(x) -> all y (shaves(y,y) -> -shaves(x,y))). 4 | end_of_list. 5 | 6 | formulas(goals). 7 | all x (barber(x) -> gay(x)). 8 | end_of_list. 9 | -------------------------------------------------------------------------------- /Prover9/group-commutative.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | all x (e * x = x). % e is a left neutral element 3 | all x exists y (y * x = e). % existence of a left inverse 4 | all x all y all z ((x * y) * z = x * (y * z)). % associativity 5 | end_of_list. 6 | 7 | formulas(goals). 8 | all x all y (x * y = y * x). % * is commutative 9 | end_of_list. 10 | -------------------------------------------------------------------------------- /Prover9/group.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | 3 | % Associativity 4 | 5 | all x all y all z ((x * y) * z = x * (y * z)). 6 | 7 | % There is a left identity element, and every element has a left inverse. 8 | 9 | all x (e * x = x). 10 | all x (i(x) * x = e). 11 | 12 | end_of_list. 13 | 14 | formulas(goals). 15 | 16 | all x all y (x * y = y * x). 17 | 18 | end_of_list. 19 | -------------------------------------------------------------------------------- /Prover9/group2.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | all x (e * x = x). % e is a left neutral element 3 | all x exists y (y * x = e). % existence of a left inverse 4 | all x all y all z ((x * y) * z = x * (y * z)). % associativity 5 | end_of_list. 6 | 7 | formulas(goals). 8 | all x (x * e = x). % e is also a right neutral element 9 | all x exists y (x * y = e). % there is also a right inverse 10 | end_of_list. 11 | -------------------------------------------------------------------------------- /Prover9/robbin.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | all x all y (x + y = y + x). % commutativity 3 | all x all y all z ((x + y) + z = x + (y + z)). % associativity 4 | all x all y (n(n(x + y) + n(x + n(y))) = x). % Robbins equation 5 | end_of_list. 6 | 7 | formulas(goals). 8 | all x all y (n(n(x) + y) + n(n(x) + n(y)) = x). % Huntington equation 9 | end_of_list. -------------------------------------------------------------------------------- /Prover9/russell.in: -------------------------------------------------------------------------------- 1 | formulas(goals). 2 | -(all x (member(x, r) <-> -member(x, x))). 3 | end_of_list. 4 | -------------------------------------------------------------------------------- /Prover9/transitive.in: -------------------------------------------------------------------------------- 1 | formulas(sos). 2 | all x all y (subset(x,y) <-> (all z (member(z,x) -> member(z,y)))). 3 | end_of_list. 4 | 5 | formulas(goals). 6 | all x all y all z (subset(x,y) & subset(y,z) -> subset(x,z)). 7 | end_of_list. 8 | -------------------------------------------------------------------------------- /Python/Breadth-First-Search.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Breadth-First-Search" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "def search(R, start, goal):\n", 17 | " Paths = { (start,) }\n", 18 | " Visited = { start }\n", 19 | " n = 0\n", 20 | " while True:\n", 21 | " n += 1\n", 22 | " NewPaths = set()\n", 23 | " for Path in Paths:\n", 24 | " for (y, z) in R:\n", 25 | " if Path[-1] == y and z not in Visited:\n", 26 | " LongerPath = Path + (z,)\n", 27 | " if z == goal:\n", 28 | " return LongerPath\n", 29 | " NewPaths.add(LongerPath)\n", 30 | " Visited .add(z)\n", 31 | " print(f'Iteration {n}: {len(NewPaths)} new states found.')\n", 32 | " if NewPaths == set():\n", 33 | " return\n", 34 | " Paths = NewPaths" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [] 43 | } 44 | ], 45 | "metadata": { 46 | "@webio": { 47 | "lastCommId": null, 48 | "lastKernelId": null 49 | }, 50 | "kernelspec": { 51 | "display_name": "Python 3 (ipykernel)", 52 | "language": "python", 53 | "name": "python3" 54 | }, 55 | "language_info": { 56 | "codemirror_mode": { 57 | "name": "ipython", 58 | "version": 3 59 | }, 60 | "file_extension": ".py", 61 | "mimetype": "text/x-python", 62 | "name": "python", 63 | "nbconvert_exporter": "python", 64 | "pygments_lexer": "ipython3", 65 | "version": "3.13.0" 66 | } 67 | }, 68 | "nbformat": 4, 69 | "nbformat_minor": 4 70 | } 71 | -------------------------------------------------------------------------------- /Python/Chapter-2/.gitignore: -------------------------------------------------------------------------------- 1 | Twin-Primes.ipynb 2 | -------------------------------------------------------------------------------- /Python/Chapter-3/Binomial.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "id": "4ae53c94", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from IPython.display import HTML\n", 11 | "HTML(open('../style.css', 'r').read())" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "6be8a2ff-5712-4f85-aa2f-c6fc8c2a2d04", 17 | "metadata": {}, 18 | "source": [ 19 | "# Recursive Computation of the Binomial Coefficients" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "id": "83d0bbca-6f56-4d0c-83f5-ee3a84f24960", 25 | "metadata": {}, 26 | "source": [ 27 | "The *binomial coefficient* ${n \\choose k}$ is defined as follows:\n", 28 | "$$ {n \\choose k} = \\frac{n!}{k! \\cdot (n-k)!} $$\n", 29 | "The function `binomial(n, k)` returns ${n \\choose k}$." 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "id": "281fdec1-eeab-45eb-b438-906dbc8f4d6e", 36 | "metadata": {}, 37 | "outputs": [], 38 | "source": [ 39 | "def binomial(n, k):\n", 40 | " if k == 0 or k == n:\n", 41 | " return 1\n", 42 | " else:\n", 43 | " return binomial(n - 1, k - 1) + binomial(n - 1, k) " 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "id": "1d3cd83a-6c3f-44ba-b170-cf89f459a5c6", 50 | "metadata": {}, 51 | "outputs": [], 52 | "source": [ 53 | "import math" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "id": "f3106e96-baab-4e29-a2a4-b73ced6368ca", 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [ 63 | "for n in range(12):\n", 64 | " for k in range(n+1):\n", 65 | " assert binomial(n, k) == math.comb(n, k)" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": null, 71 | "id": "16522cd2-ec83-4b6f-abd6-1a05ba9423bf", 72 | "metadata": {}, 73 | "outputs": [], 74 | "source": [ 75 | "for n in range(1, 10):\n", 76 | " for k in range(0, n+1):\n", 77 | " print(binomial(n, k), end=' ')\n", 78 | " print() " 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": null, 84 | "id": "6b891df4-2078-4a0e-a5d3-792973720a2f", 85 | "metadata": {}, 86 | "outputs": [], 87 | "source": [] 88 | } 89 | ], 90 | "metadata": { 91 | "kernelspec": { 92 | "display_name": "Python 3 (ipykernel)", 93 | "language": "python", 94 | "name": "python3" 95 | }, 96 | "language_info": { 97 | "codemirror_mode": { 98 | "name": "ipython", 99 | "version": 3 100 | }, 101 | "file_extension": ".py", 102 | "mimetype": "text/x-python", 103 | "name": "python", 104 | "nbconvert_exporter": "python", 105 | "pygments_lexer": "ipython3", 106 | "version": "3.13.2" 107 | } 108 | }, 109 | "nbformat": 4, 110 | "nbformat_minor": 5 111 | } 112 | -------------------------------------------------------------------------------- /Python/Chapter-3/Euclidean-Algorithm.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "id": "007b6f7c", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from IPython.display import HTML\n", 11 | "HTML(open('../style.css', 'r').read())" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "id": "ed9d20b2", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "%load_ext nb_mypy" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "id": "75e29a5f", 27 | "metadata": {}, 28 | "source": [ 29 | "# The Euclidean Algorithm for Computing the Greatest Common Divisor " 30 | ] 31 | }, 32 | { 33 | "cell_type": "markdown", 34 | "id": "08b196aa", 35 | "metadata": {}, 36 | "source": [ 37 | "The function `gcd`takes to natural numbers `a` and `b`as arguments and computes their *greatest common divisor*." 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": null, 43 | "id": "b3e1ae26", 44 | "metadata": {}, 45 | "outputs": [], 46 | "source": [ 47 | "def gcd(a: int, b: int) -> int:\n", 48 | " while b != 0:\n", 49 | " a, b = b, a % b\n", 50 | " return a" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": null, 56 | "id": "8901d883", 57 | "metadata": {}, 58 | "outputs": [], 59 | "source": [ 60 | "gcd(125, 20)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": null, 66 | "id": "c498cb6a", 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [] 70 | } 71 | ], 72 | "metadata": { 73 | "kernelspec": { 74 | "display_name": "Python 3 (ipykernel)", 75 | "language": "python", 76 | "name": "python3" 77 | }, 78 | "language_info": { 79 | "codemirror_mode": { 80 | "name": "ipython", 81 | "version": 3 82 | }, 83 | "file_extension": ".py", 84 | "mimetype": "text/x-python", 85 | "name": "python", 86 | "nbconvert_exporter": "python", 87 | "pygments_lexer": "ipython3", 88 | "version": "3.12.9" 89 | } 90 | }, 91 | "nbformat": 4, 92 | "nbformat_minor": 5 93 | } 94 | -------------------------------------------------------------------------------- /Python/Chapter-3/Power.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from IPython.display import HTML\n", 10 | "HTML(open('../style.css').read())" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "%load_ext nb_mypy" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "# Computation of Powers via Iterative Squaring" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "The *recursive implementation* of the function `power` given below is based on the following two equations:\n", 34 | "1. $m^0 = 1$\n", 35 | "2. $m^n = \\left\\{\\begin{array}{ll}\n", 36 | " m^{n//2} \\cdot m^{n//2} & \\mbox{if $n$ is even}; \\\\\n", 37 | " m^{n//2} \\cdot m^{n//2} \\cdot m & \\mbox{if $n$ is odd}.\n", 38 | " \\end{array}\n", 39 | " \\right.\n", 40 | " $\n", 41 | " \n", 42 | "Effectively, we square the $m^{n//2}$. Hence this method is also known as *iterative squaring*." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "def power(m: int, n: int) -> int:\n", 52 | " if n == 0:\n", 53 | " return 1\n", 54 | " p = power(m, n // 2)\n", 55 | " if n % 2 == 0:\n", 56 | " return p * p\n", 57 | " else:\n", 58 | " return p * p * m" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "%%time\n", 68 | "p = power(3, 500_000)\n", 69 | "p" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": null, 75 | "metadata": {}, 76 | "outputs": [], 77 | "source": [ 78 | "assert(3 ** 500_000 == power(3, 500_000))" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": null, 84 | "metadata": {}, 85 | "outputs": [], 86 | "source": [] 87 | } 88 | ], 89 | "metadata": { 90 | "kernelspec": { 91 | "display_name": "Python 3 (ipykernel)", 92 | "language": "python", 93 | "name": "python3" 94 | }, 95 | "language_info": { 96 | "codemirror_mode": { 97 | "name": "ipython", 98 | "version": 3 99 | }, 100 | "file_extension": ".py", 101 | "mimetype": "text/x-python", 102 | "name": "python", 103 | "nbconvert_exporter": "python", 104 | "pygments_lexer": "ipython3", 105 | "version": "3.13.2" 106 | } 107 | }, 108 | "nbformat": 4, 109 | "nbformat_minor": 4 110 | } 111 | -------------------------------------------------------------------------------- /Python/Chapter-4/.gitignore: -------------------------------------------------------------------------------- 1 | Onkologie-Solution.ipynb 2 | Zweistein-Solution.ipynb 3 | Prince-Tiger-Solution.ipynb 4 | Zebra-DP-Solution.ipynb 5 | Expr-Parser.ipynb 6 | Missionaries.ipynb 7 | Sudoku.ipynb 8 | Wolf-Goat-Cabage-AL-Students.ipynb 9 | Wolf-Goat-Cabbage-Solution.ipynb 10 | Zebra-Deepseek.ipynb 11 | The-Visit-Solution.ipynb -------------------------------------------------------------------------------- /Python/Chapter-4/queen-captures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-4/queen-captures.png -------------------------------------------------------------------------------- /Python/Chapter-4/queens-vars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-4/queens-vars.png -------------------------------------------------------------------------------- /Python/Chapter-4/sudoku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-4/sudoku.png -------------------------------------------------------------------------------- /Python/Chapter-5/.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints/* 2 | __pycache__/* 3 | Crypto-Arithmetic-Solution.ipynb 4 | Onkologie-CSP-Solution.ipynb 5 | Wolf-Goat-Cabbage-STS-Solution.ipynb 6 | Zebra-CSP-Solution.ipynb 7 | Zebra-Solution.ipynb 8 | Parrot-and-Penguin-Solution.ipynb 9 | Train-Solution.ipynb 10 | Sudoku-Z3-Solution.ipynb 11 | Japanese-Z3-Solution.ipynb 12 | Jealous-Couples-Z3-Solution.ipynb 13 | Bridge-Torch-Solution.ipynb 14 | Sudoku-Binary.ipynb 15 | Train-Solution-ChatGPT.ipynb 16 | Train-Z3-Solution.ipynb 17 | Z3-Group-Theory.ipynb 18 | Z3-Induction.ipynb 19 | Z3-Intro.ipynb 20 | -------------------------------------------------------------------------------- /Python/Chapter-5/australia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-5/australia.png -------------------------------------------------------------------------------- /Python/Chapter-5/knight-moves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-5/knight-moves.png -------------------------------------------------------------------------------- /Python/Chapter-5/queen-captures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-5/queen-captures.png -------------------------------------------------------------------------------- /Python/Chapter-5/send-more-money.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-5/send-more-money.png -------------------------------------------------------------------------------- /Python/Chapter-5/sudoku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Chapter-5/sudoku.png -------------------------------------------------------------------------------- /Python/Directed-Graph.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "id": "32921681", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from IPython.core.display import HTML\n", 11 | "with open('style.css', 'r') as file:\n", 12 | " css = file.read()\n", 13 | "HTML(css)" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "id": "c96cadc3", 19 | "metadata": {}, 20 | "source": [ 21 | "# Displaying a Directed Graph using GraphViz" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "id": "27652663", 27 | "metadata": {}, 28 | "source": [ 29 | "A *directed graph* is a *binary relation*, i.e. it is a set of pairs.\n", 30 | "Below, `R` is a directed graph." 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": null, 36 | "id": "b87aa850", 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "R = { (1, 2), (2, 3), (1, 3), (2, 4), (4, 5), (3, 5), (5, 6), (4, 6) }" 41 | ] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "id": "fab7efd5", 46 | "metadata": {}, 47 | "source": [ 48 | "The notebook `Graphviz.ipynb` implements the function `dot_graph`. This function takes a binary relation `R` as its \n", 49 | "sole argument and displays it using [graphviz](https://graphviz.org)." 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "id": "d0ab423d", 56 | "metadata": {}, 57 | "outputs": [], 58 | "source": [ 59 | "%run Graphviz.ipynb" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": null, 65 | "id": "586ed630", 66 | "metadata": {}, 67 | "outputs": [], 68 | "source": [ 69 | "dot_graph(R)" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": null, 75 | "id": "01aa0047", 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [ 79 | "%run Breadth-First-Search.ipynb" 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": null, 85 | "id": "88044b77", 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [ 89 | "search(R, 1, 6)" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": null, 95 | "id": "f8baa37e", 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [] 99 | } 100 | ], 101 | "metadata": { 102 | "kernelspec": { 103 | "display_name": "Python 3", 104 | "language": "python", 105 | "name": "python3" 106 | }, 107 | "language_info": { 108 | "codemirror_mode": { 109 | "name": "ipython", 110 | "version": 3 111 | }, 112 | "file_extension": ".py", 113 | "mimetype": "text/x-python", 114 | "name": "python", 115 | "nbconvert_exporter": "python", 116 | "pygments_lexer": "ipython3", 117 | "version": "3.9.4" 118 | } 119 | }, 120 | "nbformat": 4, 121 | "nbformat_minor": 5 122 | } 123 | -------------------------------------------------------------------------------- /Python/Exercises/8-puzzle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Exercises/8-puzzle.png -------------------------------------------------------------------------------- /Python/Exercises/Breadth-First-Fast.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from IPython.core.display import HTML\n", 10 | "with open('style.css', 'r') as file:\n", 11 | " css = file.read()\n", 12 | "HTML(css)" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "# Breadth-First-Search" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "The function `search` takes three arguments:\n", 27 | "- `next_states` is a function that takes a state $s$ and computes the set of all states that can be reached from\n", 28 | " $s$ in one step.\n", 29 | "- `start` is the state we are currently in.\n", 30 | "- `goal` is the state we want to reach.\n", 31 | "\n", 32 | "`search` computes the shortest path form `start` to `goal` provided such a path exists." 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": null, 38 | "metadata": {}, 39 | "outputs": [], 40 | "source": [ 41 | "def search(next_states, start, goal):\n", 42 | " Paths = { (start,) }\n", 43 | " Visited = { start }\n", 44 | " n = 0\n", 45 | " while True:\n", 46 | " n += 1\n", 47 | " NewPaths = set()\n", 48 | " for Path in Paths:\n", 49 | " for state in next_states(Path[-1]):\n", 50 | " if state not in Visited:\n", 51 | " LongerPath = Path + (state,)\n", 52 | " if state == goal:\n", 53 | " return LongerPath\n", 54 | " NewPaths.add(LongerPath)\n", 55 | " Visited .add(state)\n", 56 | " print(f'Iteration {n}: {len(NewPaths)} new states found.')\n", 57 | " if NewPaths == set():\n", 58 | " return\n", 59 | " Paths = NewPaths" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": null, 65 | "metadata": {}, 66 | "outputs": [], 67 | "source": [] 68 | } 69 | ], 70 | "metadata": { 71 | "@webio": { 72 | "lastCommId": null, 73 | "lastKernelId": null 74 | }, 75 | "kernelspec": { 76 | "display_name": "Python 3", 77 | "language": "python", 78 | "name": "python3" 79 | }, 80 | "language_info": { 81 | "codemirror_mode": { 82 | "name": "ipython", 83 | "version": 3 84 | }, 85 | "file_extension": ".py", 86 | "mimetype": "text/x-python", 87 | "name": "python", 88 | "nbconvert_exporter": "python", 89 | "pygments_lexer": "ipython3", 90 | "version": "3.9.0" 91 | } 92 | }, 93 | "nbformat": 4, 94 | "nbformat_minor": 4 95 | } 96 | -------------------------------------------------------------------------------- /Python/Exercises/Breadth-First-Search.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from IPython.core.display import HTML\n", 10 | "with open('style.css', 'r') as file:\n", 11 | " css = file.read()\n", 12 | "HTML(css)" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "# Breadth-First-Search" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": null, 25 | "metadata": {}, 26 | "outputs": [], 27 | "source": [ 28 | "def search(R, start, goal):\n", 29 | " Paths = { (start,) }\n", 30 | " Visited = { start }\n", 31 | " n = 0\n", 32 | " while True:\n", 33 | " n += 1\n", 34 | " NewPaths = set()\n", 35 | " for Path in Paths:\n", 36 | " for (y, z) in R:\n", 37 | " if Path[-1] == y and z not in Visited:\n", 38 | " LongerPath = Path + (z,)\n", 39 | " if z == goal:\n", 40 | " return LongerPath\n", 41 | " NewPaths.add(LongerPath)\n", 42 | " Visited .add(z)\n", 43 | " print(f'Iteration {n}: {len(NewPaths)} new states found.')\n", 44 | " if NewPaths == set():\n", 45 | " return\n", 46 | " Paths = NewPaths" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": null, 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [] 55 | } 56 | ], 57 | "metadata": { 58 | "@webio": { 59 | "lastCommId": null, 60 | "lastKernelId": null 61 | }, 62 | "kernelspec": { 63 | "display_name": "Python 3", 64 | "language": "python", 65 | "name": "python3" 66 | }, 67 | "language_info": { 68 | "codemirror_mode": { 69 | "name": "ipython", 70 | "version": 3 71 | }, 72 | "file_extension": ".py", 73 | "mimetype": "text/x-python", 74 | "name": "python", 75 | "nbconvert_exporter": "python", 76 | "pygments_lexer": "ipython3", 77 | "version": "3.9.0" 78 | } 79 | }, 80 | "nbformat": 4, 81 | "nbformat_minor": 4 82 | } 83 | -------------------------------------------------------------------------------- /Python/Exercises/cspSolver.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module defines a simple backtracking solver to compute the solution of 3 | a constraint satisfaction problems. 4 | """ 5 | 6 | import extractVariables as ev 7 | 8 | def arb(M): 9 | "Return an arbitrary element form the set M" 10 | for x in M: 11 | return x 12 | 13 | class Backtrack(Exception): 14 | pass 15 | 16 | def solve(CSP): 17 | "Compute a solution for the given constraint satisfaction problem." 18 | Variables, Values, Constraints = CSP 19 | CSP = (Variables, 20 | Values, 21 | [(f, ev.extractVars(f) & set(Variables)) for f in Constraints] 22 | ) 23 | try: 24 | return backtrack_search({}, CSP) 25 | except Backtrack: 26 | return # no solution found 27 | 28 | def backtrack_search(Assignment, CSP): 29 | """ 30 | Given a partial variable assignment, this function tries to complete this assignment 31 | towards a solution of the CSP. 32 | """ 33 | (Variables, Values, Constraints) = CSP 34 | if len(Assignment) == len(Variables): 35 | return Assignment 36 | var = [x for x in Variables if x not in Assignment][0] 37 | for value in Values: 38 | try: 39 | if isConsistent(var, value, Assignment, Constraints): 40 | NewAssign = Assignment.copy() 41 | NewAssign[var] = value 42 | return backtrack_search(NewAssign, CSP) 43 | except Backtrack: 44 | continue 45 | # all values have been tried without success, no solution has been found 46 | raise Backtrack() 47 | 48 | def isConsistent(var, value, Assignment, Constraints): 49 | NewAssign = Assignment.copy() 50 | NewAssign[var] = value 51 | return all(eval(f, NewAssign) for (f, Vs) in Constraints 52 | if var in Vs and Vs <= NewAssign.keys() 53 | ) 54 | -------------------------------------------------------------------------------- /Python/Exercises/davisPutnam.py: -------------------------------------------------------------------------------- 1 | def complement(l): 2 | "Compute the complement of the literal L." 3 | if isinstance(l, str): 4 | return ('¬', l) 5 | else: 6 | return l[1] 7 | 8 | def extractVariable(l): 9 | "Extract the propositional variable from the literal L." 10 | if isinstance(l, str): 11 | return l 12 | else: 13 | return l[1] 14 | 15 | def arb(S): 16 | "Return some member from the set S." 17 | for x in S: 18 | return x 19 | 20 | def selectVariable(Clauses, Forbidden): 21 | return arb({ extractVariable(L) for C in Clauses for L in C } - Forbidden) 22 | 23 | def reduce(Clauses, l): 24 | lBar = complement(l) 25 | return { C - { lBar } for C in Clauses if lBar in C } \ 26 | | { C for C in Clauses if lBar not in C and l not in C } \ 27 | | { frozenset({l}) } 28 | 29 | def saturate(Clauses): 30 | S = Clauses.copy() 31 | Units = { C for C in S if len(C) == 1 } # set of unit clausesoccurring in C 32 | Used = set() # remember which unit clauses have already been used 33 | while len(Units) > 0: # iterate as long as we derive new unit clauses 34 | unit = Units.pop() 35 | Used |= { unit } 36 | l = arb(unit) 37 | S = reduce(S, l) 38 | Units = { C for C in S if len(C) == 1 } - Used 39 | return S 40 | 41 | def solve(Clauses, Variables): 42 | S = saturate(Clauses); 43 | empty = frozenset() 44 | Falsum = {empty} 45 | if empty in S: # S is inconsistent 46 | return Falsum 47 | if all(len(C) == 1 for C in S): # S is trivial 48 | return S 49 | # case distinction on variaable p 50 | p = selectVariable(S, Variables) 51 | negP = complement(p) 52 | Result = solve(S | { frozenset({p}) }, Variables | { p }) 53 | if Result != Falsum: 54 | return Result 55 | return solve(S | { frozenset({negP}) }, Variables| { p }) 56 | 57 | def toString(S): 58 | "Convert the set S of frozen sets to a string where frozen sets are written as sets." 59 | if S == set(): 60 | return '{}' 61 | result = '{ ' 62 | for f in S: 63 | result += str(set(f)) + ', ' 64 | result = result[:-2] 65 | result += ' }' 66 | return result 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Python/Exercises/extractVariables.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module is able to extract the variable names occurring in a valid Python expression. 3 | """ 4 | 5 | import parser 6 | 7 | def isNumber(s): 8 | "Returns True if s can be parsed as a number" 9 | try: 10 | n = int(s) 11 | return True 12 | except: 13 | try: 14 | r = float(s) 15 | return True 16 | except: 17 | return False 18 | 19 | def extractVarsFromTree(tree): 20 | """ 21 | Returns the set of all variables occurring in the given syntax tree. 22 | The syntax tree is represented as a nested tuple. 23 | """ 24 | if isinstance(tree, str): 25 | if len(tree) > 0 and not isNumber(tree): 26 | return { tree } 27 | else: 28 | return set() 29 | if isinstance(tree, int): 30 | return set() 31 | if tree == (): 32 | return set() 33 | return extractVarsFromTree(tree[0]) | extractVarsFromTree(tree[1:]) 34 | 35 | def extractVars(expr): 36 | "Return the set of all variables occurring in the given expression." 37 | tree = parser.expr(expr) 38 | treeAsTuple = parser.st2tuple(tree) 39 | Operators = { '+', '-', '*', '/', '//', '%', '**', '<', '>', '<=', '>=', 40 | '!=', '==', '|', '&', '<<', '>>', '^', '>>=', '<<=', '|=', 41 | '**=', '+=', '-=', '*=', '/=', '//=', '%=', '^=', '&=', '(', ')' 42 | } 43 | Result = extractVarsFromTree(treeAsTuple) - Operators 44 | return { v for v in Result if v not in dir(__builtins__) } 45 | 46 | if __name__ == '__main__': 47 | print(extractVars('1.0 * x + y*z**2')) 48 | -------------------------------------------------------------------------------- /Python/Exercises/rangierProblem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/Exercises/rangierProblem.png -------------------------------------------------------------------------------- /Python/Exercises/style.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 102 | 103 | -------------------------------------------------------------------------------- /Python/Selection-Sort.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from IPython.core.display import HTML\n", 10 | "with open ('style.css', 'r') as file:\n", 11 | " css = file.read()\n", 12 | "HTML(css)" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "# Selection Sort" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "The algorithm *selection sort* sorts a given list `L` and works as follows:\n", 27 | " - If `L` is empty, `sort(L)` is also empty:\n", 28 | " $$\\texttt{sort([])} = \\texttt{[]}.$$\n", 29 | " - Otherwise, we first compute the minimum of `L`. Clearly, the minimum needs to be the\n", 30 | " first element of the sorted list. We remove this minimum from `L`, sort the remaining\n", 31 | " elements recursively, and finally attach the minimum at the front of this list:\n", 32 | " $$\\texttt{sort(L)} = \\texttt{[ min(L) ] + sort([}\\;x \\in \\texttt{L} \\;\\texttt{|}\\; x \\not= \\texttt{min}(L)\\;\\texttt{])}.$$" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": null, 38 | "metadata": {}, 39 | "outputs": [], 40 | "source": [ 41 | "def sort(L):\n", 42 | " \"This function return a sorted version of L.\"\n", 43 | " if L == []:\n", 44 | " return []\n", 45 | " m = min(L)\n", 46 | " return [m] + sort([x for x in L if x != m])" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": null, 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [ 55 | "L = [1, 5, 13, 27, 87, 91, 2, 12, 7, 5, 4, 3, 2, 1]" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "sort(L)" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": null, 70 | "metadata": {}, 71 | "outputs": [], 72 | "source": [] 73 | } 74 | ], 75 | "metadata": { 76 | "@webio": { 77 | "lastCommId": null, 78 | "lastKernelId": null 79 | }, 80 | "kernelspec": { 81 | "display_name": "Python 3", 82 | "language": "python", 83 | "name": "python3" 84 | }, 85 | "language_info": { 86 | "codemirror_mode": { 87 | "name": "ipython", 88 | "version": 3 89 | }, 90 | "file_extension": ".py", 91 | "mimetype": "text/x-python", 92 | "name": "python", 93 | "nbconvert_exporter": "python", 94 | "pygments_lexer": "ipython3", 95 | "version": "3.8.5" 96 | } 97 | }, 98 | "nbformat": 4, 99 | "nbformat_minor": 2 100 | } 101 | -------------------------------------------------------------------------------- /Python/cspSolver.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module defines a simple backtracking solver to compute the solution of 3 | a constraint satisfaction problems. 4 | """ 5 | 6 | import extractVariables as ev 7 | 8 | def arb(M): 9 | "Return an arbitrary element form the set M" 10 | for x in M: 11 | return x 12 | 13 | class Backtrack(Exception): 14 | pass 15 | 16 | def solve(CSP): 17 | "Compute a solution for the given constraint satisfaction problem." 18 | Variables, Values, Constraints = CSP 19 | CSP = (Variables, 20 | Values, 21 | [(f, ev.extractVars(f) & set(Variables)) for f in Constraints] 22 | ) 23 | try: 24 | return backtrack_search({}, CSP) 25 | except Backtrack: 26 | return # no solution found 27 | 28 | def backtrack_search(Assignment, CSP): 29 | """ 30 | Given a partial variable assignment, this function tries to complete this assignment 31 | towards a solution of the CSP. 32 | """ 33 | (Variables, Values, Constraints) = CSP 34 | if len(Assignment) == len(Variables): 35 | return Assignment 36 | var = [x for x in Variables if x not in Assignment][0] 37 | for value in Values: 38 | try: 39 | if isConsistent(var, value, Assignment, Constraints): 40 | NewAssign = Assignment.copy() 41 | NewAssign[var] = value 42 | return backtrack_search(NewAssign, CSP) 43 | except Backtrack: 44 | continue 45 | # all values have been tried without success, no solution has been found 46 | raise Backtrack() 47 | 48 | def isConsistent(var, value, Assignment, Constraints): 49 | NewAssign = Assignment.copy() 50 | NewAssign[var] = value 51 | return all(eval(f, NewAssign) for (f, Vs) in Constraints 52 | if var in Vs and Vs <= NewAssign.keys() 53 | ) 54 | -------------------------------------------------------------------------------- /Python/davisPutnam.py: -------------------------------------------------------------------------------- 1 | def complement(l): 2 | "Compute the complement of the literal L." 3 | if isinstance(l, str): 4 | return ('¬', l) 5 | else: 6 | return l[1] 7 | 8 | def extractVariable(l): 9 | "Extract the propositional variable from the literal L." 10 | if isinstance(l, str): 11 | return l 12 | else: 13 | return l[1] 14 | 15 | def arb(S): 16 | "Return some member from the set S." 17 | for x in S: 18 | return x 19 | 20 | def selectVariable(Clauses, Forbidden): 21 | return arb({ extractVariable(L) for C in Clauses for L in C } - Forbidden) 22 | 23 | def reduce(Clauses, l): 24 | lBar = complement(l) 25 | return { C - { lBar } for C in Clauses if lBar in C } \ 26 | | { C for C in Clauses if lBar not in C and l not in C } \ 27 | | { frozenset({l}) } 28 | 29 | def saturate(Clauses): 30 | S = Clauses.copy() 31 | Units = { C for C in S if len(C) == 1 } # set of unit clausesoccurring in C 32 | Used = set() # remember which unit clauses have already been used 33 | while len(Units) > 0: # iterate as long as we derive new unit clauses 34 | unit = Units.pop() 35 | Used |= { unit } 36 | l = arb(unit) 37 | S = reduce(S, l) 38 | Units = { C for C in S if len(C) == 1 } - Used 39 | return S 40 | 41 | def solve(Clauses, Variables): 42 | S = saturate(Clauses); 43 | empty = frozenset() 44 | Falsum = {empty} 45 | if empty in S: # S is inconsistent 46 | return Falsum 47 | if all(len(C) == 1 for C in S): # S is trivial 48 | return S 49 | # case distinction on variaable p 50 | p = selectVariable(S, Variables) 51 | negP = complement(p) 52 | Result = solve(S | { frozenset({p}) }, Variables | { p }) 53 | if Result != Falsum: 54 | return Result 55 | return solve(S | { frozenset({negP}) }, Variables| { p }) 56 | 57 | def toString(S): 58 | "Convert the set S of frozen sets to a string where frozen sets are written as sets." 59 | if S == set(): 60 | return '{}' 61 | result = '{ ' 62 | for f in S: 63 | result += str(set(f)) + ', ' 64 | result = result[:-2] 65 | result += ' }' 66 | return result 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Python/diff.py: -------------------------------------------------------------------------------- 1 | import exprParser as ep 2 | 3 | def diff(e): 4 | "differentiate the expressions e with respect to the variable x" 5 | if e[0] == '+': 6 | f , g = e[1:] 7 | fs, gs = diff(f), diff(g) 8 | return ('+', fs, gs) 9 | if e[0] == '-': 10 | f , g = e[1:] 11 | fs, gs = diff(f), diff(g) 12 | return ('-', fs, gs) 13 | if e[0] == '*': 14 | f , g = e[1:] 15 | fs, gs = diff(f), diff(g) 16 | return ('+', ('*', fs, g), ('*', f, gs)) 17 | if e[0] == '/': 18 | f , g = e[1:] 19 | fs, gs = diff(f), diff(g) 20 | return ('/', ('-', ('*', fs, g), ('*', f, gs)), ('*', g, g)) 21 | if e[0] == '**': 22 | f , g = e[1:] 23 | return diff(('exp', ('*', g, ('ln', f)))) 24 | if e[0] == 'ln': 25 | f = e[1] 26 | fs = diff(f) 27 | return ('/', fs, f) 28 | if e[0] == 'exp': 29 | f = e[1] 30 | fs = diff(f) 31 | return ('*', fs, e) 32 | if e[0] == 'x': 33 | return '1' 34 | return 0 35 | 36 | def test(s): 37 | t = ep.ExprParser(s).parse() 38 | d = diff(t) 39 | print("d/dx", s, "=", ep.toString(d)) 40 | 41 | if __name__ == "__main__": 42 | test("x") 43 | test("y") 44 | test("1") 45 | test("x+x") 46 | test("x+x+y") 47 | test("x*x") 48 | test("x/x") 49 | test("1/x") 50 | test("ln(x)") 51 | test("exp(x)") 52 | test("x ** x") 53 | 54 | -------------------------------------------------------------------------------- /Python/fixed-point.py: -------------------------------------------------------------------------------- 1 | from math import cos 2 | 3 | def solve(f, x0): 4 | """ 5 | Solve the equation f(x) = x using a fixed point iteration. x0 is the start value. 6 | """ 7 | x = x0 8 | for n in range(10000): # at most 10000 iterations 9 | oldX = x 10 | x = f(x) 11 | if abs(x - oldX) < 1.0e-15: 12 | return x 13 | 14 | print("solution to x = cos(x): ", solve(cos, 0)) 15 | print("solution to x = 1/(1+x):", solve(lambda x: 1/(1+x), 0)) 16 | -------------------------------------------------------------------------------- /Python/logic.sh: -------------------------------------------------------------------------------- 1 | conda create -n logic -c conda-forge python=3.13 jupyter_server nbclassic 2 | conda activate logic 3 | conda install -c anaconda matplotlib graphviz 4 | conda install -c conda-forge python-graphviz ipycanvas 5 | pip install nb_mypy 6 | pip install z3-solver 7 | -------------------------------------------------------------------------------- /Python/min_sort.py: -------------------------------------------------------------------------------- 1 | def minSort(L): 2 | if L == []: 3 | return [] 4 | m = min(L) 5 | return [m] + minSort([x for x in L if x != m]) 6 | 7 | if __name__ == '__main__': 8 | L = [ 2, 13, 5, 13, 7, 2, 4 ] 9 | print('minSort(', L, ') = ', minSort(L), sep='') 10 | -------------------------------------------------------------------------------- /Python/path-cyclic.py: -------------------------------------------------------------------------------- 1 | def findPaths(R): 2 | P = R 3 | while True: 4 | oldP = P 5 | P = R.union(pathProduct(P, R)) 6 | if P == oldP: 7 | return P 8 | 9 | def pathProduct(P, Q): 10 | return { join(S, T) for S in P for T in Q 11 | if S[-1] == T[0] and noCycle(S, T) 12 | } 13 | 14 | def noCycle(T1, T2): 15 | return len({ x for x in T1 }.intersection({ x for x in T2 })) == 1 16 | 17 | def join(S, T): 18 | return S + T[1:] 19 | 20 | R = { (1,2), (2,3), (1,3), (2,4), (4,5), (4, 1) } 21 | print("R = ", R) 22 | print("Computing all paths:" ) 23 | P = findPaths(R) 24 | print("P = ", P) 25 | -------------------------------------------------------------------------------- /Python/path.py: -------------------------------------------------------------------------------- 1 | def findPaths(R): 2 | P = R 3 | while True: 4 | oldP = P 5 | P = R.union(pathProduct(P, R)) 6 | print(P) 7 | if P == oldP: 8 | return P 9 | 10 | def pathProduct(P, Q): 11 | return { join(S, T) for S in P for T in Q if S[-1] == T[0] } 12 | 13 | def join(S, T): 14 | return S + T[1:] 15 | 16 | R = { (1,2), (2,3), (1,3), (2,4), (4,5) } 17 | print("R = ", R) 18 | print("Computing all paths:" ) 19 | P = findPaths(R) 20 | print("P = ", P) 21 | -------------------------------------------------------------------------------- /Python/poker.py: -------------------------------------------------------------------------------- 1 | Values = { "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A" } 2 | Suits = { "c", "h", "d", "s" } 3 | Deck = { (v, s) for v in Values for s in Suits } 4 | Hole = { ("3", "c"), ("3", "s") } 5 | Rest = Deck - Hole 6 | Flops = { (k1, k2, k3) for k1 in Rest for k2 in Rest for k3 in Rest 7 | if len({ k1, k2, k3 }) == 3 8 | } 9 | Trips = { f for f in Flops if ("3", "d") in f or ("3", "h") in f } 10 | print(len(Trips) / len(Flops)) 11 | -------------------------------------------------------------------------------- /Python/send-more-money.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/Python/send-more-money.pdf -------------------------------------------------------------------------------- /Python/solve.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | x = 1.0 4 | old_x = 0.0 5 | i = 1 6 | while abs(x - old_x) >= 4.0E-16: 7 | old_x = x 8 | x = math.cos(x) 9 | print('{:2d}'.format(i), ': ', x, sep='') 10 | i += 1 11 | -------------------------------------------------------------------------------- /Python/sum-recursive.py: -------------------------------------------------------------------------------- 1 | def sum(n): 2 | if n == 0: 3 | return 0 4 | return sum(n-1) + n 5 | 6 | n = int(input("Enter a natural number: ")) 7 | total = sum(n) 8 | if n > 2: 9 | print("0 + 1 + 2 + ... + ", n, " = ", total, sep='') 10 | else: 11 | print(total) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Python/sum.py: -------------------------------------------------------------------------------- 1 | # This program reads a number n and computes the sum 1 + 2 + ... + n. 2 | n = input('Type a natural number and press return: ') 3 | n = int(n) 4 | s = { i for i in range(1, n+1) } 5 | s = sum(s) 6 | print('The sum 1 + 2 + ... + ', n, ' is equal to ', s, '.', sep= '') 7 | 8 | -------------------------------------------------------------------------------- /Python/tautology.py: -------------------------------------------------------------------------------- 1 | import propLogParser as plp 2 | 3 | def power(M): 4 | "Compute a list containing all subsets of the set M" 5 | if M == set(): 6 | return [ set() ] 7 | x = M.pop() 8 | L = power(M) 9 | return L + [ K | { x } for K in L ] 10 | 11 | def tautology(F): 12 | "Check, whether the formula F is a tautology" 13 | P = collectVars(F) 14 | A = power(P) 15 | if { evaluate(F, I) for I in A } == { True }: 16 | return True 17 | else: 18 | return [I for I in A if not evaluate(F, I)][0] 19 | 20 | def collectVars(F): 21 | "Collect all propositional variables occurring in the formula F" 22 | if isinstance(F, str): 23 | return { F } 24 | if F[0] == '⊤' or F[0] == '⊥': 25 | return set() 26 | if F[0] == '¬': 27 | return collectVars(F[1]) 28 | return collectVars(F[1]) | collectVars(F[2]) 29 | 30 | def evaluate(F, I): 31 | "Evaluate the propositional formula F using the interpretation I" 32 | if F[0] == '⊤': return True 33 | if F[0] == '⊥': return False 34 | if isinstance(F, str): 35 | return F in I 36 | if F[0] == '¬': return not evaluate(F[1], I) 37 | if F[0] == '∧': return evaluate(F[1], I) and evaluate(F[2], I) 38 | if F[0] == '∨': return evaluate(F[1], I) or evaluate(F[2], I) 39 | if F[0] == '→': return not evaluate(F[1], I) or evaluate(F[2], I) 40 | if F[0] == '↔': return evaluate(F[1], I) == evaluate(F[2], I) 41 | if F[0] == '⊕': return evaluate(F[1], I) != evaluate(F[2], I) 42 | 43 | def test(s): 44 | F = plp.LogicParser(s).parse() 45 | counterExample = tautology(F); 46 | if counterExample == True: 47 | print('The formula', s, 'is a tautology.') 48 | else: 49 | P = collectVars(F) 50 | print('The formula ', s, ' is not a tautology.') 51 | print('Counter example: ') 52 | for x in P: 53 | if x in counterExample: 54 | print(x, "↦ True") 55 | else: 56 | print(x, "↦ False") 57 | 58 | if __name__ == "__main__": 59 | test('¬(p ∨ q) ↔ ¬p ∧ ¬q') 60 | test('(p → q) → (¬p → q) → q') 61 | test('(p → q) → (¬p → ¬q)') 62 | test('(p ⊕ q) ↔ ¬(p ↔ q)') 63 | test('¬p ↔ (p → ⊥)') 64 | 65 | -------------------------------------------------------------------------------- /Python/transitive-closure.py: -------------------------------------------------------------------------------- 1 | def product(R1, R2): 2 | "Compute the relational product of R1 and R2." 3 | return { (x, z) for (x, y1) in R1 for (y2, z) in R2 if y1 == y2 } 4 | 5 | def transClosure(R): 6 | "Compute the transitive closure of the binary relation R." 7 | T = R 8 | while True: 9 | oldT = T 10 | T = product(R,T) | R 11 | if T == oldT: 12 | return T 13 | 14 | R = { (1,2), (2,3), (1,3), (2,4), (4,5) } 15 | print( "R = ", R ); 16 | print( "Computing the transitive closure of R:" ); 17 | T = transClosure(R); 18 | print( "R+ = ", T ); 19 | -------------------------------------------------------------------------------- /Python/unify.py: -------------------------------------------------------------------------------- 1 | def apply(t, σ): 2 | "Apply the substitution σ to the term t." 3 | if isinstance(t, set): # t is a set of clauses 4 | return { apply(c, σ) for c in t } 5 | if isinstance(t, frozenset): # t is a clause 6 | return frozenset({ apply(l, σ) for l in t }) 7 | if isinstance(t, str): # t is a variable 8 | if t in σ: 9 | return σ[t] 10 | else: 11 | return t 12 | else: 13 | f = t[0] 14 | ts = t[1:] 15 | return (f,) + tuple(apply(s, σ) for s in ts) 16 | 17 | def compose(σ, τ): 18 | Result = { x: apply(s, τ) for (x, s) in σ.items() } 19 | Result.update(τ) 20 | return Result 21 | 22 | def occurs(x, t): 23 | if x == t: 24 | return True 25 | if isinstance(t, str): 26 | return False 27 | return any(occurs(x, arg) for arg in t[1:]) 28 | 29 | def mgu(s, t): 30 | return solve({('≐', s, t)}, {}) 31 | 32 | def solve(E, σ): 33 | while E != set(): 34 | _, s, t = E.pop() 35 | if s == t: 36 | continue 37 | if isinstance(s, str): # s is a variable 38 | if occurs(s, t): 39 | return None 40 | else: 41 | E = apply(E, { s: t }) 42 | σ = compose(σ, { s: t }) 43 | elif isinstance(t, str): # t is a variable, but s is not 44 | E.add(('≐', t, s)) 45 | else: 46 | f , g = s[0] , t[0] 47 | sArgs, tArgs = s[1:] , t[1:] 48 | m , n = len(sArgs), len(tArgs) 49 | if f != g or m != n: 50 | return None 51 | else: 52 | E |= { ('≐', sArgs[i], tArgs[i]) for i in range(m) } 53 | return σ 54 | 55 | if __name__ == '__main__': 56 | import folParser as fp 57 | 58 | def parseTerm(s): 59 | parser = fp.LogicParser(s) 60 | return parser.parse() 61 | 62 | t1 = parseTerm('P(x1,F(x4))') 63 | t2 = parseTerm('P(x2,x3)') 64 | μ = mgu(t1, t2) 65 | print(μ) 66 | -------------------------------------------------------------------------------- /Python/updates.py: -------------------------------------------------------------------------------- 1 | from graphics import * 2 | 3 | win = GraphWin("Animation", 1500, 1500, autoflush=False) 4 | win.setCoords(0, 0, 1200, 1200) 5 | win.setBackground('black') 6 | for i in range(500): 7 | p = Point(600 + (i % 2) * 1, 600 - (i % 2) * 1) 8 | c = Circle(p, i) 9 | c.draw(win) 10 | c.setFill(color_rgb(abs(255 - i), min(255, i), 0)) 11 | update() 12 | c.undraw() 13 | win.close() 14 | -------------------------------------------------------------------------------- /Python/watson.py: -------------------------------------------------------------------------------- 1 | def power(M): 2 | "This function computes the power set of the set M." 3 | if M == set(): 4 | return { frozenset() } 5 | else: 6 | C = set(M) # C is a copy of M as we don't want to change the set M 7 | x = C.pop() # pop removes some element x from the set C 8 | P1 = power(C) 9 | P2 = { A | {x} for A in P1 } 10 | return P1 | P2 11 | 12 | def evaluate(F, I): 13 | "Evaluate the propositional formula F using the interpretation I" 14 | if isinstance(F, str): # F is a propositional variable 15 | return F in I # This variable is true if it occurs in I 16 | if F[0] == '⊤': return True 17 | if F[0] == '⊥': return False 18 | if F[0] == '¬': return not evaluate(F[1], I) 19 | if F[0] == '∧': return evaluate(F[1], I) and evaluate(F[2], I) 20 | if F[0] == '∨': return evaluate(F[1], I) or evaluate(F[2], I) 21 | if F[0] == '→': return not evaluate(F[1], I) or evaluate(F[2], I) 22 | if F[0] == '↔': return evaluate(F[1], I) == evaluate(F[2], I) 23 | 24 | import propLogParser as plp 25 | 26 | def transform(s): 27 | "transform the string s into a nested tuple" 28 | return plp.LogicParser(s).parse() 29 | 30 | P = { 'a', 'b', 'c' } 31 | # Aaron, Bernard, or Caine is guilty. 32 | f1 = 'a ∨ b ∨ c' 33 | # If Aaron is guilty, he has exactly one accomplice. 34 | f2 = 'a → b ∨ c' 35 | f3 = 'a → ¬(b ∧ c)' 36 | # If Bernard is innocent, then Caine is innocent, too. 37 | f4 = '¬b → ¬c' 38 | # If exactly two are guilty, then Caine is one of them. 39 | f5 = '¬(¬c ∧ a ∧ b)' 40 | # If Caine is innocent, then Aaron is guilty. 41 | f6 = '¬c → a' 42 | Fs = { f1, f2, f3, f4, f5, f6 }; 43 | Fs = { transform(f) for f in Fs } 44 | 45 | def allTrue(Fs, I): 46 | return all({evaluate(f, I) for f in Fs}) 47 | 48 | print({ I for I in power(P) if allTrue(Fs, I) }) 49 | -------------------------------------------------------------------------------- /Python/wolf-goat-cabbage.py: -------------------------------------------------------------------------------- 1 | def problem(S): 2 | return ('farmer' not in S) and \ 3 | (('goat' in S and 'cabbage' in S) or # goat eats cabbage 4 | ('wolf' in S and 'goat' in S) ) # wolf eats goat 5 | 6 | All = frozenset({ 'farmer', 'wolf', 'goat', 'cabbage' }) 7 | States = { S for S in power(All) if not problem(S) and 8 | not problem(All - S) 9 | } 10 | R1 = { (S, S - B) for S in States for B in power(S) 11 | if S - B in States and 'farmer' in B and len(B) <= 2 12 | } 13 | R2 = { (S2, S1) for (S1, S2) in R1 } 14 | R = R1 | R2 15 | start = All 16 | goal = frozenset() 17 | Path = findPath(start, goal, R) 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # An Introduction to Logic for Computer Science 2 | 3 | These are the resources for my lecture on theoretical computer science I. 4 | The main topic of this lecture is logic. The algorithms discussed are implemented 5 | in Python via Jupyter notebooks. 6 | -------------------------------------------------------------------------------- /SetlX/allValuations.stlx: -------------------------------------------------------------------------------- 1 | // p is a set of propostional variables. This functions computes the set 2 | // of all propositional valuations that can be build with the variables 3 | // of p. 4 | allValuations := procedure(p) { 5 | if (p == {}) { 6 | return { {} }; 7 | } 8 | x := from(p); 9 | a := allValuations(p); 10 | return { { [x, true] } + i : i in a } + { { [x, false] } + i : i in a }; 11 | }; 12 | 13 | test := procedure(p) { 14 | print("testing $p$"); 15 | for (i in allValuations(p)) { 16 | print(i); 17 | } 18 | }; 19 | 20 | run := procedure(n) { 21 | for (k in [1 .. n]) { 22 | print("n = $k$:"); 23 | p := { "x" + i : i in [1 .. k] }; 24 | test(p); 25 | } 26 | }; 27 | 28 | run(5); 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SetlX/append-match.stlx: -------------------------------------------------------------------------------- 1 | // Append the item x at the end of the list l. The list l is 2 | // represented using the function symbols "cons" and "nil". 3 | append := procedure(l, x) { 4 | match (l) { 5 | case @nil(): return @cons(x, @nil()); 6 | case @cons(head, tail): return @cons(head, append(tail, x)); 7 | default: abort("append($l$, $x$)"); 8 | } 9 | }; 10 | l := @cons(1, @cons(2, @cons(3, @nil()))); 11 | print(append(l, 4)); 12 | 13 | -------------------------------------------------------------------------------- /SetlX/append.stlx: -------------------------------------------------------------------------------- 1 | // Append the item x at the end of the list l. The list l is 2 | // represented using the function symbols "cons" and "nil". 3 | // This program is ugly, the same function can be coded much 4 | // better using the match construct. 5 | append := procedure(l, x) { 6 | print(l); 7 | if (fct(l) == "nil") { 8 | return @cons(x, @nil()); 9 | } 10 | [head, tail] := args(l); 11 | return @cons(head, append(tail, x)); 12 | }; 13 | l := @cons(1, @cons(2, @cons(3, @nil()))); // corresponds to [1,2,3] 14 | print(append(l, 4)); 15 | 16 | -------------------------------------------------------------------------------- /SetlX/arb.stlx: -------------------------------------------------------------------------------- 1 | s := { 13, 5, 7, 2, 3 }; 2 | x := arb(s); 3 | print("x = ", x); 4 | print("s = ", s); 5 | -------------------------------------------------------------------------------- /SetlX/bug.stlx: -------------------------------------------------------------------------------- 1 | test := procedure(n) { 2 | print("n = $n$"); 3 | try { 4 | print("check($n$ == 5)"); 5 | check(n == 5); 6 | print("done!"); 7 | return; 8 | } catch (e) { 9 | // Check whether its a real error and rethrow the error 10 | // if necessary. If we don't do this, debugging will 11 | // be a nightmare! 12 | if (e != "backtrack") { 13 | throw(e); 14 | } 15 | } 16 | test(n + 1); 17 | }; 18 | 19 | // throw an exception if condition is false 20 | check := procedure(condition) { 21 | print(condition); 22 | if (!condition) { 23 | throw("backtrack"); 24 | } 25 | }; 26 | 27 | test(1); 28 | 29 | -------------------------------------------------------------------------------- /SetlX/buggy-function.stlx: -------------------------------------------------------------------------------- 1 | R := { [1, 1], [1, 4], [3, 3] }; 2 | print( "R[1] = $R[1]$" ); 3 | print( "R[2] = $R[2]$" ); 4 | print( "{ R[1], R[2] } = ${ R[1], R[2] }$" ); 5 | print( "R{1} = $R{1}$" ); 6 | print( "R{2} = $R{2}$" ); 7 | -------------------------------------------------------------------------------- /SetlX/check-equivalence.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/check-equivalence.stlx -------------------------------------------------------------------------------- /SetlX/completeness.stlx: -------------------------------------------------------------------------------- 1 | // This procedure computes the complement of the literal l. 2 | complement := procedure(l) { 3 | match (l) { 4 | case !p : return p; 5 | case p : return !p; 6 | } 7 | }; 8 | // This procedure extracts the variable from a literal l. 9 | extractVar := procedure(l) { 10 | match (l) { 11 | case !p : return p; 12 | case p : return p; 13 | } 14 | }; 15 | // Given a set of clauses M, this procedure returns a set containing all 16 | // propositional variables occurring in M. 17 | collectVars := procedure(M) { 18 | return { extractVar(l) : C in M, l in C }; 19 | }; 20 | // This procedure takes two clauses C1 and C2 and computes the set of all 21 | // clauses that result from an application of the cut rule with the premisses 22 | // C1 and C2. 23 | cutRule := procedure(C1, C2) { 24 | return { (C1-{l}) + (C2-{complement(l)}) : l in C1 | complement(l) in C2 }; 25 | }; 26 | // This procedure takes a set of clauses and performs all applications 27 | // of the cut rule that are possible. The resulting set of clauses is 28 | // returned. 29 | saturate := procedure(Clauses) { 30 | while (true) { 31 | Derived := {} +/ { cutRule(C1, C2) : C1 in Clauses, C2 in Clauses }; 32 | if ({} in Derived) { 33 | return { {} }; // clauses are inconsistent 34 | } 35 | Derived -= Clauses; // newly derived clauses 36 | print("number of newly derived clauses: $#Derived$"); 37 | if (Derived == {}) { 38 | return Clauses; // no new clauses found 39 | } 40 | Clauses += Derived; 41 | } 42 | }; 43 | // Given a set of Clauses, the procedure findValuation tries to find a 44 | // propositional valuation satisfying theses clauses. If there is no 45 | // such valuation, false is returned instead. 46 | findValuation := procedure(Clauses) { 47 | Variables := collectVars(Clauses); 48 | Clauses := saturate(Clauses); 49 | if ({} in Clauses) { 50 | return false; 51 | } 52 | Literals := {}; 53 | for (p in Variables) { 54 | if (exists(C in Clauses | 55 | p in C && C - {p} <= {complement(l) : l in Literals}) 56 | ) { 57 | Literals += { p }; 58 | } else { 59 | Literals += { !p }; 60 | } 61 | } 62 | return Literals; 63 | }; 64 | -------------------------------------------------------------------------------- /SetlX/count.stlx: -------------------------------------------------------------------------------- 1 | count := procedure(l) { 2 | return #{ s in l | s[1] == "k" }; 3 | }; 4 | -------------------------------------------------------------------------------- /SetlX/davis-putnam.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/davis-putnam.stlx -------------------------------------------------------------------------------- /SetlX/diff.stlx: -------------------------------------------------------------------------------- 1 | // In order to make the function parseTerm available, we need to load 2 | // the term utilities form the library below. 3 | loadLibrary("termUtilities"); 4 | 5 | // differentiate the term t with respect to the variable x 6 | diff := procedure(t, x) { 7 | match (t) { 8 | case a + b : 9 | return diff(a, x) + diff(b, x); 10 | case a - b : 11 | return diff(a, x) - diff(b, x); 12 | case a * b : 13 | return diff(a, x) * b + a * diff(b, x); 14 | case a / b : 15 | return ( diff(a, x) * b - a * diff(b, x) ) / (b * b); 16 | case a ** b : 17 | return diff( @exp(b * @ln(a)), x); 18 | case @ln(a) : 19 | return diff(a, x) / a; 20 | case @exp(a) : 21 | return diff(a, x) * @exp(a); 22 | case v | v == x : 23 | return 1; 24 | case y | isVariable(y) : // must be different from x 25 | return 0; 26 | case n | isNumber(n): 27 | return 0; 28 | } 29 | }; 30 | 31 | test := procedure(s) { 32 | t := parseTerm(s); 33 | v := parseTerm("x"); 34 | d := diff(t, v); 35 | print("d/dx($s$) = $d$\n"); 36 | }; 37 | 38 | test("x"); 39 | test("y"); 40 | test("1"); 41 | test("x+x"); 42 | test("x+x+y"); 43 | test("x*x"); 44 | test("x/x"); 45 | test("1/x"); 46 | test("ln(x)"); 47 | test("exp(x)"); 48 | test("x ** x"); 49 | 50 | -------------------------------------------------------------------------------- /SetlX/evaluate.stlx: -------------------------------------------------------------------------------- 1 | loadLibrary("termUtilities"); 2 | // Die Prozedur eval(f, I) wertet die aussagen-logische Formel f unter 3 | // der aussagen-logischen Interpretation I aus. 4 | evaluate := procedure(f, I) { 5 | match (f) { 6 | case true: return true; 7 | case false: return false; 8 | case p | isVariable(p): return I[p]; 9 | case !g: return !evaluate(g, I); 10 | case g && h: return evaluate(g, I) && evaluate(h, I); 11 | case g || h: return evaluate(g, I) || evaluate(h, I); 12 | case g => h: return evaluate(g, I) => evaluate(h, I); 13 | case g <==> h: return evaluate(g, I) == evaluate(h, I); 14 | default: abort("syntax error in evaluate($f$, $I$)"); 15 | } 16 | }; 17 | 18 | f := parseTerm("(p => q) => (!p => q) => q"); 19 | p := parseTerm("p"); 20 | q := parseTerm("q"); 21 | I := { [ p, true ], [ q, true ] }; 22 | print( "evaluate($f$, $I$) = $evaluate(f, I)$" ); 23 | I := { [ p, true ], [ q, false ] }; 24 | print( "evaluate($f$, $I$) = $evaluate(f, I)$" ); 25 | I := { [ p, false ], [ q, true ] }; 26 | print( "evaluate($f$, $I$) = $evaluate(f, I)$" ); 27 | I := { [ p, false ], [ q, false ] }; 28 | print( "evaluate($f$, $I$) = $evaluate(f, I)$" ); 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SetlX/evaluateOld.stlx: -------------------------------------------------------------------------------- 1 | // Die Prozedur eval(f, I) wertet die aussagen-logische Formel f unter 2 | // der aussagen-logischen Interpretation I aus. 3 | evaluate := procedure(f, i) { 4 | switch { 5 | case f == 1: return true; 6 | case f == 0: return false; 7 | case isString(f): return i[f]; 8 | case f[1] == "-": return !evaluate(f[2], i); 9 | case f[2] == "*": return evaluate(f[1], i) && evaluate(f[3], i); 10 | case f[2] == "+": return evaluate(f[1], i) || evaluate(f[3], i); 11 | case f[2] == "->": return !evaluate(f[1], i) || evaluate(f[3], i); 12 | case f[2] == "<->": return evaluate(f[1], i) == evaluate(f[3], i); 13 | default: print("evaluate($f$): syntax error "); 14 | } 15 | }; 16 | 17 | f := [ [ "p", "->", "q" ], "->", [ [ [ "-", "p" ], "->", "q" ], "->", "q" ] ]; 18 | f := [ [ "p", "->", "q" ], "->", [ [ "p", "->", [ "-", "q" ] ], "->", "q" ] ]; 19 | 20 | i := { [ "p", true ], [ "q", true ] }; 21 | print( "evaluate($f$, $i$) = $evaluate(f, i)$" ); 22 | i := { [ "p", true ], [ "q", false ] }; 23 | print( "evaluate($f$, $i$) = $evaluate(f, i)$" ); 24 | i := { [ "p", false ], [ "q", true ] }; 25 | print( "evaluate($f$, $i$) = $evaluate(f, i)$" ); 26 | i := { [ "p", false ], [ "q", false ] }; 27 | print( "evaluate($f$, $i$) = $evaluate(f, i)$" ); 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SetlX/fibonacci-combinatorics.stlx: -------------------------------------------------------------------------------- 1 | // create all lists of length n containing elements from the set s 2 | allLists := procedure(s, n) { 3 | if (n == 0) { 4 | return { [] }; 5 | } 6 | return { [ x ] + l : x in s, l in allLists(s, n-1) }; 7 | }; 8 | 9 | print("allLists(${4,5}$, 2) = $allLists({4,5}, 2)$"); 10 | 11 | fibonacciLists := procedure(n) { 12 | return #{ l : k in { 0 .. n-1 }, l in allLists({1, 2}, k) | +/ l == n-1 }; 13 | }; 14 | 15 | for (n in [0 .. 16]) { 16 | print("fib($n$) = $fibonacciLists(n)$"); 17 | } 18 | -------------------------------------------------------------------------------- /SetlX/find-path.stlx: -------------------------------------------------------------------------------- 1 | reachable := procedure(x, y, R) { 2 | P := { [x] }; 3 | while (true) { 4 | oldP := P; 5 | P := P + pathProduct(P, R); 6 | Found := { l : l in P | l[-1] == y }; 7 | if (Found != {}) { 8 | return arb(Found); 9 | } 10 | if (P == oldP) { 11 | return; 12 | } 13 | } 14 | }; 15 | pathProduct := procedure(P, Q) { 16 | return { join(x, y) : x in P, y in Q | x[-1] == y[1] && noCycle(x, y) }; 17 | }; 18 | noCycle := procedure(L1, L2) { 19 | return #({ x : x in L1 } * { x : x in L2 }) == 1; 20 | }; 21 | join := procedure(p, q) { 22 | return p + q[2..]; 23 | }; 24 | R := { [1,2], [2,3], [1,3], [2,4], [5, 1], [4,5] }; 25 | print( "R = ", R ); 26 | P := reachable(1, 5, R); 27 | print( "P = ", P ); 28 | 29 | -------------------------------------------------------------------------------- /SetlX/find-perfect.stlx: -------------------------------------------------------------------------------- 1 | perfect := procedure(n) { 2 | return +/ { x : x in {1 .. n-1} | n % x == 0 } == n; 3 | }; 4 | findPerfect := procedure() { 5 | n := 1; 6 | while (true) { 7 | if (perfect(n)) { 8 | if (n % 2 == 0) { 9 | print(n); 10 | } else { 11 | print("Heureka: Odd perfect number $n$ found!"); 12 | } 13 | } 14 | n := n + 1; 15 | } 16 | }; 17 | findPerfect(); 18 | -------------------------------------------------------------------------------- /SetlX/fixpoint.stlx: -------------------------------------------------------------------------------- 1 | solve := procedure(f, x0) { 2 | x := x0; 3 | for (n in [1 .. 10000]) { 4 | oldX := x; 5 | x := f(x); 6 | if (abs(x - oldX) < 1.0e-15) { 7 | return x; 8 | } 9 | } 10 | }; 11 | print("solution to x = cos(x): ", solve(cos, 0)); 12 | print("solution to x = 1.0/(1+x): ", solve(x |-> 1.0/(1 + x), 0)); 13 | 14 | 15 | -------------------------------------------------------------------------------- /SetlX/from.stlx: -------------------------------------------------------------------------------- 1 | printSet := procedure(S) { 2 | if (S == {}) { 3 | return; 4 | } 5 | x := from(S); 6 | print(x); 7 | printSet(S); 8 | }; 9 | S := { 13, 5, 7, 2, 4 }; 10 | printSet(S); 11 | -------------------------------------------------------------------------------- /SetlX/function.stlx: -------------------------------------------------------------------------------- 1 | Q := { [n, n**2] : n in {1..10} }; 2 | Q[5] := 7; 3 | print( "Q[3] = $Q[3]$" ); 4 | print( "Q[5] = $Q[5]$" ); 5 | print( "dom(Q) = $domain(Q)$" ); 6 | print( "rng(Q) = $range(Q)$" ); 7 | print( "Q = $Q$" ); 8 | -------------------------------------------------------------------------------- /SetlX/ggt-fast.stlx: -------------------------------------------------------------------------------- 1 | ggt := procedure(a, b) { 2 | while (b != 0) { 3 | r := a % b; 4 | a := b; 5 | b := r; 6 | } 7 | return a; 8 | }; 9 | 10 | for (x in { 2 .. 100 }) { 11 | for (y in { 2 .. 100 }) { 12 | print("ggt( $x$, $y$) = $ggt(x,y)$"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SetlX/ggt-loop.stlx: -------------------------------------------------------------------------------- 1 | ggt := procedure(x, y) { 2 | while (x != y) { 3 | if (x < y) { 4 | y := y - x; 5 | } else { 6 | x := x - y; 7 | } 8 | } 9 | return x; 10 | }; 11 | 12 | for (x in { 2 .. 100 }) { 13 | for (y in { 2 .. 100 }) { 14 | print("ggt( $x$, $y$) = $ggt(x,y)$"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SetlX/graph-2-dot.stlx: -------------------------------------------------------------------------------- 1 | // This function takes a relation together with a start and goal state 2 | // and converts this relation into a representation that is suitable for 3 | // the tool neato. Then neato is called to compute a graphical 4 | // representation. The tool neato is part of the graphviz tool set for 5 | // graph visualization. This tool set is freely available for download at 6 | // http://www.graphviz.org/. 7 | graph2Dot := procedure(relation, start, goal, file) { 8 | graph := "graph G {\n"; 9 | graph += " node [shape = box];\n"; 10 | graph += " overlap = scale;\n"; 11 | states := domain(relation) + range(relation); 12 | names := { [ start, 1 ] }; 13 | graph += " 1 [label = \"$state2String(start)$\", shape = ellipse, color = skyblue, style = filled];\n"; 14 | count := 2; 15 | for (s in states | s != start && s != goal) { 16 | graph += " $count$ [label = \"$state2String(s)$\"];\n"; 17 | names += { [s, count] }; 18 | count += 1; 19 | } 20 | names += { [ goal, count ] }; 21 | graph += " $count$ [label = \"$state2String(goal)$\", shape = ellipse, color = green, style = filled];\n"; 22 | for ([a, b] in relation) { 23 | na := names[a]; 24 | nb := names[b]; 25 | graph += " $na$ -- $nb$;\n"; 26 | } 27 | graph += "}\n"; 28 | writeFile("$file$.dot", [ graph ]); 29 | run("neato -Tpdf $file$.dot -o $file$.pdf"); 30 | run("open $file$.pdf"); 31 | }; 32 | 33 | // Turn an object into a string and remove any double quotes. 34 | removeQuote := s |-> +/ [ c: c in str(s) | c != '"' ]; 35 | 36 | // Transform a state into a string that is suitable as a node label. 37 | // Lists are written one element per line. 38 | state2String := procedure(state) { 39 | if (isList(state)) { 40 | return join([removeQuote(x) : x in state], "\\n"); 41 | } 42 | return removeQuote(state); 43 | }; 44 | -------------------------------------------------------------------------------- /SetlX/gruppen.stlx: -------------------------------------------------------------------------------- 1 | a := "a"; 2 | b := "b"; 3 | U := { a, b }; // the universe 4 | product := { [[a, a], a], [[a, b], b], [[b, a], b], [[b, b], a] }; 5 | equals := { [ x, x ] : x in U }; 6 | J := { [ "E", a ], [ "@@@product", product ], [ "@@@equals", equals ] }; 7 | S := [ U, J ]; 8 | I := { [ "x", a ], [ "y", b ], [ "z", a ] }; 9 | 10 | -------------------------------------------------------------------------------- /SetlX/hanoi-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/hanoi-frame.stlx -------------------------------------------------------------------------------- /SetlX/knf.stlx: -------------------------------------------------------------------------------- 1 | loadLibrary("termUtilities"); 2 | //////////////////////////////////////////////////////////////////////// 3 | // // 4 | // Transform a propositional formula in conjunctive normal form. // 5 | // // 6 | //////////////////////////////////////////////////////////////////////// 7 | 8 | // This procedure transforms the propositional formula F into 9 | // conjunctive normal form. 10 | normalize := procedure(F) { 11 | N1 := elimGdw(F); 12 | N2 := elimFolgt(N1); 13 | N3 := nnf(N2); 14 | N4 := cnf(N3); 15 | return simplify(N4); 16 | }; 17 | // Eliminate the operator "<==>" from F. 18 | elimGdw := procedure(F) { 19 | match (F) { 20 | case !G : return !elimGdw(G); 21 | case G && H : return elimGdw(G) && elimGdw(H); 22 | case G || H : return elimGdw(G) || elimGdw(H); 23 | case G => H : return elimGdw(G) => elimGdw(H); 24 | case G <==> H : return elimGdw((G => H) && (H => G)); 25 | default : return F; // F must be a propositional variable 26 | } 27 | }; 28 | // Eliminate the operator "=>" from F. 29 | elimFolgt := procedure(F) { 30 | match (F) { 31 | case !G : return !elimFolgt(G); 32 | case G && H : return elimFolgt(G) && elimFolgt(H); 33 | case G || H : return elimFolgt(G) || elimFolgt(H); 34 | case G => H : return elimFolgt(!G || H); 35 | default : return F; 36 | } 37 | }; 38 | // Compute the negation normal form of F. 39 | nnf := procedure(F) { 40 | match (F) { 41 | case !G : return neg(G); 42 | case G && H : return nnf(G) && nnf(H); 43 | case G || H : return nnf(G) || nnf(H); 44 | default : return F; 45 | } 46 | }; 47 | // This function computes the negation normal form of !F. 48 | neg := procedure(F) { 49 | match (F) { 50 | case !G : return nnf(G); 51 | case G && H : return neg(G) || neg(H); 52 | case G || H : return neg(G) && neg(H); 53 | default : return !F; 54 | } 55 | }; 56 | cnf := procedure(F) { 57 | match (F) { 58 | case !G : return { { !G } }; 59 | case G && H : return cnf(G) + cnf(H); 60 | case G || H : return { K1 + K2 : K1 in cnf(G), K2 in cnf(H) }; 61 | default : return { { F } }; // f is a variable 62 | } 63 | }; 64 | // Eliminate all trivial clauses from F 65 | simplify := procedure(F) { 66 | return { C : C in F | !isTrivial(C) }; 67 | }; 68 | // Is the clause C trivial? 69 | isTrivial := procedure(C) { 70 | return exists(p in C | !p in C); 71 | }; 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /SetlX/legendre.stlx: -------------------------------------------------------------------------------- 1 | // This procedure checks whether there is a prime between the numbers n ** 2 2 | // and (n+1) ** 2. 3 | legendre := procedure(n) { 4 | k := n * n + 1; 5 | while (k < (n + 1) ** 2) { 6 | if (isPrime(k)) { 7 | print("$n$**2 < $k$ < $n+1$**2"); 8 | return true; 9 | } 10 | k += 1; 11 | } 12 | return false; 13 | }; 14 | /* First, we read a number n. Next, we check whether Legendre's claim is true for 15 | this number. If its wrong, the function just returns and prints the counter example. 16 | Otherwise, n is incremented and we try to check, whether Legendre's claim is true 17 | for n+1. As long as we do not find a counter example, we keep going. 18 | 19 | This example demonstrates that the question, whether a function loops is, in general, 20 | undecidable, since if this question was decidable, the procedure for deciding it 21 | would be able to solve open mathematical questions. 22 | */ 23 | findCounterExample := procedure(n) { 24 | while (true) { 25 | if (legendre(n)) { 26 | n := n + 1; 27 | } else { 28 | print("Legendre was wrong, no prime between $n**2$ and $(n+1)**2$!"); 29 | return; 30 | } 31 | } 32 | }; 33 | findCounterExample(1); 34 | -------------------------------------------------------------------------------- /SetlX/min-sort.stlx: -------------------------------------------------------------------------------- 1 | minSort := procedure(L) { 2 | if (L == []) { 3 | return []; 4 | } 5 | m := min(L); 6 | return [m] + minSort([x : x in L | x != m]); 7 | }; 8 | 9 | L := [ 2, 13, 5, 13, 7, 2, 4 ]; 10 | print("sort($L$) = $minSort(L)$"); 11 | 12 | 13 | -------------------------------------------------------------------------------- /SetlX/mySort.stlx: -------------------------------------------------------------------------------- 1 | sort := procedure(l) { 2 | s := { x : x in l }; 3 | return [ x : x in s ]; 4 | }; 5 | -------------------------------------------------------------------------------- /SetlX/parse-propositional.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/parse-propositional.stlx -------------------------------------------------------------------------------- /SetlX/path-cyclic.stlx: -------------------------------------------------------------------------------- 1 | transClosure := procedure(R) { 2 | P := R; 3 | while (true) { 4 | oldP := P; 5 | P := R + pathProduct(R, P); 6 | print(P); 7 | if (P == oldP) { 8 | return P; 9 | } 10 | } 11 | }; 12 | pathProduct := procedure(P, Q) { 13 | return { join(x,y) : x in P, y in Q | x[-1] == y[1] && noCycle(x, y) }; 14 | }; 15 | // returns true iff the concatenation of l1 and l2 has only one shared element 16 | noCycle := procedure(L1, L2) { 17 | return #({ x : x in L1 } * { x : x in L2 }) == 1; 18 | }; 19 | join := procedure(p, q) { 20 | return p + q[2..]; 21 | }; 22 | R := { [1,2], [2,3], [1,3], [2,4], [4,5], [4, 1] }; 23 | print( "R = ", R ); 24 | print( "computing all paths" ); 25 | P := transClosure(R); 26 | print( "P = ", P ); 27 | -------------------------------------------------------------------------------- /SetlX/path.stlx: -------------------------------------------------------------------------------- 1 | transClosure := procedure(R) { 2 | P := R; 3 | while (true) { 4 | oldP := P; 5 | P := R + pathProduct(R, P); 6 | print(P); 7 | if (P == oldP) { 8 | return P; 9 | } 10 | } 11 | }; 12 | pathProduct := procedure(P, Q) { 13 | return { join(x, y) : x in P, y in Q | x[-1] == y[1] }; 14 | }; 15 | join := procedure(p, q) { 16 | return p + q[2..]; 17 | }; 18 | R := { [1,2], [2,3], [1,3], [2,4], [4,5], [4, 1] }; 19 | print( "R = ", R ); 20 | print( "computing all paths" ); 21 | P := transClosure(R); 22 | print( "P = ", P ); 23 | 24 | -------------------------------------------------------------------------------- /SetlX/poker-triple.stlx: -------------------------------------------------------------------------------- 1 | values := { "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A" }; 2 | suits := { "c", "h", "d", "s" }; 3 | deck := values >< suits; 4 | hole := { [ "3", "c" ], [ "3", "s" ] }; 5 | rest := deck - hole; 6 | flops := { { k1, k2, k3 } : k1 in rest, k2 in rest, k3 in rest 7 | | #{ k1, k2, k3 } == 3 8 | }; 9 | trips := { f : f in flops | [ "3", "d" ] in f || [ "3", "h" ] in f }; 10 | print(1.0 * #trips / #flops); 11 | 12 | -------------------------------------------------------------------------------- /SetlX/power.stlx: -------------------------------------------------------------------------------- 1 | power := procedure(x, y) { 2 | r := 1; 3 | while (y > 0) { 4 | if (y % 2 == 1) { 5 | r := r * x; 6 | } 7 | x := x * x; 8 | y := y / 2; 9 | } 10 | return r; 11 | }; 12 | 13 | for (x in [2 .. 10]) { 14 | for (y in [2 .. 10]) { 15 | print("power($x$, $y$) = $power(x, y)$"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SetlX/primes-eratosthenes.stlx: -------------------------------------------------------------------------------- 1 | startTime := now(); 2 | n := 10000; 3 | primes := [1 .. n]; 4 | for (i in [2 .. floor(sqrt(n))]) { 5 | if (primes[i] == 0) { 6 | continue; 7 | } 8 | j := i; 9 | while (i * j <= n) { 10 | primes[i * j] := 0; 11 | j += 1; 12 | } 13 | } 14 | stopTime := now(); 15 | print({ i : i in [2 .. n] | primes[i] != 0 }); 16 | print("computation took $stopTime - startTime$ milliseconds"); 17 | -------------------------------------------------------------------------------- /SetlX/primes-for.stlx: -------------------------------------------------------------------------------- 1 | startTime := now(); 2 | n := 10000; 3 | Primes := [1 .. n]; 4 | for (i in [2 .. n/2]) { 5 | j := 2; 6 | while (i * j <= n) { 7 | Primes[i * j] := 0; 8 | j += 1; 9 | } 10 | } 11 | stopTime := now(); 12 | print({ i : i in [2 .. n] | Primes[i] != 0 }); 13 | print("computation took $stopTime - startTime$ milliseconds"); 14 | 15 | -------------------------------------------------------------------------------- /SetlX/primes-forall.stlx: -------------------------------------------------------------------------------- 1 | isPrime := procedure(p) { 2 | return p != 1 && forall (x in divisors(p) | x in { 1, p }); 3 | }; 4 | divisors := procedure(p) { 5 | return { t : t in { 1 .. p } | p % t == 0 }; 6 | }; 7 | n := 100; 8 | primes := [ p : p in [1 .. n] | isPrime(p) ]; 9 | print( primes ); 10 | 11 | 12 | -------------------------------------------------------------------------------- /SetlX/primes-recursive.stlx: -------------------------------------------------------------------------------- 1 | 2 | // Compute the set of primes recursively using the algorithm of Eratosthenes. 3 | // 4 | allPrimes := procedure(numbers) { 5 | if (numbers == []) { 6 | return []; 7 | } 8 | first := numbers[1]; 9 | return [ first ] + allPrimes([ n : n in numbers[2..] | n % first != 0 ]); 10 | }; 11 | n := 10000; 12 | startTime := now(); 13 | primes := allPrimes([2 .. n]); 14 | stopTime := now(); 15 | print(primes); 16 | print("computation took $stopTime - startTime$ milliseconds"); 17 | -------------------------------------------------------------------------------- /SetlX/primes-sieve.stlx: -------------------------------------------------------------------------------- 1 | start := now(); 2 | n := 1000; 3 | // primes := {2 .. n} - { p * q : p in {2..n}, q in {2..n} }; 4 | primes := {2 .. n} - { p * q : p in {2..n/2}, q in {2..n/2} | p <= q && p * q <= n }; 5 | stop := now(); 6 | print(stop - start); 7 | print(primes); 8 | -------------------------------------------------------------------------------- /SetlX/primes-slim.stlx: -------------------------------------------------------------------------------- 1 | divisors := procedure(p) { 2 | return { t : t in {1..p} | p % t == 0 }; 3 | }; 4 | 5 | n := 100; 6 | primes := { p : p in {2..n} | divisors(p) == {1, p} }; 7 | print(primes); 8 | -------------------------------------------------------------------------------- /SetlX/primes-tuple.stlx: -------------------------------------------------------------------------------- 1 | divisors := procedure(p) { 2 | return [ t : t in [1..p] | p % t == 0 ]; 3 | }; 4 | 5 | n := 100; 6 | primes := [ p : p in [2 .. n] | divisors(p) == [1, p] ]; 7 | print(primes); 8 | 9 | -------------------------------------------------------------------------------- /SetlX/primes-while.stlx: -------------------------------------------------------------------------------- 1 | n := 100; 2 | primes := {}; 3 | p := 2; 4 | while (p <= n) { 5 | if (forall (t in primes | p % t != 0)) { 6 | print(p); 7 | primes += { p }; 8 | } 9 | p += 1; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /SetlX/queens-search.stlx: -------------------------------------------------------------------------------- 1 | // Search for a solution starting from state start. Once we have found a 2 | // solution, we pick an arbitrary solution and return it. 3 | // next is a function computing all states reachable from a given state. 4 | // isGoal is a function checking whether a given state is a solution. 5 | search := procedure(start, next, isGoal) { 6 | fringe := { start }; 7 | while (true) { 8 | print(#fringe); 9 | fringe := { k : s in fringe, k in next(s) }; 10 | solutions := { s : s in fringe | isGoal(s) }; 11 | if (solutions != {}) { 12 | print("The number of different solutions is $#solutions$."); 13 | return arb(solutions); 14 | } 15 | } 16 | }; 17 | // A state is represented as a list of length of numbers from the set 18 | // {1 .. 8}. This list has a length less or equal than 8. If a state is 19 | // given by the list 20 | // [a1, a2, a3] 21 | // the the queen in the first column is in row a1, the queen in the second 22 | // column is in row a2, the queen in the third column is in row a3, and 23 | // columns number 4 up to number 8 are empty. 24 | // 25 | // This procedure returns true iff placing the next queen in row is safe 26 | // given the current state. 27 | admissable := procedure(state, row) { 28 | if (row in state) { 29 | return false; 30 | } 31 | n := #state; 32 | col := n + 1; 33 | for (c in [1..n]) { 34 | if (state[c] + c == row + col || state[c] - c == row - col) { 35 | return false; 36 | } 37 | } 38 | return true; 39 | }; 40 | // The function next computes all admissable states that can be reached 41 | // in one step from the state s. 42 | next := procedure(s) { 43 | return { s + [ r ] : r in [1..8] | admissable(s, r) }; 44 | }; 45 | // Check whether the list is a solution. 46 | isGoal := l |-> #l == 8; 47 | // At the start, no queen has yet been placed on the board. 48 | start := []; 49 | solution := search(start, next, isGoal); 50 | print("solution = $solution$"); 51 | 52 | // This procedure prints the chessboard. 53 | printBoard := procedure(solution) { 54 | n := #solution; 55 | print( " " + ((8*n+1) * "-") ); 56 | for (row in [1..n]) { 57 | line := " |"; 58 | for (col in [1..n]) { 59 | line += " |"; 60 | } 61 | print(line); 62 | line := " |"; 63 | for (col in [1..n]) { 64 | if (solution[col] == row) { 65 | line += " Q |"; 66 | } else { 67 | line += " |"; 68 | } 69 | } 70 | print(line); 71 | line := " |"; 72 | for (col in [1..n]) { 73 | line += " |"; 74 | } 75 | print(line); 76 | print( " " + ((8*n+1) * "-") ); 77 | } 78 | }; 79 | 80 | printBoard(solution); 81 | -------------------------------------------------------------------------------- /SetlX/quine.stlx: -------------------------------------------------------------------------------- 1 | quine := procedure() { 2 | quote := char(34); 3 | indent := ' ' * 16; 4 | cmds := [ 5 | "quine := procedure() {", 6 | " quote := char(34);", 7 | " indent := ' ' * 16;", 8 | " cmds := [", 9 | " ];", 10 | " for (x in cmds[1..4]) {", 11 | " print(x);", 12 | " }", 13 | " for (x in cmds | x != 'quine();') {", 14 | " print(indent + quote + x + quote + ',');", 15 | " }", 16 | " print(indent + quote + 'quine();' + quote);", 17 | " for (x in cmds[5..]) {", 18 | " print(x);", 19 | " }", 20 | "};", 21 | "quine();" 22 | ]; 23 | for (x in cmds[1..4]) { 24 | print(x); 25 | } 26 | for (x in cmds | x != 'quine();') { 27 | print(indent + quote + x + quote + ','); 28 | } 29 | print(indent + quote + 'quine();' + quote); 30 | for (x in cmds[5..]) { 31 | print(x); 32 | } 33 | }; 34 | quine(); 35 | -------------------------------------------------------------------------------- /SetlX/quone.stlx: -------------------------------------------------------------------------------- 1 | quine := procedure() { 2 | quote := char(34); 3 | indent := ' ' * 16; 4 | cmds := [ 5 | "quine := procedure() {", 6 | " quote := char(34);", 7 | " indent := ' ' * 16;", 8 | " cmds := [", 9 | " ];", 10 | " for (x in cmds[1..4]) {", 11 | " print(x);", 12 | " }", 13 | " for (x in cmds | x != 'quine();') {", 14 | " print(indent + quote + x + quote + ',');", 15 | " }", 16 | " print(indent + quote + 'quine();' + quote);", 17 | " for (x in cmds[5..]) {", 18 | " print(x);", 19 | " }", 20 | "};", 21 | "quine();" 22 | ]; 23 | for (x in cmds[1..4]) { 24 | print(x); 25 | } 26 | for (x in cmds | x != 'quine();') { 27 | print(indent + quote + x + quote + ','); 28 | } 29 | print(indent + quote + 'quine();' + quote); 30 | for (x in cmds[5..]) { 31 | print(x); 32 | } 33 | }; 34 | quine(); 35 | -------------------------------------------------------------------------------- /SetlX/reverse.stlx: -------------------------------------------------------------------------------- 1 | reverse := procedure(l) { 2 | if (#l == 0) { 3 | return l; 4 | } 5 | return [l[#l]] + reverse(l[1..#l-1]); 6 | }; 7 | 8 | reverse2 := procedure(l) { 9 | n := #l; 10 | return [l[n + 1 - i] : i in [1 .. n]]; 11 | }; 12 | -------------------------------------------------------------------------------- /SetlX/simple-tuple.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/simple-tuple.stlx -------------------------------------------------------------------------------- /SetlX/simple.stlx: -------------------------------------------------------------------------------- 1 | A := { 1, 2, 3 }; 2 | B := { 2, 3, 4 }; 3 | // computing the union 4 | C := A + B; 5 | print(A, " + ", B, " = ", C); 6 | // computing the intersection 7 | C := A * B; 8 | print(A, " * ", B, " = ", C); 9 | // computing the set difference 10 | C := A - B; 11 | print(A, " - ", B, " = ", C); 12 | // computing the power set 13 | C := 2 ** A; 14 | print("2 ** ", A, " = ", C); 15 | // testing the inclusion relation 16 | print("(", A, " <= ", B, ") = ", (A <= B)); 17 | // test whether 1 is in A 18 | print("1 in ", A, " = ", 1 in A); 19 | // compute the cartesian product 20 | C := A >< B; 21 | print(A, " >< ", B, " = ", C); 22 | -------------------------------------------------------------------------------- /SetlX/solve.stlx: -------------------------------------------------------------------------------- 1 | x := 0.0; 2 | while (true) { 3 | old_x := x; 4 | x := cos(x); 5 | print(x); 6 | if (abs(x - old_x) < 1.0e-16) { 7 | print("x = ", x); 8 | break; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /SetlX/sort.stlx: -------------------------------------------------------------------------------- 1 | sort := procedure(L) { 2 | return [n : n in [min(L) .. max(L)] | n in L]; 3 | }; 4 | L := [13, 5, 7, 2, 4, 13]; 5 | print("sort($L$) = ", sort(L)); 6 | 7 | -------------------------------------------------------------------------------- /SetlX/stops.stlx: -------------------------------------------------------------------------------- 1 | stops := procedure(p, a) { 2 | f := "procedure(x) { while (true) { x := x + x; } }"; 3 | e := equal(f, p, a); 4 | if (e == 2) { 5 | return 2; 6 | } else { 7 | return 1 - e; 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /SetlX/sum-recursive.stlx: -------------------------------------------------------------------------------- 1 | sum := procedure(n) { 2 | if (n == 0) { 3 | return 0; 4 | } 5 | return sum(n-1) + n; 6 | }; 7 | n := read("Enter a natural number: "); 8 | total := sum(n); 9 | if (n > 2) { 10 | print("Sum 0 + 1 + 2 + ... + ", n, " = ", total); 11 | } else { 12 | print(total); 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /SetlX/sum.stlx: -------------------------------------------------------------------------------- 1 | /* Blah, 2 | blah 3 | */ 4 | // This program reads a number n and computes the sum 1 + 2 + ... + n. 5 | n := read("Type a natural number and press return: "); 6 | s := +/ { 1 .. n }; 7 | print("The sum 1 + 2 + ... + ", n, " is equal to ", s, "."); 8 | 9 | -------------------------------------------------------------------------------- /SetlX/switch.stlx: -------------------------------------------------------------------------------- 1 | print("Zahl eingeben:"); 2 | n := read(); 3 | m := n % 10; 4 | switch { 5 | case m == 0 : print("letzte Ziffer ist 0"); 6 | case m == 1 : print("letzte Ziffer ist 1"); 7 | case m == 2 : print("letzte Ziffer ist 2"); 8 | case m == 3 : print("letzte Ziffer ist 3"); 9 | case m == 4 : print("letzte Ziffer ist 4"); 10 | case m == 5 : print("letzte Ziffer ist 5"); 11 | case m == 6 : print("letzte Ziffer ist 6"); 12 | case m == 7 : print("letzte Ziffer ist 7"); 13 | case m == 8 : print("letzte Ziffer ist 8"); 14 | case m == 9 : print("letzte Ziffer ist 9"); 15 | default : print("impossible"); 16 | } 17 | -------------------------------------------------------------------------------- /SetlX/tautology.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/tautology.stlx -------------------------------------------------------------------------------- /SetlX/tautologyOld.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/tautologyOld.stlx -------------------------------------------------------------------------------- /SetlX/test-completeness.stlx: -------------------------------------------------------------------------------- 1 | loadLibrary("termUtilities"); 2 | load("knf.stlx"); 3 | load("completeness.stlx"); 4 | createValuation := procedure(Literals) { 5 | result := {}; 6 | for (l in Literals) { 7 | match(l) { 8 | case !p: result += { [p, false] }; 9 | case p: result += { [p, true ] }; 10 | } 11 | } 12 | return result; 13 | }; 14 | checkTautology := procedure(s) { 15 | print("\nChecking whether \"$s$\" is a tautology ..."); 16 | Clauses := normalize(parseTerm("!(" + s + ")")); 17 | Literals := findValuation(Clauses); 18 | if (Literals != false) { 19 | print("The formula $s$ is not a tautology. Counter example:"); 20 | print(createValuation(Literals)); 21 | } else { 22 | print("The formula $s$ is a tautology."); 23 | } 24 | }; 25 | s := "p => p"; 26 | checkTautology(s); 27 | s := "((p => q) => p) => p"; 28 | checkTautology(s); 29 | s := "(p => q) => (q => p)"; 30 | checkTautology(s); 31 | s := "p || (q && r) <==> (p || q) && (p || r)"; 32 | checkTautology(s); 33 | s := "p && (q || r) <==> (p && q) || (p && r)"; 34 | checkTautology(s); 35 | -------------------------------------------------------------------------------- /SetlX/test-davis-putnam.stlx: -------------------------------------------------------------------------------- 1 | load("davis-putnam.stlx"); 2 | 3 | m := parse("{ {p, q}, {p, !q}, {!p, q}, {!p, !q} }"); 4 | r := davisPutnam( m, {} ); 5 | print(" r = ", r); 6 | 7 | m := parse("{ {p, q, s}, {!p, r, !v}, {r, s}, {!r, q, !p}, " + 8 | "{!s, p}, {!p, !q, s, !r}, {p, !q, s}, {!r, !s}, {!p, !s} }"); 9 | r := davisPutnam( m, {} ); 10 | print(" r = ", r); 11 | 12 | m := parse("{ {p, q, s}, {!p, r, !t}, {r, s, p}, {!r, q, !p}, {!s, p}, {!p, !q, s, !r}, {p, !q, s}, {!r, !s}, {!p, !s} }"); 13 | r := davisPutnam( m, {} ); 14 | print(" r = ", r); 15 | 16 | m := parse("{ {p, q, s}, {!p, r, !t}, {r, s}, {!r, q, !p}, {!s, p}, {!p, !q, s, !r}, {p, !q, s}, {!r, !s}, {!p, !s} }"); 17 | r := davisPutnam( m, {} ); 18 | print(" r = ", r); 19 | -------------------------------------------------------------------------------- /SetlX/test-knf.stlx: -------------------------------------------------------------------------------- 1 | load("knf.stlx"); 2 | 3 | test := procedure(s) { 4 | F := parseTerm(s); 5 | print("The knf of $F$ is $normalize(F)$"); 6 | }; 7 | 8 | test("(a && !b) <==> (!b && a)"); 9 | test("(a => b) <==> (!a && b)"); 10 | test("(p && q => r) || !r => !p"); 11 | test("(p => q) => (!p => q) => q"); 12 | test("(p => q) && (q => r) => (p => r)"); 13 | test("(p => q) => (!p => !q)"); 14 | test("(p => q) && (!p => !q) => (q => p)"); 15 | -------------------------------------------------------------------------------- /SetlX/transitive-closure.stlx: -------------------------------------------------------------------------------- 1 | // The procedure call closure(r) computes the transitive closure 2 | // of the binary relation r. 3 | transClosure := procedure(R) { 4 | T := R; 5 | while (true) { 6 | oldT := T; 7 | T := R + product(R, T); 8 | print(T); 9 | if (T == oldT) { 10 | return T; 11 | } 12 | } 13 | }; 14 | product := procedure(R1, R2) { 15 | return { [x,z] : [x,y] in R1, [y,z] in R2 }; 16 | }; 17 | R := { [1,2], [2,3], [1,3], [2,4], [4,5] }; 18 | print( "R = ", R ); 19 | print( "Computing the transitive closure of R:" ); 20 | T := transClosure(R); 21 | print( "R+ = ", T ); 22 | 23 | -------------------------------------------------------------------------------- /SetlX/transitive-recursive.stlx: -------------------------------------------------------------------------------- 1 | transitiveClosure := procedure(R) { 2 | if (product(R, R) <= R) { 3 | return R; 4 | } 5 | return transitiveClosure(R + product(R, R)); 6 | }; 7 | product := procedure(R1, R2) { 8 | return { [x,z] : [x,y] in R1, [y,z] in R2 }; 9 | }; 10 | R := { [1,2], [2,3], [1,3], [2,4], [4,5] }; 11 | print( "R = ", R ); 12 | print( "Computing the transitive closure of R:" ); 13 | T := transitiveClosure(R); 14 | print( "R+ = ", T ); 15 | -------------------------------------------------------------------------------- /SetlX/tunnel-frame.stlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karlstroetmann/Logic/1e3796d5a401e3adc3f7b7bb74d3ba758419572d/SetlX/tunnel-frame.stlx -------------------------------------------------------------------------------- /SetlX/turing.stlx: -------------------------------------------------------------------------------- 1 | // The function checkTrue receives tow parameters: 2 | // * f is a function that takes one argument 3 | // * x can be anything 4 | // The function call checkTrue(f, x) is suposed to return true if and only if the 5 | // function call f(x) returns true. If f(x) does not return true or if the 6 | // computation of f(x) does not terminate, then checkTrue(f, x) returns false. 7 | checkTrue := procedure(f, x) { 8 | // To do: implement some magic! 9 | }; 10 | 11 | // The function turing receives one argument, which has to be a function. 12 | turing := procedure(f) { 13 | return !checkTrue(f, f); 14 | }; 15 | 16 | answer := turing(turing); 17 | 18 | 19 | /* Let us consider the function call checkTrue(turing, turing). This function 20 | call has to return either true or false. We consider these cases individually: 21 | 22 | 1. Case: checkTrue(turing, turing) == true 23 | 24 | Then turing(turing) == false. But according to its specification, 25 | checkTrue(turing, turing) should have returned false! 26 | 27 | 2. Case: checkTrue(turing, turing) == false 28 | 29 | Then turing(turing) == true. But according to its specification 30 | checkTrue(turing, turing) should have returned true! 31 | 32 | As we have a contradiction in either case, the function checkTrue does not exist! 33 | */ 34 | 35 | // return true iff f(x) terminates, false otherwise 36 | halting := procedure(f, x) { 37 | // To do: implement some magic! 38 | }; 39 | 40 | checkTrue := procedure(f, x) { 41 | return halting(f, x) == true; 42 | }; 43 | -------------------------------------------------------------------------------- /SetlX/watson.stlx: -------------------------------------------------------------------------------- 1 | load("evaluate.stlx"); 2 | // This procedure turns a subset M of the set of all variables 3 | // V into a propositional valuation I, such that I[x] is true 4 | // iff x is an element of the set M. 5 | createValuation := procedure(M, V) { 6 | return { [ x, x in M ] : x in V }; 7 | }; 8 | // Austin, Brian, or Colin is guilty. 9 | f1 := parse("a || b || c"); 10 | // If Austin is guilty, he has exactly one accomplice. 11 | f2 := parse("a => b || c"); // at least one accomplice 12 | f3 := parse("a => !(b && c)"); // at most one accomplice 13 | // If Brian is innocent, then Colin is innocent, too. 14 | f4 := parse("!b => !c"); 15 | // If exactly two are guilty, then Colin is one of them. 16 | f5 := parse("!(a && b && !c)"); 17 | // If Colin is innocent, then Austin is guilty. 18 | f6 := parse("!c => a"); 19 | fs := { f1, f2, f3, f4, f5, f6 }; 20 | V := { parseTerm("a"), parseTerm("b"), parseTerm("c") }; 21 | All := 2 ** V; 22 | print("All = ", All); 23 | // b is the set of all propositional valuations. 24 | B := { createValuation(M, V) : M in All }; 25 | S := { I : I in B | forall (f in fs | evaluate(f, I)) }; 26 | print("Set of all valuations satisfying all facts: ", S); 27 | if (#S == 1) { 28 | I := arb(S); 29 | offenders := { x : x in V | I[x] }; 30 | print("Set of offenders: ", offenders); 31 | } 32 | -------------------------------------------------------------------------------- /Vampire/barbier.tptp: -------------------------------------------------------------------------------- 1 | fof(a1, axiom, ! [X] : (barbier(X) => ! [Y] : (~rasiert(Y,Y) => rasiert(X,Y)))). 2 | fof(a2, axiom, ! [X] : (barbier(X) => ! [Y] : ( rasiert(Y,Y) => ~rasiert(X,Y)))). 3 | 4 | fof(t1, conjecture, ! [X] : (barbier(X) => gay(X))). 5 | -------------------------------------------------------------------------------- /Vampire/dragon.tptp: -------------------------------------------------------------------------------- 1 | % We try to prove that all communist dragons are happy. 2 | 3 | % A dragon is happy if all its children can fly. 4 | fof(a1, axiom, ! [D] : (! [C] : (child(C, D) => canFly(C)) => happy(D))). 5 | 6 | % Red dragons can fly. 7 | fof(a2, axiom, ! [D] : (red(D) => canFly(D))). 8 | 9 | % The children of communist dragons are communists. 10 | fof(a3, axiom, ! [D,C] : (child(C, D) & red(D) => red(C))). 11 | 12 | % Communist dragons are happy. 13 | fof(c, conjecture, ! [D] : (red(D) => happy(D))). 14 | -------------------------------------------------------------------------------- /Vampire/group-commutative.tptp: -------------------------------------------------------------------------------- 1 | % This file can be used to prove that groups of order 2 are commutattive. 2 | 3 | % e is the neutral element. 4 | fof(a1, axiom, ! [X] : mult(e,X) = X). 5 | 6 | % i(X) is the left inverse of X. 7 | fof(a2, axiom, ! [X] : mult(i(X), X) = e). 8 | 9 | % The law of associativity holds. 10 | fof(a3, axiom, ! [X,Y,Z] : mult(mult(X, Y), Z) = mult(X, mult(Y, Z))). 11 | 12 | % Every element is its own inverse. 13 | % fof(a4, axiom, ! [X] : mult(X, X) = e). 14 | 15 | % Then the law of commutativity should hold. 16 | fof(commute, conjecture, ! [X, Y] : mult(X, Y) = mult(Y, X)). 17 | -------------------------------------------------------------------------------- /Vampire/group-inverse-unique.tptp: -------------------------------------------------------------------------------- 1 | fof(neutral, axiom, ! [X] : mult(e,X) = X). 2 | fof(inverse, axiom, ! [X] : ? [Y] : mult(Y, X) = e). 3 | fof(assoc, axiom, ! [X,Y,Z] : mult(mult(X, Y), Z) = mult(X, mult(Y, Z))). 4 | 5 | fof(unique, conjecture, ! [X,Y1,Y2] : mult(Y1, X) = e & mult(Y2, X) = e => Y1 = Y2). 6 | -------------------------------------------------------------------------------- /Vampire/group-right-identity.tptp: -------------------------------------------------------------------------------- 1 | fof(neutral, axiom, ! [X] : mult(e, X) = X). 2 | fof(inverse, axiom, ! [X] : ? [Y] : mult(Y, X) = e). 3 | fof(assoc, axiom, ! [X,Y,Z] : mult(mult(X, Y), Z) = mult(X, mult(Y, Z))). 4 | 5 | fof(right, conjecture, ! [X] : mult(X, e) = X). 6 | -------------------------------------------------------------------------------- /Vampire/group-right-inverse.tptp: -------------------------------------------------------------------------------- 1 | fof(neutral, axiom, ! [X] : mult(e,X) = X). 2 | fof(inverse, axiom, ! [X] : ? [Y] : mult(Y, X) = e). 3 | fof(assoc, axiom, ! [X,Y,Z] : mult(mult(X, Y), Z) = mult(X, mult(Y, Z))). 4 | 5 | fof(right_i, conjecture, ! [X] : ? [Y] : mult(X, Y) = e). 6 | 7 | -------------------------------------------------------------------------------- /Vampire/non-commutative-group.tptp: -------------------------------------------------------------------------------- 1 | % We try to prove that every group is commutative. 2 | 3 | % e is the neutral element. 4 | fof(a1, axiom, ! [X] : mult(e,X) = X). 5 | 6 | % For every element X there is a left inverse element Y. 7 | fof(a2, axiom, ! [X] : ? [Y]: mult(Y, X) = e). 8 | 9 | % The law of associativity holds. 10 | fof(a3, axiom, ! [X,Y,Z] : mult(mult(X, Y), Z) = mult(X, mult(Y, Z))). 11 | 12 | % Question: Does the law of commutativity hold? 13 | fof(commute, conjecture, ! [X, Y] : mult(X, Y) = mult(Y, X)). 14 | -------------------------------------------------------------------------------- /Vampire/proof.txt: -------------------------------------------------------------------------------- 1 | 1. ? [X0] : (killed(X0,agatha) & lives_at_dreadbury(X0)) [input] 2 | 2. ! [X0] : (lives_at_dreadbury(X0) <=> (charles = X0 | butler = X0 | agatha = X0)) [input] 3 | 3. ! [X0,X1] : (killed(X0,X1) => hates(X0,X1)) [input] 4 | 4. ! [X0,X1] : (killed(X0,X1) => ~richer(X0,X1)) [input] 5 | 5. ! [X0] : (hates(agatha,X0) => ~hates(charles,X0)) [input] 6 | 6. ! [X0] : (hates(agatha,X0) <=> butler != X0) [input] 7 | 7. ! [X0] : (~richer(X0,agatha) => hates(butler,X0)) [input] 8 | 8. ! [X0] : (hates(agatha,X0) => hates(butler,X0)) [input] 9 | 9. ! [X0] : ? [X1] : ~hates(X0,X1) [input] 10 | 10. agatha != butler [input] 11 | 11. killed(agatha,agatha) [input] 12 | 12. ~killed(agatha,agatha) [negated conjecture 11] 13 | 14 | 16. ! [X0] : (charles = X0 | butler = X0 | agatha = X0 | ~lives_at_dreadbury(X0)) [flattening 14] 15 | 16 | 27. lives_at_dreadbury(sK0) [cnf transformation 23] 17 | 28. killed(sK0,agatha) [cnf transformation 23] 18 | 19 | 30. ~killed(X0,X1) | hates(X0,X1) [cnf transformation 3] 20 | 31. ~richer(X0,X1) | ~killed(X0,X1) [cnf transformation 3] 21 | 32. ~hates(charles,X0) | ~hates(agatha,X0) [cnf transformation 5] 22 | 34. hates(agatha,X0) | butler = X0 [cnf transformation 6] 23 | 35. richer(X0,agatha) | hates(butler,X0) [7] 24 | 36. ~hates(agatha,X0) | hates(butler,X0) [8] 25 | 37. ~hates(X0,sK1(X0)) [cnf transformation 9] 26 | 27 | 41. hates(sK0,agatha) [resolution 30,28] 28 | 29 | 44. ~killed(X0,agatha) | hates(butler,X0) [resolution 35,31] 30 | 31 | 46. hates(butler,X0) | butler = X0 [resolution 36,34] 32 | 47. hates(butler,sK0) [resolution 44,28] 33 | 48. butler = sK0 | agatha = sK0 | charles = sK0 [resolution 16,27] 34 | 50. 1 <=> charles = sK0 [avatar definition] 35 | 52. charles = sK0 <- (1) [avatar component clause 50] 36 | 54. 2 <=> agatha = sK0 [avatar definition] 37 | 56. agatha = sK0 <- (2) [avatar component clause 54] 38 | 58. 3 <=> butler = sK0 [avatar definition] 39 | 60. butler = sK0 <- (3) [avatar component clause 58] 40 | 61. 1 | 2 | 3 [avatar split clause 48,58,54,50] 41 | 65. killed(agatha,agatha) <- (2) [backward demodulation 28,56] 42 | 66. $false <- (2) [subsumption resolution 65,12] 43 | 67. ~2 [avatar contradiction clause 66] 44 | 68. hates(butler,butler) <- (3) [backward demodulation 47,60] 45 | 76. butler = sK1(butler) [resolution 46,37] 46 | 77. ~hates(butler,butler) [superposition 37,76] 47 | 78. $false <- (3) [subsumption resolution 77,68] 48 | 79. ~3 [avatar contradiction clause 78] 49 | 81. hates(charles,agatha) <- (1) [backward demodulation 41,52] 50 | 89. ~hates(agatha,agatha) <- (1) [resolution 81,32] 51 | 90. agatha = butler <- (1) [resolution 89,34] 52 | 91. $false <- (1) [subsumption resolution 90,10] 53 | 92. ~1 [avatar contradiction clause 91] 54 | 93. $false [avatar sat refutation 61,67,79,92] 55 | -------------------------------------------------------------------------------- /Vampire/transitive.tptp: -------------------------------------------------------------------------------- 1 | fof(subset, axiom, ! [X,Y]: (subset(X,Y) <=> (! [Z] : (member(Z,X) => member(Z,Y))))). 2 | 3 | fof(trans, conjecture, ! [X,Y,Z] : (subset(X,Y) & subset(Y,Z) => subset(X,Z))). 4 | 5 | -------------------------------------------------------------------------------- /Vampire/who-killed-agatha.tptp: -------------------------------------------------------------------------------- 1 | % Someone who lives in Dreadbury Mansion killed Aunt Agatha. Agatha, the butler, 2 | % and Charles live in Dreadbury Mansion, and are the only people who live 3 | % therein. A killer always hates his victim, and is never richer than his 4 | % victim. Charles hates no one that Aunt Agatha hates. Agatha hates everyone 5 | % except the butler. The butler hates everyone not richer than Aunt Agatha. The 6 | % butler hates everyone Aunt Agatha hates. No one hates everyone. Agatha is not 7 | % the butler. 8 | 9 | % Someone who lives in Dreadbury Mansion killed Aunt Agatha. 10 | fof(a1, axiom, ?[X] : (lives_at_dreadbury(X) & killed(X, agatha))). 11 | 12 | % Agatha, the butler, and Charles live in Dreadbury Mansion, and are the only 13 | % people who live therein. 14 | fof(a2, axiom, ![X] : (lives_at_dreadbury(X) <=> (X = agatha | X = butler | X = charles))). 15 | 16 | % A killer always hates his victim. 17 | fof(a3, axiom, ![X, Y]: (killed(X, Y) => hates(X, Y))). 18 | 19 | % A killer is never richer than his victim. 20 | fof(a4, axiom, ![X, Y]: (killed(X, Y) => ~richer(X, Y))). 21 | 22 | % Charles hates no one that Aunt Agatha hates. 23 | fof(a5, axiom, ![X]: (hates(agatha, X) => ~hates(charles, X))). 24 | 25 | % Agatha hates everyone except the butler. 26 | fof(a6, axiom, ![X]: (hates(agatha, X) <=> X != butler)). 27 | 28 | % The butler hates everyone not richer than Aunt Agatha. 29 | fof(a7, axiom, ![X]: (~richer(X, agatha) => hates(butler, X))). 30 | 31 | % The butler hates everyone Aunt Agatha hates. 32 | fof(a8, axiom, ![X]: (hates(agatha, X) => hates(butler, X))). 33 | 34 | % No one hates everyone. 35 | fof(a9, axiom, ![X]: ?[Y]: ~hates(X, Y)). 36 | 37 | % Agatha is not the butler. 38 | fof(a0, axiom, agatha != butler). 39 | 40 | % Hence, Agatha committed suicide. 41 | fof(c, conjecture, killed(agatha, agatha)). 42 | --------------------------------------------------------------------------------