<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Science  - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Science  - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 01 Jun 2026 18:37:32 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/science/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ The Logic, Philosophy, and Science of Software Testing – A Handbook for Developers ]]>
                </title>
                <description>
                    <![CDATA[ In an age of information overload, AI assistance, and rapid technological change, the ability to think clearly and reason soundly has never been more valuable. This handbook takes you on a journey from fundamental logical principles to their practica... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-logic-philosophy-and-science-of-software-testing-handbook-for-developers/</link>
                <guid isPermaLink="false">6851b75a6fd83aa331a8943b</guid>
                
                    <category>
                        <![CDATA[ Testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ debugging ]]>
                    </category>
                
                    <category>
                        <![CDATA[ logic ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Software Engineering ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ handbook ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Han Qi ]]>
                </dc:creator>
                <pubDate>Tue, 17 Jun 2025 18:43:38 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1750176539544/965a99ef-8aad-467c-ae6b-4a144e2d1117.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In an age of information overload, AI assistance, and rapid technological change, the ability to think clearly and reason soundly has never been more valuable.</p>
<p>This handbook takes you on a journey from fundamental logical principles to their practical applications in software development, scientific reasoning, and critical thinking.</p>
<p>Whether you're a high school student learning to think more clearly, a professional debugging complex systems, or simply someone curious about how sound reasoning works, this handbook provides tools for sharper, more reliable thinking.</p>
<h2 id="heading-what-well-cover">What We’ll Cover:</h2>
<h3 id="heading-part-i-foundational-theory"><strong>Part I: Foundational Theory</strong></h3>
<p>We start with the bedrock of formal logic – understanding implications, truth tables, and the core rules of reasoning.</p>
<p>You'll learn the scaffolding for everything that follows:</p>
<ul>
<li><p>How "if-then" statements actually work (spoiler: it's not always intuitive!)</p>
</li>
<li><p>The power of truth tables to map all possible scenarios</p>
</li>
<li><p>Why some arguments are valid while others are logical fallacies</p>
</li>
<li><p>The elegant relationship between <strong>Modus Ponens, Modus Tollens, and Contrapositives</strong></p>
</li>
</ul>
<h3 id="heading-part-ii-practical-applications"><strong>Part II: Practical Applications</strong></h3>
<p>Here's where logic comes alive in tangible ways:</p>
<p><strong>In Software Development:</strong></p>
<ul>
<li><p>How debugging mirrors logical reasoning, and why your tests might be lying to you</p>
</li>
<li><p>The logic behind Test-Driven Development and Mutation Testing</p>
</li>
</ul>
<p><strong>In Scientific Thinking:</strong></p>
<ul>
<li><p>Karl Popper's falsification principle and why it matters beyond academia</p>
</li>
<li><p>How <strong>Hypothesis Testing</strong> is just statistics meets <strong>Modus Tollens</strong></p>
</li>
</ul>
<p><strong>In Everyday Reasoning:</strong></p>
<ul>
<li><p>Spotting logical fallacies in arguments, media, and your thinking</p>
</li>
<li><p>The art of considering multiple causal paths instead of jumping to conclusions</p>
</li>
</ul>
<h3 id="heading-part-iii-philosophical-depths"><strong>Part III: Philosophical Depths</strong></h3>
<p>The final section confronts the beautiful complexity of applying pure logic to an impure world:</p>
<ul>
<li><p>Why perfect "<strong>if-and-only-if</strong>" relationships are the goal but rarely achievable</p>
</li>
<li><p>How modern software systems hide their complexity</p>
</li>
<li><p>The butterfly effect of bugs and why root cause analysis is often harder than it seems</p>
</li>
<li><p>Formal verification tools: from <strong>Prolog</strong> to <strong>Coq</strong> to <strong>TLA+</strong></p>
</li>
</ul>
<h2 id="heading-what-youll-gain">What You'll Gain</h2>
<h3 id="heading-for-students"><strong>For Students:</strong></h3>
<ul>
<li><p><strong>Critical thinking superpowers</strong>: Learn to spot flawed reasoning in arguments, social media, and news</p>
</li>
<li><p><strong>Academic advantage</strong>: These concepts appear in debates, philosophy, computer science, mathematics, and statistics</p>
</li>
</ul>
<h3 id="heading-for-software-engineers"><strong>For Software Engineers:</strong></h3>
<ul>
<li><p><strong>Debugging mastery</strong>: <em>Modus Tollens</em> for debugging: "If the output is wrong, what could cause it?"</p>
</li>
<li><p><strong>Testing philosophy</strong>: Move beyond "make the tests pass" to "prove the code is correct"</p>
</li>
<li><p><strong>Problem analysis</strong>: Avoid jumping to solutions before understanding the real problem</p>
</li>
<li><p><strong>System design</strong>: Think more rigorously about failure modes and edge cases, evaluate cause-and-effect relationships in complex systems</p>
</li>
<li><p><strong>Communication and career growth</strong>: Present arguments more clearly and persuasively, gain logical thinking skills that separate senior engineers from juniors</p>
</li>
</ul>
<h3 id="heading-for-scientists"><strong>For Scientists:</strong></h3>
<ul>
<li><p><strong>Experimental design</strong>: Strengthen your understanding of hypothesis testing and falsifiability</p>
</li>
<li><p><strong>Peer review</strong>: Better evaluate the logical soundness of research claims</p>
</li>
<li><p><strong>Grant writing</strong>: Structure arguments more persuasively using solid logical foundations</p>
</li>
</ul>
<h2 id="heading-pre-requisites">Pre-requisites</h2>
<p>I’ll introduce code samples starting in the second half of the article, so knowing a programming language would be helpful. The concepts in this article are programming language-agnostic, but I’ve used Python throughout for readability.</p>
<p>No prior formal logic or philosophy background is strictly necessary, but the following will let you reap the most benefits from this article:</p>
<ul>
<li><p>Experience in testing and debugging during software development.</p>
</li>
<li><p>Know what REPL (Read-Evaluate-Print-Loop) is if you want to try the Proof Assistants.</p>
</li>
<li><p>Knowledge of logical operators (NOT, AND, OR), and the fact that they take 1 or 2 boolean values as input and return a single boolean value as output.</p>
</li>
<li><p>Basic Algebraic Thinking: representing statements as variables (P, Q), the concept of NOT (¬) as an inversion of statements, and the concept that different input combinations can reach the same output.</p>
</li>
<li><p>Exposure to deductive reasoning, where inferences are made based on some facts, and fallacies, which are some ways arguments can be flawed.</p>
</li>
<li><p>Willingness to engage in conceptual back-and-forth between concrete English examples and abstract logical symbols.</p>
</li>
<li><p>Holding possibly conflicting ideas between the ideal logic world and the impure real world.</p>
</li>
<li><p>Openness to challenging intuition and following logical rules before applying your real-world experience.</p>
</li>
</ul>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-an-introduction-to-logic">An Introduction to Logic</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-truth-tables-mapping-all-possibilities">Truth Tables: Mapping All Possibilities</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-contrapositives-modus-ponens-modus-tollens">Contrapositives, Modus Ponens, Modus Tollens</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-origin-of-pq-science-and-reality">The Origin of P⟹Q: Science and Reality</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-revisiting-argument-forms-valid-inferences-and-common-fallacies">Revisiting Argument Forms: Valid Inferences and Common Fallacies</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-denying-the-antecedent-a-database-example">Denying the Antecedent: A Database Example</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-assigning-real-world-meanings-to-logic">Assigning Real-World Meanings to Logic</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-applying-logic-to-software-testing">Applying Logic to Software Testing</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-a-closer-look-at-testing">A Closer Look at Testing</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-revisiting-the-four-statements-for-coding">Revisiting the Four Statements for Coding</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-missing-ingredient-if-and-only-if">The Missing Ingredient - If and Only If</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-mutation-testing-testing-the-tests">Mutation Testing: Testing the Tests</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-toward-if-and-only-if-confidence">Toward If-and-Only-If Confidence</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-real-world-challenges">Real-World Challenges</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-glimmers-of-hope-tools-and-practices-for-clarity">Glimmers of Hope: Tools and Practices for Clarity</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-power-of-falsification-in-testing">The Power of Falsification in Testing</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-proof-assistants">Proof Assistants</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-food-for-thought">Food for Thought</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-qed-the-enduring-power-of-logic-in-an-uncertain-world">Q.E.D.: The Enduring Power of Logic in an Uncertain World</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-resources">Resources</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-glossary">Glossary</a></p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749064487021/b0404a1e-3257-4815-bc42-517b2ea955d0.jpeg" alt="man standing at edge of lake looking into the distance" class="image--center mx-auto" width="5056" height="3419" loading="lazy"></p>
<h2 id="heading-an-introduction-to-logic">An Introduction to Logic</h2>
<p>Imagine that the following statement is True:</p>
<p><strong>If you are a coding instructor, then you have a job.</strong></p>
<p>Now, do these make sense?</p>
<ol>
<li><p>You have no job, so you are not a coding instructor</p>
</li>
<li><p>You have a job, so you are a coding instructor</p>
</li>
<li><p>You are not a coding instructor, so you have no job</p>
</li>
</ol>
<h3 id="heading-interpretations">Interpretations</h3>
<p>Based on logic:</p>
<ul>
<li><p>Statement 1 is correct.</p>
</li>
<li><p>Statement 2 is wrong because you may have other jobs without being a coding instructor.</p>
</li>
<li><p>Statement 3 is wrong because you may or may not have a job, and as before, you may have other jobs without being a coding instructor.</p>
</li>
</ul>
<h3 id="heading-growing-complexity">Growing complexity</h3>
<p>These statements grow increasingly complex due to:</p>
<ul>
<li><p>Changing from 2 valid statements to 2 invalid conclusions</p>
</li>
<li><p>Moving from a clear job status (1, 2) to uncertainty about job existence or type (3).</p>
</li>
</ul>
<p>Let’s get familiar with some notation before seeing how <strong>Truth tables</strong> help manage this complexity.</p>
<h3 id="heading-notations">Notations</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Notation</td><td>Meaning</td><td>Example (if P="It's raining", Q="The ground is wet")</td></tr>
</thead>
<tbody>
<tr>
<td><strong>P, Q</strong></td><td>Propositions</td><td>P, Q</td></tr>
<tr>
<td><strong>⟹</strong></td><td>Implies / If...then...</td><td>P⟹Q ("If it's raining, then the ground is wet")</td></tr>
<tr>
<td><strong>¬</strong></td><td>Not</td><td>¬P ("It's not raining")</td></tr>
<tr>
<td><strong>∧</strong></td><td>And (conjunction)</td><td>P∧Q ("It's raining and the ground is wet")</td></tr>
<tr>
<td><strong>∨</strong></td><td>Or (disjunction)</td><td>P∨Q ("It's raining or the ground is wet")</td></tr>
<tr>
<td><strong>⟺</strong></td><td>If and only if (biconditional)</td><td>P⟺Q ("It's raining if and only if the ground is wet")</td></tr>
<tr>
<td>∴</td><td>Therefore</td><td>P ⟹ Q: If it's raining, then the ground is wet; P: It's raining; ∴ Q: <strong>Therefore</strong>, the ground is wet</td></tr>
</tbody>
</table>
</div><h2 id="heading-truth-tables-mapping-all-possibilities">Truth Tables: Mapping All Possibilities</h2>
<h3 id="heading-what-is-a-truth-table"><strong>What is a Truth Table?</strong></h3>
<p>A truth table is a powerful tool in logic that helps us determine the overall truth or falsity of a compound logical statement. It does this by systematically listing <strong>all possible combinations</strong> of truth values (True or False) for its individual component propositions.</p>
<p>For every way the "inputs" (our propositions like P and Q) can be true or false, the truth table shows you the precise "output" (the truth value of the entire logical statement, such as P⟹Q).</p>
<h3 id="heading-why-are-truth-tables-helpful"><strong>Why are Truth Tables Helpful?</strong></h3>
<p>Truth tables offer critical benefits for clear thinking:</p>
<ul>
<li><p><strong>Clarity and precision:</strong> They eliminate ambiguity by explicitly showing the outcome for every single scenario.</p>
</li>
<li><p><strong>Systematic analysis:</strong> They ensure no possible combination is missed, which is vital for sound reasoning.</p>
</li>
<li><p><strong>Foundation for understanding:</strong> They define how logical rules work, forming the bedrock for analyzing more complex arguments in any domain.</p>
</li>
</ul>
<h3 id="heading-how-to-read-our-first-truth-table"><strong>How to Read Our First Truth Table:</strong></h3>
<p>Let's examine the truth table for the implication P⟹Q ("If P then Q").</p>
<p>Each row represents a unique scenario, combining the truth values of P and Q to show the resulting truth value of P⟹Q.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>P</td><td>Q</td><td>P⟹Q (If P then Q)</td><td>Used In</td></tr>
</thead>
<tbody>
<tr>
<td>True</td><td>True</td><td>True</td><td>Modus Ponens ✅</td></tr>
<tr>
<td>True</td><td>False</td><td>False</td><td>Falsifiability 🚨</td></tr>
<tr>
<td>False</td><td>True</td><td>True</td><td>No Inference</td></tr>
<tr>
<td>False</td><td>False</td><td>True</td><td>Modus Tollens ✅</td></tr>
</tbody>
</table>
</div><p>Let's break down each row:</p>
<ul>
<li><p><strong>P and Q Columns:</strong> These show the input truth values (True or False) for our two propositions. Since each can be one of two values, we have 2×2 = 4 unique combinations, filling all four rows.</p>
</li>
<li><p><strong>P ⟹ Q Column:</strong> This is the output truth value of the "If P then Q" statement for each combination of inputs P and Q.</p>
<ul>
<li><p><strong>Row 1: P is True, Q is True.</strong></p>
<ul>
<li><p>If P is true <strong>(you are a coding instructor</strong>) and Q is also true <strong>(you have a job</strong>), then the implication P⟹Q is <strong>True</strong>. (The "If...then..." statement holds).</p>
</li>
<li><p>This row is key for <strong>Modus Ponens</strong>.</p>
</li>
</ul>
</li>
<li><p><strong>Row 2: P is True, Q is False</strong></p>
<ul>
<li><p>If P is true <strong>(you are a coding instructor</strong>) but Q is false <strong>(you have a job</strong>), then the implication P⟹Q is <strong>False</strong>. This is the only scenario that disproves an "if-then" statement.</p>
</li>
<li><p>This row is key for <strong>Falsifiability</strong>.</p>
</li>
</ul>
</li>
<li><p><strong>Row 3: P is False, Q is True.</strong></p>
<ul>
<li><p>If P is False <strong>(you are not a coding instructor)</strong> but Q is True <strong>(you have a job)</strong>, then the implication P⟹Q is still considered <strong>True</strong>. This can seem counter-intuitive.</p>
</li>
<li><p>The reason is that the implication statement <em>only</em> makes a claim about what happens when P is true. If P is false, the implication's claim isn't tested, so it is considered <a target="_blank" href="https://en.wikipedia.org/wiki/Vacuous_truth">vacuously true</a>.</p>
</li>
</ul>
</li>
<li><p><strong>Row 4: P is False, Q is False.</strong></p>
<ul>
<li><p>If P is False <strong>(you are not a coding instructor)</strong> and Q is False <strong>(you have no job)</strong>, then the implication P⟹Q is also considered <strong>True</strong>.</p>
</li>
<li><p>Similar to Row 3, since the initial condition (P) was false, the implication's truth value remains True, as it hasn't been disproven.</p>
</li>
<li><p>This row is key for <strong>Modus Tollens</strong>.</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>The "Used In" column serves as a preview of the specific logical arguments or concepts that rely on each row's behavior, which we will explore in detail later.</p>
<h3 id="heading-understanding-the-implication-pq-deeper">Understanding the Implication (P⟹Q) Deeper</h3>
<p>Most programmers are familiar with truth tables from logical operators like <strong>AND (∧)</strong>, <strong>OR (∨)</strong>, and <strong>NOT (¬)</strong>, where they define the output based on combinations of inputs.</p>
<p>The implication (P⟹Q) works similarly, its output is defined by the rules of propositional logic, not by any real-world causal relationship or your “common sense”. For any given pair of inputs for P and Q, the result of P⟹Q is fixed.</p>
<p>If this feels counter-intuitive, consider that mathematical logic, like any formal system, is built upon agreed-upon <strong>axioms</strong>. These basic accepted truths allow us to construct complex systems of ideas. If later found ineffective or contradictory, these axioms can be redefined, or a new system can be developed.</p>
<p>In formal logic, this implication is also defined as being logically equivalent to <strong>"NOT P OR Q" (¬P∨Q)</strong>.</p>
<p>This is the fundamental logical rule that dictates why, <strong>if P is False, P⟹Q is always True, regardless of Q's truth value</strong>. You can also understand this using the <strong>NOT P OR Q</strong> form.</p>
<ul>
<li><p>If P is False, that means NOT P is True.</p>
</li>
<li><p>Using the rules of Logical operation:</p>
<ul>
<li><p>True (Not P) OR True (Q) is True (<strong>NOT P OR Q</strong>)</p>
</li>
<li><p>True (Not P) OR False (Q) is True (<strong>NOT P OR Q</strong>)</p>
</li>
<li><p><strong>NOT P OR Q</strong> is True regardless of what Q is.</p>
</li>
</ul>
</li>
</ul>
<p>The above explains rows 3 and 4 of the truth table from the <strong>NOT P OR Q</strong> form. As an exercise, you can apply the inputs (P, Q) from the first two rows of the truth table to NOT P OR Q to arrive at the same results defined in the P⟹Q column.</p>
<p>This formal definition allows us to use implication to reason in powerful ways, not just in the "forward" direction (P⟹Q, leading to Modus Ponens), but also in a crucial "backward" direction.</p>
<p>This backward form (<strong>Contrapositive</strong>) involves swapping and negating the propositions (¬Q⟹¬P).</p>
<p>For example, if "If you are a coding instructor, then you have a job" is true, then it must also be true that "If you have no job (¬Q), then you are not a coding instructor (¬P). ".</p>
<p>This "backward" way of reasoning, which underpins Modus Tollens, is a powerful tool for inferring conclusions from observed outcomes.</p>
<p>We'll explore the <strong>Contrapositive</strong> and two argument forms (<strong>Modus Ponens, Modus Tollens</strong>) in detail next.</p>
<h2 id="heading-contrapositives-modus-ponens-modus-tollens">Contrapositives, Modus Ponens, Modus Tollens</h2>
<p>We've explored the fundamental implication (P⟹Q) and how truth tables reveal its behavior.</p>
<p>Now, we explore reasoning tools that build upon this foundation: <strong>Modus Ponens</strong>, <strong>Modus Tollens</strong>, and the concept of <strong>Contrapositives</strong>. These are bedrock principles of valid argument and efficient logical thought.</p>
<h3 id="heading-what-is-logical-equivalence">What is Logical Equivalence?</h3>
<p>Before we dive into these specific concepts, let's clarify what <strong>logical equivalence</strong> means. Two statements are <strong>logically equivalent</strong> if they always have the same truth value under all possible circumstances. In simpler terms, if one statement is true, the other is <em>always</em> true. If one is false, the other is <em>always</em> false. They are, in essence, different ways of saying the same logical thing.</p>
<p>Understanding logical equivalence is incredibly useful. It:</p>
<ul>
<li><p><strong>Simplifies logic:</strong> It allows us to substitute one statement for another without changing the truth of an argument, which simplifies complex proofs and reasoning.</p>
</li>
<li><p><strong>Reduces complexity:</strong> In fields like circuit design, it can lead to fewer physical gates.</p>
</li>
<li><p><strong>Maintains software correctness:</strong> In programming, it helps maintain code's correctness during refactoring and debugging, especially when simplifying conditional statements, by ensuring the transformed code still behaves identically to the original under all conditions.</p>
</li>
</ul>
<h3 id="heading-the-contrapositive-an-equivalent-implication">The Contrapositive: An Equivalent Implication</h3>
<p>One of the most important logical equivalences involves the <strong>Contrapositive</strong> of an implication. The contrapositive of an "If P then Q" (P⟹Q) statement is <strong>"If not Q, then not P"</strong> (¬Q⟹¬P).</p>
<p>You might intuitively question how "<strong>If P then Q</strong>" could be logically the same as "<strong>If not Q then not P</strong>." Let's demonstrate this using a truth table.</p>
<p>We'll start with our familiar P and Q columns and the P⟹Q implication. Then, we'll add columns for ¬P (Not P) and ¬Q (Not Q), and finally, the implication for the contrapositive, ¬Q⟹¬P.</p>
<p>Let's look at how the truth table explicitly shows this equivalence:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747584857181/2732a798-da1d-48d9-aa92-c1ca3459b169.png" alt="Truth Table of columns P, Q, P->Q, not P, not Q, not Q -> not P" class="image--center mx-auto" width="1042" height="325" loading="lazy"></p>
<h3 id="heading-explanation-of-the-table">Explanation of the table</h3>
<ol>
<li><p><strong>P, Q, P ⟹ Q (Columns 1-3):</strong> These are our standard propositions and the implication we've already defined.</p>
</li>
<li><p><strong>¬P (Column 4):</strong> This column simply shows the negation (opposite truth value) of the P column. If P is True, ¬P is False, and vice-versa.</p>
</li>
<li><p><strong>¬Q (Column 5):</strong> Similarly, this column shows the negation of the Q column.</p>
</li>
<li><p><strong>¬Q ⟹ ¬P (Column 6):</strong> This is the contrapositive. We apply the same rules for implication that we learned earlier, but now using ¬Q as our "if" part and ¬P as our "then" part. For example, in Row 2, ¬Q is True and ¬P is False. According to the implication rule (True ⟹ False yields False), the result for ¬Q⟹¬P is False.</p>
</li>
<li><p><strong>The Proof of Equivalence:</strong> Now, compare <strong>Column 3 (P⟹Q)</strong> with <strong>Column 6 (¬Q⟹¬P)</strong>. You'll notice that for every single row, their truth values are identical! When P⟹Q is True, ¬Q⟹¬P is also True. When P⟹Q is False, ¬Q⟹¬P is also False. This perfectly illustrates why they are <strong>logically equivalent</strong>.</p>
</li>
</ol>
<p>So, "If you are a coding instructor, then you have a job" (P⟹Q) is logically the same as saying "If you have no job, then you are not a coding instructor" (¬Q⟹¬P). They convey the same information about the relationship between being a coding instructor and having a job.</p>
<h3 id="heading-how-modus-ponens-and-modus-tollens-relate-to-implication">How Modus Ponens and Modus Tollens Relate to Implication</h3>
<p>Having defined logical equivalence and the contrapositive, we can now precisely understand two of the most fundamental and valid forms of deductive argument: <strong>Modus Ponens</strong> and <strong>Modus Tollens</strong>. Both of these argument forms rely on a core premise that an implication (P⟹Q) is true, and then use additional information to draw a valid conclusion.</p>
<ol>
<li><p><strong>Modus Ponens (Affirming the Antecedent):</strong> This is often considered the most intuitive and direct form of logical inference. It works in the "forward" direction of the implication.</p>
<ul>
<li><p><strong>Premise 1:</strong> We are given that the implication is true: If P, then Q (P⟹Q).</p>
</li>
<li><p><strong>Premise 2:</strong> We are also given that the "if" part, the antecedent, is true: P is true.</p>
</li>
<li><p><strong>Conclusion:</strong> Therefore, we can validly infer that the "then" part, the consequent, must also be true: Q is true.</p>
</li>
</ul>
</li>
</ol>
<p>    <em>Example:</em></p>
<ul>
<li><p>Premise 1: If it is raining (P), then the ground is wet (Q).</p>
</li>
<li><p>Premise 2: It is raining (P).</p>
</li>
<li><p>Conclusion: Therefore, the ground is wet (Q).</p>
</li>
</ul>
<p>    This directly corresponds to <strong>Row 1 (True, True)</strong> of our truth table for P⟹Q.</p>
<ol start="2">
<li><p><strong>Modus Tollens (Denying the Consequent):</strong> This argument form works in the "backward" direction and relies directly on the logical equivalence of an implication and its contrapositive.</p>
<ul>
<li><p><strong>Premise 1:</strong> We are given that the implication is true: If P, then Q (P⟹Q).</p>
</li>
<li><p><strong>Premise 2</strong>: We are also given that the "then" part, the consequent, is false: Not Q (¬Q).</p>
</li>
<li><p><strong>Conclusion</strong>: Therefore, we can validly infer that the "if" part, the antecedent, must also be false: Not P (¬P).</p>
</li>
</ul>
</li>
</ol>
<p>    <em>Example:</em></p>
<ul>
<li><p>Premise 1: If it is raining (P), then the ground is wet (Q).</p>
</li>
<li><p>Premise 2: The ground is <strong>not</strong> wet (¬Q).</p>
</li>
<li><p>Conclusion: Therefore, it is <strong>not</strong> raining (¬P).</p>
</li>
</ul>
<p>    Modus Tollens is valid because if P⟹Q is true, its contrapositive (¬Q⟹¬P) must also be true. Applying Modus Ponens to this contrapositive (with ¬Q as our second premise) directly leads to the conclusion ¬P. This corresponds to <strong>Row 4 (False, False)</strong> of our original truth table for P⟹Q, where P and Q are both false but the implication is still true.</p>
<p>These two argument forms are central to rigorous deductive reasoning, allowing us to draw certain conclusions based on the truth of implications and related facts.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749063972374/e3eaf8a6-8eb1-4fa2-9e97-703b547a81bd.jpeg" alt="Title Page of Book by Charles Darwin: On the Origin of Species" class="image--center mx-auto" width="4473" height="2982" loading="lazy"></p>
<h2 id="heading-the-origin-of-pq-science-and-reality">The Origin of P⟹Q: Science and Reality</h2>
<p>In science, hypotheses often take the form "<strong>If P, then Q</strong>" where P is a cause and Q is its predicted effect –for example, "If a drug is given (P), then symptoms improve (Q)."</p>
<p>Ideally, P is controllable, as in experimental studies, but even in observational studies, P must be clearly defined and measurable.</p>
<p>Each experiment yields one observation, reflecting one of four possible truth-value combinations of P and Q.</p>
<h3 id="heading-the-falsifying-case-in-science-and-logic">The Falsifying Case in Science and Logic</h3>
<p>Each experiment produces a single observation – one of the four possible combinations of P and Q.</p>
<ul>
<li><p>If P=True, Q=False is observed (row 2 of the truth table), the hypothesis is <strong>falsified</strong></p>
</li>
<li><p>In all other cases, the hypothesis is <strong>not falsified</strong> (yet)</p>
</li>
</ul>
<p>Thus:</p>
<ul>
<li><p>If all observations fall in the 3 truth-preserving rows, the hypothesis remains viable.</p>
</li>
<li><p>If at least one experiment yields P=True, Q=False, we either:</p>
<ul>
<li><p>Conclude falsification, or</p>
</li>
<li><p>Re-examine the experiment and attempt replication before accepting falsification.</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-the-power-of-the-falsifying-case">The Power of the Falsifying Case</h3>
<h4 id="heading-in-the-logical-world">In the Logical World</h4>
<p>The falsifying case is not useful for inference with Modus Ponens or Modus Tollens because these two argument forms require starting with <strong>P⟹Q = True</strong>. I’ll explain both arguments in detail later.</p>
<p>But the falsifying case is useful for showing counterexamples to disprove the implication, or proof by contradiction.</p>
<h4 id="heading-in-the-real-scientific-world">In the Real Scientific world</h4>
<p>The falsifying case embodies <strong>Falsifiability</strong> – a crucial concept in Science.</p>
<blockquote>
<p>In so far as a scientific statement speaks about reality, it must be falsifiable: and in so far as it is not falsifiable, it does not speak about reality.</p>
<p><strong>— Karl R. Popper, The Logic of Scientifc Discovery</strong></p>
</blockquote>
<p>Scientific theories come about through hypotheses that are continually tested and survive attempts at falsification.</p>
<h3 id="heading-popperian-falsification-and-hypothesis-testing">Popperian Falsification and Hypothesis Testing</h3>
<p>These two approaches, one philosophical and one statistical, are distinct but complementary in the scientific method.</p>
<ul>
<li><p><strong>Popperian Falsification</strong> starts with a scientific hypothesis (for example, "P has an effect on Q"). Its core aim is to actively seek evidence that would disprove this hypothesis. If such disproving evidence is found, the hypothesis is falsified.</p>
</li>
<li><p><strong>Statistical Hypothesis Testing</strong> begins with a null hypothesis (H0​) (for example, "P has no effect on Q"). Its goal is to determine if the collected data provides sufficiently extreme evidence to reject this null hypothesis.</p>
</li>
</ul>
<p>If the null hypothesis is rejected, it provides statistical support for the alternative hypothesis (that P <em>does</em> have an effect on Q). This statistically supported hypothesis then becomes a stronger candidate, continually subjected to further Popperian attempts at falsification through new experiments and observations.</p>
<h3 id="heading-the-nuance-implication-is-not-causality">The Nuance: Implication is Not Causality</h3>
<p>P⟹Q does <strong>not</strong> inherently imply that P causes Q.</p>
<p>Consider these examples:</p>
<ul>
<li><p>"If the fire alarm is sounding, then there is smoke." The alarm doesn't <em>cause</em> the smoke.</p>
</li>
<li><p>"If a colleague screams during code review, then the code is bad." Does the screaming <em>cause</em> the bad code, or merely reveal it? (Perhaps sometimes both! 😰)</p>
</li>
</ul>
<p><strong>Causality</strong> is a real-world concept crucial for making informed decisions, predicting outcomes, and inferring the underlying reasons for events.</p>
<p>It's often central to predictive modeling and supervised learning in data science, where the target variable is the effect and the predictors are proposed causes. A common pitfall here is <strong>data leakage</strong>, where predictors are inadvertently influenced by (or are themselves effects of) the target, violating the causal assumption.</p>
<p>Logic, however, doesn't model time, mechanisms, or interventions. It only cares about <strong>truth values and formal structure</strong>. Logic defines what is true based on premises, not what <em>makes</em> something true in a causal sense.</p>
<h2 id="heading-revisiting-argument-forms-valid-inferences-and-common-fallacies">Revisiting Argument Forms: Valid Inferences and Common Fallacies</h2>
<p>We've now established the rules of implication, understood logical equivalence, and learned about two powerful, valid argument forms: <strong>Modus Ponens</strong> and <strong>Modus Tollens</strong>. But when we try to reason using "if-then" statements, it's easy to fall into common logical traps.</p>
<p>In this section, we'll systematically revisit the four common ways we might try to draw conclusions from an implication <strong>P⟹Q (If you are a coding instructor, then you have a job)</strong> introduced at the start of the handbook.</p>
<p>Two are valid arguments (Modus Ponens and Modus Tollens), and two are common logical fallacies. Understanding the differences is crucial for sound reasoning.</p>
<p>First, let's quickly define the parts of an "if-then" condition:</p>
<ul>
<li><p><strong>Antecedent:</strong> The "if" part of the condition (P).</p>
</li>
<li><p><strong>Consequent:</strong> The "then" part of the condition (Q).</p>
</li>
</ul>
<p>Now, let's examine these four argument forms, using our knowledge of truth tables and the coding instructor example.</p>
<h3 id="heading-affirming-the-antecedent-modus-ponens">Affirming the Antecedent (Modus Ponens)</h3>
<p>This is the first valid argument form we discussed. It's called "affirming the antecedent" because it asserts the truth of the "if" part (the antecedent, P) to conclude the "then" part (the consequent, Q).</p>
<ul>
<li><p><strong>Argument Form:</strong></p>
<ol>
<li><p>If P, then Q (P⟹Q)</p>
</li>
<li><p>P is true.</p>
</li>
<li><p>Therefore, Q is true.</p>
</li>
</ol>
</li>
<li><p><strong>Examples:</strong></p>
<ul>
<li><p>You are a coding instructor (P), so you have a job (Q).</p>
</li>
<li><p>You provided invalid input data (P), so the code will show an error (Q).</p>
</li>
</ul>
</li>
<li><p><strong>Interpretation:</strong> This argument directly aligns with <strong>Row 1 (P=True, Q=True)</strong> of our truth table, where the implication holds true. It's often the most intuitive form of logical deduction. In programming, it's natural to expect bad input to lead to error messages if the code is designed correctly.</p>
</li>
</ul>
<h3 id="heading-denying-the-consequent-modus-tollens">Denying the Consequent (Modus Tollens)</h3>
<p>This is the second valid argument form. It's called "denying the consequent" because it asserts the falsity of the "then" part (the consequent, ¬Q) to conclude the falsity of the "if" part (the antecedent, ¬P). As we learned, Modus Tollens derives its validity from the logical equivalence of P⟹Q and its contrapositive (¬Q⟹¬P).</p>
<ul>
<li><p><strong>Argument Form:</strong></p>
<ol>
<li><p>If P, then Q (P⟹Q)</p>
</li>
<li><p>Not Q is true (¬Q).</p>
</li>
<li><p>Therefore, Not P is true (¬P).</p>
</li>
</ol>
</li>
<li><p><strong>Examples:</strong></p>
<ul>
<li><p>You have no job (¬Q), so you are not a coding instructor (¬P).</p>
</li>
<li><p>There are no error messages (¬Q), so the input data is valid (¬P)</p>
</li>
</ul>
</li>
<li><p><strong>Interpretation:</strong> This argument corresponds to <strong>Row 4 (P=False, Q=False)</strong> of our truth table, where P⟹Q is true, and both P and Q are false. This form of reasoning is critical for skillful debugging, allowing you to infer reasonably true conclusions about the cause (P) from observations of the outcome (Q), assuming your program logic (P⟹Q) holds true.</p>
</li>
</ul>
<h3 id="heading-affirming-the-consequent-fallacy">Affirming the Consequent (Fallacy)</h3>
<p>Now we move to the common pitfalls. This is an <strong>invalid argument form</strong> where we attempt to conclude that the antecedent (P) is true simply because the consequent (Q) is true. It's a fallacy because the truth of Q does not guarantee the truth of P, as Q could have been caused by something other than P.</p>
<ul>
<li><p><strong>Argument Form (Invalid):</strong></p>
<ol>
<li><p>If P, then Q (P⟹Q)</p>
</li>
<li><p>Q is true.</p>
</li>
<li><p>Therefore, P is true. (**Incorrect inference!**🚨)</p>
</li>
</ol>
</li>
<li><p><strong>Examples:</strong></p>
<ul>
<li><p>You have a job (Q), so you are a coding instructor (P).</p>
<ul>
<li>Incorrect: You could have many other jobs.</li>
</ul>
</li>
<li><p>The code showed an error (Q), so you provided invalid data (P).</p>
<ul>
<li>Incorrect: Other things besides invalid data can cause errors.</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Interpretation:</strong> This fallacy highlights the difference between a one-to-one and a one-to-many relationship. Looking at our truth table, when P⟹Q is True and Q is True, P could be <strong>True (Row 1)</strong> or <strong>False (Row 3)</strong>. The argument mistakenly concludes that P must always be True. The uncertainty arises because observing Q as True doesn't uniquely point to P as the cause – there could be many other reasons or paths that lead to Q.</p>
<ul>
<li>Think of walking down a forest path, unaware that another trail has merged into yours from behind you. When retracing your steps in reverse, you encounter a split (Q) at that merge and feel disoriented, unsure which path leads back to your start point (P). Just as multiple paths can converge on the same point, multiple causes can produce the same outcome.</li>
</ul>
</li>
</ul>
<h3 id="heading-denying-the-antecedent-fallacy">Denying the Antecedent (Fallacy)</h3>
<p>This is another <strong>invalid argument form</strong>. Here, we attempt to conclude that the consequent (Q) is false simply because the antecedent (P) is false. It's a fallacy because P being false does not guarantee that Q will also be false. Q could still be true for other reasons, or the implication might not cover all scenarios where Q occurs.</p>
<ul>
<li><p><strong>Argument Form (Invalid):</strong></p>
<ol>
<li><p>If P, then Q (P⟹Q)</p>
</li>
<li><p>Not P is true (¬P).</p>
</li>
<li><p>Therefore, Not Q is true (¬Q). (**Incorrect inference!**🚨)</p>
</li>
</ol>
</li>
<li><p><strong>Examples:</strong></p>
<ul>
<li><p>You are not a coding instructor (¬P), so you have no job (¬Q).</p>
<ul>
<li>Incorrect: You could have a different job.</li>
</ul>
</li>
<li><p>You provided valid data (¬P), so you have no error (¬Q).</p>
<ul>
<li>Incorrect: Valid data doesn't guarantee no error. Other factors like network issues, memory leaks, or non-idempotent operations can still cause errors.</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Interpretation:</strong> Similar to Affirming the Consequent, this fallacy stems from incorrectly assuming a unique relationship. From our truth table, when P⟹Q is True and P is False, Q could be <strong>True (Row 3)</strong> or <strong>False (Row 4)</strong>. The argument mistakenly concludes Q must always be False.</p>
</li>
</ul>
<p>Both of these fallacies (<strong>Affirming the Consequent</strong> and <strong>Denying the Antecedent</strong>) creep into our thinking when we prematurely assume a single cause for an effect. In complex real-world systems, many factors can lead to an outcome, and narrowing your thinking too soon can lead to missed bugs or incorrect conclusions.</p>
<h3 id="heading-fallacies-and-implication-a-prerequisite">Fallacies and Implication: A Prerequisite</h3>
<p>Both the fallacy of affirming the consequent and denying the antecedent assume the underlying implication (P⟹Q) is true.</p>
<p>If this implication is false from the start, there's no logical argument to be made, and thus, no fallacy to speak of.</p>
<h3 id="heading-exercise-identifying-an-argument-form">Exercise: Identifying an Argument Form</h3>
<p>Which of the 4 forms of argument is this?</p>
<ul>
<li><strong>Penguins can’t fly. I can’t fly. Therefore, I’m a penguin.</strong></li>
</ul>
<p><em>Hint: Rephrase the first statement into an if-then form</em>.</p>
<h2 id="heading-denying-the-antecedent-a-database-example">Denying the Antecedent: A Database Example</h2>
<p>We just saw that Denying the Antecedent is a logical fallacy, meaning that even if the initial implication (P⟹Q) is true, concluding ¬Q from ¬P is not a valid inference. To make this abstract concept concrete, and to illustrate why this fallacy can be particularly dangerous in real-world systems like software, let's explore a practical example involving a database.</p>
<p>The implication: <strong>If the database is down (P), we’ll see a connection timeout error (Q).</strong></p>
<p>Now, applying the fallacy of Denying the Antecedent, we might incorrectly conclude: <strong>If the database is not down (¬P), we will not see a connection timeout error (¬Q). ❌</strong></p>
<p>But even if the database itself is perfectly operational and "not down," you might still encounter a connection timeout error. This could happen due to a variety of other, independent reasons, such as:</p>
<ul>
<li><p>Network problems</p>
</li>
<li><p>Firewall rules</p>
</li>
<li><p>The database is up but extremely slow</p>
</li>
<li><p>The query engine is stuck</p>
</li>
</ul>
<p>This specific example of multiple potential causes for a "timeout" highlights a broader, critical skill in software development: <strong>thorough case analysis</strong>.</p>
<p>This is precisely why technical assessments, especially in areas like algorithms and system design, frequently demand that you consider exhaustive possibilities. For instance, you are often asked to handle <strong>base and recursive cases in dynamic programming</strong>, or to ensure <strong>mutually exclusive and collectively exhaustive coverage when grouping multiple scenarios in problems like interval merging.</strong></p>
<p>Such strong case analysis is vital for minimizing bugs and cultivating an open-minded approach to considering multiple causal paths, driven by experience, curiosity, and a dedication to craftsmanship.</p>
<p>But even perfect case analysis doesn't guarantee a correct implementation. Weak language mastery or mistaken assumptions can still lead to errors, making tests a crucial last line of defense.</p>
<p>Before jumping into applying logic to software testing, let’s practice our agility in conceptually switching between real-world concepts in English and symbols in logic.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1750012280729/731cd405-1a5c-45c1-8d16-9e6b28837979.jpeg" alt="kitten in front of computer screen full of code" class="image--center mx-auto" width="6000" height="4000" loading="lazy"></p>
<h2 id="heading-assigning-real-world-meanings-to-logic">Assigning Real-World Meanings to Logic</h2>
<p>We must define what P, Q, and P⟹Q refer to when applying logical theory to real-world concepts.</p>
<p>How we define these variables affects our truth tables.</p>
<p>For example:</p>
<ul>
<li><p>If <strong>P means "valid input,"</strong> then ¬P means "invalid input."</p>
</li>
<li><p>If <strong>P means "invalid input,"</strong> then ¬P means "valid input."</p>
</li>
</ul>
<p>Imagine we define <strong>P = "Good input"</strong> and <strong>Q = "No Error."</strong></p>
<ul>
<li><p>When testing the <strong>happy path</strong>, we are verifying that the implication <strong>P⟹Q (If input is good, then no error)</strong> holds true.</p>
</li>
<li><p>When testing the <strong>unhappy path</strong> (mutation testing, more details later), we are verifying that <strong>¬P⟹¬Q (If input is not good, then an error occurs)</strong> holds true.</p>
</li>
</ul>
<p>In any test, a failure indicates that the tested implication is false. This warrants investigation into whether the issue lies with the specification's interpretation, the implementation, or even the test itself.</p>
<h2 id="heading-applying-logic-to-software-testing">Applying Logic to Software Testing</h2>
<p>Software development relies on constructing systems that behave predictably. <strong>Software testing</strong> is our primary tool for validating these behaviors. At its core, testing is a process deeply rooted in logical implications, where we propose a hypothesis about our code and then run an experiment (the test) to check its truth.</p>
<p>A test case is carefully designed to evaluate a specific piece of code. This involves:</p>
<ol>
<li><p><strong>Setting up Preconditions and Inputs:</strong> Before executing the code under test, we meticulously establish a specific environment and provide particular inputs. This includes:</p>
<ul>
<li><p><strong>Function/Method Arguments:</strong> The precise values passed into the code being tested.</p>
</li>
<li><p><strong>System State:</strong> Setting up relevant data in a database, preparing the content of a file system, configuring an object's instance variables, or dictating the responses of external services (often through "mocks" or "stubs").</p>
</li>
<li><p><strong>Environmental Factors:</strong> Controlling elements like the current time, specific network conditions, or user permissions relevant to the code's execution. This precise setup ensures that the code runs under defined conditions, allowing us to evaluate its behavior consistently.</p>
</li>
</ul>
</li>
</ol>
<p>Once the setup is complete, the code under test is executed, and its output or behavior is observed. This observation is then compared against an <strong>expected result</strong>.</p>
<p>To precisely analyze test outcomes, let's establish our specific logical mapping:</p>
<ul>
<li><p><strong>P: The code under test is correct for the specific scenario defined by the test.</strong> This refers to the <em>actual, objective state</em> of the code's internal logic and implementation when presented with the test's preconditions and inputs. If P is True, the code is without defect for this case. If P is False, there is a bug or deviation.</p>
</li>
<li><p><strong>Q: The test passes.</strong> This means the actual output or behavior observed from the code precisely matches the expected outcome defined in our test case. If they do not match, the test fails.</p>
</li>
<li><p><strong>P⟹Q: If the code under test is correct for this specific scenario, then the test will pass.</strong> In pure propositional logic, the truth value of P⟹Q is indeed defined by the truth values of P and Q. But in the context of software testing, P⟹Q represents our <strong>hypothesis or desired specification</strong> for how the code <em>should</em> behave. We don't directly "know" P's truth value beforehand. Instead, the test's execution provides empirical data (the actual Q) that allows us to <strong>evaluate whether this hypothesis holds true in practice</strong>, and thereby infer the actual state of P.</p>
</li>
</ul>
<p>Understanding this mapping is vital for interpreting test results. Let's examine the different outcomes of a test run, referencing the truth table for P⟹Q:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1750280931102/bc300c03-ce17-456d-9a7e-47c8e649cfd6.png" alt="Truth table - explained in the text below" width="2431" height="1309" loading="lazy"></p>
<ul>
<li><p><strong>Row 1: P is True (Code is correct), Q is True (Test passes)</strong></p>
<ul>
<li><p><strong>Interpretation in Testing: Ideal State/Validation</strong></p>
<ul>
<li><p>This is the desired outcome and strengthens our confidence that the code adheres to its specification.</p>
</li>
<li><p>This scenario directly confirms the truth of our hypothesis (P⟹Q).</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Row 2: P is True (Code is correct), Q is False (Test fails)</strong></p>
<ul>
<li><p><strong>Interpretation in Testing: Logical Contradiction / Falsification of Hypothesis</strong></p>
<ul>
<li><p>This row means our overall hypothesis P⟹Q is <em>false</em> for this specific instance.</p>
</li>
<li><p>This demands investigation: either our initial assumption that P <em>was</em> True (meaning the code was correct) is wrong (i.e., there's an actual bug, so P is actually False), or the test itself is flawed (its inputs/expectations are incorrect), or the specification is wrong.</p>
</li>
<li><p>This is where rethinking of the P⟹Q hypothesis itself happens.</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Row 3: P is False (Code is incorrect), Q is True (Test passes)</strong></p>
<ul>
<li><p><strong>Interpretation in Testing: False Positive / Inadequate Test</strong></p>
<ul>
<li><p>This is a problematic scenario. It implies the test is not robust enough to detect the defect in the code, or the test's expectation is flawed.</p>
</li>
<li><p>While P⟹Q remains true vacuously, this outcome is misleading and means the test is not effectively verifying code correctness.</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Row 4: P is False (Code is incorrect), Q is False (Test fails)</strong></p>
<ul>
<li><p><strong>Interpretation in Testing: Bug Found / Confirmation of Incorrectness</strong></p>
<ul>
<li><p>This is a beneficial outcome, as the test has successfully identified a defect.</p>
</li>
<li><p>When P is truly False, P⟹Q is vacuously true.</p>
</li>
<li><p>This row can represent either a known, intended 'P is False' state (e.g., TDD Red phase) or the <em>actual state discovered</em> via deduction (explained below in Scenario 1).</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="heading-note-on-this-contextualized-truth-table-and-probabilistic-nature"><strong>Note on this Contextualized Truth Table and Probabilistic Nature</strong></h3>
<p>This truth table differs from a purely abstract logical truth table by being explicitly contextualized for software testing.</p>
<ul>
<li><p><strong>Specific Definitions:</strong> Unlike a generic P and Q, here they have precise meanings within the domain of code correctness and test outcomes.</p>
</li>
<li><p><strong>"Interpretation in Testing" Column:</strong> This is the key distinguishing feature. It translates the raw logical outcomes of (P, Q, and P⟹Q) into actionable insights and common debugging/development scenarios for software engineers. It explains <em>what it means</em> when a particular row is observed in the context of testing.</p>
</li>
<li><p><strong>Probabilistic Confidence:</strong> While formal logic operates in binary (True/False), real-world software testing often involves <strong>probabilistic confidence</strong>. A test doesn't provide absolute logical proof of correctness (for example, a passing test doesn't guarantee P is 100% True due to the possibility of undiscovered bugs or false positives). Instead, test results <em>increase our confidence</em> that the code is correct, or <em>provide strong evidence</em> that it is incorrect. Testing is fundamentally about reducing uncertainty and increasing the probability that our code functions as intended.</p>
</li>
</ul>
<p>Let's now explore how these logical outcomes are interpreted in two common testing scenarios:</p>
<h3 id="heading-scenario-1-debugging-an-unexpected-defect-applying-modus-tollens">Scenario 1: Debugging an Unexpected Defect (Applying Modus Tollens)</h3>
<p>This scenario occurs when a test that was previously passing, or a newly written test that we strongly trust as a precise and correct specification, unexpectedly fails. In this context, we assume the validity of the implication P⟹Q for this specific test case, treating it as an unbreakable rule for how correct code <em>should</em> behave.</p>
<ol>
<li><p><strong>Our Core Premise (Trusted Specification):</strong> We operate under the assumption that the implication "P⟹Q" ("If the code is correct for this scenario, then the test passes") is <strong>True</strong> for this specific test. Our confidence stems from the test's meticulous design, its history of passing, or its role in a well-established regression suite.</p>
</li>
<li><p><strong>Test Execution and Observation:</strong> We run the test, which has its preconditions and inputs set.</p>
<ul>
<li><p><strong>If the Test Fails (Q is False):</strong> This is the key observation. Since we <strong>trust our premise that P⟹Q is True</strong>, and we observe ¬Q (the test fails), we are logically compelled to deduce that our initial belief about P (the code being correct for this scenario) must be false.</p>
<ul>
<li><p><strong>Application of Modus Tollens:</strong></p>
<ul>
<li><p>Premise 1: If the code is correct for this scenario (P), then the test passes (Q). (P⟹Q, assumed true as a trusted specification).</p>
</li>
<li><p>Premise 2: The test did not pass (¬Q).</p>
</li>
<li><p>Conclusion: Therefore, the <strong>code is not correct for this scenario (¬P).</strong></p>
</li>
</ul>
</li>
<li><p><strong>Outcome:</strong> This inference directly points us to a defect in the code. The test's failure, given its trusted nature, <em>reveals</em> that the actual state of the code for this scenario is <strong>P is False</strong>. This effectively places the scenario in <strong>Row 4 (P False, Q False)</strong> of our truth table, confirming the presence of a bug that needs fixing. This is typical in <strong>regression testing</strong>, where a previously correct feature suddenly breaks.</p>
</li>
</ul>
</li>
</ul>
</li>
</ol>
<h3 id="heading-scenario-2-validatingrefining-the-specification-falsifying-pq-or-confirming-known-incorrectness">Scenario 2: Validating/Refining the Specification (Falsifying P⟹Q or Confirming Known Incorrectness)</h3>
<p>This scenario arises when a test fails, and our primary focus is not immediately on debugging the code as if it's a regression. Instead, it's on understanding <em>why</em> the P⟹Q relationship (our hypothesis for this specific behavior) isn't holding, or simply confirming an expected failure. This can involve questioning the test itself, the underlying requirements, or confirming a deliberately incorrect state of the code.</p>
<ol>
<li><p><strong>Our Hypothesis (Being Challenged or Confirmed):</strong> We are either actively evaluating the validity of the implication "P⟹Q" for a specific behavior, or we are running a test against code we know is incomplete or incorrect.</p>
</li>
<li><p><strong>Test Execution and Observation:</strong> We run the test with its defined preconditions and inputs.</p>
</li>
<li><p><strong>If the Test Fails (Q is False):</strong> The interpretation here depends on our prior knowledge or intent about the code's state (P):</p>
<ul>
<li><p><strong>Sub-scenario 2A: Falsifying P⟹Q and Rethinking Specification (Corresponds to Row 2: P True, Q False):</strong></p>
<ul>
<li><p>We observe Q is False (the test fails).</p>
</li>
<li><p>If we then examine the code and the requirements, and we conclude that the code <em>should</em> have been correct for this scenario (meaning, our expectation/belief was P is True), then the test result means <strong>the specific instance of our hypothesis "P⟹Q" is FALSE.</strong></p>
</li>
<li><p>This direct falsification reveals a contradiction. We must then investigate:</p>
<ul>
<li><p>Is our initial belief that P was True mistaken (that is, is there a genuine bug in the code that makes P actually False, moving this to a Row 4 scenario)?</p>
</li>
<li><p>Or, is the test itself incorrect (its inputs or expected output are wrong), meaning our P⟹Q premise needs to be re-evaluated and corrected?</p>
</li>
<li><p>Or, have the underlying requirements changed or been misunderstood?</p>
</li>
</ul>
</li>
<li><p><strong>Outcome:</strong> This critical outcome prompts us to "rethink" – either the code needs fixing, or the test needs adjusting, or the specification needs clarification. This is common in <strong>exploratory testing</strong> or when working with new/evolving features where the exact behavior is still being defined.</p>
</li>
</ul>
</li>
<li><p><strong>Sub-scenario 2B: Confirming Known Incorrectness (Corresponds to Row 4: P False, Q False):</strong></p>
<ul>
<li><p>We observe Q is False (the test fails).</p>
</li>
<li><p>We <em>already know or intentionally designed</em> the code to be incorrect for this scenario (that is, we are actively developing a feature and haven't written the full code yet, or we're running a test against a known, un-fixed bug, so our expectation is P is False).</p>
</li>
<li><p>The test result simply <strong>confirms our prior knowledge that P is False</strong>. The test correctly highlights the missing or incorrect behavior. In this case, the P⟹Q implication is vacuously true, and the test effectively served its purpose of showing the existing defect.</p>
</li>
<li><p><strong>Outcome:</strong> This is typical in Test-Driven Development (TDD) in the Red phase, where a failing test for a not-yet-implemented feature confirms the "P is False" state, guiding development to make P True. It also applies when verifying that a bug fix indeed works: the test initially fails (confirming the bug), and then passes after the fix (confirming P is now True).</p>
</li>
</ul>
</li>
</ul>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749063701013/bc574591-90ec-4439-9b47-f0737d5a5384.jpeg" alt="girl looking into microscope" class="image--center mx-auto" width="4480" height="6720" loading="lazy"></p>
<h2 id="heading-a-closer-look-at-testing">A Closer Look at Testing</h2>
<h3 id="heading-the-illusion-of-correctness-affirming-the-consequent">The Illusion of Correctness: Affirming the Consequent</h3>
<p>Consider a common scenario where a test passes, seemingly validating our code:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_user_role</span>(<span class="hljs-params">user_id</span>):</span>
    <span class="hljs-keyword">if</span> user_id == <span class="hljs-number">42</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">"admin"</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">"guest"</span>

<span class="hljs-comment"># test</span>
<span class="hljs-keyword">assert</span> get_user_role(<span class="hljs-number">42</span>) == <span class="hljs-string">"admin"</span>
</code></pre>
<p>Here, our implicit claim (the specification) is: <strong>If the code is correct (P), then the output will match the expectation (Q).</strong></p>
<p>In this example, the test passes – the output is "admin" <strong>(Q)</strong>, but can we definitively conclude that the function is correct <strong>(P)</strong>? Not necessarily.</p>
<p>This scenario often exemplifies the logical fallacy of <strong>affirming the consequent</strong>. We see the desired outcome (Q) and mistakenly assume that our specific intended cause (P, the correctness of <em>our specific implementation path</em>) was the reason.</p>
<p><strong>The Problem:</strong> What if the real condition for an "admin" role should be checking a database, but we have temporarily hardcoded the value for testing? The test would pass, but the correctness is illusory. If we see P as false because the code did not implement the behaviour from the full specification, this corresponds to Row 3 (P False, Q True: False Positive) in our truth table.</p>
<p>As I mentioned before, deliberately implementing ¬P works well if ¬Q is observed, but is not useful, or even erroneous, if Q is observed.</p>
<p>Even without hardcoding, the output might match by coincidence, or because of factors outside the direct logic we intended to test. This can happen due to:</p>
<ul>
<li><p><strong>Default behavior:</strong> A broader system default might produce the expected output.</p>
</li>
<li><p><strong>Caching:</strong> A previous successful operation might have cached the result, bypassing the actual logic.</p>
</li>
<li><p><strong>Fallback logic:</strong> An unintended fallback mechanism produces the correct output despite an error in the primary path.</p>
</li>
<li><p><strong>Test harness bugs:</strong> Flaws in the testing setup itself might obscure real issues.</p>
</li>
</ul>
<h3 id="heading-the-role-and-risks-of-test-doubles">The Role and Risks of Test Doubles</h3>
<p>The challenges highlighted above are particularly relevant when using <strong>test doubles</strong>, such as Stubs and Mocks. These are artificial components that replace real dependencies (for example, databases, external APIs, time-sensitive operations) during testing.</p>
<ul>
<li><p><strong>Stubs</strong> focus on <strong>state</strong>: they provide pre-programmed fake data or return values to get the rest of the code under test working predictably, like the <code>get_user_role</code> example</p>
</li>
<li><p><strong>Mocks</strong> focus on <strong>behavior</strong>: they allow you to verify interactions, such as the number of calls made to a certain API, or how control flow flows through specific parts of the system.</p>
</li>
</ul>
<p>Both remove external dependencies, allowing you to isolate and focus on the internal logic of the code without noise or side effects. But using them without understanding their limitations can lead to <strong>false confidence</strong>.</p>
<p>If a test double simulates a "correct" response, but the real dependency it replaces has a bug, or the way the main code interacts with that dependency is flawed, the test will pass (Q is True) – yet P (the code's overall correctness in a real environment) might be False, leading to a dangerous false positive.</p>
<p>Whether you encounter such logical fallacies in your testing depends on precisely what behavior or state you are attempting to verify, and whether you are over-interpreting the test results.</p>
<h3 id="heading-test-scope-and-interpretation">Test Scope and Interpretation</h3>
<p>The choice of testing scope – from narrowly focused unit tests to broader integration tests, system tests, user acceptance tests (UAT), and even testing in production – represents a continuum. On this spectrum, various trade-offs are involved, especially concerning the effort-reward ratio. This effort is influenced by factors like individual developer skill, company engineering practices (for example, responsibility split between feature developer and dedicated tester roles), and industry regulations.</p>
<p>Generally:</p>
<ul>
<li><p><strong>Smaller-scoped tests</strong> (for example, unit tests) have fewer assumptions baked in and a shorter chain of logical implications. This translates to less risk of committing fallacies in both test implementation and test result interpretation. They are excellent for quickly verifying isolated units of code.</p>
</li>
<li><p><strong>Larger-scoped tests</strong> (for example, end-to-end integration tests) incorporate more real-world complexities and dependencies. While providing higher confidence in the system's overall behavior, they inherently increase the potential for confounding factors that can lead to false positives or make debugging more challenging.</p>
</li>
</ul>
<p>Being acutely aware of the assumptions implicit in each test, at every scope level, is paramount. Passing tests for the wrong reasons will inevitably cause problems down the road.</p>
<h3 id="heading-debugging-observability-and-mental-models">Debugging, Observability, and Mental Models</h3>
<p>Failing tests are not failures of the testing process but are, in fact, incredibly valuable learning moments. They represent opportunities to:</p>
<ul>
<li><p>Run focused debugging experiments to pinpoint the exact cause of the failure.</p>
</li>
<li><p>Refine your <strong>mental model of the code-to-outcome (P⟹Q) link</strong>. A failing test (where Q is False) tells you that your current understanding of P, or of the P⟹Q relationship, is flawed. Use this feedback to update your understanding of the code's actual behavior.</p>
</li>
<li><p>Improve both the code and the tests themselves.</p>
</li>
</ul>
<p>Enhance system <strong>observability</strong> to better detect and confirm outcomes (Q). The more clearly, from multiple angles, and through diverse methods we can observe Q (for example, logs, metrics, tracing, output inspection), the more confident we can be in its causes and, by extension, the actual state of P.</p>
<p>Crucially, avoid blindly fixing tests just to make them pass. Always ensure you thoroughly understand why a test failed and update your P⟹Q model accordingly. The ultimate goal is not just to fix current bugs, but to prevent them in the future by continually strengthening both the correctness of the code and the verifiability of its behavior.</p>
<h3 id="heading-falsifiable-tests-reveal-regressions">Falsifiable Tests Reveal Regressions</h3>
<p>Beyond avoiding false positives (where the code is incorrect but the test passes), a good test must also be <strong>falsifiable</strong>. This means the test must be genuinely capable of failing under certain (incorrect) conditions. An unfalsifiable test is a broken test – it cannot serve its purpose of revealing regressions or confirming the presence of bugs.</p>
<p>While we strive for the implication P⟹Q to hold true for all the scenarios we care about, it may not be true for all cases due to unforeseen or mistaken assumptions, or simply because the code is incorrect. The test's ability to demonstrate this incorrectness by failing under specific, well-defined conditions makes it profoundly valuable.</p>
<p>Some common culprits for unfalsifiable or "bad" tests include:</p>
<ul>
<li><p><strong>Vague or Untestable Specifications:</strong> Statements like "The system should behave well under most conditions," "It shouldn't crash randomly," or "The algorithm is robust" lack clear, measurable criteria. It's impossible to design a test that definitively passes or fails against such statements, thus rendering them effectively unfalsifiable.</p>
</li>
<li><p><strong>Broken Implementations of the Test Suite:</strong> The test code itself might be flawed, perhaps due to logical errors or control flow issues that prevent assertions from ever being reached or correctly evaluated, inadvertently taking the same passing path regardless of the code under test.</p>
</li>
<li><p><strong>Insufficient Test Data or Edge Cases:</strong> If tests only cover "happy path" scenarios and fail to include challenging inputs or boundary conditions, they might pass for incorrect code that only breaks under specific, untested circumstances.</p>
</li>
</ul>
<p>A robust specification clearly defines what constitutes success and failure. Correspondingly, a good test suite correctly implements that specification, making its tests both accurate and truly falsifiable.</p>
<h3 id="heading-take-a-step-back">Take a step back</h3>
<p>Critical thinkers might observe that the application of the four fundamental logical argument forms to coding scenarios, as initially presented, could be misleading in the complexities of real-world software.</p>
<p>The next section shows some nuances that arise when we transition from the clear-cut rules of formal logic to the often messy reality of software development.</p>
<p>Specifically:</p>
<ul>
<li><p>The first two points below show why the seemingly valid arguments of Modus Ponens and Modus Tollens may not always lead to reliable conclusions when applied to coding scenarios.</p>
</li>
<li><p>The last two points below show why the two common logical fallacies, Affirming the Consequent and Denying the Antecedent, may actually provide correct insights under specific real-world coding conditions.</p>
</li>
</ul>
<h2 id="heading-revisiting-the-four-statements-for-coding">Revisiting the Four Statements for Coding</h2>
<p>Here are the four arguments and their associated coding examples:</p>
<ol>
<li><p><strong>Modus Ponens:</strong> If you provide invalid input data (P), the code will show an error (Q).</p>
</li>
<li><p><strong>Modus Tollens:</strong> There are no error messages (¬Q), so the input data is valid (¬P).</p>
</li>
<li><p><strong>Affirming the Consequent (Fallacy):</strong> The code showed an error (Q), so you provided invalid data (P).</p>
</li>
<li><p><strong>Denying the Antecedent (Fallacy):</strong> You provided valid data (¬P), so you have no error (¬Q).</p>
</li>
</ol>
<p>Now, let's dive into the nuances of each:</p>
<h3 id="heading-modus-ponens">Modus Ponens</h3>
<ul>
<li><p><strong>Our coding example:</strong> If you provide invalid input data (P), then the code will show an error (Q).</p>
</li>
<li><p><strong>Why it may not always hold:</strong> This application of Modus Ponens assumes that either your code or any third-party code it relies upon will <em>always</em> properly detect and explicitly raise exceptions or show errors on bad data. In reality, systems might automatically fix or sanitize bad input, silence errors, or simply proceed with unexpected behavior without explicitly signaling an error, leading to a passing (or non-failing) state (¬Q) even when P (invalid input) was true.</p>
</li>
</ul>
<h3 id="heading-modus-tollens">Modus Tollens</h3>
<ul>
<li><p><strong>Our coding example:</strong> There are no error messages (¬Q), so the input data is valid (¬P).</p>
</li>
<li><p><strong>Why it may not always hold:</strong> This application of Modus Tollens assumes there are no automatic mechanisms within the system to fix or silence bad input <em>before</em> errors are typically displayed. If such "silent correction" or "error suppression" occurs, you might observe no error messages (¬Q), but the input data could still be invalid (P), rendering the conclusion (¬P) false despite the premise (¬Q) being true. This highlights the dangers of incomplete observability.</p>
</li>
</ul>
<h3 id="heading-affirming-the-consequent-fallacy-1">Affirming the Consequent (Fallacy)</h3>
<ul>
<li><p><strong>Our coding example:</strong> The code showed an error (Q), so you provided invalid data (P).</p>
</li>
<li><p><strong>Why it may actually be correct:</strong> While logically a fallacy, in specific, highly constrained real-world conditions, this inference can gain practical validity. If the error message is so uniquely and specifically defined that it can <em>only</em> be caused by invalid input data (P) and no other known factor, then this statement can become reliable. This is rare and typically requires meticulous error handling design where each error message maps unambiguously to a single root cause.</p>
</li>
</ul>
<h3 id="heading-denying-the-antecedent-fallacy-1">Denying the Antecedent (Fallacy)</h3>
<ul>
<li><p><strong>Our coding example:</strong> You provided valid data (¬P), so you have no error (¬Q).</p>
</li>
<li><p><strong>Why it may actually be correct:</strong> Although a fallacy in general logic, this inference can hold a high degree of practical confidence under certain programming paradigms (<strong>Functional Programming</strong>). If the code is sufficiently simple, purely functional (meaning outputs depend <em>only</em> on inputs and have no side effects), and has no external dependencies (like network or database interactions), then the absence of invalid data (¬P) can indeed make us reasonably confident that there will be no errors (¬Q). The lack of external variables and internal state makes the code's behavior highly predictable and directly tied to its inputs.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749061917858/db44dba5-2184-427a-8e28-27fc59904c49.jpeg" alt="dog with head tilted" class="image--center mx-auto" width="2778" height="4269" loading="lazy"></p>
<p>You may now be thinking: what’s the point of studying logic if it has so many loopholes and edge cases when applied to coding?</p>
<h2 id="heading-the-missing-ingredient-if-and-only-if">The Missing Ingredient – If and Only If</h2>
<p>In our exploration of logical implications, we've focused primarily on the <strong>unidirectional relationship</strong> P⟹Q ("If P, then Q"). This statement tells us what happens <em>if</em> P is true, but it remains silent on whether Q <em>only</em> happens when P is true. It's like saying, "If it rains, the ground gets wet." This is true, but the ground can also get wet if a sprinkler is on, even if it's not raining.</p>
<p>But in many critical contexts, especially in rigorous scientific theories and robust software systems, we often seek a much stronger relationship: one where the truth of Q absolutely <em>depends</em> on the truth of P, and vice versa. This powerful <strong>bidirectional relationship</strong> is captured by the phrase "<strong>If and Only If</strong>" (P⟺Q).</p>
<h3 id="heading-what-if-and-only-if-means-a-stronger-statement">What "If and Only If" Means: A Stronger Statement</h3>
<p>When we assert "P⟺Q", we're making two distinct claims simultaneously:</p>
<ol>
<li><p><strong>If P, then Q</strong> (P⟹Q): P is a sufficient condition for Q. Whenever P is true, Q must also be true.</p>
</li>
<li><p><strong>If Q, then P</strong> (Q⟹P): P is also a necessary condition for Q. Whenever Q is true, P must also be true. In other words, Q cannot be true without P being true.</p>
</li>
</ol>
<p>Notice the <strong>significant increase in the strength</strong> of the statement. "If P, then Q" merely states a consequence. "P⟺Q" declares a <strong>definitive equivalence</strong>, where P and Q are inextricably linked. They rise and fall together – one cannot be true without the other being true, and one cannot be false without the other being false.</p>
<h3 id="heading-bidirectional-truth-table-unambiguous-relationships">Bidirectional Truth Table: Unambiguous Relationships</h3>
<p>Let's construct the truth table for P⟺Q to clearly see this strong relationship.</p>
<p>P⟺Q is logically equivalent to (P⟹Q)∧(Q⟹P).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747678444501/8d498249-eec2-46ca-a5c1-85801eb1b350.png" alt="Truth table with columns P, Q, P->Q, Q->P, P<->Q" class="image--center mx-auto" width="1226" height="323" loading="lazy"></p>
<h4 id="heading-creating-the-table-columns-4-and-5-are-new">Creating the Table (columns 4 and 5 are new):</h4>
<ul>
<li><p><strong>Q⟹P (Column 4):</strong> We apply the standard implication rules, but with Q as our "if" and P as our "then." For instance, in Row 3, Q is True and P is False, so Q⟹P is False.</p>
</li>
<li><p><strong>P⟺Q (Column 5):</strong> This is the logical <strong>AND</strong> of the P⟹Q and Q⟹P columns. For P⟺Q to be True, both component implications must be True, which explains why you see less Trues in the bidirectional implication compared to any of the unidirectional implications.</p>
</li>
</ul>
<h3 id="heading-implications-for-the-two-common-fallacies">Implications for the Two Common Fallacies</h3>
<p>The clarity provided by "If and Only If" is particularly powerful in preventing the very logical fallacies we discussed earlier: Affirming the Consequent and Denying the Antecedent. These fallacies arise from the incorrect assumption that an "if-then" statement implies an "if and only if" relationship.</p>
<p>Let's revisit them with the lens of <strong>P⟺Q If and Only If you provided invalid data (P), then the code will show an error (Q)</strong>:</p>
<h4 id="heading-affirming-the-consequent-no-more-ambiguity">Affirming the Consequent: No More Ambiguity</h4>
<ul>
<li><p><strong>The Fallacy (assuming unidirectional P⟹Q):</strong></p>
<ul>
<li><p>If the code showed an error (Q), then you provided invalid data (P).</p>
</li>
<li><p>Previously, when P⟹Q was True and Q was True, P could be True (Row 1) or False (Row 3). This ambiguity led to the fallacy.</p>
</li>
</ul>
</li>
<li><p><strong>With P⟺Q:</strong></p>
<ul>
<li><p>Now, look at the P⟺Q column in the table. When P⟺Q is True and Q is True (Row 1), P is <strong>unambiguously True</strong>. The confusion from Row 3 is gone because if Q were True while P was False, P⟺Q would be False (as Q⟹P would be False), thus making that row irrelevant for valid modus ponens inference under the P⟺Q premise.</p>
</li>
<li><p>In a system designed with P⟺Q in mind, knowing that Q is True (observing an error) would <strong>force</strong> the conclusion that P is True (invalid data is the cause), assuming the "if and only if" relationship holds true for that specific system design.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-denying-the-antecedent-unmistakable-consequences">Denying the Antecedent: Unmistakable Consequences</h4>
<ul>
<li><p><strong>The Fallacy (assuming unidirectional P⟹Q):</strong></p>
<ul>
<li><p>You provided valid data (¬P), so you have no error (¬Q).</p>
</li>
<li><p>Previously, when P⟹Q was True and P was False, Q could be True (Row 3) or False (Row 4). This ambiguity led to the fallacy.</p>
</li>
</ul>
</li>
<li><p><strong>With P⟺Q:</strong></p>
<ul>
<li><p>Now, when P⟺Q is True and P is False (Row 4), Q is <strong>unambiguously False</strong>. The problematic scenario from Row 3 (where P was False but Q was True) is irrelevant here because P⟺Q would be False in that case (specifically, Q⟹P would be False).</p>
</li>
<li><p>If your system genuinely adheres to "P⟺Q", then knowing that P is False (valid data provided) <strong>guarantees</strong> that Q is False (no error messages).</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-practical-mitigation-in-coding">Practical Mitigation in Coding</h3>
<p>The insights from "If and Only If" are more than just theoretical. Practically, both fallacies (Affirming the Consequent and Denying the Antecedent) can be mitigated by striving for conditions that approximate an "if and only if" relationship in your code and tests.</p>
<h4 id="heading-focused-unit-tests">Focused Unit Tests</h4>
<p>Design unit tests that are so granular and isolated that they effectively aim to establish an "if and only if" scenario for a tiny piece of logic. By thoroughly mocking or controlling all external dependencies and environmental factors, you reduce the impact of "other causes."</p>
<p>If your test for a specific input passes, you want to be as confident as possible that it passed <em>only</em> because the code handled that specific input correctly, and not due to some irrelevant side effect. Similarly, if it fails, you want to be sure that the failure points directly to the intended logical path.</p>
<h4 id="heading-exception-handling-and-specificity">Exception Handling and Specificity</h4>
<p>Instead of catching broad <code>Exception</code> types, catch and handle specific exceptions. This helps differentiate between various "causes" (P1​,P2​,…) that might lead to a generic "error" (Q). The more precise your error handling, the closer you get to a scenario where "If X error, then Y specific cause," moving towards a bidirectional understanding of error conditions.</p>
<h4 id="heading-test-driven-development-tdd-and-mutation-testing">Test-Driven Development (TDD) and Mutation Testing</h4>
<p>These methodologies inherently push towards P⟺Q thinking. TDD encourages writing a failing test <em>first</em> (¬Q), which <em>then</em> necessitates a specific code change (P) to make it pass.</p>
<p>Mutation testing, which we'll explore further, takes this a step further by ensuring that your tests are robust enough to <em>fail</em> when code is subtly altered (that is, proving that ¬P leads to ¬Q, and thus, that the original P was indeed necessary for Q).</p>
<p>By consciously aiming for "if and only if" relationships in your code's design and your testing strategies, you can build systems that are not only predictable but also much easier to debug and reason about, moving beyond mere correlation to a deeper understanding of cause and effect.</p>
<h3 id="heading-callback-to-mutation-testing">Callback to Mutation Testing</h3>
<p>In the earlier section on <strong>Assigning Real-World Meanings to Logic</strong>, we discussed:</p>
<blockquote>
<p>When testing the <strong>happy path</strong>, we are verifying that the implication <strong>P</strong>⟹<strong>Q (If input is good, then no error)</strong> holds true.</p>
<p>When testing the <strong>unhappy path (mutation testing)</strong>, we are verifying that <strong>¬P</strong>⟹<strong>¬Q (If input is not good, then an error occurs)</strong> holds true.</p>
</blockquote>
<p>This dual view is key to understanding how mutation testing contributes to software correctness.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749063165908/e1e3736c-75dd-4f1f-81bb-fd7d4f4f7837.jpeg" alt="artistic representation of molecular structures" class="image--center mx-auto" width="4000" height="4000" loading="lazy"></p>
<h2 id="heading-mutation-testing-testing-the-tests">Mutation Testing: Testing the Tests</h2>
<p>Mutation testing deliberately introduces small faults (mutations) in the code and checks whether the test suite detects them by failing. This process assesses not the <em>code</em>, but the <em>tests themselves</em>.</p>
<p>In a robust test suite, we strive for two ideal conditions:</p>
<ul>
<li><p>All <strong>correct</strong> implementations should <strong>pass</strong> the tests.</p>
</li>
<li><p>All <strong>incorrect</strong> implementations should <strong>fail</strong> the tests.</p>
</li>
</ul>
<p>If a mutated (wrong) version of the code is introduced and causes no test failures, that defeats the fundamental purpose of testing. It means your tests aren't sensitive enough to catch a deviation from correctness. Mutations reveal hidden assumptions or gaps in your test coverage, acting as a sensitivity probe for your test suite.</p>
<p><strong>Example code mutations:</strong></p>
<ul>
<li><p>Changing an arithmetic operator (<code>+</code> to <code>-</code>, <code>&gt;</code> to <code>&gt;=</code>).</p>
</li>
<li><p>Flipping a boolean condition (<code>true</code> to <code>false</code>).</p>
</li>
<li><p>Deleting or duplicating a statement.</p>
</li>
<li><p>Modifying a constant value.</p>
</li>
</ul>
<p><strong>Common Python mutation testing tools:</strong></p>
<ul>
<li><p><strong>mutmut</strong> uses Python’s built-in <code>ast</code> module.</p>
</li>
<li><p><strong>cosmic-ray</strong> uses <code>parso</code>, which provides a more complete AST.</p>
</li>
</ul>
<p>These tools rely on abstract syntax trees to surgically mutate code.</p>
<p>You can even swap out underlying AST libraries for different precision or completeness: <a target="_blank" href="https://github.com/boxed/mutmut/issues/281">https://github.com/boxed/mutmut/issues/281</a></p>
<h3 id="heading-logic-behind-mutation-testing">Logic Behind Mutation Testing</h3>
<p>Let's formalize the logical mapping of mutation testing, recalling our definitions:</p>
<ul>
<li><p>Let P: Code is correct.</p>
</li>
<li><p>Let Q: Tests pass.</p>
</li>
</ul>
<p>Standard <strong>happy path testing</strong> primarily checks that P⟹Q – "if the code is correct, then tests pass."</p>
<p><strong>Mutation testing</strong> focuses on the other side of the coin: we intentionally make ¬P true (by introducing a fault), and then we expect ¬Q (the tests should fail). This process rigorously checks whether the implication ¬P⟹¬Q ("if the code is <em>not</em> correct, then the tests <em>fail</em>") holds true for your test suite.</p>
<p>But there's a deeper, more powerful logical implication here:</p>
<p>As we learned earlier, the statement ¬P⟹¬Q is <strong>logically equivalent</strong> to its <strong>contrapositive</strong>, Q⟹P.</p>
<p>So, by successfully verifying that introducing a fault (¬P) leads to a test failure (¬Q), we are simultaneously validating the contrapositive: <code>if tests pass (Q), then the code must be correct (P)</code>.</p>
<p>This is incredibly significant! It moves us much closer to establishing a <strong>bidirectional guarantee</strong> between our code and our tests: P⟺Q (code correctness is tightly coupled with test success). Mutation testing helps us confidently eliminate false positives in the test suite – situations where Q is true (the test passes) but P is false (the code is actually incorrect).</p>
<p>In a world where LLMs help us write and refactor code quickly, having this "if and only if" confidence in our test suite is invaluable for ensuring the generated or refactored code truly meets expectations.</p>
<h3 id="heading-clarifying-the-kinds-of-failures"><strong>Clarifying the Kinds of Failures</strong></h3>
<p>In software, we typically categorize errors into three main types:</p>
<ul>
<li><p><strong>Syntax errors:</strong> Violations of the language's grammatical rules (for example, missing colon, invalid keyword). These prevent the code from running at all.</p>
</li>
<li><p><strong>Runtime errors:</strong> Errors that occur during program execution, often due to unexpected conditions (for example, <code>TypeError</code>, <code>AttributeError</code>, <code>ZeroDivisionError</code>).</p>
</li>
<li><p><strong>Logic errors:</strong> The program runs without crashing, but it produces an incorrect result or behaves in a way that doesn't match the intended specification (for example, wrong algorithm, wrong return value).</p>
</li>
</ul>
<p>Mutation testing focuses on <strong>logic errors</strong> – failures where the program runs, but produces incorrect results. These are usually caught via <code>AssertionError</code> in the "Assert" phase of the Arrange–Act–Assert (AAA) testing pattern.</p>
<p>You could argue pedantically that <code>AssertionError</code> is a runtime error, but in testing, we treat it as a <strong>signal for logical failure</strong>:</p>
<blockquote>
<p><em>"The function ran, but the output didn’t match the expected behavior."</em></p>
</blockquote>
<p>Mutation testing assumes that syntax and runtime errors are already handled. Its purpose is to validate whether the test suite reliably catches logical misbehavior.</p>
<h3 id="heading-a-deeper-falsification-perspective">A Deeper Falsification Perspective</h3>
<p>Now, let's connect mutation testing back to <strong>Karl Popper's principle of falsification</strong>, which we introduced earlier in the context of scientific reasoning. Recall that Popper argued scientific theories gain strength not by being "proven," but by <em>surviving rigorous attempts to disprove them</em>. The core idea of falsification logic is that to disprove an implication like P⟹Q, you only need to find one instance where P is True and Q is False.</p>
<p>Mutation testing applies this same powerful principle, but to our test suite's effectiveness:</p>
<p>Instead of trying to <em>prove</em> directly that our tests are perfect, mutation testing takes a falsification approach to the implication <strong>¬P⟹¬Q ("If the code is incorrect, then the tests fail").</strong> It actively tries to <strong>falsify</strong> this crucial relationship.</p>
<p>If we introduce a mutation (making ¬P true, that is, the code is now incorrect) but the existing test suite <em>still passes</em> (meaning Q is true), then we have found an instance where:</p>
<ol>
<li><p>¬P is True (the code is incorrect due to the mutation).</p>
</li>
<li><p>Q is True (the test still passes).</p>
</li>
</ol>
<p>In this scenario, the implication <strong>¬P⟹¬Q is falsified</strong> because we have a True antecedent (¬P) leading to a False consequent (¬Q is false, because Q is true).</p>
<p>And, critically, if ¬P⟹¬Q is falsified, then its logically equivalent contrapositive, Q⟹P ("If the tests pass, then the code is correct"), is <em>also</em> falsified. This means we can no longer trust that a passing test suite reliably indicates correct code. Our desired P⟺Q relationship is broken – <strong>the test suite is no longer fully effective</strong> at guaranteeing correctness.</p>
<p>By pushing for zero surviving mutants, mutation testing forces us to minimize the surface area of these "hidden assumptions" in our test suite. It demands highly sensitive and specific tests that can pinpoint even subtle logical flaws, thereby moving us closer to building truly resilient systems.</p>
<h3 id="heading-comparing-tdd-red-phase-and-mutation-testing">Comparing TDD (Red Phase) and Mutation Testing</h3>
<p>Both methodologies, albeit through different means and at different stages of the development cycle, aim to establish confidence in the <strong>¬P ⟹ ¬Q</strong> relationship.</p>
<p><strong>Key Differences Summarized:</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Feature</td><td>TDD (Red Phase)</td><td>Mutation Testing</td></tr>
</thead>
<tbody>
<tr>
<td><strong>Primary Goal</strong></td><td>Drive new code development. Confirm a bug/feature.</td><td>Evaluate the quality/completeness of existing tests.</td></tr>
<tr>
<td><strong>Code State</strong></td><td>Production code is incomplete or buggy.</td><td>Production code is (assumed to be) correct.</td></tr>
<tr>
<td><strong>Test State</strong></td><td>The <em>new</em> test is expected to fail.</td><td><em>Existing</em> tests are expected to fail (due to mutants).</td></tr>
<tr>
<td><strong>Initiator</strong></td><td>Developer wanting to add functionality/fix bug.</td><td>Tool that inserts artificial bugs into code.</td></tr>
<tr>
<td><strong>"Bugs"</strong></td><td>Actual, intended bugs or missing features.</td><td>Artificial, subtle changes to the code.</td></tr>
</tbody>
</table>
</div><h2 id="heading-toward-if-and-only-if-confidence">Toward If-and-Only-If Confidence</h2>
<p>Ultimately, the goal in software development is to establish if-and-only-if relationships whenever possible, both in the code implementation and especially in the sensitivity of the test suite to the code under test.</p>
<p>This means <strong>if a certain condition (P) is true, then a specific outcome (Q) <em>must</em> occur, and if Q occurs, then P <em>must</em> have been the cause</strong>. Achieving this level of clarity comes from:</p>
<ul>
<li><p>A deep understanding of the problem.</p>
</li>
<li><p>Aligned expectations during requirements gathering.</p>
</li>
<li><p>Logical analysis and interpretation of well-designed experiments.</p>
</li>
<li><p>Adherence to Single Responsibility Principle in SOLID</p>
</li>
<li><p>Rigorous tests with meaningful coverage.</p>
</li>
</ul>
<p>This allows us to understand how <strong>control flow</strong> and <strong>data flow</strong> work with greater depth and confidence, leading to better inferences throughout the entire software development lifecycle.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749062596293/9bfb566a-5e3c-4fec-ac42-326aa22532c8.jpeg" alt="Monarch Butterfly resting on butterfly bush flower" class="image--center mx-auto" width="4212" height="2812" loading="lazy"></p>
<h2 id="heading-real-world-challenges">Real-World Challenges</h2>
<p>While striving for perfect "if-and-only-if" relationships provides a powerful logical ideal, the messy reality of modern software development presents significant hurdles. The very characteristics that make large systems powerful and scalable – their intricate interconnections and inherent dynamism – simultaneously obscure clear cause-and-effect relationships, making precise logical reasoning and debugging an ongoing battle.</p>
<h3 id="heading-a-web-of-complexity">A Web of Complexity</h3>
<h4 id="heading-fan-in-fan-out-the-nature-of-modern-systems">Fan-In, Fan-Out: The Nature of Modern Systems</h4>
<p>Any reasonably large software system rarely operates through purely linear control and data flows. Fan-out and fan-in patterns – where many components are called and then their results merged – are inevitable.</p>
<p>For example:</p>
<ul>
<li><p>In <strong>ETL pipelines</strong>, data may be ingested from multiple sources (external APIs, CSVs) and logged to multiple destinations (files, databases).</p>
</li>
<li><p>In <strong>concurrent programming</strong>, Python’s <code>ProcessPoolExecutor</code> splits data into chunks processed in parallel, then recombines the results.</p>
</li>
</ul>
<h4 id="heading-srp-meets-real-world-boundaries">SRP Meets Real-World Boundaries</h4>
<p>Just as functional programming must eventually perform I/O, the <strong>Single Responsibility Principle (SRP)</strong> runs into real-world boundaries, whether conceptual or infrastructural. At some point, something must glue these isolated units together.</p>
<p>Orchestration logic might live in a single function, span multiple files, or even distribute across microservices and machines communicating over networks. While this decomposition enhances modularity, it also increases surface area for bugs involving:</p>
<ul>
<li><p><strong>Side effects:</strong> Unintended changes to system state outside a component's explicit outputs.</p>
</li>
<li><p><strong>Circular dependencies:</strong> Components relying on each other in a loop, leading to difficult-to-trace behavior.</p>
</li>
<li><p><strong>Interface drift:</strong> Changes in one component's input/output expectations not being correctly reflected elsewhere.</p>
</li>
<li><p><strong>Race conditions:</strong> Timing-dependent bugs in concurrent operations.</p>
</li>
<li><p><strong>Serialization issues:</strong> Problems translating data between different formats or systems.</p>
</li>
<li><p><strong>Network unreliability:</strong> Unpredictable latency, packet loss, or disconnections in distributed systems.</p>
</li>
</ul>
<h4 id="heading-the-double-edged-sword-of-abstraction">The Double-Edged Sword of Abstraction</h4>
<p>This web of dependencies is the price of progress, made manageable only through better tooling and abstractions.</p>
<ul>
<li><p>If boundaries are <strong>well-designed, observable, and testable</strong>, they enable asynchronous collaboration, improve long-term maintainability, and increase developer confidence. (See GitHub Playbook in References)</p>
</li>
<li><p>If systems <strong>lack architectural coherence</strong> or fall behind evolving needs, they calcify into technical debt that demoralizes even the most motivated teams.</p>
</li>
</ul>
<h4 id="heading-clean-code-is-contextual">Clean Code Is Contextual</h4>
<p>While abstractions and orchestration help manage complexity, overusing design patterns or creating unnecessary class layers can introduce needless indirection. This is a common counterargument to architectural purism.</p>
<p>Ultimately, what counts as "clean code" is context-dependent. It varies with programmer skill, the tooling at hand (linters, tests, Copilot), and whether the project is a throwaway script or a multi-year infrastructure investment. Architectural practices like SRP should evolve alongside those constraints.</p>
<h3 id="heading-the-butterfly-effect-of-bugs">The Butterfly Effect of Bugs</h3>
<h4 id="heading-from-srp-to-reasoning-chains">From SRP to Reasoning Chains</h4>
<p>Previously, we focused on simple, direct cause-effect logic (P ⟹ Q), but real-world systems are messier.</p>
<p>The more we adhere to SRP through small, focused functions, the more we create longer chains of logic. This improves separation of concerns but also extends the reasoning required to debug behavior.</p>
<h4 id="heading-debugging-in-a-causal-fog">Debugging in a Causal Fog</h4>
<p>A seemingly minor trigger (O) can cascade through a chain like O⟹P⟹Q⟹R, which we may not fully understand due to knowledge silos, evolving requirements, or runtime dynamism.</p>
<p>Even when we understand the components, precisely identifying “P” is hard, much like how redefining a research question shifts the statistical population being studied. In complex systems with <strong>feedback loops</strong> (recommender engines), there might not be a single "root cause" at all.</p>
<h4 id="heading-short-term-triage-vs-long-term-insight">Short-Term Triage vs. Long-Term Insight</h4>
<p>Finding the true origin of a bug often demands experimentation, telemetry, and broad system insight. These investigations produce robust, future-proof fixes but take time.</p>
<p>In on-call scenarios, however, urgency reshapes priorities. Fast mitigations and clear communication often take precedence over deep diagnosis.</p>
<h3 id="heading-masked-by-design-and-debt">Masked by Design and Debt</h3>
<p>As systems scale, failure stops looking like a crash. Instead, it shows up as a retry spike, a slow metric drift, or silent fallback behavior.</p>
<p>Modern fault-tolerant systems, built with retries, failovers, circuit breakers, and autoscaling, are designed to recover quickly. This resilience often masks deeper problems, delaying detection for weeks and making root cause analysis harder.</p>
<p>Operating in <strong>non-deterministic environments</strong> with flaky networks, race conditions, or dynamic routing adds further ambiguity. Small symptoms become harder to link back to specific causes.</p>
<p>Compounding this, <strong>technical debt</strong> driven by weak technical leadership, shifting priorities or time pressure weakens the system’s observability and test coverage. Teams inherit brittle, poorly understood code, making it hard to draw clean lines between cause and effect.</p>
<p>Even the best engineers struggle in such conditions. When a system resists clarity, it doesn’t just block debugging. It erodes trust, slows learning, and fuels long-term burnout.</p>
<h2 id="heading-glimmers-of-hope-tools-and-practices-for-clarity">Glimmers of Hope: Tools and Practices for Clarity</h2>
<p>Despite these challenges, several strategies and practices offer a path toward more robust and understandable software.</p>
<h3 id="heading-leveraging-design-patterns">Leveraging Design Patterns</h3>
<p>Design patterns offer a shared vocabulary and time-tested strategies for structuring systems. When applied well, they tame complexity, reduce technical debt, and make behavior more predictable.</p>
<p>They also tend to concentrate similar failure modes. The same bug might appear across companies or industries, creating a wealth of prior art and solution playbooks. Familiarity with patterns can accelerate debugging and deepen shared understanding across teams.</p>
<h3 id="heading-nurturing-expert-mentorship">Nurturing Expert Mentorship</h3>
<p>Promoting mentors based on real technical impact instead of tenure builds stronger teams and avoids the <strong>Peter Principle</strong> (people in a hierarchy tend to rise to a level of respective incompetence).</p>
<p>Great mentors teach more than skills – they model falsifiability, independent thinking, and an ability to reason under uncertainty.</p>
<p>They help others challenge assumptions, navigate tradeoffs, and grow both technically and interpersonally. In systems where root causes are murky, this kind of leadership is essential.</p>
<p>One of the most powerful techniques that scales from mentorship to code is <strong>falsification</strong>: the disciplined search for counterexamples. Whether applied in design reviews, debugging sessions, or automated tests, this mindset anchors reasoning in reality.</p>
<h2 id="heading-the-power-of-falsification-in-testing">The Power of Falsification in Testing</h2>
<p>The deliberate search for counterexamples is core to building reliable systems.</p>
<ul>
<li><p>In algorithm design, testing edge cases is just falsification in disguise: finding where your logic breaks.</p>
</li>
<li><p>In code, <strong>fuzz testing</strong> (Atheris) throws diverse inputs at functions to expose falsifying examples.</p>
</li>
<li><p><strong>Property-based testing</strong> (Hypothesis) goes further by generating inputs that satisfy certain rules, then shrinks failures to their minimal form. This greatly improves reproducibility and helps stress-test concurrency issues.</p>
</li>
</ul>
<p>The more rigorously we attempt to falsify our assumptions, the more confidently we can reason about behavior using tools like Modus Ponens and Modus Tollens.</p>
<p>Assumptions are always present in software to simplify complexity. The question is whether they're <strong>explicitly codified in tests</strong> or <strong>left hidden and fragile</strong>.</p>
<p>Of course, no test is ever bulletproof: our assumptions could be mistaken, or the world could change. That’s why critical thinking, discerning "what should be" versus "what is", remains essential as newer generations increasingly rely on AI tools like Large Language Models.</p>
<p>This deliberate, <strong>falsification-driven approach</strong> is paramount for building reliable software. It underpins sophisticated testing techniques designed to expose hidden assumptions and break our logical chains.</p>
<p>While testing helps us uncover where our reasoning might falter, some domains demand an even higher degree of certainty. For those critical systems, we turn to the ultimate tools for logical rigor: <strong>Proof Assistants</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749062895395/f92ed2e7-f1fd-4351-a9d3-12c436c989f1.jpeg" alt="row of dominos" class="image--center mx-auto" width="5184" height="3888" loading="lazy"></p>
<h2 id="heading-proof-assistants">Proof Assistants</h2>
<p>While traditional testing and fuzzing are powerful for finding bugs, they fundamentally cannot guarantee correctness for all possible inputs or scenarios. They can only prove the <em>presence</em> of bugs, not their <em>absence</em>.</p>
<p>To achieve formal, mathematically verified proofs of program behavior – providing the strongest possible guarantees – we turn to <strong>proof assistants</strong>. These tools allow us to build step-by-step logical proofs, ensuring that a program or system design adheres to its specification with absolute rigor.</p>
<h3 id="heading-prolog"><strong>Prolog</strong></h3>
<p>Prolog offers a relatively straightforward entry point into the world of logic programming and theorem proving. <strong>SWI-Prolog</strong> is a common interpreter (a <strong>REPL</strong>, or Read-Eval-Print Loop) for Prolog.</p>
<p>You interact with Prolog by providing it with a knowledge base composed of <code>facts</code> and <code>rules</code> (which are a type of logical clause called <strong>Horn clauses</strong>). You then pose <code>queries</code>.</p>
<h4 id="heading-installing-swi-prolog">Installing SWI-Prolog</h4>
<p>You can download SWI-Prolog from its official website: <a target="_blank" href="https://www.swi-prolog.org/download/stable">https://www.swi-prolog.org/download/stable</a><br>Follow the instructions for your operating system (Windows, macOS, or Linux).</p>
<p>On Ubuntu/Debian, you can usually install it via:</p>
<pre><code class="lang-bash">sudo apt update
sudo apt install swi-prolog
</code></pre>
<h4 id="heading-using-prolog-repl-vs-file">Using Prolog: REPL vs. File</h4>
<ul>
<li><p><strong>REPL (</strong><code>swipl</code>) is best for: Quick, interactive tests of single facts or rules, and posing queries to an <em>already loaded</em> knowledge base.</p>
</li>
<li><p><strong>A File (</strong><code>.pl</code> extension) is best for: Defining your <strong>entire knowledge base</strong> (multiple facts and rules) and storing your program for reusability. This is the standard way to work with Prolog for anything beyond a few lines.</p>
</li>
</ul>
<h4 id="heading-example-a-simple-knowledge-base">Example: A Simple Knowledge Base</h4>
<p>Let's define a knowledge base to represent who has a job and who is a coding instructor.</p>
<p><strong>1. Create a file</strong> named <code>knowledge.pl</code> with the following content:</p>
<pre><code class="lang-haskell">% knowledge.pl
% <span class="hljs-type">This</span> file defines a small knowledge base <span class="hljs-keyword">in</span> <span class="hljs-type">Prolog</span>.
% <span class="hljs-type">In</span> <span class="hljs-type">Prolog</span>, all statements (facts and rules) about the same predicate
% (identified by its name <span class="hljs-type">AND</span> number <span class="hljs-keyword">of</span> arguments, e.g., 'has_job' with <span class="hljs-number">1</span> argument is 'has_job/<span class="hljs-number">1</span>')
% must be written consecutively without other predicate definitions <span class="hljs-keyword">in</span> between.

% <span class="hljs-comment">--- Definitions for the 'has_job' predicate (takes 1 argument) ---</span>

% <span class="hljs-type">Fact</span>: <span class="hljs-type">Alice</span> has a job.
<span class="hljs-title">has_job</span>(alice).

% <span class="hljs-type">Fact</span>: <span class="hljs-type">Bob</span> has a job.
<span class="hljs-title">has_job</span>(bob).

% <span class="hljs-type">Rule</span>: <span class="hljs-type">Anyone</span> (represented by variable <span class="hljs-type">X</span>) has a job <span class="hljs-type">IF</span> they are a coding instructor.
% ':-' means '<span class="hljs-keyword">if</span>'. '<span class="hljs-type">X'</span> is a variable (starts with uppercase).
<span class="hljs-title">has_job</span>(<span class="hljs-type">X</span>) :- is_coding_instructor(<span class="hljs-type">X</span>).

% <span class="hljs-comment">--- Definitions for the 'is_coding_instructor' predicate (takes 1 argument) ---</span>

% <span class="hljs-type">Fact</span>: <span class="hljs-type">Alice</span> is a coding instructor.
<span class="hljs-title">is_coding_instructor</span>(alice).
</code></pre>
<p><strong>What each line does:</strong></p>
<ul>
<li><p>Lines starting with <code>%</code>: These are comments for human readability, ignored by Prolog. They explain the file's purpose and key rules like predicate grouping.</p>
</li>
<li><p><code>has_job(alice).</code> / <code>has_job(bob).</code>: These are facts. They assert simple truths, like "Alice has a job." The <code>.</code> at the end is mandatory for every statement.</p>
</li>
<li><p><code>has_job(X) :- is_coding_instructor(X).</code>: This is a rule. It states a conditional truth: "For any <code>X</code>, <code>X</code> has a job <em>if</em> <code>X</code> is a coding instructor." <code>X</code> is a variable (always starts with an uppercase letter), and <code>:-</code> means "if." This rule allows Prolog to deduce new information.</p>
</li>
<li><p><code>is_coding_instructor(alice).</code>: Another fact, asserting "Alice is a coding instructor." It's placed after all <code>has_job/1</code> clauses to satisfy Prolog's grouping rule.</p>
</li>
</ul>
<p><strong>2. Load and Query in the REPL:</strong></p>
<p>Open your terminal and type <code>swipl</code>. Once at the <code>?-</code> prompt, load the file and then pose your queries:</p>
<pre><code class="lang-bash">$ swipl
?- [knowledge].   % Load the <span class="hljs-string">'knowledge.pl'</span> file (omit .pl, use square brackets and a period)
% Press Enter. Prolog will confirm it loaded the file, e.g., <span class="hljs-string">'% knowledge.pl compiled...'</span>
True.

?- has_job(alice). % Query: Does Alice have a job?
% Press Enter. Prolog gives you a solution, <span class="hljs-keyword">then</span> waits.
True.              % Output: Yes, because it<span class="hljs-string">'s a fact.
% After '</span>True.<span class="hljs-string">', you'</span>ll see the <span class="hljs-string">'?- '</span> prompt again, indicating Prolog is ready <span class="hljs-keyword">for</span> your next query.
% If there were multiple ways to prove <span class="hljs-string">'True.'</span>, Prolog would present the first <span class="hljs-string">'True.'</span> <span class="hljs-keyword">then</span> <span class="hljs-built_in">wait</span> <span class="hljs-keyword">for</span> you to press <span class="hljs-string">';'</span> <span class="hljs-keyword">for</span> alternatives, <span class="hljs-keyword">then</span> Enter to confirm the final <span class="hljs-string">'True.'</span> or <span class="hljs-string">'False.'</span>.

?- has_job(carol). % Query: Does Carol have a job?
% Press Enter.
False.             % Output: No, Prolog cannot prove it from its knowledge.

?- has_job(X).     % Query: Who has a job? (Find values <span class="hljs-keyword">for</span> X)
% Press Enter
X = alice ;        % Prolog finds Alice as the first solution. Type <span class="hljs-string">';'</span> and press Enter to ask <span class="hljs-keyword">for</span> the next solution.
X = bob ;          % It finds Bob. Type <span class="hljs-string">';'</span> and press Enter <span class="hljs-keyword">for</span> the next solution.
X = alice          % It finds Alice again (this time deduced via the rule and is_coding_instructor(alice)).
% Press Enter. This accepts the current <span class="hljs-built_in">set</span> of solutions and stops searching <span class="hljs-keyword">for</span> more.
False.             % Output: Indicates no more solutions found after the last <span class="hljs-string">'Enter'</span> (or <span class="hljs-keyword">if</span> you explicitly chose not to search further).

?- halt.           % Type <span class="hljs-string">'halt.'</span> to <span class="hljs-built_in">exit</span> the Prolog REPL cleanly.
% Alternatively, you can often use Ctrl+D (press and hold Ctrl, <span class="hljs-keyword">then</span> D) to <span class="hljs-built_in">exit</span> most REPLs.
</code></pre>
<p><strong>The Prolog example clearly demonstrates:</strong></p>
<ul>
<li><p><strong>"Is P(X) true for a specific X?"</strong>: Shown by <code>?- has_job(alice).</code> (returns <code>True.</code>) and <code>?- has_job(carol).</code> (returns <code>False.</code>).</p>
</li>
<li><p><strong>"Is there an X for which P(X) is true?"</strong>: Shown by <code>?- has_job(X).</code> (provides solutions like <code>X = alice</code>, <code>X = bob</code>).</p>
</li>
</ul>
<h4 id="heading-prolog-limitations">Prolog Limitations</h4>
<p>Prolog's limitations become evident when attempting to reason about falsity or non-existence. <strong>You cannot directly ask "Is there any X for which P(X) is false?"</strong></p>
<p>Instead, Prolog operates on the principle of negation as failure. This means that if Prolog cannot prove a statement, it considers that statement false.</p>
<p>For example, if you ask <code>?- \+ has_job(carol).</code> (meaning "Is it not true that Carol has a job?"), Prolog will say True, because it simply cannot find any proof that Carol has a job in its knowledge base.</p>
<p>This is a significant distinction: it doesn't mean Carol definitely doesn't have a job, nor does Prolog provide a formal counterexample. It merely reflects a lack of provable information.</p>
<p>This fundamental constraint means Prolog, while powerful for logic programming, falls short of being a full-fledged proof assistant for comprehensive formal verification.</p>
<h3 id="heading-coq"><strong>Coq</strong></h3>
<p>After experimenting with Prolog and seeing its limitations, you can move on to a more powerful proof assistant like <strong>Coq</strong>. Coq is employed in <strong>safety-critical domains</strong> where absolute mathematical certainty is paramount. <code>coqtop</code> is the standard REPL for Coq.</p>
<p>A fundamental difference from Prolog is Coq's lack of a <strong>Closed World Assumption</strong>. In Coq, anything not explicitly proven is simply <strong>unknown</strong>, not automatically false.</p>
<p>Unlike Prolog, Coq's primary purpose isn't solving computational problems by searching a knowledge base. Its true power lies in its ability to <strong>construct and verify formal mathematical proofs and programs with absolute rigor</strong>. Its interaction involves managing a <strong>proof state</strong> (your remaining goals) and applying <strong>tactics</strong> (logical inference steps) until the proof is complete.</p>
<h4 id="heading-installing-coq">Installing Coq</h4>
<p>Coq can be installed in several ways, often via package managers or a tool called <code>opam</code> (the OCaml package manager, as Coq is written in OCaml).</p>
<ul>
<li><p><strong>Official Downloads:</strong> Visit the Coq website for detailed instructions for your OS: <a target="_blank" href="https://coq.inria.fr/download">https://coq.inria.fr/download</a></p>
</li>
<li><p><strong>Using a system package manager (for example, Ubuntu/Debian):</strong> Bash</p>
<pre><code class="lang-haskell">  sudo apt update
  sudo apt install coq
</code></pre>
</li>
</ul>
<h4 id="heading-using-coq-repl-vs-file">Using Coq: REPL vs. File</h4>
<ul>
<li><p><strong>REPL (</strong><code>coqtop</code>) is best for: Trying out single tactics, inspecting the current proof state, or learning basic syntax for very short commands.</p>
</li>
<li><p><strong>A File (</strong><code>.v</code> extension) is best for: <strong>Almost all Coq development and proof construction.</strong> This is how complex proofs and verified programs are structured and managed.</p>
</li>
</ul>
<h4 id="heading-coqs-comprehensive-question-answering">Coq's Comprehensive Question Answering</h4>
<p>Unlike Prolog, Coq can directly address all three types of logical questions we've discussed, providing robust answers backed by formal proof:</p>
<ul>
<li><p><strong>"Is P(X) true for a specific X?"</strong>: Coq allows you to define a precise statement (a <strong>theorem</strong>) like "Alice has a job." You then build a step-by-step logical <strong>proof</strong> that formally confirms whether this statement is true based on your definitions. If the proof succeeds, Coq formally verifies it: if it fails, Coq clearly shows where your logic breaks down.</p>
</li>
<li><p><strong>"Is there an X for which P(X) is true?"</strong>: Coq handles questions of existence. If you ask, "Does someone have a job?", you can construct a proof by explicitly providing an example (like "Alice") and then proving that your chosen example indeed satisfies the condition ("Alice has a job").</p>
</li>
<li><p><strong>"Is there any X for which P(X) is false?"</strong>: This is a key capability where Coq excels over Prolog. Coq allows you to formally prove that a statement is false, or that a counterexample exists. For instance, you could prove "Carol does not have a job" by showing it contradicts the definition, or prove "there exists someone who doesn't have a job" by explicitly identifying such a person and proving that they indeed lack a job. This direct ability to reason about negation and provide formal counterexamples (or prove their non-existence) is what makes Coq a <strong>full-fledged proof assistant</strong>.</p>
</li>
</ul>
<p>While Coq's core doesn't automatically generate counterexamples when a proof fails, plugins like QuickChick can be integrated for property-based testing to find falsifying examples.</p>
<p>It's a Coq library that allows you to specify properties about your Coq definitions and then <strong>randomly generate inputs</strong> to try and find a counterexample that falsifies your property.</p>
<p>This is a powerful way to <em>find bugs early</em> in your formalization before you invest a lot of time trying to prove a false theorem.</p>
<h3 id="heading-tla-isabelle-and-lean-a-spectrum-of-formal-verification">TLA+, Isabelle, and Lean: A Spectrum of Formal Verification</h3>
<p>Beyond Prolog and Coq, other powerful proof assistants and formal specification languages cater to different needs and paradigms:</p>
<ul>
<li><p><strong>TLA+:</strong> This is a formal <strong>specification language</strong> developed by Leslie Lamport. It focuses on modeling and verifying <strong>system designs</strong> (especially concurrent and distributed ones) using <strong>temporal logic</strong>, rather than proving low-level code. It helps ensure critical properties like safety (nothing bad ever happens) and liveness (something good eventually happens). Its practicality and accessibility make it popular in industry, notably at Amazon and Microsoft for robust system design.</p>
</li>
<li><p><strong>Isabelle and Lean:</strong> These are modern, highly advanced proof assistants.</p>
<ul>
<li><p><strong>Isabelle</strong>, grounded in higher-order logic, is widely used by researchers and institutions (for example, in projects like the seL4 verified microkernel) for formal theorem proving and software verification in academic and <strong>safety-critical domains</strong> demanding extreme rigor.</p>
</li>
<li><p><strong>Lean</strong>, based on dependent type theory, is favored by mathematicians for <strong>formalizing proofs in pure mathematics</strong> (for example, number theory, algebra). It's known for its powerful automation and active community.</p>
</li>
</ul>
</li>
</ul>
<p>These tools represent the pinnacle of applying formal logic to ensure the correctness and reliability of both mathematical theories and complex software systems.</p>
<p>Now that you have a good lay of the land in both theory and practice, here are some thought experiments to enrich your education.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749063042362/b94ec237-0aca-46d8-8921-80dfe1f5f051.jpeg" alt="nuts on a table, like almond, cashew " class="image--center mx-auto" width="6000" height="4000" loading="lazy"></p>
<h2 id="heading-food-for-thought">Food for Thought</h2>
<p>The journey into formal logic and its intersection with practical domains like software and science offers many avenues for deeper exploration.</p>
<h3 id="heading-hypothesis-testing-in-science-and-the-implication-truth-table">Hypothesis Testing in Science and the Implication Truth Table</h3>
<p>Statistical hypothesis testing uses a probabilistic form of Modus Tollens. We start with a <strong>null hypothesis (H0​): "If H0​ is true, then observing this data (or more extreme data) is likely."</strong> We then observe data that is highly unlikely/unexpected if H0​ were true (that is, a small p-value). This serves as our <strong>probabilistic "not Q."</strong> Therefore, we conclude that H0​ is likely not true (we reject H0​). This is our <strong>probabilistic "∴¬P."</strong></p>
<p>Here, the <strong>"truthiness" of P⟹Q is being tested</strong>, rather than simply assumed to be true for developing arguments, as in Modus Ponens or Modus Tollens. There's no absolute truth or anything to "prove" definitively.</p>
<p>Inferences are drawn from prior experiments (which inform the test data distribution) and context-specific experiment setups (which determine the significance level α), together defining the threshold (critical value) for what is considered an unlikely observation of Q.</p>
<p>The experiment's result is a rejection (or lack thereof) of H0​, not a definitive proof that H0​ is true.</p>
<h3 id="heading-inductive-reasonings-relationship-to-deductive-arguments">Inductive Reasoning's Relationship to Deductive Arguments</h3>
<ul>
<li><p><strong>Induction</strong> generates general rules (for example, "P is always followed by Q") from specific observations or cases.</p>
</li>
<li><p><strong>Deduction</strong> then tests or applies those general rules in new situations.</p>
</li>
</ul>
<p>If deduction leads to wrong predictions (that is, a rule is falsified), induction may need to revise the original rule, which forms a continuous <strong>feedback loop</strong> that refines our understanding.</p>
<h3 id="heading-necessity-and-sufficiency-in-implication">Necessity and Sufficiency in Implication</h3>
<p>The implication <strong>P⟹Q ("If you crossed the border, you must have had a passport")</strong> unpacks into two fundamental logical concepts:</p>
<ul>
<li><p><strong>P is sufficient for Q:</strong> Crossing the border <strong>guarantees</strong> you had a passport. (P alone is enough for Q.)</p>
</li>
<li><p><strong>Q is necessary for P:</strong> If you <strong>didn't have a passport (¬Q), you couldn't have crossed (¬P)</strong>. (Q is required for P to happen.)</p>
</li>
</ul>
<h2 id="heading-qed-the-enduring-power-of-logic-in-an-uncertain-world">Q.E.D.: The Enduring Power of Logic in an Uncertain World</h2>
<p>Throughout this handbook, we’ve journeyed from the foundational concepts of propositional logic and truth tables to the powerful argument forms of Modus Ponens and Modus Tollens. We explored how these tools enable valid deductions and identified common logical fallacies like Affirming the Consequent and Denying the Antecedent, understanding why they lead to incorrect inferences when an "if-then" relationship isn't a strict "if and only if." We learned the profound importance of falsifiability – the ability for a statement or hypothesis to be disproven – a cornerstone of both scientific inquiry and robust software testing.</p>
<p>We then delved into the practical application of these logical principles in software development, mapping code correctness to test outcomes. We discovered how a failing test, when trusted, becomes a powerful application of Modus Tollens, pinpointing defects. We also confronted the "illusion of correctness" that arises from the affirming the consequent fallacy when tests pass for the wrong reasons, especially when using test doubles.</p>
<p>Crucially, we introduced the "If and Only If" (P⟺Q) relationship, highlighting its unparalleled power in establishing unambiguous connections between cause and effect. This bidirectional guarantee is the ideal we strive for in test suite quality, moving beyond mere correlation to a deeper understanding of causality. We saw how mutation testing rigorously pushes us towards this "if and only if" confidence by actively trying to falsify the assumption that "incorrect code leads to failing tests," thereby strengthening the inverse: "passing tests guarantee correct code."</p>
<p>We also acknowledged the "messy reality" of modern software. Large systems are webs of complexity, with fan-in/fan-out patterns, side effects, and unforeseen interactions that can obscure clear logical chains. Technical debt and the double-edged sword of abstraction often mask the true origins of bugs, turning debugging into a "causal fog."</p>
<h3 id="heading-logic-as-your-compass">Logic as Your Compass</h3>
<p>Despite these formidable challenges, the logical principles we've explored remain your most vital tools. They provide the mental framework to navigate uncertainty.</p>
<p>When confronted with a bug, your ability to reason logically allows you to formulate hypotheses, design focused experiments (your tests), and interpret their outcomes with precision. Whether you're debugging a complex microservice or reasoning about a simple function, applying Modus Tollens to a failing test or designing tests that aim for P⟺Q clarity helps you cut through the noise.</p>
<p>We also touched upon advanced tools like Proof Assistants (Prolog, Coq, TLA+, Isabelle, Lean), which represent the pinnacle of applying formal logic to guarantee system correctness – a testament to the enduring power of logical rigor in critical domains.</p>
<p>In the intricate dance between theory and practice, the principles of logic stand as an unshakeable foundation. They are the "rocks" upon which you can meticulously build your understanding and your systems. The more consistently you apply this critical thinking, driven by curiosity and a commitment to rigorous validation, the clearer your path becomes.</p>
<p>This clarity is not just about fixing today’s bugs, it’s about continually refining your mental models, fostering trust in your codebase, and equipping yourself to build increasingly robust and predictable systems in an ever-evolving technological landscape.</p>
<p>If you love problem solving, critical thinking, or have experiences on how you fixed an issue that looked different from how it initially seemed, feel free to connect with me at <a target="_blank" href="https://linkedin.com/in/hanqi91">https://linkedin.com/in/hanqi91</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749064755840/c7646f6a-a8ba-4cf5-9647-0488e24705aa.jpeg" alt="man kayaking and readying for a drop down a waterfall" class="image--center mx-auto" width="2208" height="2686" loading="lazy"></p>
<h2 id="heading-resources">Resources</h2>
<ol>
<li><p>Article that motivated this handbook: <a target="_blank" href="https://thoughtbot.com/blog/classical-reasoning-and-debugging">Classical Reasoning and Debugging</a></p>
</li>
<li><p>3 Formal proofs of modus tollens: <a target="_blank" href="https://en.wikipedia.org/wiki/Modus_tollens">https://en.wikipedia.org/wiki/Modus_tollens</a></p>
</li>
<li><p>Table of 24 syllogisms: <a target="_blank" href="https://en.wikipedia.org/wiki/Syllogism">https://en.wikipedia.org/wiki/Syllogism</a></p>
</li>
<li><p>Challenging Assumptions: <a target="_blank" href="https://thoughtbot.com/blog/falsehoods-software-teams-believe-about-user-feedback">Falsehoods software teams believe about user feedback</a></p>
</li>
<li><p>How assumptions and software evolve beyond your control: <a target="_blank" href="https://www.tdda.info/why-code-rusts">https://www.tdda.info/why-code-rusts</a></p>
</li>
<li><p>Relationship to Hypothesis Testing: <a target="_blank" href="https://sites.google.com/view/reasonedwriting/home/FRAMEWORK_FOR_SCIENTIFIC_PAPERS/HYPOTHESES/HOW_TO_TEST_HYPOTHESES/MODUS_TOLLENS">https://sites.google.com/view/reasonedwriting/home/FRAMEWORK_FOR_SCIENTIFIC_PAPERS/HYPOTHESES/HOW_TO_TEST_HYPOTHESES/MODUS_TOLLENS</a></p>
</li>
<li><p>The Troubleshooting Mindset: <a target="_blank" href="https://www.autodidacts.io/troubleshooting/">https://www.autodidacts.io/troubleshooting/</a></p>
</li>
<li><p>Causal Diagrams from The Effect Book: <a target="_blank" href="https://theeffectbook.net/ch-CausalDiagrams.html">https://theeffectbook.net/ch-CausalDiagrams.html</a></p>
</li>
<li><p>A systematic guide to the mindsets and practices of debugging: <a target="_blank" href="https://www.amazon.sg/Debug-Find-Repair-Prevent-Bugs/dp/193435628X">https://www.amazon.sg/Debug-Find-Repair-Prevent-Bugs/dp/193435628X</a></p>
</li>
<li><p>Constructing P in a way to ensure software correctness: <a target="_blank" href="https://www.hillelwayne.com/post/constructive/">https://www.hillelwayne.com/post/constructive/</a></p>
</li>
<li><p>Fail Fast by explicitly representing assumptions as assertions: <a target="_blank" href="https://www.martinfowler.com/ieeeSoftware/failFast.pdf">https://www.martinfowler.com/ieeeSoftware/failFast.pdf</a></p>
</li>
<li><p>Deterministic Simulation Testing to tackle complex systems: <a target="_blank" href="https://pierrezemb.fr/posts/learn-about-dst/">https://pierrezemb.fr/posts/learn-about-dst/</a></p>
</li>
<li><p>GitHub’s Engineering System Success Playbook (ESSP) - Quality, Velocity, Developer Happiness on Business Outcomes: <a target="_blank" href="https://assets.ctfassets.net/wfutmusr1t3h/us6AUuwawrtNGTlwlT9Ac/f0fce86712054fc87f10db28b20f303b/GitHub-ESSP.pdf">https://assets.ctfassets.net/wfutmusr1t3h/us6AUuwawrtNGTlwlT9Ac/f0fce86712054fc87f10db28b20f303b/GitHub-ESSP.pdf</a></p>
</li>
<li><p>Closed-world assumption: <a target="_blank" href="https://en.wikipedia.org/wiki/Closed-world_assumption">https://en.wikipedia.org/wiki/Closed-world_assumption</a></p>
</li>
</ol>
<h2 id="heading-glossary">Glossary</h2>
<ul>
<li><p><strong>Axiom:</strong> A fundamental truth or rule accepted as a starting point for a logical or mathematical system, without requiring proof.</p>
</li>
<li><p><strong>Contrapositive:</strong> A logically equivalent form of an "if-then" statement (P⟹Q), which is ¬Q⟹¬P ("If not Q, then not P").</p>
</li>
<li><p><strong>Deductive Reasoning:</strong> A type of logical reasoning where a conclusion is necessarily true if its premises are true.</p>
</li>
<li><p><strong>Falsification:</strong> The principle, especially in science (from Karl Popper), that a hypothesis or theory must be capable of being proven false by empirical observation or experiment.</p>
</li>
<li><p><strong>Formal Logic:</strong> The study of abstract systems of reasoning and arguments based on their structure, independent of content.</p>
</li>
<li><p><strong>Hypothesis Testing:</strong> A statistical method for making inferences about a population based on sample data, typically by testing a null hypothesis (e.g., "P has no effect on Q") against an alternative hypothesis.</p>
</li>
<li><p><strong>Logical Fallacy:</strong> A flaw in the structure or content of an argument that makes it unsound or invalid, even if its conclusion might seem plausible.</p>
<ul>
<li><p><strong>Affirming the Consequent (Fallacy):</strong> An invalid argument form that mistakenly assumes if P⟹Q is true, and Q is true, then P must be true.</p>
</li>
<li><p><strong>Denying the Antecedent (Fallacy):</strong> An invalid argument form that mistakenly assumes if P⟹Q is true, and P is false, then Q must be false.</p>
</li>
</ul>
</li>
<li><p><strong>Modus Ponens:</strong> A valid argument form: If P⟹Q is true and P is true, then Q must be true.</p>
</li>
<li><p><strong>Modus Tollens:</strong> A valid argument form: If P⟹Q is true and ¬Q is true, then ¬P must be true.</p>
</li>
<li><p><strong>Mutation Testing:</strong> A software testing technique that involves deliberately introducing small, single-point faults (mutations) into code to assess the effectiveness and coverage of a test suite.</p>
</li>
<li><p><strong>Propositional Logic:</strong> A branch of logic that deals with propositions and their relationships using logical operators.</p>
</li>
<li><p><strong>Test-Driven Development (TDD):</strong> A software development methodology where tests are written <em>before</em> the code, guiding the development process and ensuring correctness.</p>
</li>
<li><p><strong>Truth Table:</strong> A table that systematically lists all possible truth values for a set of propositions and shows the resulting truth value of a complex logical statement.</p>
</li>
<li><p><strong>Vacuously True:</strong> Describes an implication (P⟹Q) that is considered true simply because its antecedent (P) is false.</p>
</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ 460 Free Textbooks – Math, Science, and More [Online PDF for College and High School] ]]>
                </title>
                <description>
                    <![CDATA[ While you're in school, you will go through a number of textbooks and the cost can add up pretty quickly. Luckily, there are websites that offer free textbooks for high school and college students.  Here is a list of 460 free textbooks, arranged by t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/free-textbooks-math-science-and-more-online-pdf-for-college-and-high-school/</link>
                <guid isPermaLink="false">66b8d945f805ffd579552e84</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ books ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Computer Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Thu, 09 Sep 2021 14:25:28 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/10/inaki-del-olmo-NIJuEQw0RKg-unsplash--1-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>While you're in school, you will go through a number of textbooks and the cost can add up pretty quickly. Luckily, there are websites that offer free textbooks for high school and college students. </p>
<p>Here is a list of 460 free textbooks, arranged by topic. Once you find a topic that interests you, click that link and it will jump you down to a list of related textbooks.</p>
<h2 id="heading-high-school-textbook-categories">High School Textbook Categories</h2>
<ul>
<li><a class="post-section-overview" href="#heading-math">Math</a></li>
<li><a class="post-section-overview" href="#heading-natural-sciences">Natural Sciences</a></li>
<li><a class="post-section-overview" href="#heading-classical-novels">Classical Novels</a></li>
</ul>
<h2 id="heading-college-textbook-categories">College Textbook Categories</h2>
<ul>
<li><a class="post-section-overview" href="#heading-computer-science">Computer Science</a></li>
<li><a class="post-section-overview" href="#heading-engineering">Engineering</a> </li>
<li><a class="post-section-overview" href="#heading-education">Education</a></li>
<li><a class="post-section-overview" href="#heading-math-1">Math</a></li>
<li><a class="post-section-overview" href="#heading-natural-sciences-1">Natural Sciences</a></li>
<li><a class="post-section-overview" href="#heading-medicine">Medicine</a></li>
<li><a class="post-section-overview" href="#social-sciences-1">Social Sciences</a></li>
<li><a class="post-section-overview" href="#heading-humanities">Humanities</a></li>
<li><a class="post-section-overview" href="#heading-business">Business</a></li>
<li><a class="post-section-overview" href="#heading-law">Law</a></li>
<li><a class="post-section-overview" href="#heading-journalism-and-communication">Journalism and Communication</a></li>
</ul>
<h2 id="heading-high-school-textbooks-90">High school Textbooks (90)</h2>
<h3 id="heading-math">Math</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/statistics">Statistics</a> </li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/advanced-high-school-statistics-first-edition">Advanced High School Statistics - 2nd Edition</a></li>
<li><a target="_blank" href="https://www.math.ksu.edu/~dbski/writings/further.pdf">Advanced High School Mathematics</a></li>
</ol>
<h3 id="heading-natural-sciences">Natural Sciences</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/college-physics-ap-courses">AP Physics Collection</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/college-physics-ap-courses">Biology for AP courses</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/physics">Physics</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-macroeconomics-ap-courses-2e">Principles of Macroeconomics for AP courses 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-microeconomics-ap-courses-2e">Principles of Microeconomics for AP courses 2e</a></li>
</ol>
<h3 id="heading-classical-novels">Classical Novels</h3>
<ol>
<li><a target="_blank" href="https://www.planetebook.com/the-adventures-of-huckleberry-finn/">Adventures of Huckleberry Finn, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-adventures-of-tom-sawyer/">Adventures of Tom Sawyer, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/aesops-fables/">Aesop’s Fables</a></li>
<li><a target="_blank" href="https://www.planetebook.com/agnes-grey/">Agnes Grey</a></li>
<li><a target="_blank" href="https://www.planetebook.com/alices-adventures-in-wonderland/">Alice’s Adventures in Wonderland</a></li>
<li><a target="_blank" href="https://www.planetebook.com/andersens-fairy-tales/">Andersen’s Fairy Tales</a></li>
<li><a target="_blank" href="https://www.planetebook.com/anna-karenina/">Anna Karenina</a></li>
<li><a target="_blank" href="https://www.planetebook.com/anne-of-green-gables/">Anne of Green Gables</a></li>
<li><a target="_blank" href="https://www.planetebook.com/around-the-world-in-80-days/">Around the World in 80 Days</a></li>
<li><a target="_blank" href="https://www.planetebook.com/beyond-good-and-evil/">Beyond Good and Evil</a></li>
<li><a target="_blank" href="https://www.planetebook.com/bleak-house/">Bleak House</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-brothers-karamazov/">Brothers Karamazov, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/a-christmas-carol/">Christmas Carol, A</a></li>
<li><a target="_blank" href="https://www.planetebook.com/crime-and-punishment/">Crime and Punishment</a></li>
<li><a target="_blank" href="https://www.planetebook.com/david-copperfield/">David Copperfield</a></li>
<li><a target="_blank" href="https://www.planetebook.com/down-and-out-in-paris-and-london/">Down and Out in Paris and London</a></li>
<li><a target="_blank" href="https://www.planetebook.com/dracula/">Dracula</a></li>
<li><a target="_blank" href="https://www.planetebook.com/dubliners/">Dubliners</a></li>
<li><a target="_blank" href="https://www.planetebook.com/emma/">Emma</a></li>
<li><a target="_blank" href="https://www.planetebook.com/erewhon/">Erewhon</a></li>
<li><a target="_blank" href="https://www.planetebook.com/for-the-term-of-his-natural-life/">For the Term of His Natural Life</a></li>
<li><a target="_blank" href="https://www.planetebook.com/frankenstein/">Frankenstein</a></li>
<li><a target="_blank" href="https://www.planetebook.com/great-expectations/">Great Expectations</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-great-gatsby/">Great Gatsby, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/grimms-fairy-tales/">Grimms Fairy Tales</a></li>
<li><a target="_blank" href="https://www.planetebook.com/gullivers-travels/">Gulliver’s Travels</a></li>
<li><a target="_blank" href="https://www.planetebook.com/heart-of-darkness/">Heart of Darkness</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-hound-of-the-baskervilles/">Hound of the Baskervilles, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-idiot/">Idiot, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-iliad/">Iliad, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-island-of-doctor-moreau/">Island of Doctor Moreau, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/jane-eyre/">Jane Eyre</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-jungle-book/">Jungle Book, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/kidnapped/">Kidnapped</a></li>
<li><a target="_blank" href="https://www.planetebook.com/lady-chatterlys-lover/">Lady Chatterly’s Lover</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-last-of-the-mohicans/">Last of the Mohicans, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-legend-of-sleepy-hollow/">Legend of Sleepy Hollow, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/les-miserables/">Les Miserables</a></li>
<li><a target="_blank" href="https://www.planetebook.com/little-women/">Little Women</a></li>
<li><a target="_blank" href="https://www.planetebook.com/madame-bovary/">Madame Bovary</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-merry-adventures-of-robin-hood/">Merry Adventures of Robin Hood, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-metamorphosis/">Metamorphosis, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/middlemarch/">Middlemarch</a></li>
<li><a target="_blank" href="https://www.planetebook.com/moby-dick/">Moby Dick</a></li>
<li><a target="_blank" href="https://www.planetebook.com/1984/">1984</a></li>
<li><a target="_blank" href="https://www.planetebook.com/northanger-abbey/">Northanger Abbey</a></li>
<li><a target="_blank" href="https://www.planetebook.com/nostromo-a-tale-of-the-seaboard/">Nostromo: A Tale of the Seaboard</a></li>
<li><a target="_blank" href="https://www.planetebook.com/notes-from-the-underground/">Notes from the Underground</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-odyssey/">Odyssey, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/of-human-bondage/">Of Human Bondage</a></li>
<li><a target="_blank" href="https://www.planetebook.com/oliver-twist/">Oliver Twist</a></li>
<li><a target="_blank" href="https://www.planetebook.com/paradise-lost/">Paradise Lost</a></li>
<li><a target="_blank" href="https://www.planetebook.com/persuasion/">Persuasion</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-picture-of-dorian-gray/">Picture of Dorian Gray, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/pollyanna/">Pollyanna</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-portrait-of-a-lady/">Portrait of a Lady, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/a-portrait-of-the-artist-as-a-young-man/">Portrait of the Artist as a Young Man, A</a></li>
<li><a target="_blank" href="https://www.planetebook.com/pride-and-prejudice/">Pride and Prejudice</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-prince/">Prince, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/robinson-crusoe/">Robinson Crusoe</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-scarlet-pimpernel/">Scarlet Pimpernel, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/sense-and-sensibility/">Sense and Sensibility</a></li>
<li><a target="_blank" href="https://www.planetebook.com/sons-and-lovers/">Sons and Lovers</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-strange-case-of-dr-jekyll/">Strange Case of Dr Jekyll and Mr Hyde, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/swanns-way/">Swanns Way</a></li>
<li><a target="_blank" href="https://www.planetebook.com/a-tale-of-two-cities/">Tale of Two Cities, A</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-tales-of-mother-goose/">Tales of Mother Goose, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/tarzan-of-the-apes/">Tarzan of the Apes</a></li>
<li><a target="_blank" href="https://www.planetebook.com/tender-is-the-night/">Tender is the Night</a></li>
<li><a target="_blank" href="https://www.planetebook.com/tess-of-the-durbervilles/">Tess of the d’Urbervilles</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-thirty-nine-steps/">Thirty Nine Steps, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-three-musketeers/">Three Musketeers, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-time-machine/">Time Machine, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/treasure-island/">Treasure Island</a></li>
<li><a target="_blank" href="https://www.planetebook.com/the-trial/">Trial, The</a></li>
<li><a target="_blank" href="https://www.planetebook.com/ulysses/">Ulysses</a></li>
<li><a target="_blank" href="https://www.planetebook.com/utopia/">Utopia</a></li>
<li><a target="_blank" href="https://www.planetebook.com/vanity-fair/">Vanity Fair</a></li>
<li><a target="_blank" href="https://www.planetebook.com/war-and-peace/">War and Peace</a></li>
<li><a target="_blank" href="https://www.planetebook.com/within-a-budding-grove/">Within A Budding Grove</a></li>
<li><a target="_blank" href="https://www.planetebook.com/women-in-love/">Women In Love</a></li>
<li><a target="_blank" href="https://www.planetebook.com/wuthering-heights/">Wuthering Heights</a></li>
</ol>
<h2 id="heading-college-textbooks-370">College TextBooks (370)</h2>
<h3 id="heading-computer-science">Computer Science</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/python-for-everybody-exploring-data-using-python-3">Python for Everybody: Exploring Data Using Python 3</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/web-accessibility-for-developers">Web Accessibility for Developers</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-missing-link-an-introduction-to-web-development-and-programming">The Missing Link: An Introduction to Web Development and Programming</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/foundations-of-computation">Foundations of Computation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/algorithms-and-data-structures-with-applications-to-graphics-and-geometry">Algorithms and Data Structures With Applications to Graphics and Geometry</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-data-structures-algorithms-and-information-retrieval-in-java">Think Data Structures: Algorithms and Information Retrieval in Java</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/open-data-structures-an-introduction">Open Data Structures: An Introduction</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/java-with-bluej">Java with BlueJ</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-programming-using-java-seventh-edition">Introduction to Programming Using Java - Eighth Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-byte-of-python">A Byte of Python</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/eloquent-javascript-a-modern-introduction-to-programming">Eloquent JavaScript: A Modern Introduction to Programming</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/high-performance-computing">High Performance Computing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/database-design-2nd-edition">Database Design - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/relational-databases-and-microsoft-access">Relational Databases and Microsoft Access</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-first-course-in-electrical-and-computer-engineering">A First Course in Electrical and Computer Engineering</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/how-to-think-like-a-computer-scientist-learning-with-python">How to Think Like a Computer Scientist: Learning with Python</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/how-to-think-like-a-computer-scientist-c-version-1999">How to Think Like a Computer Scientist: C Version</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/how-to-think-like-a-computer-scientist-c-version">How to Think Like a Computer Scientist: C++ Version</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/programming-fundamentals-a-modular-structured-approach-using-c">Programming Fundamentals - A Modular Structured Approach using C++</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-java-how-to-think-like-a-computer-scientist">Think Java: How To Think Like a Computer Scientist - 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/java-java-java-object-oriented-problem-solving">Java, Java, Java: Object-Oriented Problem Solving</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-stats-probability-and-statistics-for-programmers">Think Stats: Probability and Statistics for Programmers - 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-bayes-bayesian-statistics-made-simple">Think Bayes: Bayesian Statistics Made Simple</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-complexity-exploring-complexity-science-with-python">Think Complexity: Exploring Complexity Science with Python - 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/digital-circuit-projects-an-overview-of-digital-circuits-through-implementing-integrated-circuits">Digital Circuit Projects: An Overview of Digital Circuits Through Implementing Integrated Circuits</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-the-modeling-and-analysis-of-complex-systems">Introduction to the Modeling and Analysis of Complex Systems</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/physical-modeling-in-matlab">Physical Modeling in MATLAB</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/spatial-thinking-in-planning-practice-an-introduction-to-gis">Spatial Thinking in Planning Practice: An Introduction to GIS</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-computer-graphics">Introduction to Computer Graphics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/computer-networks-a-systems-approach">Computer Networks: A Systems Approach</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-introduction-to-computer-networks">An Introduction to Computer Networks - Second Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/computer-networking-principles-protocols-and-practice">Computer Networking : Principles, Protocols and Practice</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain">Signal Computing: Digital Signals in the Software Domain</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/x86-64-assembly-language-programming-with-ubuntu">x86-64 Assembly Language Programming with Ubuntu</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/professional-web-accessibility-auditing-made-easy">Professional Web Accessibility Auditing Made Easy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/first-semester-in-numerical-analysis-with-python">First Semester in Numerical Analysis with Python</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-crystal-ball-instruction-manual-volume-one-introduction-to-data-science">The Crystal Ball Instruction Manual - version 1.1 Volume One: Introduction to Data Science</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-introduction-to-matlab-and-mathcad">An Introduction to Matlab and Mathcad</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/yet-another-introductory-number-theory-textbook-cryptology-emphasis-version">Yet Another Introductory Number Theory Textbook (Cryptology Emphasis Version)</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/delftse-foundations-of-computation">Delftse Foundations of Computation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-unicode-cookbook-for-linguists-managing-writing-systems-using-orthography-profiles">The Unicode cookbook for linguists: Managing writing systems using orthography profiles</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/implementing-a-one-address-cpu-in-logisim">Implementing a One Address CPU in Logisim</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/embedded-controllers-using-c-and-arduino-2e">Embedded Controllers Using C and Arduino - 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-mips-assembly-language-programming">Introduction to MIPS Assembly Language Programming</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/think-dsp-digital-signal-processing-in-python">Think DSP: Digital Signal Processing in Python</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/information-systems-for-business-and-beyond">Information Systems for Business and Beyond</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/information-systems-a-manager-s-guide-to-harnessing-technology">Information Systems: A Manager's Guide to Harnessing Technology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-little-book-of-semaphores">The Little Book of Semaphores</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/essentials-of-geographic-information-systems">Essentials of Geographic Information Systems</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/programming-languages-application-and-interpretation">Programming Languages: Application and Interpretation - Version Second Edition</a></li>
</ol>
<h3 id="heading-engineering">Engineering</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-brief-introduction-to-engineering-computation-with-matlab">A Brief Introduction to Engineering Computation with MATLAB</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-industrial-engineering">Introduction to Industrial Engineering</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-electrical-engineering-1">Fundamentals of Electrical Engineering I</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-first-course-in-electrical-and-computer-engineering">A First Course in Electrical and Computer Engineering</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/sustainability-a-comprehensive-foundation">Sustainability: A Comprehensive Foundation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/notes-on-diffy-qs-differential-equations-for-engineers">Notes on Diffy Qs: Differential Equations for Engineers</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/elementary-differential-equations-with-boundary-value-problems">Elementary Differential Equations with Boundary Value Problems</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/developing-new-products-and-services">Developing New Products and Services</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-aerospace-structures-and-materials">Introduction to Aerospace Structures and Materials</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/building-maintenance-construction-tools-and-maintenance-tasks">Building Maintenance &amp; Construction: Tools and Maintenance Tasks</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/direct-energy">Direct Energy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/operational-amplifiers-linear-integrated-circuits-theory-and-application-3e">Operational Amplifiers &amp; Linear Integrated Circuits: Theory and Application - 3e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/manufacturing-processes-4-5">Manufacturing Processes 4-5</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/electromagnetics-vol-1">Electromagnetics Vol 1</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/dc-electrical-circuit-analysis-a-practical-approach-fiore">DC Electrical Circuit Analysis: A Practical Approach</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/ac-electrical-circuit-analysis-a-practical-approach-fiore">AC Electrical Circuit Analysis: A Practical Approach</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/applied-fluid-mechanics-lab-manual-ahmari">Applied Fluid Mechanics Lab Manual</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-microwave-and-rf-design">Fundamentals of Microwave and RF Design</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-probability">Introduction to Probability</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-linear-time-invariant-dynamic-systems-for-students-of-engineering">Introduction to Linear, Time-Invariant, Dynamic Systems for Students of Engineering</a></li>
</ol>
<h3 id="heading-education">Education</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/hybrid-flexible-course-design-beatty">Hybrid-Flexible Course Design</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/creating-online-learning-experiences">Creating Online Learning Experiences</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/education-for-a-digital-world-advice-guidelines-and-effective-practice-from-around-globe">Education for a Digital World: Advice, Guidelines and Effective Practice from Around Globe</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/educational-psychology">Educational Psychology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/learning-to-learn-online">Learning to Learn Online</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/sharing-our-knowledge-best-practices-for-supporting-english-language-learners-in-schools">Sharing Our Knowledge: Best Practices for Supporting English Language Learners in Schools</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-curriculum-for-early-childhood-education">Introduction to Curriculum for Early Childhood Education</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/bad-ideas-about-writing">Bad Ideas About Writing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/write-here-right-now-an-interactive-introduction-to-academic-writing-and-research">Write Here, Right Now: An Interactive Introduction to Academic Writing and Research</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/elementary-earth-and-space-science-methods-2019">Elementary Earth and Space Science Methods</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/mathematics-for-elementary-teachers">Mathematics for Elementary Teachers</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/trauma-informed-behaviour-support-a-practical-guide-to-developing-resilient-learners">Trauma Informed Behaviour Support: A Practical Guide to Developing Resilient Learners</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/trauma-informed-school-practices-building-expertise-to-transform-schools">Trauma-Informed School Practices: Building Expertise To Transform Schools</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/wellbeing-in-educational-contexts">Wellbeing in Educational Contexts</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/parenting-and-family-diversity-issues">Parenting and Family Diversity Issues</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/safety-health-and-nutrition-in-early-childhood-education">Safety, Health, and Nutrition in Early Childhood Education</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-elc-an-early-childhood-learning-community-at-work">The ELC: An Early Childhood Learning Community at Work</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/building-democracy-for-all-interactive-explorations-of-government-and-civic-life">Building Democracy for All: Interactive Explorations of Government and Civic Life</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/foundations-of-learning-and-instructional-design-technology">Foundations of Learning and Instructional Design Technology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/ethical-use-of-technology-in-digital-learning-environments-graduate-student-perspectives">Ethical Use of Technology in Digital Learning Environments: Graduate Student Perspectives</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-instruction-tips-for-automated-essay-graders-how-to-design-an-essay-for-a-non-human-reader">Writing Instruction Tips For Automated Essay Graders: How To Design an Essay for a Non-human Reader</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/conventions-101-a-functional-approach-to-teaching-and-assessing-grammar-and-punctuation">Conventions 101: A Functional Approach to Teaching (And Assessing!) Grammar and Punctuation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/choosing-using-sources-a-guide-to-academic-research">Choosing &amp; Using Sources: A Guide to Academic Research</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/wac-and-second-language-writers-research-towards-linguistically-and-culturally-inclusive-programs-and-practices">WAC and Second-Language Writers: Research Towards Linguistically and Culturally Inclusive Programs and Practices</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/wac-partnerships-between-secondary-and-postsecondary-institutions">WAC Partnerships Between Secondary and Postsecondary Institutions</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/working-with-academic-literacies-case-studies-towards-transformative-practice">Working With Academic Literacies: Case Studies Towards Transformative Practice</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/antiracist-writing-assessment-ecologies-teaching-and-assessing-writing-for-a-socially-just-future">Antiracist Writing Assessment Ecologies: Teaching and Assessing Writing for a Socially Just Future</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/critical-expressivism-theory-and-practice-in-the-composition-classroom">Critical Expressivism: Theory and Practice in the Composition Classroom</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/copy-write-intellectual-property-in-the-writing-classroom">Copy(write): Intellectual Property in the Writing Classroom</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/teaching-autoethnography-personal-writing-in-the-classroom">Teaching Autoethnography: Personal Writing in the Classroom</a></li>
</ol>
<h3 id="heading-math-1">Math</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/algebra-and-trigonometry">Algebra and Trigonometry</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/calculus-volume-1">Calculus Volume 1</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/calculus-volume-2">Calculus Volume 2</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/calculus-volume-3">Calculus Volume 3</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/multivariable-calculus">Multivariable Calculus</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/college-algebra">College Algebra</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/open-resources-for-community-college-algebra">Open Resources for Community College Algebra</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/elementary-algebra-2e">Elementary Algebra 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/intermediate-algebra-2e">Intermediate Algebra 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-matrix-algebra">Fundamentals of Matrix Algebra</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-gnu-octave-a-brief-tutorial-for-linear-algebra-and-calculus-students">Introduction to GNU Octave: A brief tutorial for linear algebra and calculus students</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-cool-brisk-walkthrough-discrete-mathematics-davis">A Cool Brisk Walk Through Discrete Mathematics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/mathematical-analysis-i">Mathematical Analysis I</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introductory-statistics-with-randomization-and-simulation-first-edition">Introductory Statistics with Randomization and Simulation - First Edition</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/introductory-business-statistics">Introductory Business Statistics</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/introductory-statistics">Introductory Statistics</a> </li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/statistical-thinking-for-the-21st-century">Statistical Thinking for the 21st Century</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/lies-damned-lies-or-statistics-how-to-tell-the-truth-with-statistics">Lies, Damned Lies, or Statistics: How to Tell the Truth with Statistics</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/prealgebra-2e">Prealgebra 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/precalculus">Precalculus</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/geometry-with-an-introduction-to-cosmic-topology">Geometry with an Introduction to Cosmic Topology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/technical-mathematics">Technical Mathematics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-game-theory-a-discovery-approach">Introduction to Game Theory: a Discovery Approach</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/quantitative-problem-solving-in-natural-resources">Quantitative Problem Solving in Natural Resources</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/euclidean-plane-and-its-relatives">Euclidean plane and its relatives</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/proofs-and-concepts-the-fundamentals-of-abstract-mathematics">Proofs and Concepts: The Fundamentals of Abstract Mathematics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/applied-finite-mathematics">Applied Finite Mathematics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/linear-regression-using-r-an-introduction-to-data-modeling">Linear Regression Using R: An Introduction to Data Modeling</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/applied-combinatorics">Applied Combinatorics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/math-in-society">Math in Society - Edition 2.5</a></li>
</ol>
<h3 id="heading-natural-sciences-1">Natural Sciences</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/anatomy-and-physiology">Anatomy and Physiology</a> </li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-anatomy-lab-manual">Human Anatomy Lab Manual</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-mixed-course-based-research-approach-to-human-physiology">A Mixed Course-Based Research Approach to Human Physiology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-anatomy-and-physiology">Fundamentals of Anatomy and Physiology - Australian Edition</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/astronomy">Astronomy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/biochemistry-free-for-all-ahern">Biochemistry: Free For All</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/biology-2e">Biology 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/concepts-biology">Concepts of Biology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/principles-of-biology-biology-211-212-and-213">Principles of Biology: Biology 211, 212, and 213</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/microbiology">Microbiology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/general-microbiology-1st-edition-bruslind">General Microbiology - 1st Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-primer-for-computational-biology">A Primer for Computational Biology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/from-growing-to-biology-plants-1e">From Growing to Biology: Plants 1e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-student-s-guide-to-tropical-marine-biology">A Student's Guide to Tropical Marine Biology</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/chemistry-2e">Chemistry 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/chemistry-atoms-first-2e">Chemistry: Atoms first 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/college-physics">College Physics</a> </li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/foundations-of-neuroscience">Foundations of Neuroscience</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/foundations-of-epidemiology">Foundations of Epidemiology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/radiation-safety">Radiation Safety</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/environmental-toxicology">Environmental Toxicology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/geological-structures-a-practical-introduction">Geological Structures: a Practical Introduction</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/physical-geology-first-university-of-saskatchewan-edition">Physical Geology - First University of Saskatchewan Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/climate-toolkit-a-resource-manual-for-science-and-action-granshaw">Climate Toolkit: A Resource Manual for Science and Action</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-climate-science-1st-edition-schmittner">Introduction to Climate Science - 1st Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/bending-the-curve-climate-change-solutions">Bending the Curve: Climate Change Solutions</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/chemical-biology-biochemistry-laboratory-using-genetic-code-expansion-manual-mehl">Chemical Biology &amp; Biochemistry Laboratory Using Genetic Code Expansion Manual</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/biotechnology-foundations">Biotechnology Foundations - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-ekg-interpretation-primer">An EKG Interpretation Primer</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-oceanography">Introduction to Oceanography</a></li>
</ol>
<h3 id="heading-medicine">Medicine</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/nutrition-science-and-everyday-application">Nutrition: Science and Everyday Application - beta v 0.1</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-nutrition">Human Nutrition - 2020 Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/concepts-of-fitness-and-wellness">Concepts of Fitness and Wellness</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/histology-and-embryology-for-dental-hygiene">Histology and Embryology for Dental Hygiene</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/nursing-pharmacology">Nursing Pharmacology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/nursing-care-at-the-end-of-life-what-every-clinician-should-know">Nursing Care at the End of Life: What Every Clinician Should Know</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/transitions-to-professional-nursing-practice-2nd-edition">Transitions to Professional Nursing Practice - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/safety-health-and-nutrition-in-early-childhood-education">Safety, Health, and Nutrition in Early Childhood Education</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-complete-subjective-health-assessment-lapum">The Complete Subjective Health Assessment</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/evidence-based-massage-therapy">Evidence-Based Massage Therapy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-laboratory-guide-to-clinical-hematology">A Laboratory Guide to Clinical Hematology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/undergraduate-diagnostic-imaging-fundamentals">Undergraduate Diagnostic Imaging Fundamentals</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/public-health-ethics-global-cases-practice-and-context">Public Health Ethics: Global Cases, Practice, and Context</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/literature-reviews-for-education-and-nursing-graduate-students">Literature Reviews for Education and Nursing Graduate Students</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/health-case-studies">Health Case Studies</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/supporting-individuals-with-intellectual-disabilities-mental-illness">Supporting Individuals with Intellectual Disabilities &amp; Mental Illness</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/field-trials-of-health-interventions-a-toolbox">Field Trials of Health Interventions: A Toolbox</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/clinical-procedures-for-safer-patient-care">Clinical Procedures for Safer Patient Care</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/creative-clinical-teaching-in-the-health-professions">Creative Clinical Teaching In The Health Professions</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/veterinary-epidemiology-principles-and-methods">Veterinary Epidemiology: Principles and Methods</a></li>
</ol>
<h3 id="heading-social-sciences">Social Sciences</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/american-government-2e">American Government 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/american-government-3e">American Government 3e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/introduction-sociology-2e">Introduction to Sociology 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/introduction-sociology-3e">Introduction to Sociology 3e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-economics-2e">Principles of Economics 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-macroeconomics-2e">Principles of  Macroeconomics 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-microeconomics-2e">Principles of Microeconomics 2e</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/psychology-2e">Psychology 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/psychology-the-science-of-human-potential">Psychology: The Science of Human Potential</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/abnormal-psychology-1st-edition">Abnormal Psychology - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-community-psychology">Introduction to Community Psychology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-introduction-to-psychological-statistics">An Introduction to Psychological Statistics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-behavior-and-the-social-environment-i-tyler">Human Behavior and the Social Environment I</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-behavior-and-the-social-environment-ii-payne">Human Behavior and the Social Environment II</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/language-and-culture-in-context-a-primer-on-intercultural-communication">Language and Culture in Context - A Primer on Intercultural Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/intercultural-communication">Intercultural Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/contemporary-families-an-equity-lens">Contemporary Families: An Equity Lens</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/child-growth-and-development">Child Growth and Development</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/child-family-and-community">Child, Family, and Community</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/parenting-and-family-diversity-issues">Parenting and Family Diversity Issues</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/interpersonal-communication-a-mindful-approach-to-relationships">Interpersonal Communication: A Mindful Approach to Relationships</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/attenuated-democracy">Attenuated Democracy: A Critical Introduction to U.S. Government and Politics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/foundations-of-social-work-research">Foundations of Social Work Research</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-human-geography-dorrell">Introduction to Human Geography - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/beyond-race-cultural-influences-on-human-social-life">Beyond Race: Cultural Influences on Human Social Life</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/classical-sociological-theory-and-foundations-of-american-sociology-hurst">Classical Sociological Theory and Foundations of American Sociology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/speak-out-call-in-public-speaking-as-advocacy-mapes">Speak Out, Call In: Public Speaking as Advocacy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-quick-guide-to-quantitative-research-in-the-social-sciences">A Quick Guide to Quantitative Research in the Social Sciences</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-balance-of-personality">The Balance of Personality</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-art-of-being-human-a-textbook-for-cultural-anthropology">The Art of Being Human: A Textbook for Cultural Anthropology</a></li>
</ol>
<h3 id="heading-humanities">Humanities</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/stand-up-speak-out-the-practice-and-ethics-of-public-speaking">Stand up, Speak out: The Practice and Ethics of Public Speaking</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/us-history">U.S. History</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/world-history-cultures-states-and-societies-to-1500">World History: Cultures, States, and Societies to 1500</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/modern-world-history-2021">Modern World History</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/international-relations">International Relations</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/becoming-america-an-exploration-of-american-literature-from-precolonial-to-post-revolution">Becoming America: An Exploration of American Literature from Precolonial to Post-Revolution</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/american-literature-i-an-anthology-of-texts-from-early-america-through-the-civil-war">American Literature I: An Anthology of Texts From Early America Through the Civil War</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/spanish-i-beginning-spanish-language-and-culture">Spanish I: Beginning Spanish Language and Culture</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/linguistics-for-teachers-of-english-russell">Linguistics for Teachers of English</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-changing-story-digital-stories-that-participate-in-transforming-teaching-learning">The Changing Story: digital stories that participate in transforming teaching &amp; learning</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/essentials-of-linguistics">Essentials of Linguistics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/technical-writing-2016">Technical Writing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/let-s-get-writing">Let's Get Writing!</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/you-writing-a-guide-to-college-composition">You, Writing! A Guide to College Composition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-for-success">Writing for Success</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/college-esl-writers-applied-grammar-and-composing-strategies-for-success">College ESL Writers: Applied Grammar and Composing Strategies for Success</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-sociology-2e">Introduction to Sociology - 2e</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-philosophy-philosophy-of-religion">Introduction to Philosophy: Philosophy of Religion</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-philosophy-philosophy-of-mind">Introduction to Philosophy: Philosophy of Mind</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/english-composition-connect-collaborate-communicate">English Composition: Connect, Collaborate, Communicate</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/studying-the-bible-the-tanakh-and-early-christian-writings-eiselein">Studying the Bible: The Tanakh and Early Christian Writings</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/philosophical-ethics">Philosophical Ethics</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/ethics-for-a-level">Ethics for A-Level</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/steps-to-success-crossing-the-bridge-between-literacy-research-and-practice">Steps to Success: Crossing the Bridge Between Literacy Research and Practice</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/exploring-public-speaking-2nd-revision">Exploring Public Speaking - 4th Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/plato-s-republic-an-introduction">Plato's 'Republic': An Introduction</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/decoding-the-1920s-a-reader-for-advanced-learners-of-russian">Decoding the 1920s: A Reader for Advanced Learners of Russian</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-introduction-to-technical-theatre">An Introduction to Technical Theatre</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/theatrical-worlds">Theatrical Worlds</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/understanding-basic-music-theory-2013">Understanding Basic Music Theory</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/music-theory-for-the-21st-century-classroom">Music Theory for the 21st-Century Classroom</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/music-on-the-move-fosler-lussier">Music on the Move</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-art-design-context-and-meaning">Introduction to Art: Design, Context, and Meaning</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/guide-to-ancient-egyptian-art-ezra">Guide to Ancient Egyptian Art</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/guide-to-ancient-roman-art-ezra">Guide to Ancient Roman art</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/guide-to-ancient-greek-art-ezra">Guide to Ancient Greek Art</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/moving-pictures-an-introduction-to-cinema">Moving Pictures: An Introduction to Cinema</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/naming-the-unnameable-an-approach-to-poetry-for-new-generations">Naming the Unnameable: An Approach to Poetry for New Generations</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/prose-fiction-an-introduction-to-the-semiotics-of-narrative">Prose Fiction: An Introduction to the Semiotics of Narrative</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/composing-mindfully-writing-fundamentals-atkinson">Mindful Technical Writing: An Introduction to the Fundamentals</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/explorations-1-grammar-for-the-experienced-beginner">Explorations 1: Grammar for the Experienced Beginner</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-logic-and-critical-thinking">Introduction to Logic and Critical Thinking</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-and-literature-composition-as-inquiry-learning-thinking-and-communication">Writing and Literature: Composition as Inquiry, Learning, Thinking, and Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/british-literature-i-anthology-from-the-middle-ages-to-neoclassicism-and-the-eighteenth-century">British Literature I Anthology: From the Middle Ages to Neoclassicism and the Eighteenth Century</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/british-literature-ii-romantic-era-to-the-twentieth-century-and-beyond">British Literature II: Romantic Era to the Twentieth Century and Beyond</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/perspectives-an-open-invitation-to-cultural-anthropology">Perspectives: An Open Invitation to Cultural Anthropology</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-guide-to-good-reasoning-cultivating-intellectual-virtues">A Guide to Good Reasoning: Cultivating Intellectual Virtues - Second edition, revised and updated</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/inferring-and-explaining">Inferring and Explaining</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/exploring-perspectives-a-concise-guide-to-analysis">Exploring Perspectives: A Concise Guide to Analysis</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/empoword-a-student-centered-anthology-handbook-for-college-writers">EmpoWord: A Student-Centered Anthology &amp; Handbook for College Writers</a></li>
</ol>
<h3 id="heading-business">Business</h3>
<ol>
<li><a target="_blank" href="https://openstax.org/details/books/introduction-business">Introduction to Business</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/business-ethics">Business Ethics</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/business-law-i-essentials">Business Law 1 Essentials</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/entrepreneurship">Entrepreneurship</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/introduction-intellectual-property">Introduction to Intellectual Property</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/organizational-behavior">Organizational Behavior</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-financial-accounting">Principles of Financial Accounting</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-managerial-accounting">Principles of Managerial Accounting</a></li>
<li><a target="_blank" href="https://openstax.org/details/books/principles-management">Principles of Management</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-writing-style-guide">Business Writing Style Guide</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/financial-management-for-small-businesses-financial-statements-present-value-models">Financial Management for Small Businesses: Financial Statements &amp; Present Value Models</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/intermediate-microeconomicswith-microsoft-excel-2nd-edition-barreto">Intermediate Microeconomics with Microsoft Excel - 2nd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-computers-365-lacher">Business Computers 365</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/problem-solving-in-teams-and-groups">Problem Solving in Teams and Groups</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/digital-accessibility-as-a-business-practice">Digital Accessibility as a Business Practice</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/management-communication">Management Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-financial-accounting-u-s-gaap-adaptation">Introduction to Financial Accounting: U.S. GAAP Adaptation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/emarketing-the-essential-guide-to-online-marketing">eMarketing - The Essential Guide to Online Marketing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-infrastructure-management">Fundamentals of Infrastructure Management</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/an-introduction-to-cooperation-and-mutualism">An Introduction to Cooperation and Mutualism</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/financial-strategy-for-public-managers">Financial Strategy for Public Managers</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/entrepreneurship-and-innovation-toolkit">Entrepreneurship and Innovation Toolkit</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-plan-development-guide">Business Plan Development Guide</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/project-management">Project Management</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introducing-marketing">Introducing Marketing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-business">Fundamentals of Business - 3rd Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-law-and-the-legal-environment">Business Law and the Legal Environment</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/good-corporation-bad-corporation-corporate-social-responsibility-in-the-global-economy">Good Corporation, Bad Corporation: Corporate Social Responsibility in the Global Economy</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/guidelines-for-improving-the-effectiveness-of-boards-of-directors-of-nonprofit-organizations">Guidelines for Improving the Effectiveness of Boards of Directors of Nonprofit Organizations</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/small-business-management-in-the-21st-century">Small Business Management in the 21st Century</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-sustainable-business-case-book">The Sustainable Business Case Book</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/advanced-business-law-and-the-legal-environment">Advanced Business Law and the Legal Environment</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/electronic-commerce-the-strategic-perspective">Electronic Commerce: The Strategic Perspective</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/developing-new-products-and-services">Developing New Products and Services</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/focusing-on-organizational-change">Focusing on Organizational Change</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-relations">Human Relations</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/leading-with-cultural-intelligence">Leading with Cultural Intelligence</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/managerial-accounting">Managerial Accounting</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-english-for-success">Business English for Success</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/human-resource-management">Human Resource Management</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/international-business">International Business</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/mastering-strategic-management">Strategic Management</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/sustainability-innovation-and-entrepreneurship">Sustainability, Innovation, and Entrepreneurship</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-power-of-selling">The Power of Selling</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/principles-of-marketing">Principles of Marketing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-legal-and-ethical-environment-of-business">The Legal and Ethical Environment of Business</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/money-and-banking">Money and Banking</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/risk-management-for-enterprises-and-individuals">Risk Management for Enterprises and Individuals</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/exploring-business">Exploring Business</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/international-finance-theory-and-policy">International Finance: Theory and Policy</a></li>
</ol>
<h3 id="heading-law">Law</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/law-school-materials-for-success">Law School Materials for Success</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-criminal-investigation-processes-practices-and-thinking">Introduction to Criminal Investigation: Processes, Practices and Thinking</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/ethics-in-law-enforcement">Ethics in Law Enforcement</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/criminal-law">Criminal Law</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/intellectual-property-law-the-information-society-cases-and-materials">Intellectual Property: Law &amp; the Information Society—Cases and Materials</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/wetlands-law-a-course-source">Wetlands Law: A Course Source</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/first-amendment-cases-controversies-and-contexts">First Amendment: Cases, Controversies, and Contexts - Second Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-indigo-book-a-manual-of-legal-citation-sprigman">The Indigo Book: A Manual of Legal Citation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-business-law-randall">Fundamentals of Business Law</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-law-i-essentials">Business Law I Essentials</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/law-101-fundamentals-of-the-law">Law 101: Fundamentals of the Law</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/liberty-equality-and-due-process-cases-controversies-and-contexts-in-constitutional-law">Liberty, Equality and Due Process: Cases, Controversies, and Contexts in Constitutional Law</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-law-and-the-legal-environment">Business Law and the Legal Environment</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-the-american-criminal-justice-system">Introduction to the American Criminal Justice System</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-law-of-trusts">The Law of Trusts</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/sources-of-american-law-an-introduction-to-legal-research">Sources of American Law: An Introduction to Legal Research - 4th Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/basic-income-tax">Basic Income Tax - 8th Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/what-color-is-your-c-f-r">What Color is Your C.F.R.?</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/u-s-federal-income-taxation-of-individuals-2017">U.S. Federal Income Taxation of Individuals 2020</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-contracts-sales-and-product-liability">Introduction to Contracts, Sales and Product Liability</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/law-for-entrepreneurs">Law for Entrepreneurs</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/legal-aspects-of-corporate-management-and-finance">Legal Aspects of Corporate Management and Finance</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/legal-aspects-of-marketing-and-sales">Legal Aspects of Marketing and Sales</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-basic-legal-citation">Introduction to Basic Legal Citation</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/contract-doctrine-theory-practice-volume-1">Contract Doctrine, Theory &amp; Practice Volume 1</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/united-states-copyright-law">United States Copyright Law</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/land-use">Land Use</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/introduction-to-the-law-of-property-estate-planning-and-insurance">Introduction to the Law of Property, Estate Planning and Insurance</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/law-of-commercial-transactions">Law of Commercial Transactions</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/united-states-securities-law">United States Securities Law</a></li>
</ol>
<h3 id="heading-journalism-and-communication">Journalism and Communication</h3>
<ol>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/exploring-public-speaking-2nd-revision">Exploring Public Speaking - 4th Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/stand-up-speak-out-the-practice-and-ethics-of-public-speaking">Stand up, Speak out: The Practice and Ethics of Public Speaking</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/communication-in-the-real-world-an-introduction-to-communication-studies">Communication in the Real World: An Introduction to Communication Studies</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/launch-advertising-and-promotion-in-real-time">Launch! Advertising and Promotion in Real Time</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/business-communication-for-success">Business Communication for Success</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/understanding-media-and-culture-an-introduction-to-mass-communication">Understanding Media and Culture: An Introduction to Mass Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/information-strategies-for-communicators">Information Strategies for Communicators</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/tools-for-podcasting">Tools for Podcasting</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/digital-foundations-introduction-to-media-design-with-the-adobe-creative-cloud-revised-edition">Digital Foundations: Introduction to Media Design with the Adobe Creative Cloud - Revised Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/humans-r-social-media-open-textbook-edition">Humans R Social Media - Open Textbook Edition</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-for-strategic-communication-industries">Writing for Strategic Communication Industries</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/open-technical-writing-an-open-access-text-for-instruction-in-technical-and-professional-writing">Open Technical Writing: An Open-Access Text for Instruction in Technical and Professional Writing</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-for-electronic-media">Writing for Electronic Media</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/be-credible">Be Credible</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/language-and-culture-in-context-a-primer-on-intercultural-communication">Language and Culture in Context - A Primer on Intercultural Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/intercultural-communication">Intercultural Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/arguing-using-critical-thinking">Arguing Using Critical Thinking</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/writing-unleashed">Writing Unleashed: Content and Structure - 3.0</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/management-communication">Management Communication</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/oer-a-field-guide-for-academic-librarians">OER: A Field Guide for Academic Librarians</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/the-data-journalism-handbook">The Data Journalism Handbook</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/media-society-culture-and-you">Media, Society, Culture and You</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/message-processing-the-science-of-creating-understanding">Message Processing: The Science of Creating Understanding</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/media-innovation-and-entrepreneurship">Media Innovation and Entrepreneurship</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/a-guide-to-technical-communications-strategies-applications">A Guide to Technical Communications: Strategies &amp; Applications</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/graphic-design-and-print-production-fundamentals">Graphic Design and Print Production Fundamentals</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/media-studies-101">Media Studies 101</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/small-group-communication-forming-sustaining-teams">Small Group Communication: Forming &amp; Sustaining Teams</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/new-media-futures-faltesek">New Media Futures</a></li>
<li><a target="_blank" href="https://open.umn.edu/opentextbooks/textbooks/communication-affect-learning-in-the-classroom">Communication, Affect, &amp; Learning in the Classroom - 4th Edition</a>  </li>
</ol>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Introduction to Evolutionary Game Theory ]]>
                </title>
                <description>
                    <![CDATA[ By Peter Gleeson For the longest time, the evolution of cooperative social behaviour has fascinated evolutionary biologists. The mathematical field of game theory helps shed light on how it emerges. Game theory is “the study of mathematical models of... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/introduction-to-evolutionary-game-theory/</link>
                <guid isPermaLink="false">66d460a8677cb8c6c15f3171</guid>
                
                    <category>
                        <![CDATA[ evolution ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Theory ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 13 Apr 2021 17:12:33 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/605de4899618b008528a7b69.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Peter Gleeson</p>
<p>For the longest time, the evolution of cooperative social behaviour has fascinated evolutionary biologists.</p>
<p>The mathematical field of game theory helps shed light on how it emerges. Game theory is “the study of mathematical models of strategic interaction among rational decision-makers” (according to <a target="_blank" href="https://en.wikipedia.org/wiki/Game_theory">Wikipedia</a>).</p>
<p>Game theory applies to “games” as varied as economics, politics, chess and tic-tac-toe. In each case, there are some rules, some “players” or “agents”, and a set of strategies available to them.</p>
<p>Each player has a concept of “utility” – a “currency” they seek to individually maximise through the strategies they play.</p>
<p>The currency of evolution is the concept of <a target="_blank" href="https://www.nature.com/scitable/blog/accumulating-glitches/the_meaning_of_fitness/">fitness</a>.</p>
<p>That is, the chance of being represented in the next generation. Genes and traits which increase the odds of survival to reproductive age are more likely to be passed on to future generations. Therefore, they confer a greater fitness to the individual which "hosts” them.</p>
<p>Evolutionary game theory takes the concepts from game theory and applies them in an evolutionary context.</p>
<p>For a given model, it lets you ask questions about which strategy prevails, and whether certain strategies can coexist. And if so – at what frequencies?</p>
<h2 id="heading-replicator-dynamics">Replicator dynamics</h2>
<p>Evolutionary game theory plays “games” over many generations.</p>
<p>Each game will alter the utility (that is, fitness) of the players. The next generation is produced, with players being represented proportionally to their overall fitness.</p>
<p>This set up is called “replicator dynamics”. It is easy to simulate and explore different models of evolutionary games.</p>
<p>The classic model of evolutionary game theory is the “Hawk-Dove” game, popularised by John Maynard Smith in the 1970s.</p>
<p>In this game, there exists a population of animals which compete for a finite resource (for example, food). The more resources an individual wins, the greater its fitness.</p>
<p>Each animal can play one of two strategies:</p>
<ul>
<li><strong>Hawks</strong> are aggressive, and will fight for a resource at all costs.</li>
<li><strong>Doves</strong> are passive, and will share instead of fight for a resource.</li>
</ul>
<p>The animals are all the same kind – “hawk” and “dove” refer to their behaviour.</p>
<p>There are three pairwise competitions that can exist:</p>
<p><strong>Hawk vs Hawk</strong></p>
<ul>
<li>If two hawks compete, they will engage in a 50:50 battle to win the resource. This is a winner-takes-all scenario – the winner obtains the full value of the resource. The injured loser pays a price, and loses a certain amount of fitness.</li>
</ul>
<p><strong>Hawk vs Dove</strong></p>
<ul>
<li>If a hawk meets a dove, the dove will back down immediately. The hawk wins the full value of the resource, and the dove walks (or, rather flies) away with nothing. But they do not pay any cost.</li>
</ul>
<p><strong>Dove vs Dove</strong></p>
<ul>
<li>When two doves meet, they agree to share the resource evenly. No one gets hurt.</li>
</ul>
<p>This can be modelled mathematically. Doing so allows us to understand whether these strategies can coexist (or if one of them prevails).</p>
<h3 id="heading-the-math-of-replicator-dynamics">The math of replicator dynamics</h3>
<p>Let <em>V</em> be the value of winning a contest, and <em>C</em> be the cost of injury in a contest.</p>
<p>Represent the frequency of hawks in the population as <em>p</em>, and the frequency of doves as <em>1-p</em>.</p>
<p>Now, define two functions F(H) and F(D) which define the expected fitness of playing the hawk and dove strategies, respectively.</p>
<p>Playing as a hawk will mean engaging in a hawk-vs-hawk contest with frequency <em>p.</em> The expected utility of doing so is understood as the average outcome. Half the time the hawk wins <em>V</em>, half the time it loses <em>C</em>.</p>
<p>The rest of a hawk’s contests will be against doves. This guarantees an easy win <em>V.</em></p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F8b5ac2e8-fdfb-4ffc-8abe-15d0d014f580_544x112.png" alt="Image" width="544" height="112" loading="lazy"></p>
<p>Playing as a dove will win nothing against hawks. But a dove will encounter another dove with frequency <em>1-p</em>. Under this scenario, the expected utility is the shared resource, worth <em>V/2</em>.</p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F6303e0b2-d6ab-434d-b7ec-cad18a82d154_508x110.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now, set <em>F(H)</em> equal to <em>F(D)</em> and solve for <em>p</em>.</p>
<p>This reveals the frequency <em>p</em> at which the hawk strategy confers no more or less fitness than the dove strategy.</p>
<p>At this frequency, there is no advantage to either strategy, so this is the equilibrium at which both strategies may coexist.</p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F77be89c1-0286-4673-867f-1c8e1a038cb7_516x104.png" alt="Image" width="516" height="104" loading="lazy"></p>
<p>Some algebraic rearrangement gives:</p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fca77237e-29a4-4826-af4a-2fbb390d3572_404x108.png" alt="Image" width="404" height="108" loading="lazy"></p>
<p>Which provides the ratio of hawks-to-doves that exists at equilibrium.</p>
<p>Just a little more rearranging gives the equilibrium in terms of <em>p</em>:</p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb812b56c-8387-4a47-902e-61aaa87cf317_342x98.png" alt="Image" width="342" height="98" loading="lazy"></p>
<p>Considering the properties of this expression reveals two things:</p>
<ul>
<li>Whenever the cost <em>C</em> of losing a contest is less than or equal to the value <em>V</em> of winning, the hawk strategy will dominate. Neither strategy can coexist.</li>
<li>If the cost <em>C</em> is greater than the value <em>V</em>, the strategies will coexist in equilibrium.</li>
</ul>
<p>Plugging in the values <em>V</em>=4 and <em>C</em>=6 shows the equilibrium occurs when 2/3 of the population play the hawk strategy.</p>
<p>You can test this by simulating the model in Python.</p>
<h3 id="heading-the-code">The code</h3>
<p>In the file called bird.py:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> random

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bird</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, strategy</span>):</span>
        <span class="hljs-string">"""
        Each bird has a strategy type (hawk or dove)
        And a small starting fitness
        """</span>
        self.strategy = strategy
        self.fitness = <span class="hljs-number">10</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">contest</span>(<span class="hljs-params">self, opponent, v, c</span>):</span>
       <span class="hljs-string">"""
       Simulate the outcomes depending on the strategies
       """</span>

        <span class="hljs-comment"># both hawks --&gt; 50:50 battle</span>

        <span class="hljs-keyword">if</span> self.strategy == opponent.strategy == <span class="hljs-string">"hawk"</span>:
            <span class="hljs-keyword">if</span> random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>) == <span class="hljs-number">1</span>:
                self.fitness = self.fitness + v
                opponent.fitness = opponent.fitness - c
            <span class="hljs-keyword">else</span>:
                self.fitness = self.fitness - c
                opponent.fitness = opponent.fitness + v

        <span class="hljs-comment"># hawk meets dove</span>

        <span class="hljs-keyword">elif</span> self.strategy == <span class="hljs-string">"hawk"</span> != opponent.strategy:
            self.fitness = self.fitness + v
            opponent.fitness = opponent.fitness
        <span class="hljs-keyword">elif</span> self.strategy == <span class="hljs-string">"dove"</span> != opponent.strategy:
            self.fitness = self.fitness
            opponent.fitness = opponent.fitness + v

        <span class="hljs-comment"># both doves --&gt; share the resource</span>

        <span class="hljs-keyword">else</span>:
            self.fitness = self.fitness + v/<span class="hljs-number">2</span>
            opponent.fitness = opponent.fitness + v/<span class="hljs-number">2</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">spawn</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-string">"""
        Allow a small chance of mutation to flip strategy
        Otherwise, return offspring of the same type
        """</span>

        mutation = random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">1000</span>) &gt; <span class="hljs-number">999</span>
        <span class="hljs-keyword">if</span> mutation:
            <span class="hljs-keyword">if</span> self.strategy == <span class="hljs-string">"dove"</span>:
                <span class="hljs-keyword">return</span> Bird(<span class="hljs-string">"hawk"</span>)
            <span class="hljs-keyword">else</span>:
                <span class="hljs-keyword">return</span> Bird(<span class="hljs-string">"dove"</span>)
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> Bird(self.strategy)
</code></pre>
<p>The next file is called simulation.py.</p>
<ol>
<li>Initialise a population of all doves.</li>
<li>Define a timestep function to simulate randomised contests.</li>
<li>Draw the next generation weighted by their relative fitnesses.</li>
<li>Rinse and repeat a thousand times over, then save the output as a graph.</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> bird <span class="hljs-keyword">import</span> Bird
<span class="hljs-keyword">import</span> random
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> matplotlib


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">initialise</span>():</span>
    <span class="hljs-string">"""
    Create a population of birds - all dove to begin
    """</span>

    birds = []

    <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(<span class="hljs-number">1000</span>):
        birds.append(Bird(<span class="hljs-string">"dove"</span>))

    <span class="hljs-keyword">return</span> (birds)


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">timestep</span>(<span class="hljs-params">birds, value, cost</span>):</span>
    <span class="hljs-string">"""
    Pair up the birds, make them compete
    Then produce next generation, weighted by fitness
    """</span>

    next_generation = []

    random.shuffle(birds)

    <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(<span class="hljs-number">1000</span>):

        <span class="hljs-comment"># pair up random birds to contest</span>
        a, b = random.sample(birds, <span class="hljs-number">2</span>)
        a.contest(b, value, cost)

    <span class="hljs-comment"># generate next generation</span>
    fitnesses = [bird.fitness <span class="hljs-keyword">for</span> bird <span class="hljs-keyword">in</span> birds]

    draw = random.choices(birds, k=<span class="hljs-number">1000</span>, weights=fitnesses)
    next_generation = [bird.spawn() <span class="hljs-keyword">for</span> bird <span class="hljs-keyword">in</span> draw]

    <span class="hljs-keyword">return</span> next_generation


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">main</span>():</span>

    birds = initialise()

    rows = []

    V = <span class="hljs-number">4</span> ; C = <span class="hljs-number">6</span>

    <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(<span class="hljs-number">1000</span>):

        <span class="hljs-comment"># add the counts to a new row</span>
        strategy = [bird.strategy <span class="hljs-keyword">for</span> bird <span class="hljs-keyword">in</span> birds]
        n_hawks = strategy.count(<span class="hljs-string">"hawk"</span>)
        n_doves =  strategy.count(<span class="hljs-string">"dove"</span>)
        row = {<span class="hljs-string">'n_hawks'</span>: n_hawks, <span class="hljs-string">'n_doves'</span>: n_doves}
        rows.append(row)

        <span class="hljs-comment"># run the timestep function</span>
        birds = timestep(birds, V, C)


    <span class="hljs-comment"># create dataframe and save output</span>

    df = pd.DataFrame(rows)
    df.to_csv(<span class="hljs-string">'simulation.csv'</span>)
    fig = df.plot(y=[<span class="hljs-string">"n_hawks"</span>, <span class="hljs-string">"n_doves"</span>]).get_figure()
    fig.savefig(<span class="hljs-string">'simulation.pdf'</span>)

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">"__main__"</span>:
    main()
</code></pre>
<p>And voilà - here’s an example of the output for <em>V</em>=4 and <em>C</em>=6:</p>
<p><img src="https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F44100a89-d377-435e-bf11-97b046db5f32_1438x1048.png" alt="Image" width="1438" height="1048" loading="lazy"></p>
<p>Exactly as the theory predicts.</p>
<h2 id="heading-outro">Outro</h2>
<p>The evolution of complex systems is a fascinating field of study. Understanding how natural forces and competitive pressures can shape individual-level traits to give rise to complex social behaviours has been one of the major areas of research in biological sciences in the last few decades.</p>
<p>The ability of relatively simple mathematical models to accurately predict outcomes of dynamic systems is also a key point to take away. </p>
<p>In this case, it is the existence of a feedback loop that results in the two strategies reaching an equilibrium. The advantage conferred by either strategy varies depending on how many others in the population are playing that strategy.</p>
<p>In other words, when more individuals play "dove", there is an advantage to playing "hawk". However, as more individuals play "hawk", the expected value of playing "dove" increases.</p>
<p>Finally, the availability of programming and software tools makes it possible to test theoretical predictions through simulation.</p>
<p>If you found this article interesting, you may also find <a target="_blank" href="https://www.freecodecamp.org/news/how-to-model-an-epidemic-with-r/">How to Model an Epidemic With R</a> worth checking out, too.</p>
<p>You can follow more of my writing at <a target="_blank" href="https://gleeson.substack.com/">gleeson.substack.com</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Read a Research Paper – A Guide to Setting Research Goals, Finding Papers to Read, and More ]]>
                </title>
                <description>
                    <![CDATA[ If you work in a scientific field, you should try to build a deep and unbiased understanding of that field. This not only educates you in the best possible way but also helps you envision the opportunities in your space. A research paper is often the... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/building-a-habit-of-reading-research-papers/</link>
                <guid isPermaLink="false">66d45f359208fb118cc6cfc5</guid>
                
                    <category>
                        <![CDATA[ Data Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ reading ]]>
                    </category>
                
                    <category>
                        <![CDATA[ research ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technical writing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Harshit Tyagi ]]>
                </dc:creator>
                <pubDate>Thu, 04 Mar 2021 19:01:49 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/03/October-AI.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you work in a scientific field, you should try to build a deep and unbiased understanding of that field. This not only educates you in the best possible way but also helps you envision the opportunities in your space.</p>
<p>A research paper is often the culmination of a wide range of deep and authentic practices surrounding a topic. When writing a research paper, the author thinks critically about the problem, performs rigorous research, evaluates their processes and sources, organizes their thoughts, and then writes. These genuinely-executed practices make for a good research paper.</p>
<p>If you’re struggling to build a habit of reading papers (like I am) on a regular basis, I’ve tried to break down the whole process. I've talked to researchers in the field, read a bunch of papers and blogs from distinguished researchers, and jotted down some techniques that you can follow.</p>
<p>Let’s start off by understanding what a research paper is and what it is NOT!</p>
<h2 id="heading-what-is-a-research-paper">What is a Research Paper?</h2>
<p>A research paper is a dense and detailed manuscript that compiles a thorough understanding of a problem or topic. It offers a proposed solution and further research along with the conditions under which it was deduced and carried out, the efficacy of the solution and the research performed, and potential loopholes in the study.</p>
<p>A research paper is written not only to provide an exceptional learning opportunity but also to pave the way for further advancements in the field. These papers help other scholars germinate the thought seed that can either lead to a new world of ideas or an innovative method of solving a longstanding problem.</p>
<h2 id="heading-what-research-papers-are-not">What Research Papers are NOT</h2>
<p>There is a common notion that a research paper is a well-informed summary of a problem or topic written by means of other sources.</p>
<p>But you shouldn't mistake it for a book or an opinionated account of an individual’s interpretation of a particular topic.</p>
<h2 id="heading-why-should-you-read-research-papers">Why Should You Read Research Papers?</h2>
<p>What I find fascinating about reading a good research paper is that you can draw on a profound study of a topic and engage with the community on a new perspective to understand what can be achieved in and around that topic.</p>
<p>I work at the intersection of instructional design and data science. Learning is part of my day-to-day responsibilities. If the source of my education is flawed or inefficient, I’d fail at my job in the long term. This applies to many other jobs in Science with a special focus on research.</p>
<p>There are three important reasons to read a research paper:</p>
<ol>
<li><p><strong>Knowledge —</strong> Understanding the problem from the eyes of someone who has probably spent years solving it and has taken care of all the edge cases that you might not think of at the beginning.</p>
</li>
<li><p><strong>Exploration —</strong> Whether you have a pinpointed agenda or not, there is a very high chance that you will stumble upon an edge case or a shortcoming that is worth following up. With persistent efforts over a considerable amount of time, you can learn to use that knowledge to make a living.</p>
</li>
<li><p><strong>Research and review —</strong> One of the main reasons for writing a research paper is to further the development in the field. Researchers read papers to review them for conferences or to do a literature survey of a new field. For example, <a target="_blank" href="http://yann.lecun.com/exdb/publis/pdf/lecun-89e.pdf">Yann LeCun’</a>s paper on integrating domain constraints into backpropagation set the foundation of modern computer vision back in 1989. After decades of research and development work, we have come so far that we're now perfecting problems like object detection and optimizing autonomous vehicles.</p>
</li>
</ol>
<p>Not only that, with the help of the internet, you can extrapolate all of these reasons or benefits onto multiple business models. It can be an innovative state-of-the-art product, an efficient service model, a content creator, or a dream job where you are solving problems that matter to you.</p>
<h2 id="heading-goals-for-reading-a-research-paper-what-should-you-read-about">Goals for Reading a Research Paper — What Should You Read About?</h2>
<p>The first thing to do is to figure out your motivation for reading the paper. There are two main scenarios that might lead you to read a paper:</p>
<ol>
<li><p><strong>Scenario 1 —</strong> You have a well-defined agenda/goal and you are deeply invested in a particular field. For example, you’re an NLP practitioner and you want to learn how GPT-4 has given us a breakthrough in NLP. This is always a nice scenario to be in as it offers clarity.</p>
</li>
<li><p><strong>Scenario 2 —</strong> You want to keep abreast of the developments in a host of areas, say <a target="_blank" href="https://deepmind.com/blog/article/alphafold-a-solution-to-a-50-year-old-grand-challenge-in-biology">how a new deep learning architecture has helped us solve a 50-year old biological problem of understanding protein structures.</a> This is often the case for beginners or for people who consume their daily dose of news from research papers (yes, they exist!).</p>
</li>
</ol>
<p>If you’re an inquisitive beginner with no starting point in mind, start with scenario 2. Shortlist a few topics you want to read about until you find an area that you find intriguing. This will eventually lead you to scenario 1.</p>
<h3 id="heading-ml-reproducibility-challenge">ML Reproducibility Challenge</h3>
<p>In addition to these generic goals, if you need an end goal for your habit-building exercise of reading research papers, you should check out the <a target="_blank" href="https://openreview.net/group?id=ML_Reproducibility_Challenge/2020">ML reproducibility challenge.</a></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>[https://openreview.net/group?id=ML_Reproducibility_Challenge/2020](https://openreview.net/group?id=ML_Reproducibility_Challenge/2020" rel="nofollow noopener)</em></p>
<p>You’ll find top-class papers from world-class conferences that are worth diving deep into and reproducing the results.</p>
<p>They conduct this challenge twice a year and they have one coming up in <a target="_blank" href="https://paperswithcode.com/rc2020">Spring 2021.</a> You should study the past three versions of the challenge, and I’ll write a detailed post on what to expect, how to prepare, and so on.</p>
<p><strong>Now you must be wondering – how can you find the right paper to read?</strong></p>
<h2 id="heading-how-to-find-the-right-paper-to-read">How to Find the Right Paper to Read</h2>
<p>In order to get some ideas around this, I reached out to my friend, <a target="_blank" href="https://scholar.google.com/citations?user=zd0-SNQAAAAJ&amp;hl=en&amp;oi=ao">Anurag Ghosh</a> who is a researcher at Microsoft. Anurag has been working at the crossover of computer vision, machine learning, and systems engineering.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-04-at-12.08.31-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>https://anuragxel.github.io/</em></p>
<p>Here are a few of his tips for getting started:</p>
<ul>
<li><p>Always pick an area you're interested in.</p>
</li>
<li><p>Read a few good books or detailed blog posts on that topic and start diving deep by reading the papers referenced in those resources.</p>
</li>
<li><p>Look for seminal papers around that topic. These are papers that report a major breakthrough in the field and offer a new method perspective with a huge potential for subsequent research in that field. Check out papers from <a target="_blank" href="https://blog.acolyer.org/">the morning paper</a> or <a target="_blank" href="https://www.thecvf.com/?page_id=413#Helmholtz">C</a>VF - test of time award/Helmholtz prize (if you're interested in computer vision).</p>
</li>
<li><p>Check out books like <strong>Computer Vision: Algorithms and Applications</strong> by Richard Szeliski and look for the papers referenced there.</p>
</li>
<li><p>Have and build a sense of community. Find people who share similar interests, and join groups/subreddits/discord channels where such activities are promoted.</p>
</li>
</ul>
<p>In addition to these invaluable tips, there are a number of web applications that I’ve shortlisted that help me narrow my search for the right papers to read:</p>
<ul>
<li><a target="_blank" href="https://www.reddit.com/r/MachineLearning/">r/MachineLearning</a> — there are many researchers, practitioners, and engineers who share their work along with the papers they've found useful in achieving those results.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-01-at-10.55.53-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>[https://www.reddit.com/r/MachineLearning/](https://www.reddit.com/r/MachineLearning/" rel="nofollow noopener)</em></p>
<ul>
<li><a target="_blank" href="http://www.arxiv-sanity.com/top">Arxiv Sanity Preserver</a> — built by Andrej Karpathy to accelerate research. It is a repository of 142,846 papers from computer science, machine learning, systems, AI, Stats, CV, and so on. It also offers a bunch of filters, powerful search functionality, and a discussion forum to make for a super useful research platform.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-01-at-10.59.41-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li><a target="_blank" href="https://research.google/">Google Research</a> — the research teams at Google are working on problems that have an impact on our everyday lives. They share their publications for individuals and teams to learn from, contribute to, and expedite research. They also have a Google AI blog that you can check out.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-01-at-11.13.31-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-to-read-a-research-paper">How to Read a Research Paper</h2>
<p>After you have stocked your to-read list, then comes the process of reading these papers. Remember that NOT every paper is useful to read and we need a mechanism that can help us quickly screen papers that are worth reading.</p>
<p>To tackle this challenge, you can use this <a target="_blank" href="http://ccr.sigcomm.org/online/files/p83-keshavA.pdf"><strong>Three-Pass Approach</strong> by <strong>S. Keshav</strong></a>. This approach proposes that you read the paper in three passes instead of starting from the beginning and diving in deep until the end.</p>
<h3 id="heading-the-three-pass-approach">The three pass approach</h3>
<ol>
<li><p><strong>The first pass —</strong> is a quick scan to capture a high-level view of the paper. Read the title, abstract, and introduction carefully followed by the headings of the sections and subsections and lastly the conclusion. It should take you no more than 5–10 mins to figure out if you want to move to the second pass.</p>
</li>
<li><p><strong>The second pass —</strong> is a more focused read without checking for the technical proofs. You take down all the crucial notes, underline the key points in the margins. Carefully study the figures, diagrams, and illustrations. Review the graphs, mark relevant unread references for further reading. This helps you understand the background of the paper.</p>
</li>
<li><p><strong>The third pass —</strong> reaching this pass denotes that you’ve found a paper that you want to deeply understand or review. The key to the third pass is to reproduce the results of the paper. Check it for all the assumptions and jot down all the variations in your re-implementation and the original results. Make a note of all the ideas for future analysis. It should take 5–6 hours for beginners and 1–2 hours for experienced readers.</p>
</li>
</ol>
<h2 id="heading-tools-and-software-to-keep-track-of-your-pipeline-of-papers">Tools and Software to Keep Track of Your Pipeline of Papers</h2>
<p>If you’re sincere about reading research papers, your list of papers will soon grow into an overwhelming stack that is hard to keep track of. Fortunately, we have software that can help us set up a mechanism to manage our research.</p>
<p>Here are a bunch of them that you can use:</p>
<ul>
<li><a target="_blank" href="https://www.mendeley.com/?interaction_required=true"><strong>Mendeley</strong></a> <strong>[not free]</strong> — you can add papers directly to your library from your browser, import documents, generate references and citations, collaborate with fellow researchers, and access your library from anywhere. This is mostly used by experienced researchers.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-02-at-1.28.19-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>https://www.mendeley.com/?interaction_required=true</em></p>
<ul>
<li><strong>Zotero [free &amp; open source] —</strong> Along the same lines as Mendeley but free of cost. You can make use of all the features but with limited storage space.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/Screenshot-2021-03-02-at-1.42.28-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>https://www.zotero.org/</em></p>
<ul>
<li><strong>Notion —</strong> this is great if you are just starting out and want to use something lightweight with the option to organize your papers, jot down notes, and manage everything in one workspace. It might not stand anywhere in comparison with the above tools but I personally feel comfortable using Notion and I have created <a target="_blank" href="https://www.notion.so/My-paper-pipeline-ec3ff02ce9c641d2953f6cdbc431a55a">this board</a> to keep track of my progress for now that you can duplicate:</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-symptoms-of-reading-a-research-paper">⚠️ Symptoms of Reading a Research Paper</h2>
<p>Reading a research paper can turn out to be frustrating, challenging, and time-consuming especially when you’re a beginner. You might face the following common symptoms:</p>
<ul>
<li><p>You might start feeling dumb for not understanding a thing a paper says.</p>
</li>
<li><p>Finding yourself pushing too hard to understand the math behind those proofs.</p>
</li>
<li><p>Beating your head against the wall to wrap it around the number of acronyms used in the paper. Just kidding, you’ll have to look up those acronyms every now and then.</p>
</li>
<li><p>Being stuck on one paragraph for more than an hour.</p>
</li>
</ul>
<p>Here’s a complete list of emotions that you might undergo as explained by Adam Ruben in <a target="_blank" href="https://www.sciencemag.org/careers/2016/01/how-read-scientific-paper">this article</a>.</p>
<h2 id="heading-key-takeaways">Key Takeaways</h2>
<p>We should be all set to dive right in. Here’s a quick summary of what we have covered here:</p>
<ul>
<li><p>A research paper is an in-depth study that offers an detailed explanation of a topic or problem along with the research process, proofs, explained results, and ideas for future work.</p>
</li>
<li><p>Read research papers to develop a deep understanding of a topic/problem. Then you can either review papers as part of being a researcher, explore the domain and the kind of problems to build a solution or startup around it, or you can simply read them to keep abreast of the developments in your domain of interest.</p>
</li>
<li><p>If you’re a beginner, start with exploration to soon find your path to goal-oriented research.</p>
</li>
<li><p>In order to find good papers to read, you can use websites like arxiv-sanity, google research, and subreddits like r/MachineLearning.</p>
</li>
<li><p>Reading approach — Use the 3-pass method to find a paper.</p>
</li>
<li><p>Keep track of your research, notes, developments by using tools like Zotero/Notion.</p>
</li>
<li><p>This can get overwhelming in no time. Make sure you start off easy and increment your load progressively.</p>
</li>
</ul>
<p><strong>Remember: Art is not a single method or step done over a weekend but a process of accomplishing remarkable results over time.</strong></p>
<p>You can also watch the video on this topic on my <a target="_blank" href="https://www.youtube.com/channel/UCH-xwLTKQaABNs2QmGxK2bQ">YouTube channel</a>:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/FukV7n8ztT8" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>Feel free to respond to this blog or comment on the video if you have some tips, questions, or thoughts!</p>
<p>If this tutorial was helpful, you should check out my data science and machine learning courses on <a target="_blank" href="https://www.wiplane.com/">Wiplane Academy</a>. They are comprehensive yet compact and helps you build a solid foundation of work to showcase.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ The Computer Science of Evolution: an Introduction to Genetic Algorithms ]]>
                </title>
                <description>
                    <![CDATA[ By Ben Mmari Being a computer scientist with an interest in evolution and biological processes, the topic of genetic algorithms, and more broadly, evolutionary computation is to me what a candy shop is to a 5-year-old: Heaven. The mere possibility of... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-computer-science-of-evolution-an-introduction-to-genetic-algorithms-b3871286c7e7/</link>
                <guid isPermaLink="false">66c36117c6c49ae59cf21ade</guid>
                
                    <category>
                        <![CDATA[ algorithms ]]>
                    </category>
                
                    <category>
                        <![CDATA[ evolution ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Genetics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 11 Apr 2019 20:49:44 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*J3BtJTlHKnx3152UKoTgYg.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Ben Mmari</p>
<p>Being a computer scientist with an interest in evolution and biological processes, the topic of genetic algorithms, and more broadly, evolutionary computation is to me what a candy shop is to a 5-year-old: Heaven. The mere possibility of being able to merge two of my interests in such a seamless manner has been extremely exhilarating, and it would be wrong for me to keep this knowledge and excitement all to myself.</p>
<p>So in an attempt to test out some of my learnings thus far, and share my findings with the rest of the world, I have decided to put together a series of articles on this topic.</p>
<p>In this post, I will provide a brief introduction to genetic algorithms and explain how they imitate the same natural processes that have been taking place on Earth for billions of years.</p>
<h4 id="heading-life-on-earth"><strong>Life on Earth</strong></h4>
<p>Over the past 3.5 billion years, mother nature, father time, evolution and natural selection have collaborated together to produce <strong>all</strong> of the specialized forms of life that we see on earth today: like the carnivorous Venus Flytrap plant; the ocean-dwelling Atlantic Flying Fish; echolocation-using bats; long-necked giraffes; super-quick cheetahs, dancing Honeybees; and of course, yours truly, the street smart Homo sapiens.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/LmZm7DjfgyLwH3RpgYrQCnWCIj0L7xB9zYvG" alt="Image" width="224" height="225" loading="lazy">
<em>The Venus Flytrap is a carnivorous plant that primarily feasts on insects and arachnids.</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/tbRcMzxleAYOcEE8r-69ZP2n6lLGunkP4QYe" alt="Image" width="318" height="159" loading="lazy">
<em>Some bats use echolocation to navigate and hunt prey and contrary to popular belief, bats are actually not blind; a species of bats known as The Flying Foxes actually have better eyesight than humans.</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9m1HytKWrGc6wd46E5ijI2zanCsYY8OWW1Kr" alt="Image" width="800" height="368" loading="lazy">
<em>Flying Fish cannot fly in the same way that birds do, however, these fish can make powerful, self-propelled leaps out of the water where their long wing-like fins enable them to glide for considerable distances above the water’s surface.</em></p>
<p>Needless to say, life on Earth is one of, if not the most successful experiments ever run in our universe; and judging from the impressive outcomes of this experiment, it is clear that evolution is clearly onto something.</p>
<p>Recently, we humans — just one of the many end products of this process — realized that we could also take advantage of this ingenious approach to progressive problem solving, and since the 1950s, computer scientist, geneticists, mathematicians, and biologist, have attempted to mimic these biological processes through the implementation of computer simulations. With the aim of producing optimal solutions for difficult, non-trivial problems, in an efficient manner.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/LdDYa7txaI3r3aOW2UnrS-U1yyIQaBhR0RzF" alt="Image" width="800" height="376" loading="lazy"></p>
<h4 id="heading-the-blind-watchmaker"><strong>The blind watchmaker</strong></h4>
<p>One of the first books I came across that sparked my interest in the field of evolutionary biology was <a target="_blank" href="https://www.goodreads.com/book/show/117047.The_Blind_Watchmaker">The Blind Watchmaker</a>, by Richard Dawkins. In this book, Richard Dawkins explains how complex mechanisms like <a target="_blank" href="https://en.wikipedia.org/wiki/Animal_echolocation">echolocation</a> (a process that bats use to navigate, hunt and forage, also known as bio-sonar), complex structures like spiderwebs (which spiders use to attract and catch their prey), and complex instruments like the human eye (those two spherical objects that you are currently using to read this article) are simply the result of thousands, if not millions of years of evolution and adaptation.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/M35jP6QH4Qor2PeQHTErVdrxHexZe1ALKB1j" alt="Image" width="800" height="1116" loading="lazy">
_The progressive evolution of the human eye. What started off as simple photosensitive cells, evolved into a complex instrument that we often take completely for granted. The first animals with anything resembling an eye lived about 550 million years ago. And, according to one [scientist’s](https://www.pbs.org/wgbh/evolution/library/01/1/l_011_01.html" rel="noopener" target="<em>blank" title=") calculations, it would only take 364,000 years for a camera-like eye to evolve from a light-sensitive patch.</em></p>
<p>Even though these marvels of nature give the impression that they were built with a purpose from the get-go (i.e by a conscious ‘maker’), they are actually just a result of iterations upon iterations of trial and error, bundled up with ever-changing selection pressure (i.e a change in climate, habitat, or the behaviour and capabilities of predators or prey). So while they may look and behave like the outcome of precise, forward-thinking engineering, they are actually the result of a completely blind process, a process that does not know beforehand what the perfect ‘solution’ would be.</p>
<h4 id="heading-what-are-genetic-algorithms-and-why-do-we-need-them"><strong>What are genetic algorithms and why do we need them?</strong></h4>
<p>Genetic algorithms are a technique used to generate high-quality solutions to optimization and search problems, which are based on fundamental biological processes. These algorithms are used in situations where the possible range of solutions is very large, and where the more basic approaches to problem-solving like exhaustive search/brute force would consume too much time and effort.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1GLH7oZafaBQavO5i0FCqqhifqkG5fRNXT39" alt="Image" width="272" height="234" loading="lazy"></p>
<p>The <a target="_blank" href="https://en.wikipedia.org/wiki/Travelling_salesman_problem">traveling salesman problem</a> asks the following question: “Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and returns to the origin city?” It is an NP-hard problem in combinatorial optimization.</p>
<p>We can use genetic algorithms to provide high-quality solutions to this problem, at a much lower cost than the more primitive problem-solving techniques, like exhaustive search, which would require you to permute through all possible solutions.</p>
<h4 id="heading-how-do-genetic-algorithms-work"><strong>How do genetic algorithms work?</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/GWo8z30RJKWLiKSH7UOgqT8UOfFGuC0cASCq" alt="Image" width="800" height="558" loading="lazy"></p>
<p>An algorithm works by iterating through a number of steps, up until it reaches a predefined termination point. Each iteration of the genetic algorithm produces a new generation of possible solutions, which, in theory, should be an improvement on the previous generation.</p>
<p>The steps are as follows:</p>
<ol>
<li>Create an initial population of N possible solutions (the primordial soup)</li>
</ol>
<p>The first step of the algorithm is to create an initial group of solutions that serve as the base solutions in generation 0. Each solution in this initial population will carry a set of chromosomes, which are made up of a collection of genes, where each gene is assigned to one of the possible variables of the problem. It is important that the solutions in the initial population are created with randomly assigned genes, in order to have a high degree of genetic variation.</p>
<ol start="2">
<li>Rank the solutions of the population by fitness (survival of the fittest, part 1).</li>
</ol>
<p>In this step, the algorithm needs to be able to determine what makes one solution more ‘fit’ than another solution. This is determined by the fitness function. The aim of the fitness function is to evaluate the genetic viability of the solutions within the population, placing those with the most viable, favorable &amp; superior genetic traits at the top of the list.</p>
<p>In the traveling salesman problem, the fitness function could be a calculation of the total distance traveled by the solution. Where a shorter distance equates to higher fitness.</p>
<ol start="3">
<li>Cull the weaker solutions (survival of the fittest, part 2)</li>
</ol>
<p>In this step, the algorithm removes the less fit solutions from the population. The ‘fittest’ does not necessarily mean the strongest, the fastest or the fiercest, as humans usually tend to assume. Survival of the fittest simply means that the better equipped an organism is to survive in its environment, the more likely it is to live long enough to reproduce and spread its genes onto the next generation.</p>
<p>Steps 3 and 4 are collectively known as <strong>selection</strong>.</p>
<ol start="4">
<li>Breed the stronger solutions (survival of the fittest, part 3)</li>
</ol>
<p>The remaining solutions are then paired with each other in order to mate and reproduce offspring. During this process, in its most basic form, each parent will contribute a % of their genes (in nature it is a 50/50 split) to each of their offspring, where P1(G)% +P2(G)% = 100%. The process of determining which of the parents’ genes will be inherited by the offspring is known as <strong>crossover</strong>.</p>
<ol start="5">
<li>Mutate the genes of the offspring (<strong>mutation</strong>)</li>
</ol>
<p>The offspring will contain a percentage of the ‘mother’s’ genes, and a percentage of the ‘fathers’ genes and occasionally there will be a ‘mutation’ of one or more of these genes. A mutation is essentially a genetic abnormality, a copying error which causes one or more of the offspring’s genes to differ from the genes it inherited from its parents. In genetic algorithms, in some cases a mutation will increase the fitness of the offspring, in other cases, it will reduce it.</p>
<p>It is important to note that there does not need to be a mutation with each offspring, the required mutation frequency can also be a parameter of the algorithm.</p>
<p>In genetic algorithms, selection, crossover, and mutation are known as <strong>genetic operators</strong>.</p>
<ol start="6">
<li>Termination</li>
</ol>
<p>Steps 2 to 5 will be repeated up until a predefined termination point. This termination point can be one of the following:</p>
<ol>
<li>Maximum time/resource allocation reached.</li>
<li>Fixed number of generations have passed.</li>
<li>The fitness of the dominant solution cannot be surpassed by any future generations.</li>
</ol>
<h4 id="heading-solution-convergence"><strong>Solution convergence</strong></h4>
<ol>
<li>Global optimum</li>
</ol>
<p>In the ideal situation, the fittest solution will have the highest fitness value possible, i.e it will be the optimal solution, meaning that there will be no need to continue with the algorithm and produce further generations.</p>
<ol start="2">
<li>Local optimum</li>
</ol>
<p>In some cases, if the parameters of the algorithm are not reasonable, the population may tend towards a premature convergence upon a less optimal solution, which is not the global optimum that we are after, but rather a local one. Once here, continuing the algorithm and producing further generations may be futile.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/SQpPAJ72-NY7p7kJKotoBiWWYNJmJt-UmeGQ" alt="Image" width="800" height="640" loading="lazy">
<em>Global optimum vs local optimum</em></p>
<h4 id="heading-what-would-happen-if-there-were-no-mutations"><strong>What would happen if there were no mutations?</strong></h4>
<p>On first glance, mutations may seem like an unnecessary, irrelevant part of the process. But without this fundamental aspect of randomness, evolution by natural selection would be completely restricted to the genetic variety set by the initial population, and there would be no new traits introduced into the population after that. This would severely hinder nature’s problem-solving capabilities, and life on earth would not be able to ‘adapt’ to its environment, at least not physically.</p>
<p>If this was the case in our genetic algorithm, at some point in our simulation, the future generations of the population would not be able to explore part of the solution space that their predecessors did not explore. A simulation without any mutations would severely restrict the genetic variation within the population, and in most cases — depending on the initial population — prevent us from ever reaching a global optimum.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/3QFDQk2FY1jiPsvblLEuPuxzqjFMNAeawGIn" alt="Image" width="800" height="450" loading="lazy">
<em>Without mutations, we wouldn’t have mutants, and without mutants, we wouldn’t have the X-men franchise.</em></p>
<h4 id="heading-what-would-happen-if-the-population-size-was-not-large-enough"><strong>What would happen if the population size was not large enough?</strong></h4>
<p>I was recently at the Jukani Wildlife Sanctuary in Plettenberg, where I had the privilege of meeting a white tiger. He was a truly majestic animal. He was large, he looked ferocious, and, he was also 80% blind and getting progressively worse as the years went by.</p>
<p>Why was he blind? Because he is a product of generations of inbreeding. These white tigers are only produced when two tigers that carry a recessive gene controlling coat color are bred together. Thus, in order to ensure the continuation of these tigers in captivity, people have been breeding these tigers within a very limited population in order to either show them off at circuses, parade them at zoos, or keep them as household pets.</p>
<p>But one of the negative effects of inbreeding is that you severely limit the genetic variation within the species, which progressively increases the chances that harmful recessive traits will be passed onto the offspring.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/RMBs4EciPnnoKCCfrTNr4BDKJPvNKu32dRtS" alt="Image" width="800" height="450" loading="lazy">
<em>The white tiger that I met at the Jukani Wildlife Sanctuary in April 2019. He looks majestic, but he is suffering.</em></p>
<p>Even in the wild, inbreeding can still be a massive problem. Over the past few decades, the rhino population in Southern Africa has been significantly impacted due to poaching, and if the population size reaches a low enough number it would mean that maintaining the genetic diversity of these threatened rhino species would be extremely difficult. So even if poaching doesn’t completely lead them to extinction, inbreeding could.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/H3GecodM44iYchyZsSdQj1QXAusXk5oprVt-" alt="Image" width="800" height="730" loading="lazy">
_Photo by [Unsplash](https://unsplash.com/photos/xtvo0ffGKlI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" rel="noopener" target="_blank" title=""&gt;redcharlie on &lt;a href="https://unsplash.com/search/photos/black-rhino?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" rel="noopener" target="<em>blank" title=").</em></p>
<p>Of course, humans are no strangers to inbreeding. One famous result of continuous inbreeding within our own species is <a target="_blank" href="http://blogs.discovermagazine.com/gnxp/2009/04/inbreeding-the-downfall-of-the-spanish-hapsburgs/#.XJO9wFMzY0o">Charles (Carlos) the II of Spain</a>.</p>
<p><em>“The Habsburg King Carlos II of Spain was sadly degenerated with an enormous misshapen head. His Habsburg jaw stood so much out that his two rows of teeth could not meet; he was unable to chew. His tongue was so large that he was barely able to speak. His intellect was similarly disabled.”</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/C4vGkUhe7UQOphhhbebMTt72DJNpuhy8nd6v" alt="Image" width="796" height="1024" loading="lazy">
<em>The Habsburg King Charles II of Spain. His father was his mother’s uncle, making Charles their son, great-nephew and first-cousin respectively.</em></p>
<p>‘Inbreeding’ in our genetic algorithm, essentially means the breeding of solutions that have a very similar genetic makeup, which, thankfully, in this case, would not result in offspring with a predisposition to any physical abnormalities. But if the <strong>population is very small</strong> and if <strong>all of the solutions share a very similar genetic makeup</strong> then the fitness of the future generations of the population will be severely restricted. Meaning that it could take much longer to converge upon a globally optimal solution if we even get there at all.</p>
<p>Inbreeding is not always a bad thing, it just depends on which stage of the simulation you are in. In very advanced stages of the simulation, as the population converges towards a global/local optima, it is obviously very hard to avoid inbreeding, because, in some cases, many of the dominant solutions will be very similar to each other, and thus, will share a lot of the same genetic traits.</p>
<h4 id="heading-wrapping-up">Wrapping up</h4>
<p>Alright, that should cover the basics. If you have any questions, requests, or genetic mutations to contribute, please leave a comment below.</p>
<p>In the next post, we will delve into some code as we look at how each of the genetic operators outlined above plays out in the world of programming. I used the Ruby programming language for the software simulation that I worked on, and in it, I show how in only a few generations, a genetic algorithm can produce a predefined word or phrase from an initial collection of complete and utter gibberish. All of the code will be hosted on Github.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Rejected? Get inspired by the stories of science/tech giants ]]>
                </title>
                <description>
                    <![CDATA[ By Nezar Assawiel Getting that rejection call or email is not pleasant. You feel disappointed, sad, confused, or teary-eyed. It is especially hard after getting so many no’s, or when you know that you are objectively an excellent candidate for the jo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/rejected-get-inspired-by-the-stories-of-science-tech-giants-76c1b007d63a/</link>
                <guid isPermaLink="false">66c35de3add0807b8e3fb90e</guid>
                
                    <category>
                        <![CDATA[ Inspiration ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Hunting ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 17 Dec 2018 22:12:27 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*075MvqkChXLP0wbBcN4osQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Nezar Assawiel</p>
<p>Getting that rejection call or email is not pleasant. You feel disappointed, sad, confused, or teary-eyed. It is especially hard after getting so many no’s, or when you know that you are objectively an excellent candidate for the job. You start doubting yourself and wondering what you are missing.</p>
<p>While there is always room for improvement from your end, there is always room for mistakes from the other end. Those mistakes could be the worst ones of their careers and the biggest opportunities of yours. Treat each rejection as what it is — possibly the best thing that ever happened to you.</p>
<p>When doubt starts getting to your head because you received many rejections, remember that some of the greatest scientists and entrepreneurs were rejected many times, too. Those rejections have led to much better outcomes. Here are some of the rejection stories that inspire me to keep going in the face of rejections.</p>
<h3 id="heading-albert-einstein">Albert Einstein</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/BSrmwQECMGp53R8k0fxGMKBjs0rWyVsxVa3J" alt="Image" width="240" height="300" loading="lazy"></p>
<p>After graduating with a degree in mathematics and physics in 1900, Albert Einstein could not find anybody to hire him. He got rejected from all the schools and colleges to which he applied for a teaching or a research post.</p>
<p>He was struggling so much to find a job that he thought about switching fields and selling insurance! His father wrote letters to his friends, without telling Einstein, asking if they could get a job for his son, with no success.</p>
<p>After almost two years of unemployment, the desperate Einstein moved to Bern — the Swiss capital — where the father of one of his friends got him a job as a junior patent examiner. He worked there until 1909.</p>
<p>Einstein used to finish his tasks quickly and use the rest of his time to work on scientific research that interested him. During that time — specifically 1905 — he published four of the most important scientific papers ever published. These papers laid the foundation of modern physics in space, time, mass and, energy.</p>
<h3 id="heading-srinivasa-ramanujan">Srinivasa Ramanujan</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/xKz-ZhyRdyvFvpXk6DZw92ad1dN43AkXNE7R" alt="Image" width="240" height="300" loading="lazy"></p>
<p>Despite living in poverty for most of his life, receiving little formal education, and passing away at the age of 32, Srinivasa Ramanujan contributed substantially to the field of mathematics.</p>
<p>Ramanujan was able to get a scholarship to attend college. However, his strong interest in mathematics distracted him, thus he failed other subjects and was dropped from the scholarship. He enrolled in another college later and failed other subjects again.</p>
<p>With no college degree, he pursued his mathematical research independently. He lived in poverty and was going door-to-door looking for a clerical job. He would show prospective employers his work and send letters to mathematicians and colleges, detailing advanced theorems that he came up with.</p>
<p>Some didn’t respond to him, some thought he was a fraud, and some were impressed by the work he presented but doubted it was his. There were others, however, who gave him letters of introduction to other notable mathematicians.</p>
<p>His break came as a reply and a sponsorship from G. Hardy — a mathematician at Cambridge University — who recognized the work of a genius. Ramanujan traveled to the UK to work with Hardy, and become one of the youngest Fellows of the Royal Society in history, at the age of 31.</p>
<h3 id="heading-jack-ma">Jack Ma</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/f5gv2A4lobsy0bFs03uerC1BXS0xF6gFP9wC" alt="Image" width="240" height="300" loading="lazy"></p>
<p>Jack Ma, the founder of Alibaba and a global business leader, had his fair share of rejections. After graduating college from his home city of Hangzhou, China, he applied for 30 jobs and got rejected from all of them. He applied to be a police officer. Out of five applicants, he was the only one rejected.</p>
<p>He was even rejected by KFC. When they came to his home city, he tried to get a job with them. Out of 24 applicants, he was the only one rejected, he stated.</p>
<p>Later on, the rejections did not stop! Ma tried to get into Harvard Business School ten times, and got rejected every time. When he came to the USA in 2001 to raise $5 million investment, he got rejected. “…we [will] come back raising a little bit more,” he said.</p>
<p>Ma attributes his resilience and success as entrepreneur in part to the rejections he encountered all the way.</p>
<h3 id="heading-brian-acton">Brian Acton</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/KNBNj9f2wn58rs7FS1WnE19I62h2vl6GKVi3" alt="Image" width="240" height="300" loading="lazy"></p>
<p>Brian Acton, co-founder of WhatsApp, got his “best thing happened to me” rejections as well. In 2009, Acton —a software engineer with years of experience at Yahoo and Apple —got rejected by Twitter, then Facebook.</p>
<p>As no other company he aspired to join would hire him, he took the entrepreneurship route and started WhatsApp with Jan Koum — another Yahoo alum.</p>
<p>Five years later, the cloud-based messaging company co-founded by Acton changed how people text around the world. The company who rejected him earlier — Facebook — wanted him. This time, they had to pay $19 billion to acquire his company and hire him back.</p>
<h3 id="heading-brian-chesky">Brian Chesky</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/rGQMbWaAevl2a5Ltw2u2kf5cUUMR5mlSoBGq" alt="Image" width="240" height="300" loading="lazy"></p>
<p>In 2008, Brian Chesky, co-founder and CEO of Airbnb, was a “nobody” entrepreneur looking for someone to believe in him, his small team, and their idea.</p>
<p>Chesky and his team were looking for $150,000 investment for 10% of Airbnb. One of his friends introduced him to seven potential investors. Five of them rejected him, and the other two didn’t bother to even reply to him.</p>
<p>Ten years later, in 2018, Airbnb is the largest hotel company in the world. Rejecting Chesky’s 10% offer turned to be a $3 billion mistake for those investors now that Airbnb is valued at $30 billion.</p>
<h3 id="heading-kevin-systrom">Kevin Systrom</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Ix-vK98BT-EYy4LMHDgUBwBl8GyXrc94LjpI" alt="Image" width="245" height="303" loading="lazy"></p>
<p>Systrom, the co-founder of Instagram, joined Google right after graduating Stanford.</p>
<p>He worked with Salar Kamangar — a senior Google executive— who was impressed by Systrom, and wanted to transfer him to Googles’s Associate Product Manager (APM) program.</p>
<p>The APM program is an elite rotational program at Google where a select few are chosen and given vital roles in real-impact projects.</p>
<p>Systrom was rejected because the program only accepted candidates with a computer science degree. This occurred despite Salar Kamangar’s efforts to convince his fellow executives to accept Systrom who “is a brilliant self-taught programmer with a history of working closely with engineers to ship products”.</p>
<p>Frustrated by the rejection, Kevin left Google to later co-found Instagram in 2010 and sell it to Facebook for $1 billion two years later.</p>
<h3 id="heading-the-lesson">The lesson</h3>
<p>While rejection is a setback in the short term, it is a necessary step to potential significant outcomes in the long term that are unlikely to happen without it.</p>
<p>We have a choice. We can choose to get depressed over the rejections we receive because “we are not good”. Or we can choose to have faith that our future days want the superiority for us by getting in the way of inferiority. I choose the latter and I trust you do too!</p>
<h3 id="heading-sources">Sources</h3>
<p>[1] Einstein: <a target="_blank" href="https://en.wikipedia.org/wiki/Albert_Einstein">Wikipedia</a>, <a target="_blank" href="https://www.youtube.com/watch?v=Uvpw6Jh1WGQ">The Extraordinary Genius of Albert Einstein</a>.</p>
<p>[2]Srinivasa Ramanujan: <a target="_blank" href="https://en.wikipedia.org/wiki/Srinivasa_Ramanujan">Wikipedia</a>, <a target="_blank" href="https://blog.stephenwolfram.com/2016/04/who-was-ramanujan/">Who Was Ramanujan?</a></p>
<p>[3] Jack Ma: <a target="_blank" href="https://en.wikipedia.org/wiki/Jack_Ma">Wikipedia</a>, <a target="_blank" href="https://www.youtube.com/watch?v=2baJreTbMvs">Rejection — Jack Ma</a>.</p>
<p>[4] Brian Acton: <a target="_blank" href="https://en.wikipedia.org/wiki/Brian_Acton">Wikipedia</a>, <a target="_blank" href="https://www.forbes.com/sites/georgeanders/2014/02/19/he-wanted-a-job-facebook-said-no-in-a-3-billion-mistake/#bdd2cf852441">Forbes</a>.</p>
<p>[5] Brain Chesky: <a target="_blank" href="https://en.wikipedia.org/wiki/Brian_Chesky">Wikipedia</a> , <a target="_blank" href="https://medium.com/@bchesky/7-rejections-7d894cbaa084">Brian Chesky’s Medium</a></p>
<p>[6] Kevin Systrom: <a target="_blank" href="https://en.wikipedia.org/wiki/Kevin_Systrom">Wikipedia</a>, <a target="_blank" href="https://books.google.ca/books?id=fEJ0AwAAQBAJ&amp;printsec=frontcover&amp;source=gbs_ge_summary_r&amp;cad=0#v=onepage&amp;q&amp;f=false">How Google Works</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Connections between Neural Networks and Pure Mathematics ]]>
                </title>
                <description>
                    <![CDATA[ By Marco Tavora How an esoteric theorem gives important clues about the power of Artificial Neural Networks Nowadays, artificial intelligence is present in almost every part of our lives. Smartphones, social media feeds, recommendation engines, onlin... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/connections-between-deep-learning-physics-and-pure-mathematics-part-i-947abeb3a5dd/</link>
                <guid isPermaLink="false">66c347d1790a62b5fbf7b8ac</guid>
                
                    <category>
                        <![CDATA[ Artificial Intelligence ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 12 Dec 2018 08:23:21 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*GJj62r8BX02Sx0I26O3DUA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Marco Tavora</p>
<h4 id="heading-how-an-esoteric-theorem-gives-important-clues-about-the-power-of-artificial-neural-networks">How an esoteric theorem gives important clues about the power of Artificial Neural Networks</h4>
<p>Nowadays, artificial intelligence is present in almost every part of our lives. Smartphones, social media feeds, recommendation engines, online ad networks, and navigation tools are examples of AI-based applications that affect us on a daily basis.</p>
<p>Deep learning has been systematically improving the state of the art in areas such as speech recognition, autonomous driving, machine translation, and visual object recognition. However, the reasons why deep learning works so spectacularly well are not yet fully understood.</p>
<h3 id="heading-hints-from-mathematics">Hints from Mathematics</h3>
<p><a target="_blank" href="https://en.wikipedia.org/wiki/Paul_Dirac">Paul Dirac</a>, one of the fathers of quantum mechanics and arguably the greatest English physicist since <a target="_blank" href="https://www.westminster-abbey.org/abbey-commemorations/commemorations/sir-isaac-newton/">Sir Isaac Newton</a>, once remarked that progress in physics using the “<a target="_blank" href="http://www.damtp.cam.ac.uk/events/strings02/dirac/speach.html">method of mathematical reason</a>” would</p>
<blockquote>
<p>“…enable[s] one to infer results about experiments that have not been performed. There is no logical reason why the […] method should be possible at all, but one has found in practice that it does work and meets with reasonable success. This must be ascribed to some mathematical quality in Nature, a quality which the casual observer of Nature would not suspect, but which nevertheless plays an important role in Nature’s scheme.”</p>
<p>— Paul Dirac, 1939</p>
</blockquote>
<p><img src="https://cdn-media-1.freecodecamp.org/images/5ZKarm0xndzz384YDVedKxTTau618wLukOBK" alt="Image" width="800" height="586" loading="lazy">
<em>Portrait of Paul Dirac is at the peak of his powers (Wikimedia Commons).</em></p>
<p>There are many examples in history where purely abstract mathematical concepts eventually led to powerful applications way beyond the context in which they were developed. This article is about one of those examples.</p>
<p>Though I’ve been working with machine learning for a few years now, I’m a <a target="_blank" href="https://scholar.google.com/citations?user=SaB1GO0AAAAJ&amp;hl=en">theoretical physicist</a> by training, and I have a soft spot for pure mathematics. Lately, I have been particularly interested in the connections between deep learning, pure mathematics, and physics.</p>
<p>This article provides examples of powerful techniques from a branch of mathematics called <a target="_blank" href="https://en.wikipedia.org/wiki/Real_analysis">mathematical analysis</a>. My goal is to use rigorous mathematical results to try to “justify”, at least in some respects, why deep learning methods work so surprisingly well.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Iwu2ZtCJlo0yRbVQjxfldXmO1tZx9O4P19BZ" alt="Image" width="800" height="324" loading="lazy">
_Abstract representation of a neural network ([source](https://www.shutterstock.com/g/ktsdesign" rel="noopener" target="<em>blank" title=")).</em></p>
<h3 id="heading-a-beautiful-theorem">A Beautiful Theorem</h3>
<p>In this section, I will argue that one of the reasons why artificial neural networks are so powerful is intimately related to the mathematical form of the output of its neurons.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yDxrc-KkYWRqxhJNWZF85398nV8fMrOCjjAc" alt="Image" width="800" height="462" loading="lazy">
_A manuscript by Albert Einstein ([source](http://www.alberteinstein.info/manuscripts.html" rel="noopener" target="<em>blank" title=")).</em></p>
<p>I will justify this bold claim using a celebrated theorem originally proved by two Russian mathematicians in the late 50s, the so-called <a target="_blank" href="https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Arnold_representation_theorem">Kolmogorov-Arnold representation theorem</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/FZ9m54A8ujLhtGC5Q5Ek45M3j7sPYdzzKqXi" alt="Image" width="800" height="485" loading="lazy">
<em>The mathematicians Andrei Kolmogorov (left) and Vladimir Arnold (right).</em></p>
<h4 id="heading-hilberts-13th-problem">Hilbert’s 13th problem</h4>
<p>In 1900, <a target="_blank" href="https://en.wikipedia.org/wiki/David_Hilbert">David Hilbert</a>, one of the most influential mathematicians of the 20th century, presented a famous <a target="_blank" href="https://en.wikipedia.org/wiki/Hilbert%27s_problems">collection of problems</a> that effectively set the course of the 20th-century mathematics research.</p>
<p>The Kolmogorov–Arnold representation theorem is related to one of the celebrated <a target="_blank" href="https://en.wikipedia.org/wiki/Hilbert%27s_problems">Hilbert problems</a>, all of which hugely influenced 20th-century mathematics.</p>
<h4 id="heading-closing-in-on-the-connection-with-neural-networks">Closing in on the connection with neural networks</h4>
<p>A generalization of one of these problems, the <a target="_blank" href="https://en.wikipedia.org/wiki/Hilbert%27s_thirteenth_problem">13th</a> problem specifically, considers the possibility that a function of <em>n</em> variables can be expressed as a combination of sums and compositions of just two functions of a single variable which are denoted by Φ and <em>ϕ</em>.</p>
<p>More concretely:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/5ciEd-xaR7lp3US513Jo20KsVnwtor2qBeWU" alt="Image" width="800" height="186" loading="lazy">
<em>Kolmogorov-Arnold representation theorem</em></p>
<p>Here, <em>η</em> and the λs are real numbers. It should be noted that these two univariate functions are Φ and <em>ϕ</em> can have a highly complicated (fractal) structure.</p>
<p>Three articles, by Kolmogorov (1957), Arnold (1958) and <a target="_blank" href="http://www.ams.org/journals/tran/1965-115-00/S0002-9947-1965-0210852-X/S0002-9947-1965-0210852-X.pdf">Sprecher</a> (1965) provided a proof that there must exist such representation. This result is rather unexpected since according to it, the bewildering complexity of multivariate functions can be “translated” into trivial operations of univariate functions, such as additions and function compositions.</p>
<h3 id="heading-now-what">Now what?</h3>
<p>If you got this far (and I would be thrilled if you did), you are probably wondering: how could an esoteric theorem from the 50s and 60s be even remotely related to cutting-edge algorithms such as artificial neural networks?</p>
<h3 id="heading-a-quick-reminder-of-neural-networks-activations">A Quick Reminder of Neural Networks Activations</h3>
<p>The expressions computed at each node of a neural network are compositions of other functions, in this case, the so-called activation functions. The degree of complexity of such compositions depends on the depth of the hidden layer containing the node. For example, a node in the second hidden layer performs the following computation:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/L8v4n0-Pw16u8yIcdkQXoTADtSM5zyWJJQfr" alt="Image" width="800" height="108" loading="lazy">
<em>Computation performed by the k-th hidden unit in the second hidden layer.</em></p>
<p>Where the _w_s are the weights, and the _b_s are the biases. The similarity with the multivariate function <em>f</em> shown a few paragraphs above is evident!</p>
<p>Let us quickly write down a function in Python only for forward-propagation which outputs the calculations performed by the neurons. The code for the function below has the following steps:</p>
<ul>
<li><strong>First line</strong>: the first activation function <em>ϕ</em> acts on the first linear step given by:</li>
</ul>
<pre><code>x0.dot(w1) + b1
</code></pre><p>where <code>x0</code> is the input vector.</p>
<ul>
<li><strong>Second line: t</strong>he second activation function acts on the second linear step</li>
</ul>
<pre><code>y1.dot(w2) + b2
</code></pre><ul>
<li><strong>Third line:</strong> a <a target="_blank" href="https://en.wikipedia.org/wiki/Softmax_function#Neural_networks">softmax function</a> is used in the final layer of the neural network, acting on the third linear step</li>
</ul>
<pre><code>y2.dot(w3) + b3
</code></pre><p>The full function is:</p>
<pre><code>def forward_propagation(w1, b1, w2, b2, w3, b3, x0):        y1 = phi(x0.dot(w1) + b1)    y2 = phi(y1.dot(w2) + b2)    y3 = softmax(y2.dot(w3) + b3)        <span class="hljs-keyword">return</span> y1, y2, y3
</code></pre><p>To compare this with our expression above we write:</p>
<pre><code>y2 = phi(phi(x0.dot(w1) + b1).dot(w2) + b2)
</code></pre><p>The correspondence can be made more clear:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/T77L1UoWBNfvewKPTmoAzGReC54fhnp0eKzV" alt="Image" width="800" height="402" loading="lazy"></p>
<h3 id="heading-a-connection-between-two-worlds">A Connection Between Two Worlds</h3>
<p>We, therefore, conclude that the result proved by Kolmogorov, Arnold, and Sprecher implies that neural networks, whose output is nothing but the repeated composition of functions, are extremely powerful objects, which can represent any multivariate function or equivalently almost any process in nature. This partly explains why neural networks work so well in so many fields. In other words, the generalization power of neural networks is, at least in part, a consequence of the Kolmogorov-Arnold representation theorem.</p>
<p>As pointed out by <a target="_blank" href="https://indico.math.cnrs.fr/event/2435/">Giuseppe Carleo</a>, the generalization power of forming functions of functions of functions <em>ad</em> nauseam was, in a way, “discovered independently also by nature” since neural networks, which work as shown above doing precisely that, are a simplified way to describe how our brains work.</p>
<p>Thanks a lot for reading! Constructive criticism and feedback are always welcome!</p>
<p>My <a target="_blank" href="https://github.com/marcotav">Github</a> and my website <a target="_blank" href="https://marcotavora.me/">www.marcotavora.me</a> have some other interesting stuff both about data science and physics.</p>
<p>There is a lot more to come, stay tuned!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Will the sun rise tomorrow? ]]>
                </title>
                <description>
                    <![CDATA[ By Peter Gleeson Laplace, Bayes, and machine learning today It may not be a question that you were worrying much about. After all, it appears to happen every day without fail. But what is the probability the sun will rise tomorrow? Believe it or not,... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/will-the-sun-rise-tomorrow-255afc810682/</link>
                <guid isPermaLink="false">66d460c047a8245f78752aa9</guid>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 15 Aug 2018 19:39:06 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*WxMNTDnwTA-9R_7K" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Peter Gleeson</p>
<h4 id="heading-laplace-bayes-and-machine-learning-today">Laplace, Bayes, and machine learning today</h4>
<p>It may not be a question that you were worrying much about. After all, it appears to happen every day without fail.</p>
<p>But what <em>is</em> the probability the sun will rise tomorrow?</p>
<p>Believe it or not, this question was given consideration by one of mathematics’ all-time greats <a target="_blank" href="http://scienceworld.wolfram.com/biography/Laplace.html">Pierre-Simon Laplace</a> in his pioneering work of 1814, <em>“</em><a target="_blank" href="https://ia801407.us.archive.org/35/items/essaiphilosophiq00lapluoft/essaiphilosophiq00lapluoft_bw.pdf">Essai philosophique sur les probabilités</a>”.</p>
<p>Fundamentally, Laplace’s treatment of the question was intended to illustrate a more general concept. It was not a serious attempt to estimate whether the sun will, in fact, rise.</p>
<p>In his essay, Laplace describes a framework for probabilistic reasoning that today we recognise as Bayesian.</p>
<p>The Bayesian approach forms a keystone in many modern machine learning algorithms. But the computational power required to make use of these methods has only been available since the latter half of the 20th Century.</p>
<p>(So far, it appears current state-of-the-art AI is keeping quiet on the issue of tomorrow’s sunrise.)</p>
<p>Laplace’s ideas are still relevant today, despite being developed more than two centuries ago. This article will review some of these ideas, and show how they are used in modern applications, perhaps envisaged by Laplace’s contemporaries.</p>
<h4 id="heading-pierre-simon-laplace">Pierre-Simon Laplace</h4>
<p>Born in the small Normandy commune of Beaumont-en-Auge in 1749, Pierre-Simon Laplace was initially marked out to become a theologian.</p>
<p>However, while studying at the University of Caen, he discovered a brilliant aptitude for mathematics. He transferred to Paris, where he impressed the great mathematician and physicist Jean le Rond d’Alembert.</p>
<p>At the age of 24, Laplace was elected to the prestigious Académie des Sciences.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/wz95dMqv5qEq65D9G1Xg3-DQ26SGSfFmGWyF" alt="Image" width="200" height="272" loading="lazy"></p>
<p>Laplace was an astonishingly prolific scientist and mathematician. Amongst his many contributions, his work on probability, planetary motion, and mathematical physics stand out. He counted figures such as Antoine Lavoisier, Jean d’Alembert, Siméon Poisson, and even Napoleon Bonaparte, as his collaborators, advisers, and students.</p>
<p>Laplace’s “Essai philosophique sur les probabilités” was based upon a lecture he delivered in 1795. It provided a general overview of ideas contained within his work “Théorie analytique des probabilités”, published two years earlier in 1812.</p>
<p>In “Essai philosophique”, Laplace provides ten principles of probability. The first few cover basic definitions, and how to calculate probabilities relating to independent and dependent events.</p>
<p>Principles eight, nine, and ten concern the application of probability to what we might describe today as cost-benefit analysis.</p>
<p>The sixth is an important generalization of <a target="_blank" href="http://mathworld.wolfram.com/BayesTheorem.html">Thomas Bayes’ eponymous theorem of 1763</a>.</p>
<p>It states that, for a given event, the likelihood of each possible cause is found by multiplying the prior probability of that cause by a fraction.</p>
<p>This fraction is the probability of the event arising from that particular cause, divided by the probability of the event occurring by any cause.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/iSkx6zOPJr9jeMHRKxCgwKQ4b3nsRVxgI8Ln" alt="Image" width="800" height="145" loading="lazy">
<em>Probability of A-given-B equals probability of A times probability of B-given-A, divided by probability of B</em></p>
<p>This theorem’s influence within machine learning cannot be overstated.</p>
<p>The seventh principle is the one that has caused the most controversy since its publication. However, the actual wording is innocuous enough.</p>
<p>Rather, it is Laplace’s choice of discussing the probability of the sun rising the next day by way of illustrative example that has in turn drawn derision and objection over the following two centuries.</p>
<p>The rule of succession is still used today under various guises, and sometimes in the form Laplace originally described.</p>
<p>In fact, the rule of succession represents an important early step in applying Bayesian thinking to systems for which we have very limited data and little or no prior knowledge. This is a starting point often faced in modern machine learning problems.</p>
<h4 id="heading-laplaces-rule-of-succession">Laplace’s rule of succession</h4>
<p>The seventh principle of probability given in Laplace’s “Essai philosophique” is, in essence, straightforward.</p>
<p>It states that the probability of a given event occurring is found by summing the probability of each of its potential causes multiplied by the probability of that cause giving rise to the event in question.</p>
<p>Laplace then proceeds to outline an example based upon drawing balls from urns. So far, so good. Nothing contentious yet.</p>
<p>However, he then describes how to proceed with estimating the probability of an event occurring in situations where we have limited (or indeed no) prior knowledge about what that probability might be.</p>
<blockquote>
<p>“On trouve ainsi qu’un événement étant arrivé de suite un nombre quelconque de fois , la probabilité qu’il arrivera encore la fois suivante est égale à ce nombre augmenté de l’unité, divisé par le même nombre augmenté de deux unités.”</p>
</blockquote>
<p>Which translates in English: “So, one finds for a event which has occurred any number of times until now, the probability it will occur again the next time is equal to this number increased by one, divided by the same number increased by two”.</p>
<p>Or, in math notation:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/oTRD9vv5j3fG3Tt-e2mFkbzNTEKxzBS9aH-i" alt="Image" width="800" height="79" loading="lazy"></p>
<p>That is, given <em>s</em> successes out of <em>n</em> trials, the probability of success on the next trial is approximately (s+1)/(n+2).</p>
<p>To make his point, Laplace doesn’t hold back:</p>
<blockquote>
<p>“… par exemple, remonter la plus ancienne époque de l’histoire à cinq mille ans, ou à 1,826,213 jours, et le soleil s’étant levé constamment dans cet intervalle, à chaque révolution de vingtquatre heures, il y a 1,826,214 à parier contre un qu’il se lèvera encore demain”</p>
</blockquote>
<p>Which translates as: “…for example, given the sun has risen every day for the last 5000 years — or 1,826,213 days — the probability it will rise tomorrow is 1,826,214 / 1,826,215”.</p>
<p>At 99.9%, that’s a pretty certain bet. And it only becomes more certain each day the sun continues to rise.</p>
<p>Yet Laplace acknowledges that, for someone who understands the mechanism by which the sun rises and sees no reason why it should cease to function, even this probability is unreasonably low.</p>
<p>And it turns out that this qualification is perhaps just as important as the actual rule itself. After all, it hints at the fact that our prior knowledge of a system is encoded in the assumptions we make when assigning probabilities to each of its potential outcomes.</p>
<p>This is true in machine learning today, especially when we try learning from limited or incomplete training data.</p>
<p>But what is the rationale behind Laplace’s rule of succession, and how does it live on in some of today’s most popular machine learning algorithms?</p>
<h4 id="heading-nothing-is-impossible">Nothing is impossible?</h4>
<p>To better understand the significance of Laplace’s rule, we need to consider what it means to have very little prior knowledge about a system.</p>
<p>Say you have one of Laplace’s urns, which you know to contain at least one red ball. You know nothing else about the contents of the urn “system”. Perhaps it contains many different colors, perhaps it only contains that one red ball.</p>
<p>Draw one ball from the urn. You know the probability that it will be red is greater than zero, and either less than or equal to one.</p>
<p>But, as you don’t know whether the urn contains other colors, you cannot say the probability of drawing red certainly equals one. You simply cannot rule out any other possibility.</p>
<p>So, how do you estimate the probability of drawing a red ball from the urn?</p>
<p>Well, according to Laplace’s rule of succession, you can model drawing a ball from the urn as a <a target="_blank" href="http://www.mathwords.com/b/bernoulli_trials.htm">Bernoulli trial</a> with two possible outcomes: “red” and “not-red”.</p>
<p>Before we’ve drawn anything from the urn, we’ve already allowed for two potential outcomes to exist. In so doing, we’ve effectively “pseudo-counted” two imaginary draws from the urn, observing each outcome once.</p>
<p>This gives each outcome (“red” and “not-red”) a probability of 1/2.</p>
<p>As the number of draws from the urn increases, the effect of these pseudo-counts becomes less and less important. If the first ball drawn is red, you update the probability of the next one being red to (1+1)/(1+2) = 2/3.</p>
<p>If the next ball is red, the probability updates to 3/4. If you keep drawing red, the probability reaches ever closer to 1.</p>
<p>In today’s language, probability concerns a <a target="_blank" href="http://mathworld.wolfram.com/SampleSpace.html">sample space</a>. This is a mathematical set of all possible outcomes for a given “experiment” (a process that selects one of the outcomes).</p>
<p>Probability was put on a formal axiomatic basis by Andrey Kolmogorov in the 1930s. <a target="_blank" href="https://www.le.ac.uk/users/dsgp1/COURSES/LEISTATS/Lecture2.pdf">Kolmogorov’s axioms</a> make it easy to prove that a sample space must contain at least one element.</p>
<p>Kolmogorov also defines <a target="_blank" href="https://en.wikipedia.org/wiki/Probability_measure">probability as a measure</a> that returns a real valued number between zero and one for all elements of the sample space.</p>
<p>Naturally, probability makes a useful way to model real world systems, especially when you assume complete knowledge about the contents of the sample space.</p>
<p>But when we don’t understand the system at hand, we don’t know the sample space — apart from that it must contain at least one element. This is a common starting point in many machine learning contexts. We have to learn the contents of the sample space as we go.</p>
<p>Therefore, we ought to allow the sample space to contain at least one extra, catch-all element — or, if you like, the “unknown unknown”. Laplace’s rule of succession tells us to assign the “unknown unknown” a probability of 1/n_+_2, after n repeated observations of known events.</p>
<p>Although in many cases it is convenient to ignore the possibility of unknown unknowns, there are <a target="_blank" href="https://en.wikipedia.org/wiki/Skepticism#Philosophical_skepticism">epistemological grounds</a> for always allowing such eventualities to exist.</p>
<p>One such argument is known as Cromwell’s Rule, coined by <a target="_blank" href="https://www.theguardian.com/science/2014/mar/16/dennis-lindley">the late Dennis Lindley</a>. Quoting the 17th century’s <a target="_blank" href="https://www.historic-uk.com/HistoryUK/HistoryofEngland/Oliver-Cromwell/">Oliver Cromwell</a>:</p>
<blockquote>
<p>“I beseech you, in the bowels of Christ, think it possible that you may be mistaken”</p>
</blockquote>
<p>This rather dramatic statement asks us to allow a remote possibility for the unexpected to occur. In the language of Bayesian probability, this amounts to requiring us to always consider a non-zero prior.</p>
<p>Because if your prior probability is set to zero, no amount of evidence will ever convince you otherwise. After all, even the strongest evidence to the contrary will still yield a posterior probability of zero, when multiplied by zero.</p>
<h4 id="heading-objections-and-a-defence-of-laplace">Objections, and a defence of Laplace</h4>
<p>It may come as little surprise to learn that Laplace’s sunrise example attracted much criticism from his contemporaries.</p>
<p>People objected to the perceived simplicity — naivety, even — of Laplace’s assumptions. The idea that there was a 1/1,826,215 probability the sun would not rise the following day seemed absurd.</p>
<p>It is tempting to believe that, given a large number of trials, a non-zero probability event must happen. And therefore, observing so many consecutive sunrises without a single failure surely implies Laplace’s estimate is an overestimate?</p>
<p>For example, you might expect that after a million trials, you’d have observed a one-in-a-million event — almost guaranteed by definition! What’s the probability of doing otherwise?</p>
<p>Well, you wouldn’t be astonished if you tossed a fair coin twice without landing heads. Nor would it be cause for concern if you rolled a die six times, and never saw the number six. These are events with probability 1/2 and 1/6 respectively, but that absolutely does not guarantee their occurrence in the first two and six trials.</p>
<p>A <a target="_blank" href="https://en.wikipedia.org/wiki/E_(mathematical_constant)#Bernoulli_trials">result attributed to Bernoulli</a> back in the 17th Century finds the limit as the probability 1/n and number of trials n grow very large:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/SxCrLe6DHd8yei8xYNvUjyCa69t9zcNgSGtV" alt="Image" width="800" height="73" loading="lazy"></p>
<p>Although on average you will have observed at least one occurrence of an event with probability 1/n after n trials, there is still a greater than 1/3 chance you will not.</p>
<p>Likewise, if the true probability of the sun failing to rise were indeed 1/1,826,215, then we perhaps shouldn’t be so surprised such an occurrence has never been recorded in history.</p>
<p>And, arguably, Laplace’s qualification is too generous.</p>
<p>It is true that, for a person who claims to understand the mechanism by which the sun rises every day, the probability of it failing to do so must be much closer to zero.</p>
<p>Yet to assume an understanding of such a mechanism requires us to possess prior knowledge of the system, beyond that which we have observed. This is because such a mechanism is implicitly assumed constant — in other words, true for all time.</p>
<p>This assumption lets us, in a sense, “conjure up” an unlimited number of observations — on top of those we have actually observed. It’s an assumption called for by none other than Isaac Newton, at the beginning of the third book in his famous “<a target="_blank" href="https://ia802706.us.archive.org/0/items/newtonspmathema00newtrich/newtonspmathema00newtrich.pdf">Philosophiae Naturalis Principia Mathematica</a>”.</p>
<p>Newton outlines four “Rules of Reasoning in Philosophy”. The fourth rule claims we can regard propositions derived from previous observations as “very nearly true”, until contradicted by future observations.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/6QtTrbJmXaemWI37d-vPeyEWG78rywIUdYVo" alt="Image" width="800" height="178" loading="lazy">
<em>“In experimental philosophy we are to look upon propositions collected by general induction from phenomena as accurately or very nearly true”</em></p>
<p>Such an assumption was crucial for the scientific revolution, despite being a kick in the teeth for philosophers such as David Hume, <a target="_blank" href="http://www.davidhume.org/texts/ehu.html">who famously argued for the problem of induction</a>.</p>
<p>It is this epistemological compromise that lets us do useful science and, in turn, invent technology. Somewhere along the line, as we see the estimated probability of the sun failing to rise diminish ever closer to zero, we allow ourselves to “round down” and claim a fully fledged scientific truth.</p>
<p>But all of this presumably lies beyond the scope of the point Laplace originally sought to make.</p>
<p>Indeed, his choice of a sunrise example is unfortunate. The rule of succession really comes into its own when applied to completely unknown “black-box” systems for which we have zero (or very few) observations.</p>
<p>This is because the rule of succession offers an early example of a non-informative prior.</p>
<h4 id="heading-how-to-assume-as-little-as-possible">How to assume as little as possible</h4>
<p>Bayesian probability is a keystone concept in modern machine learning. Algorithms such as <a target="_blank" href="http://scikit-learn.org/stable/modules/naive_bayes.html">Naive Bayes classification</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm">Expectation Maximisation</a>, <a target="_blank" href="http://www.orchid.ac.uk/eprints/40/1/fox_vbtut.pdf">Variational Inference</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo">Markov Chain Monte Carlo</a> are amongst the most popular in use today.</p>
<p>Bayesian probability generally refers to <a target="_blank" href="https://plato.stanford.edu/entries/probability-interpret/">an interpretation of probability</a> where you update your (often subjective) belief in the light of new evidence.</p>
<p>Two key concepts are prior and posterior probabilities.</p>
<p>Posterior probabilities are those we ascribe to after updating our beliefs in the face of new evidence.</p>
<p>Prior probabilities (or ‘priors’) are those we hold to be true before seeing new evidence.</p>
<p>Data scientists are interested in how we assign prior probabilities to events in the absence of any previous knowledge at all. This is a typical starting point for many problems in machine learning and predictive analytics.</p>
<p>Priors can be informative, in the sense they come with “opinions” about the probability of different events. These “opinions” can be strong or weak, and are usually based on past observations or otherwise reasonable assumptions. These are invaluable in situations where we want to train our machine learning model quickly.</p>
<p>However, priors can also be non-informative. This means they assume as little as possible about the respective probabilities of an event. These are useful in situations where we want our machine learning model to learn from a blank state.</p>
<p>So we must ask: how do you measure how “informative” a prior probability distribution is?</p>
<p><a target="_blank" href="http://web.mit.edu/6.933/www/Fall2001/Shannon2.pdf">Information theory</a> provides an answer. This is a branch of mathematics that concerns how information is measured and communicated.</p>
<p>Information can be thought of in terms of certainty, or a lack thereof.</p>
<p>After all, in an everyday sense, the more information you have about some event, the more certain you are about its outcome. Less information equates to less certainty. This means that information theory and probability theory are inextricably linked.</p>
<p><a target="_blank" href="http://mathworld.wolfram.com/Entropy.html">Information entropy</a> is a fundamental concept in information theory. It serves as a measure of the uncertainty inherent to a given <a target="_blank" href="http://mathworld.wolfram.com/DistributionFunction.html">probability distribution</a>. A probability distribution with high entropy is one for which the outcome is more uncertain.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/zKwL45eeeHVN5a5CNdJ863vwN-Xk7v-DH-Ag" alt="Image" width="800" height="107" loading="lazy"></p>
<p>Perhaps intuitively, you can reason that a uniform probability distribution — a distribution for which each event is equally likely — has the highest possible entropy. For example, if you flipped a fair coin and a biased coin, which outcome would you be least certain about?</p>
<p>Information entropy provides a formal means of quantifying this, and if you know some calculus, <a target="_blank" href="https://en.wikipedia.org/wiki/Lagrange_multiplier#Example_3:_Entropy">you can check out the proof here</a>.</p>
<p>So the uniform distribution is, in a very real sense, the least informative distribution possible. And for that reason, it makes an obvious choice for an uninformative prior.</p>
<p>Perhaps you’ve spotted how Laplace’s rule of succession effectively amounts to using a uniform prior? By adding one success and one failure before we’ve even observed any outcomes, we’re using a uniform probability distribution to represent our “prior” belief about the system.</p>
<p>Then, as we observe more and more outcomes, the weight of the evidence increasingly overpowers the prior.</p>
<h4 id="heading-case-study-naive-bayes-classification">Case study: Naive Bayes classification</h4>
<p>Today, Laplace’s rule of succession is generalised to additive smoothing and pseudo-counting.</p>
<p>These are techniques which allow us to use non-zero probabilities for events not observed in training data. This is an essential part of how machine learning algorithms are able to generalize when faced with inputs not seen previously.</p>
<p>For instance, take Naive Bayes classification.</p>
<p>This is a simple yet effective algorithm that can classify textual and other suitably tokenized data, using Bayes’ theorem.</p>
<p>The algorithm is trained on a corpus of pre-classified data, in which each document consists of a set of words or “features”. The algorithm begins by estimating the probability of each feature, given a certain class.</p>
<p>Using Bayes’ theorem (and some very naive assumptions about feature independence), the algorithm can then approximate the relative probabilities of each class, given the features observed in a previously unseen document.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/-6HX91wIpY2IY9ySy3tPJJq4k0q4bZGq50Mp" alt="Image" width="800" height="123" loading="lazy">
<em>The best estimate is the class, k, which maximizes the likelihood of observing the individual features, x, within a given document</em></p>
<p>An important step in Naive Bayes classification is estimating the probability of a feature being observed within a given class. This can be done by calculating the frequency at which the feature is observed in each of that class’s records in the training data.</p>
<p>For instance, the word “Python” might appear in 12% of all documents classed as “programming”, compared to 1% of all documents classed as “start-up”. The word “learn” might appear in 10% of programming documents and 20% of all start-up documents.</p>
<p>Take the sentence “learn Python”.</p>
<p>Using these frequencies, we find the probability of the sentence being classed as “programming” equals 0.12 ×0.10 = 0.012, and the probability of it being classed as “start-up” is 0.01×0.20 = 0.002.</p>
<p>Therefore, “programming” is the more likely of these two classes.</p>
<p>But this frequency-based approach runs into trouble whenever we consider a feature which never occurs in a given class. This would mean it has a frequency of zero.</p>
<p>Naive Bayes classification requires us to multiply probabilities, but multiplying anything by zero will, of course, always yield zero.</p>
<p>So, what happens if a previously unseen document does contain a word never observed in a given class in the training data? That class will be deemed impossible — no matter how frequently every other word in the document occurs in that class.</p>
<h4 id="heading-additive-smoothing">Additive smoothing</h4>
<p>An approach called additive smoothing offers a solution. Instead of allowing for zero frequencies, we add a small constant to the numerator. This prevents unseen class/feature combinations from derailing the classifier.</p>
<p>When this constant equals one, additive smoothing is the same as applying Laplace’s rule of succession.</p>
<p>As well as Naive Bayes classification, additive smoothing is used in other probabilistic machine learning contexts. Examples include problems in language modelling, neural networks, and hidden Markov models.</p>
<p>In mathematical terms, additive smoothing amounts to using a beta distribution as a <a target="_blank" href="https://en.wikipedia.org/wiki/Conjugate_prior">conjugate prior</a> for carrying out Bayesian inference with binomial and geometric distributions.</p>
<p>The beta distribution is a family of probability distributions defined over the interval [0,1]. It takes two shape parameters, α and β. Laplace’s rule of succession corresponds to setting α = 1 and β <em>=</em> 1.</p>
<p>As discussed above, the beta(1,1) distribution is the one for which information entropy is maximised. However, there are alternative priors for cases in which the assumption of one success and one failure are not valid.</p>
<p>For instance, Haldane’s prior is defined as a beta(0,0) distribution. It applies in cases when we are not even sure if we can allow for a binary outcome. Haldane’s prior places an infinite amount of “weight” on zero and one.</p>
<p>Jeffrey’s prior, the beta(0.5, 0.5) distribution, is another non-informative prior. It has the helpful property that it remains invariant under reparameterization. Its derivation is beyond the scope of this article, but if you are interested, <a target="_blank" href="https://math.stackexchange.com/questions/210607/in-what-sense-is-the-jeffreys-prior-invariant">check out this thread</a>.</p>
<h4 id="heading-the-legacy-of-ideas">The legacy of ideas</h4>
<p>Personally, I find it fascinating how some of the earliest ideas in probability and statistics have survived years of contention, and still find widespread use in modern machine learning.</p>
<p>It is extraordinary to realise that the influence of ideas developed more than two centuries ago is still being felt today. Machine learning and data science have gained real mainstream momentum in the last decade or so. But the foundations upon which they are built were laid long before the first computers were even close to realization.</p>
<p>It’s no coincidence that such ideas border on the philosophy of knowledge. This becomes especially relevant as machines become more and more intelligent. At what point might the focus shift onto our philosophy of consciousness?</p>
<p>Finally, what would Laplace and his contemporaries make of machine learning today? It’s tempting to suggest they’d be astounded by the progress that’s been made.</p>
<p>But that would probably be a disservice to their foresight. After all, the French philosopher <a target="_blank" href="https://plato.stanford.edu/entries/descartes/">René Descartes</a> had written of <a target="_blank" href="http://www.biusante.parisdescartes.fr/sfhm/hsm/HSMx1987x021x004/HSMx1987x021x004x0381.pdf">a mechanistic philosophy</a> back in the 17th Century. Describing a hypothetical machine:</p>
<blockquote>
<p>“Je désire que vous considériez … toutes les fonctions que j’ai attribuées à cette machine, comme … la réception de la lumière, des sons, des odeurs, des goûts … l’empreinte de ces idées dans la mémoire … et enfin les mouvements extérieurs … qu’ils imitent le plus parfaitement possible ceux d’un vrai homme … considériez que ces fonctions … de la seule disposition de ses organes, ni plus ni moins que font les mouvements d’une horloge … <strong>de celle de ses contrepoids et de ses roues”</strong></p>
</blockquote>
<p>Which translates as: “I desire that you consider that all the functions I’ve attributed to this machine such as… the reception of light, sound, smell and taste… the imprint of these ideas in the memory… and finally the external movements which imitate as perfectly as possible those of a true human…Consider that these functions are only under the control of the organs, no more or less than the movements of a clock are to its counterweights and wheels”</p>
<p>The passage above describes a hypothetical machine capable of responding to stimuli and behaving like a “true human”. It was published in Descartes’ 1664 work “Traité de l’homme” — a full 150 years before Laplace’s “Essai philosophique sur les probabilités”.</p>
<p>Indeed, the 18th and early 19th Centuries saw the construction of incredibly sophisticated automata by inventors such as <a target="_blank" href="https://en.wikipedia.org/wiki/Pierre_Jaquet-Droz">Pierre Jaquet-Droz</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Henri_Maillardet">Henri Maillardet</a>. These clockwork androids could be “programmed” to <a target="_blank" href="https://www.youtube.com/watch?v=bY_wfKVjuJM">write</a>, <a target="_blank" href="https://www.youtube.com/watch?v=LCNQvm61_78">draw</a>, and <a target="_blank" href="https://www.youtube.com/watch?v=9n0gCi-oQ9s">play music</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/oQoY4BGg2Yjpyzp3nASbEx5D9Jm3RyryTITm" alt="Image" width="800" height="438" loading="lazy">
_Drawing produced by one of Henri Maillardet’s early 19th Century automata ([video](https://www.youtube.com/watch?v=LCNQvm61_78" rel="noopener" target="<em>blank" title="))</em></p>
<p>So there is no doubting that Laplace and his contemporaries could conceive of the notion of an intelligent machine. And it surely would not have escaped their notice how progress made in the field of probability might be applied to machine intelligence.</p>
<p>Right at the beginning of “Essai philosophique”, Laplace writes of a hypothetical super-intelligence, retrospectively named “Laplace’s Demon”:</p>
<blockquote>
<p>“Une intelligence qui, pour un instant donné, connaîtrait toutes les forces dont la nature est animée, et la situation respective des êtres qui la composent, si d’ailleurs elle était assez vaste pour sou- mettre ces données à l’analyse … rien ne serait incertain pour elle, et l’avenir comme le passé, serait présent à ses yeux”</p>
</blockquote>
<p>Which translates as: “An intelligence, which in a given moment, knows all the forces by which nature is animated, and the respective situation of the beings which compose it, and if it were large enough to submit these data to analysis … nothing would be uncertain to it, and the future as the past, would be present in its eyes”.</p>
<p>Could Laplace’s Demon be realized as one of Descartes’ intelligent machines? <a target="_blank" href="https://ti.arc.nasa.gov/m/pub-archive/1476h/1476%20(Wolpert).pdf">Modern sensibilities overwhelmingly suggest no</a>.</p>
<p>Yet Laplace’s premise envisaged on a smaller scale may soon become a reality, thanks in no small part to his own pioneering work in the field of probability.</p>
<p>Meanwhile, the sun will (probably) continue to rise.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How I used (computer) SCIENCE! to deal with more than a thousand Lego pieces ]]>
                </title>
                <description>
                    <![CDATA[ By Eumir Gaspar Most kids absolutely LOVE Legos. My son has been playing with the Duplo ones, but we have since recently “upgraded” him to the normal ones. Since we didn’t have a collection of regular legos yet, we opted to just inherit someone else’... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/using-computer-science-to-deal-with-more-than-a-thousand-lego-pieces-439a2d5a3278/</link>
                <guid isPermaLink="false">66d45eef7df3a1f32ee7f861</guid>
                
                    <category>
                        <![CDATA[ Computer Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ play ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 02 May 2018 17:07:47 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*nnr2BTzLiLncURCANSAOqQ.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Eumir Gaspar</p>
<p>Most kids absolutely LOVE <a target="_blank" href="https://www.lego.com">Legos</a>. My son has been playing with the <a target="_blank" href="https://www.lego.com/en-au/themes/duplo">Duplo</a> ones, but we have since recently “upgraded” him to the normal ones. Since we didn’t have a collection of regular legos yet, we opted to just inherit someone else’s. We finally got our break when we found someone selling off their kids’ Lego collection since they were too old for them.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/LqBNo6G6BJtK7N1F6MwlWi-nSgAhrLj70NWH" alt="Image" width="800" height="1421" loading="lazy">
<em>This is just half of the collection. Half was already sorted by colours, but these weren’t.</em></p>
<p>Since we had just gotten a payload of more than a thousand pieces, we now had to sort them by colour just to organise them. I sure wasn’t going <a target="_blank" href="http://brickarchitect.com/guide/bricks/more/">to sort them by part or catalogue them</a>, since that would have taken forever.</p>
<p>So given the insurmountable task, we then decided to get into it. We started sorting by picking up all the green bricks and collecting them in a basin for washing. Yep, this was a very old collection, so it was very dusty.</p>
<p>The initial plan of attack was this:</p>
<ul>
<li>I sort the bricks and my wife cleans them and the shelves included. Yes the deal included 3 shelves, 9 boxes, 1 Lego bag (in the photo) and 1 Lego head in addition to probably five to ten thousand pieces</li>
<li>We then pack them away — easy, right?</li>
</ul>
<p>This sounded like a good plan, until I realised that sorting by colour the way I was doing it was too slow. I was only picking up one colour at a time. I’d probably only sorted about 30 bricks and it had taken me five minutes. Imagine how long it would have taken for me to finish with the other colours like black, grey, red and blue!</p>
<p>So I had to rethink my plan. I was joking around with a couple of friends who then mentioned I was probably doing <a target="_blank" href="https://en.wikipedia.org/wiki/Bubble_sort">bubble sort</a>, which was one of the slowest sorting algorithms our there (yes there are some other slower algorithms!). I laughed at the joke, then realised I might be able to use my computer science knowledge here — at least what’s left of it! Uni was ages ago, so I knew I’d have to improvise.</p>
<h3 id="heading-enter-horizontal-scaling">Enter horizontal scaling</h3>
<p>I told everyone to stop what they were doing and help me sort out the bag. This meant that now there were more people sorting, so I basically <a target="_blank" href="https://en.wikipedia.org/wiki/Scalability#Horizontal_and_vertical_scaling">scaled horizontally</a> by adding more resources to finish the job.</p>
<p>As a web developer, I have seen this as a common solution to a problem with server load.</p>
<p>When your server is overloaded by a lot of incoming traffic, you usually have two options: vertical or horizontal scaling.</p>
<p>Vertical scaling means you basically add more power to your server. For example, if you’re using AWS, instead of having a <code>t2.micro</code> which only has 1 CPU and 1GB of RAM, you upgrade it to a <code>t2.xlarge</code> which has 4 CPUs and 16GB of RAM.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9DhR1m-V-piFE7y0m1-L-8notdcAfY6VLeCP" alt="Image" width="430" height="534" loading="lazy">
_[The Amazon EC2 instance types](https://aws.amazon.com/ec2/instance-types/" rel="noopener" target="<em>blank" title=")</em></p>
<p>Horizontal scaling means you just add more resources. So, instead of upgrading your single<code>t2.micro</code> instance, you add 5 more to accommodate the load.</p>
<p>Both have their use cases, but for this specific instance, horizontal scaling was the solution.</p>
<p>I mean, I wouldn’t have been able to vertically scale myself by adding more brain power, so the only choice was to horizontally scale by adding more people.</p>
<p>After five minutes of sorting, I noticed that we did make some sort of progress. It wasn’t enough for me though. Time was passing and I was getting tired. We needed to make it faster!</p>
<h3 id="heading-divide-and-conquer-algorithm">Divide and conquer algorithm</h3>
<p>I had a think. There were three of us with a large bag full of bricks in front of us. I estimated it to be about two thousand pieces at this point. And while we had made some progress in the last five minutes, we were still looking at hours of sorting.</p>
<p>I have since then changed my initial technique of just looking for green blocks. Instead, I was having a quick look at which colour looked like the majority, and getting as many as I could with my hand. After putting the bricks in their appropriate colour basket, I looked at the pile again and picked the “majority” again. It usually changed, since after getting a bunch of say, reds, it would have fewer reds. The next majority would be blue or green, for example.</p>
<p>This was looking good. But after analysing it, I was basically looking at two thousand pieces, getting the maximum count of a colour, getting that colour and subtracting it from the pile. My processing was slow, because how do you actually get the majority without counting or estimating?</p>
<p>Since I was taking too much cognitive load, I was slowing down. So I stopped looking at the colour with the most bricks and just picked a random colour every time I dumped the handful of bricks I had just collected. This sped up my processing a little, but I thought we could still improve.</p>
<p>So, <a target="_blank" href="https://en.wikipedia.org/wiki/Divide_and_conquer_algorithm">divide and conquer</a> it was. In CS terms, this meant an algorithm that broke down a huge problem into smaller bits so they were simple enough to solve in a faster time.</p>
<p>Let’s say your site accepts user uploaded zip files with photos and processes them. If your server accepted the zip file, unzipped it, and processed it the minute you uploaded it, everyone else would be waiting for it to finish. Sure you can horizontally or vertically scale your server, but the wait time is unnecessary. Also, what happens when a user uploads a zip file with 100 photos in it?</p>
<p>You can solve this by using a divide and conquer technique instead. First off, you delegate the processing to a delayed job infrastructure like Rails’ <a target="_blank" href="http://guides.rubyonrails.org/active_job_basics.html">ActiveJob</a>. Or if you’re not using Rails, <a target="_blank" href="https://github.com/mperham/sidekiq">Sidekiq</a>. Still, that job would take a long time if it was a 100 photos, and there would be the possibility of your worker dying from the workload.</p>
<p>One solution would be to have a job that unzips it, <strong>and then</strong> enqueues each of the photos to be processed as a separate job. Now instead of your worker having to process 100 photos by itself, it then puts 100 tiny jobs of processing single photos in the queue, which can then be picked up by other workers.</p>
<p>With that in mind, I made a factory line deal with my son: he had to get a handful (or two) of bricks from the bag and dump them into my corner. That meant I only had about 50 bricks to sort which was easier and faster — mainly because by this point, I knew the colour with the most bricks: grey.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/nfwkLNviXS9NJzYYvlZLwoK2Ultncxb7cyoV" alt="Image" width="800" height="1066" loading="lazy">
<em>The most common block colour was grey.</em></p>
<p>So what if I knew it was grey? Well, that meant that I only had to pick all the red, green, yellow, blue, black and white bricks. When I was left with grey, I dumped the remaining bricks into the grey box — that saved me one less colour to sort that I would not have been able to do on a larger scale.</p>
<h4 id="heading-an-hour-later">An hour later …</h4>
<p>All done! Now we just had to clean them. The initial plan was:</p>
<ul>
<li>Dump a box of colours into a basin.</li>
<li>Wash with water and soap</li>
<li>Dry</li>
</ul>
<p>What was the problem here? I’ll give you a guess.</p>
<p>Still there? Okay. If we washed with water and soap, that meant we had to rinse the soap off — which meant we had to wash it twice! No way! So I decided not to add soap but just thoroughly wash with warm water.</p>
<p>The modified plan was:</p>
<ul>
<li>Dump a box of colours into a basin</li>
<li>Wash with water thoroughly</li>
<li>Dry</li>
</ul>
<p>On to the next problem: drying the Legos.</p>
<h3 id="heading-centrifugal-force-to-the-rescue">Centrifugal force to the rescue!</h3>
<p>Initially, we tried drying the pieces with a towel. It wasn’t very effective. Next was to use a hairdryer and blow hot air into the pieces. It was okay, but it still didn’t dry the pieces — we were getting hopeless and almost decided to just lay them all on the floor and let all the water evaporate.</p>
<p>Only, it was autumn so it wouldn’t have been hot enough. So while pondering about how to dry thousands of Lego pieces, I suddenly remembered how I dry salad leaves using a salad spinner. “I wish I could use the salad spinner,” I thought. Then it dawned on me: a <a target="_blank" href="https://en.wikipedia.org/wiki/Salad_spinner">salad spinner</a> works by using <a target="_blank" href="https://en.wikipedia.org/wiki/Centrifugal_force">centrifugal force to separate the water from the leaves</a>. I could do the same!</p>
<p>I wrapped the lego pieces into a towel and secured them by turning the towel into a giant candy wrapper. I stepped on one end of the towel, pulled the other end as tight as I could and started spinning the towel.</p>
<p>What do you know — it actually worked! I could see the towel suddenly become wet as the water from the pieces flew out of them and into the towel. SCIENCE!</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/HEp6MVkDlD9fjO7zFMgzQ0Wj1Xwpl4vcfFi1" alt="Image" width="500" height="502" loading="lazy">
<em>SCIENCE!</em></p>
<p>The Legos weren’t completely dry, of course, so I still had to use the hairdryer to help the remaining droplets evaporate. But that was all right — the hard part was over.</p>
<p>I never thought I’d use my stock CS knowledge for something like sorting Legos. In any case, it was a good and fun experience scaling horizontally, using a divide and conquer strategy, and even bringing out centrifugal force to organise my son’s newly inherited Lego collection. I don’t look forward to the day he jumbles them all up and we have to sort them again, though!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Explained Simply: How an AI program mastered the ancient game of Go ]]>
                </title>
                <description>
                    <![CDATA[ By Aman Agarwal This is about AlphaGo, Google DeepMind’s Go playing AI that shook the technology world in 2016 by defeating one of the best players in the world, Lee Sedol. Go is an ancient board game which has so many possible moves at each step tha... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/explained-simply-how-an-ai-program-mastered-the-ancient-game-of-go-62b8940a9080/</link>
                <guid isPermaLink="false">66c34a10465d1b2f886ba3b2</guid>
                
                    <category>
                        <![CDATA[ Artificial Intelligence ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Deep Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sat, 10 Mar 2018 05:54:28 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*Y9MhKgjWmKJ_iwT5.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Aman Agarwal</p>
<p>This is about <strong>AlphaGo</strong>, Google DeepMind’s <a target="_blank" href="https://en.wikipedia.org/wiki/Go_(game)"><em>Go</em></a> playing AI that shook the technology world in 2016 by defeating one of the best players in the world, <a target="_blank" href="https://en.wikipedia.org/wiki/Lee_Sedol">Lee Sedol</a>.</p>
<p>Go is an ancient board game which has so many possible moves at each step that future positions are hard to predict — and therefore it requires strong intuition and abstract thinking to play. Because of this reason, it was believed that only humans could be good at playing Go. Most researchers thought that it would still take decades to build an AI which could think like that. In fact, I’m releasing this essay today because <em>this week (March 8–15) marks the two-year anniversary of the AlphaGo vs Sedol match!</em></p>
<p>But AlphaGo didn’t stop there. 8 months later, it played 60 professional games on a Go website under disguise as a player named “Master”, and won <em>every single game,</em> against <em>dozens</em> of world champions, of course without resting between games.</p>
<p>Naturally this was a HUGE achievement in the field of AI and sparked worldwide discussions about whether we should be excited or worried about artificial intelligence.</p>
<p>Today we are going to take the original research paper published by DeepMind in the <em>Nature</em> journal, and break it down paragraph-by-paragraph using simple English.</p>
<p><strong><em>After this essay, you’ll know very clearly what AlphaGo is, and how it works. I also hope that after reading this you will not believe all the news headlines made by journalists to scare you about AI, and instead feel excited about it.</em></strong></p>
<p>Worrying about the growing achievements of AI is like worrying about the growing abilities of Microsoft Powerpoint. Yes, it will get better with time with new features being added to it, but it can’t just <em>uncontrollably</em> grow into some kind of Hollywood monster.</p>
<p><strong>You DON’T need to know how to play Go to understand this paper.</strong> In fact, I myself have only read the first 3–4 lines in Wikipedia’s opening paragraph about it. Instead, surprisingly, I use some examples from basic Chess to explain the algorithms. You just have to know what a 2-player board game is, in which each player takes turns and there is one winner at the end. Beyond that you don’t need to know any physics or advanced math or anything.</p>
<p>This will make it more approachable for people who only just now started learning about machine learning or neural networks. And especially for those who don’t use English as their first language (which can make it very difficult to read such papers).</p>
<p><em>If you have NO prior knowledge of AI and neural networks, you can read the “Deep Learning” section of one of my previous essays <a target="_blank" href="https://medium.com/swlh/everything-about-self-driving-cars-explained-for-non-engineers-f73997dcb60c"><strong>here</strong></a>. After reading that, you’ll be able to get through this essay.</em></p>
<p><em>If you want to get a shallow understanding of Reinforcement Learning too (optional reading), you can find it <a target="_blank" href="https://medium.freecodecamp.org/explained-simply-how-deepmind-taught-ai-to-play-video-games-9eb5f38c89ee"><strong>here</strong></a>.</em></p>
<p>Here’s the original paper if you want to try reading it:</p>
<p>As for me: Hi I’m <a target="_blank" href="http://aman-agarwal.com">Aman</a>, an AI and autonomous robots engineer. I hope that my work will save you a lot of time and effort if you were to study this on your own.</p>
<p><em>Do you speak Japanese?</em> <a target="_blank" href="https://www.freecodecamp.org/news/explained-simply-how-an-ai-program-mastered-the-ancient-game-of-go-62b8940a9080/undefined">Ryohji Ikebe</a> has kindly written a brief memo about this essay in Japanese, in a <a target="_blank" href="https://twitter.com/ikb/status/976008433852866560">series of Tweets</a>.</p>
<h3 id="heading-lets-get-started">Let’s get started!</h3>
<h4 id="heading-abstract">Abstract</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*vDDMR_HFoZ1o7Ry5K2s9lQ.png" alt="Image" width="800" height="181" loading="lazy"></p>
<p>As you know, the goal of this research was to train an AI program to play Go at the level of world-class professional human players.</p>
<p>To understand this challenge, let me first talk about something similar done for Chess. In the early 1990s, IBM came out with the Deep Blue computer which defeated the great champion <a target="_blank" href="https://en.wikipedia.org/wiki/Garry_Kasparov"><strong>Garry Kasparov</strong></a> in Chess. (He’s also a very cool guy, make sure to read more about him later!) How did Deep Blue play?</p>
<p>Well, it used a very brute force method. At each step of the game, it took a look at all the possible legal moves that could be played, and went ahead to explore each and every move to see what would happen. And it would keep exploring move after move for a while, forming a kind of HUGE decision tree of thousands of moves. And then it would come back along that tree, observing which moves seemed most likely to bring a good result. But, what do we mean by “good result”? Well, Deep Blue had many carefully designed chess strategies built into it by expert chess players to help it make better decisions — for example, how to decide whether to protect the king or get advantage somewhere else? They made a specific “evaluation algorithm” for this purpose, to compare how advantageous or disadvantageous different board positions are (IBM hard-coded expert chess strategies into this evaluation function). And finally it chooses a carefully calculated move. On the next turn, it basically goes through the whole thing again.</p>
<p>As you can see, this means Deep Blue thought about millions of theoretical positions before playing each move. This was not so impressive in terms of the AI software of Deep Blue, but rather in the hardware — IBM claimed it to be one of the most powerful computers available in the market at that time. It could look at 200 million board positions per second.</p>
<p>Now we come to Go. Just believe me that this game is much more open-ended, and if you tried the Deep Blue strategy on Go, you wouldn’t be able to play well. There would be SO MANY positions to look at at each step that it would simply be impractical for a computer to go through that hell. For example, at the opening move in Chess there are 20 possible moves. In Go the first player has 361 possible moves, and this scope of choices stays wide throughout the game.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/0*XimL5rBEve3cv2m9.jpg" alt="Image" width="624" height="416" loading="lazy"></p>
<p>This is what they mean by “enormous search space.” Moreover, in Go, it’s not so easy to judge how advantageous or disadvantageous a particular board position is at any specific point in the game — you kinda have to play the whole game for a while before you can determine who is winning. But let’s say you magically had a way to do both of these. And that’s where deep learning comes in!</p>
<p>So in this research, DeepMind used neural networks to do both of these tasks (if you have never read about neural networks yet, <a target="_blank" href="https://medium.com/swlh/everything-about-self-driving-cars-explained-for-non-engineers-f73997dcb60c">here’s the link again</a>). They trained a “policy neural network” to decide which are the most sensible moves in a particular board position (so it’s like following an intuitive strategy to pick moves from any position). And they trained a “value neural network” to estimate how advantageous a particular board arrangement is for the player (or in other words, how likely you are to win the game from this position). They trained these neural networks first with human game examples (your good old ordinary supervised learning). After this the AI was able to mimic human playing to a certain degree, so it acted like a weak human player. And then to train the networks even further, they made the AI play against itself millions of times (this is the “reinforcement learning” part). With this, the AI got better because it had more practice.</p>
<p>With these two networks alone, DeepMind’s AI was able to play well against state-of-the-art Go playing programs that other researchers had built before. These other programs had used an already popular pre-existing game playing algorithm, called the “Monte Carlo Tree Search” (MCTS). More about this later.</p>
<p>But guess what, we still haven’t talked about the real deal. DeepMind’s AI isn’t just about the policy and value networks. It doesn’t use these two networks as a <em>replacement</em> of the Monte Carlo Tree Search. Instead, it uses the neural networks to make the MCTS algorithm work <em>better</em>… and it got so much better that it reached superhuman levels. THIS improved variation of MCTS is “AlphaGo”, the AI that beat Lee Sedol and went down in AI history as one of the greatest breakthroughs ever. So essentially, AlphaGo is simply an <em>improved implementation</em> of a very ordinary computer science algorithm. Do you understand now why AI in its current form is absolutely <strong>nothing</strong> to be scared of?</p>
<p>Wow, we’ve spent a lot of time on the Abstract alone.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*R5nRwdKMg9bw7epJgOf-jA.png" alt="Image" width="482" height="418" loading="lazy"></p>
<p>Alright — to understand the paper from this point on, first we’ll talk about a gaming strategy called the Monte Carlo Tree Search algorithm. For now, I’ll just explain this algorithm at enough depth to make sense of this essay. But if you want to learn about it in depth, some smart people have also made excellent videos and blog posts on this:</p>
<ol>
<li><a target="_blank" href="https://www.youtube.com/watch?v=onBYsen2_eA">A short video series from Udacity</a>  </li>
<li><a target="_blank" href="https://jeffbradberry.com/posts/2015/09/intro-to-monte-carlo-tree-search/">Jeff Bradberry’s explanation of MCTS</a>  </li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=Fbs4lnGLS8M">An MCTS tutorial by Fullstack Academy</a></li>
</ol>
<p>The following section is long, but easy to understand (I’ll try my best) and VERY important, so stay with me! The rest of the essay will go much quicker.</p>
<p>Let’s talk about the first paragraph of the essay above. Remember what I said about Deep Blue making a huge tree of millions of board positions and moves at each step of the game? You had to do simulations and look at and compare each and every possible move. As I said before, that was a simple approach and very straightforward approach — if the average software engineer had to design a game playing AI, and had all the strongest computers of the world, he or she would probably design a similar solution.</p>
<p>But let’s think about how do humans themselves play chess? Let’s say you’re at a particular board position in the middle of the game. By game rules, you can do a dozen different things — move this pawn here, move the queen two squares here or three squares there, and so on. But do you really make a list of all the possible moves you can make with all your pieces, and then select one move from this long list? No — you “intuitively” narrow down to a few key moves (let’s say you come up with 3 sensible moves) that you think make sense, and then you wonder what will happen in the game if you chose one of these 3 moves. You might spend 15–20 seconds considering each of these 3 moves and their future — and note that during these 15 seconds you don’t have to carefully plan out the future of each move; you can just “roll out” a few mental moves guided by your intuition without TOO much careful thought (well, a good player would think farther and more deeply than an average player). This is because you have limited time, <em>and</em> you can’t accurately predict what your <em>opponent</em> will do at each step in that lovely future you’re cooking up in your brain. So you’ll just have to let your gut feeling guide you. I’ll refer to this part of the thinking process as “rollout”, so take note of it!<br>So after “rolling out” your few sensible moves, you finally say screw it and just play the move you find best.</p>
<p>Then the opponent makes a move. It might be a move you had already well anticipated, which means you are now pretty confident about what you need to do next. You don’t have to spend too much time on the rollouts again. OR, it could be that your opponent hits you with a pretty cool move that you had not expected, so you have to be even more careful with your next move.<br>This is how the game carries on, and as it gets closer and closer to the finishing point, it would get easier for you to predict the outcome of your moves — so your rollouts don’t take as much time.</p>
<p>The purpose of this long story is to describe what the MCTS algorithm does on a superficial level — it mimics the above thinking process by building a “search tree” of moves and positions every time. Again, for more details you should check out the links I mentioned earlier. The innovation here is that instead of going through all the possible moves at each position (which Deep Blue did), it instead intelligently selects a small set of sensible moves and explores those instead. To explore them, it “rolls out” the future of each of these moves and compares them based on their <em>imagined</em> outcomes.<br>(Seriously — this is all I think you need to understand this essay)</p>
<p>Now — coming back to the screenshot from the paper. Go is a “<a target="_blank" href="https://jeffbradberry.com/posts/2015/09/intro-to-monte-carlo-tree-search/">perfect information game</a>” (please read the definition in the link, don’t worry it’s not scary). And <strong>theoretically</strong>, for such games, no matter <strong><em>which</em></strong> particular position you are at in the game (even if you have just played 1–2 moves), it is possible that you can correctly guess who will win or lose (assuming that both players play “perfectly” from that point on). <em>I have no idea who came up with this theory, but it is a fundamental assumption in this research project and it works.</em></p>
<p>So that means, given a state of the game <em>s</em>, there is a function v*(s) which can predict the outcome, let’s say probability of you winning this game, from 0 to 1. They call it the “optimal value function”. Because some board positions are more likely to result in you winning than other board positions, they can be considered more “valuable” than the others. Let me say it again: Value = Probability between 0 and 1 of you winning the game.</p>
<p>But wait — say there was a girl named Foma sitting next to you while you play Chess, and she keeps telling you at each step if you’re winning or losing. “You’re winning… You’re losing… Nope, still losing…” I think it wouldn’t help you much in choosing which move you need to make. She would also be quite annoying. What would instead help you is if you drew the whole tree of all the possible moves you can make, and the states that those moves would lead to — and then Foma would tell you for the entire tree which states are winning states and which states are losing states. Then you can choose moves which will keep leading you to winning states. All of a sudden Foma is your partner in crime, not an annoying friend. Here, Foma behaves as your optimal value function v*(s). Earlier, it was believed that it’s not possible to have an accurate value function like Foma for the game of Go, because the games had so much uncertainty.</p>
<p>BUT — even if you had the wonderful Foma, this wonderland strategy of drawing out all the possible positions for Foma to evaluate will not work very well in the real world. In a game like Chess or Go, as we said before, if you try to imagine even 7–8 moves into the future, there can be so many possible positions that you don’t have enough time to check all of them with Foma.</p>
<p>So Foma is not enough. You need to narrow down the list of moves to a few sensible moves that you can roll out into the future. How will your program do that? Enter Lusha. Lusha is a skilled Chess player and enthusiast who has spent decades watching grand masters play Chess against each other. She can look at your board position, look quickly at all the available moves you can make, and tell you how likely it would be that a Chess expert would make any of those moves if they were sitting at your table. So if you have 50 possible moves at a point, Lusha will tell you the probability that each move would be picked by an expert. Of course, a few sensible moves will have a much higher probability and other pointless moves will have very little probability. For example: if in Chess, let’s say your Queen is in danger in one corner of the game, you might still have the option to move a little pawn in another corner of the game She is your <em>policy function</em>, p(a\s). For a given state s, she can give you probabilities for all the possible moves that an expert would make.</p>
<p>Wow — you can take Lusha’s help to guide you in how to select a few sensible moves, and Foma will tell you the likelihood of winning from each of those moves. You can choose the move that both Foma and Lusha approve. Or, if you want to be extra careful, you can roll out the moves selected by Lusha, have Foma evaluate them, pick a few of them to roll out further into the future, and keep letting Foma and Lusha help you predict VERY far into the game’s future — much quicker and more efficient than to go through all the moves at each step into the future. THIS is what they mean by “reducing the search space”. Use a value function (Foma) to predict outcomes, and use a policy function (Lusha) to give you grand-master probabilities to help narrow down the moves you roll out. These are called “Monte Carlo rollouts”. Then while you backtrack from future to present, you can take average values of all the different moves you rolled out, and pick the most suitable action. So far, this has only worked on a weak amateur level in Go, because the policy functions and value functions that they used to guide these rollouts weren’t that great.</p>
<p>Phew.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*sonozS4bQD9Dd_-thQxKMg.png" alt="Image" width="482" height="236" loading="lazy"></p>
<p>The first line is self explanatory. In MCTS, you can start with an unskilled Foma and unskilled Lusha. The more you play, the better they get at predicting solid outcomes and moves. “Narrowing the search to a beam of high probability actions” is just a sophisticated way of saying, “Lusha helps you narrow down the moves you need to roll out by assigning them probabilities that an expert would play them”. Prior work has used this technique to achieve strong amateur level AI players, even with simple (or “shallow” as they call it) policy functions.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*LGYVFeJlh4eM9ecwSNjTIA.png" alt="Image" width="482" height="192" loading="lazy"></p>
<p>Yeah, convolutional neural networks are great for image processing. And since a neural network takes a particular input and gives an output, it is essentially a function, right? So you can use a neural network to become a complex function. So you can just pass in an image of the board position and let the neural network figure out by itself what’s going on. This means it’s possible to create neural networks which will behave like VERY accurate policy and value functions. The rest is pretty self explanatory.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*1eYuYipiPEX9rrUAXwuCeQ.png" alt="Image" width="482" height="255" loading="lazy"></p>
<p>Here we discuss how Foma and Lusha were trained. To train the policy network (predicting for a given position which moves experts would pick), you simply use examples of human games and use them as data for good old supervised learning.</p>
<p>And you want to train another slightly different version of this policy network to use for rollouts; this one will be smaller and faster. Let’s just say that since Lusha is so experienced, she takes some time to process each position. She’s good to start the narrowing-down process with, but if you try to make her repeat the process , she’ll still take a little too much time. So you train a <em>faster policy network</em> for the rollout process (I’ll call it… Lusha’s younger brother Jerry? I know I know, enough with these names). After that, once you’ve trained both of the slow and fast policy networks enough using human player data, you can try letting Lusha play against herself on a Go board for a few days, and get more practice. This is the reinforcement learning part — making a better version of the policy network.</p>
<p>Then, you train Foma for value prediction: determining the probability of you winning. You let the AI practice through playing itself again and again in a simulated environment, observe the end result each time, and learn from its mistakes to get better and better.</p>
<p>I won’t go into details of <strong><em>how</em></strong> these networks are trained. You can read more technical details in the later section of the paper (‘Methods’) which I haven’t covered here. In fact, the real purpose of this particular paper is not to show <em>how</em> they used reinforcement learning on these neural networks. One of DeepMind’s previous papers, in which they taught AI to play ATARI games, has already discussed some reinforcement learning techniques in depth (And I’ve already written an explanation of that paper <a target="_blank" href="https://medium.freecodecamp.org/explained-simply-how-deepmind-taught-ai-to-play-video-games-9eb5f38c89ee">here</a>). For this paper, as I lightly mentioned in the Abstract and also underlined in the screenshot above, the biggest innovation was <em>the fact that they used RL with neural networks</em> for improving an already popular game-playing algorithm, MCTS. RL is a cool tool in a toolbox that they used to fine-tune the policy and value function neural networks after the regular supervised training. This research paper is about proving how versatile and excellent this tool it is, not about teaching you how to use it. <strong>In television lingo, the Atari paper was a RL infomercial and this AlphaGo paper is a commercial.</strong></p>
<h4 id="heading-alright-were-finally-done-with-the-introduction-parts-by-now-you-already-have-a-very-good-feel-for-what-alphago-was-all-about">Alright we’re finally done with the “introduction” parts. By now you already have a very good feel for what AlphaGo was all about.</h4>
<h4 id="heading-next-well-go-slightly-deeper-into-each-thing-we-discussed-above-you-might-see-some-ugly-and-dangerous-looking-mathematical-equations-and-expressions-but-theyre-simple-i-explain-them-all-relax">Next, we’ll go slightly deeper into each thing we discussed above. You might see some ugly and dangerous looking mathematical equations and expressions, but they’re simple (I explain them all). Relax.</h4>
<p>A quick note before you move on. Would you like to help me write more such essays explaining cool research papers? If you’re serious, I’d be glad to work with you. Please leave a comment and I’ll get in touch with you.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/0*fVll6yCFC9UDeFR1.jpg" alt="Image" width="800" height="615" loading="lazy">
<em>A photo of two Japanese women playing Go, placed here in case you’re already sick of looking at long slabs of text.</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*_df8aEGWvtbPvUUIvr8fAA.png" alt="Image" width="800" height="432" loading="lazy"></p>
<p>So, the first step is in training our policy NN (Lusha), to predict which moves are likely to be played by an expert. This NN’s goal is to allow the AI to play similar to an expert human. This is a convolutional neural network (as I mentioned before, it’s a special kind of NN that is very useful in image processing) that takes in a simplified image of a board arrangement. “Rectifier nonlinearities” are layers that can be added to the network’s architecture. They give it the ability to learn more complex things. If you’ve ever trained NNs before, you might have used the “ReLU” layer. That’s what these are.</p>
<p>The training data here was in the form of random pairs of board positions, and the labels were the actions chosen by humans when they were in those positions. Just regular supervised learning.</p>
<p>Here they use “stochastic gradient ASCENT”. Well, this is an algorithm for backpropagation. Here, you’re trying to <em>maximise</em> a reward function. And the reward function is just the probability of the action predicted by a human expert; you want to increase this probability. But hey — you don’t really need to think too much about this. Normally you train the network so that it <em>minimises</em> a loss function, which is essentially the error/difference between predicted outcome and actual label. That is called gradient DESCENT. In the actual implementation of this research paper, they have indeed used the regular gradient <strong>descent</strong>. You can easily find a loss function that behaves opposite to the reward function such that minimising this loss will maximise the reward.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*pr-BLx7eZ90tAuTUNL_w6A.png" alt="Image" width="482" height="258" loading="lazy"></p>
<p>The policy network has 13 layers, and is called “SL policy” network (SL = supervised learning). The data came from a… I’ll just say it’s a popular website on which millions of people play Go. How good did this SL policy network perform?</p>
<p>It was more accurate than what other researchers had done earlier. The rest of the paragraph is quite self-explanatory. As for the “rollout policy”, you do remember from a few paragraphs ago, how Lusha the SL policy network is slow so it can’t integrate well with the MCTS algorithm? And we trained another faster version of Lusha called Jerry who was her younger brother? Well, this refers to Jerry right here. As you can see, Jerry is just half as accurate as Lusha BUT it’s thousands of times faster! It will really help get through rolled out simulations of the future faster, when we apply the MCTS.</p>
<p>For this next section, you don’t <em>have</em> to know about Reinforcement Learning already, but then you’ll have to assume that whatever I say works. If you really want to dig into details and make sure of everything, you might want to read a little about RL first.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*lZ4zT1qpm8wA4n18fjtv9Q.png" alt="Image" width="800" height="576" loading="lazy"></p>
<p>Once you have the SL network, trained in a supervised manner using human player moves with the human moves data, as I said before you have to let her practice by itself and get better. That’s what we’re doing here. So you just take the SL policy network, save it in a file, and make another copy of it.</p>
<p>Then you use reinforcement learning to fine-tune it. Here, you make the network play against itself and learn from the outcomes.</p>
<p>But there’s a problem in this training style.</p>
<p>If you only forever practice against ONE opponent, and that opponent is also only practicing with you exclusively, there’s not much of new learning you can do. You’ll just be training to practice how to beat THAT ONE player. This is, you guessed it, overfitting: your techniques play well against one opponent, but don’t generalize well to other opponents. So how do you fix this?</p>
<p>Well, every time you fine-tune a neural network, it becomes a slightly different kind of player. So you can save this version of the neural network in a list of “players”, who all behave slightly differently right? Great — now while training the neural network, you can randomly make it play against many different older and newer versions of the opponent, chosen from that list. They are versions of the same player, but they all play slightly differently. And the more you train, the MORE players you get to train even more with! Bingo!</p>
<p>In this training, the only thing guiding the training process is the ultimate goal, i.e winning or losing. You don’t need to specially train the network to do things like capture more area on the board etc. You just give it all the possible legal moves it can choose from, and say, “you have to win”. And this is why RL is so versatile; it can be used to train policy or value networks for any game, not just Go.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*jhOXPDOCwgzpjw9s9qZl_A.png" alt="Image" width="800" height="366" loading="lazy"></p>
<p>Here, they tested how accurate this RL policy network was, just by itself without any MCTS algorithm. As you would remember, this network can directly take a board position and decide how an expert would play it — so you can use it to single-handedly play games.<br>Well, the result was that the RL fine-tuned network won against the SL network that was only trained on human moves. It also won against other strong Go playing programs.</p>
<p>Must note here that <em>even before training this RL policy network, the SL policy network was already better than the state of the art — and now, it has further improved</em>! And we haven’t even come to the other parts of the process like the value network.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*FK7eVx2Fzc9Vjo4Tkp6yeg.png" alt="Image" width="482" height="388" loading="lazy"></p>
<p>Did you know that baby penguins can sneeze louder than a dog can bark? Actually that’s not true, but I thought you’d like a little joke here to distract from the scary-looking equations above. Coming to the essay again: we’re done training Lusha here. Now back to Foma — remember the “optimal value function”: v<em>(s) -&gt; that only tells you how likely you are to win in your current board position if both players play perfectly from that point on?<br>So obviously, to train an NN to become our value function, we would need a perfect player… which we don’t have. So we just u<em>*<em>se our strongest pla</em></em></em>yer, which happens to be our RL policy network.</p>
<p>It takes the current state board state s, and outputs the probability that you will win the game. You play a game and get to know the outcome (win or loss). Each of the game states act as a data sample, and the outcome of that game acts as the label. So by playing a 50-move game, you have 50 data samples for value prediction.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*ZumV81-2OpuPzmQzEFvOlA.png" alt="Image" width="482" height="358" loading="lazy"></p>
<p>Lol, no. This approach is naive. You can’t use all 50 moves from the game and add them to the dataset.</p>
<p>The training data set had to be chosen carefully to avoid overfitting. Each move in the game is very similar to the next one, because you only move once and that gives you a new position, right? If you take the states at all 50 of those moves and add them to the training data with the same label, you basically have lots of “kinda duplicate” data, and that causes overfitting. To prevent this, you choose only very distinct-looking game states. So for example, instead of all 50 moves of a game, you only choose 5 of them and add them to the training set. DeepMind took 30 million positions from 30 million different games, to reduce any chances of there being duplicate data. And it worked!</p>
<p><strong><em>Now, something conceptual here</em></strong>: there are two ways to evaluate the value of a board position. One option is a magical optimal value function (like the one you trained above). The other option is to simply roll out into the future using your current policy (Lusha) and look at the final outcome in this roll out. Obviously, the real game would rarely go by your plans. But DeepMind compared how both of these options do. You can also do a mixture of both these options. We will learn about this “mixing parameter” a little bit later, so make a mental note of this concept!</p>
<p>Well, your single neural network trying to approximate the optimal value function is EVEN BETTER than doing thousands of mental simulations using a rollout policy! Foma really kicked ass here. When they replaced the fast rollout policy with the twice-as-accurate (but slow) RL policy Lusha, and did thousands of simulations with <em>that</em>, it did better than Foma. But only slightly better, and too slowly. So Foma is the winner of this competition, she has proved that she can’t be replaced.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*qZanMJBFb7GtqYmLEUerLw.png" alt="Image" width="631" height="742" loading="lazy"></p>
<p>Now that we have trained the policy and value functions, we can combine them with MCTS and give birth to our former world champion, destroyer of grand masters, the breakthrough of a generation, weighing two hundred and sixty eight pounds, one and only <em>Alphaaaaa GO!</em></p>
<p>In this section, ideally you should have a slightly deeper understanding of the inner workings of the MCTS algorithm, but what you have learned so far should be enough to give you a good feel for what’s going on here. The only thing you should note is <em>how</em> we’re using the policy probabilities and value estimations. We combine them during roll outs, to narrow down the number of moves we want to roll out at each step. Q(s,a) represents the value function, and u(s,a) is a stored probability for that position. I’ll explain.</p>
<p>Remember that the policy network uses supervised learning to predict expert moves? And it doesn’t just give you most likely move, but rather gives you <strong><em>probabilities</em></strong> for each possible move that tell how likely it is to be an expert move. This probability can be stored for each of those actions. Here they call it “prior probability”, and they obviously use it while selecting which actions to explore. So basically, to decide whether or not to explore a particular move, you consider two things: First, by playing this move, how likely are you to win? Yes, we already have our “value network” to answer this first question. And the second question is, how likely is it that an expert would choose this move? (If a move is super unlikely to be chosen by an expert, why even waste time considering it. This we get from the policy network)</p>
<p>Then let’s talk about the “mixing parameter” (see came back to it!). As discussed earlier, to evaluate positions, you have two options: one, simply use the value network you have been using to evaluate states all along. And two, you can try to quickly play a rollout game with your current strategy (assuming the other player will play similarly), and see if you win or lose. We saw how the value function was better than doing rollouts in general. Here they combine both. You try giving each prediction 50–50 importance, or 40–60, or 0–100, and so on. If you attach a % of X to the first, you’ll have to attach 100-X to the second. That’s what this mixing parameter means. You’ll see these hit and trial results later in the paper.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*7vZGbapsdnNVlkTvpzz_rA.png" alt="Image" width="482" height="262" loading="lazy"></p>
<p>After each roll out, you update your search tree with whatever information you gained during the simulation, so that your next simulation is more intelligent. And at the end of all simulations, you just pick the best move.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*CGyyDnQjqYSTIwC1d2oNVg.png" alt="Image" width="800" height="244" loading="lazy"></p>
<p>Interesting insight here!</p>
<p>Remember how the RL fine-tuned policy NN was better than just the SL human-trained policy NN? But when you put them within the MCTS algorithm of AlphaGo, using the human trained NN proved to be a better choice than the fine-tuned NN. But in the case of the value function (which you would remember uses a strong player to approximate a perfect player), training Foma using the RL policy works better than training her with the SL policy.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*n_PiVVyVdvzg0NtET63jyQ.png" alt="Image" width="482" height="136" loading="lazy"></p>
<p>“Doing all this evaluation takes a lot of computing power. We really had to bring out the big guns to be able to run these damn programs.”</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/0*8WFyFNZFCIaegHCy." alt="Image" width="800" height="600" loading="lazy">
<em>Another photo, from the first AlphaGo vs Lee Sedol game.</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*6T2huF9r4oKPJb9QSLUqBA.png" alt="Image" width="800" height="312" loading="lazy"></p>
<p>Self explanatory.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*o6k-P1HQzWCf9SaKDywVZQ.png" alt="Image" width="482" height="196" loading="lazy"></p>
<p>“LOL, our program literally blew the pants off of every other program that came before us”</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*4JF8kOfmkOb9gKGVZNCqqw.png" alt="Image" width="800" height="400" loading="lazy"></p>
<p>This goes back to that “mixing parameter” again. While evaluating positions, giving equal importance to both the value function and the rollouts performed better than just using one of them. The rest is self explanatory, and reveals an interesting insight!</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*7ffhp9i2PXv9I56YwENz3A.png" alt="Image" width="482" height="158" loading="lazy"></p>
<p>Self explanatory.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*DM09OIIgih_ALPwch3TT9A.png" alt="Image" width="800" height="680" loading="lazy"></p>
<p>Self explanatory. But read that red underlined sentence again. I hope you can see clearly now that this line right here is pretty much the summary of what this whole research project was all about.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*mCqgpWNDdte7DCJNQTlFlg.png" alt="Image" width="482" height="214" loading="lazy"></p>
<p>Concluding paragraph. “Let us brag a little more here because we deserve it!” :)</p>
<p><strong>Oh and if you’re a scientist or tech company, and need some help in explaining your science to non-technical people for marketing, PR or training etc, I can help you. Drop me a message on Twitter: @mngrwl</strong></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Programming the genome with CRISPR ]]>
                </title>
                <description>
                    <![CDATA[ By Josh McMenemy How scientists edit genomes with the help of computers CRISPR (pronounced “crisper”) is part of a bacterial immune system evolved to ‘remember’ and remove invading viral DNA. Its name is short for ‘Clustered Regularly Interspaced Sh... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/programming-the-genome-with-crispr-bd567a214e2a/</link>
                <guid isPermaLink="false">66c35cdcadd0807b8e3fb8f8</guid>
                
                    <category>
                        <![CDATA[ coding ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Genetics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sun, 18 Feb 2018 18:19:25 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*jEBmdQVQvOeQba3Msz5f5g.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Josh McMenemy</p>
<h4 id="heading-how-scientists-edit-genomes-with-the-help-of-computers">How scientists edit genomes with the help of computers</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*jEBmdQVQvOeQba3Msz5f5g.jpeg" alt="Image" width="800" height="500" loading="lazy"></p>
<p>CRISPR (pronounced “crisper”) is part of a bacterial immune system evolved to ‘remember’ and remove invading viral DNA.</p>
<p>Its name is short for ‘Clustered Regularly Interspaced Short Palindromic Repeats’. But despite its mouthful of an acronym and complex biological origins, its engineering application is straightforward. To get started, there is only one protein you need to understand — Cas9.</p>
<p>Cas9 searches for a specified DNA sequence and cuts it by breaking both strands of the DNA molecule. This protein is useful to researchers because they can ‘program’ it to target any DNA sequence. A sgRNA (‘single guide’ RNA) molecule determines the sequence that Cas9 binds to. RNA is a biological molecule similar to DNA, that can bind to proteins and DNA.</p>
<p>sgRNAs are short sequences with a constant region and variable region. The constant region attaches the sgRNA to the Cas9 protein. The variable region causes Cas9 to bind to the DNA sequence that complements it (see the diagram below).</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*HatelyoaNAjVo1jR4KWQtw.jpeg" alt="Image" width="800" height="458" loading="lazy">
<em>The Cas9 protein bound to the DNA when the PAM sequence is on the forward (top) strand. The bold sequence is the target sequence, the green sequence is the sgRNA, and the three blue characters are the PAM. The triangles show where Cas9 will cut the DNA.</em></p>
<p>Making sgRNA is cheap and fast. This allows researchers to quickly set up a Cas9 experiment that cuts any DNA sequence. Well, not actually <em>any</em> sequence. There is a small constraint: the target sequence must be flanked by the correct PAM (protospacer adjacent motif) — a short sequence of DNA.</p>
<p><a target="_blank" href="https://en.wikipedia.org/wiki/Streptococcus_pyogenes"><em>Streptococcus pyogenes</em></a> is an infectious species of bacteria. In the version of Cas9 it produces, the PAM motif is ‘NGG’, where N is any nucleotide (the ‘letters’ that make up DNA).</p>
<p>Luckily, the motif ‘NGG’ occurs roughly once every 42 basepairs in the human genome. This mean that researchers can find a target site near almost every sequence of interest.</p>
<p>Depending on the experimental set up, these cuts in the DNA can either cause a <strong>random change</strong> or a <strong>precise change</strong> to the DNA sequence (more on this later).</p>
<p>Before jumping into writing this program, I recommend studying the Cas9 diagram below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*Bkb6hf7coqumUDNdxJ3CsQ.jpeg" alt="Image" width="800" height="458" loading="lazy">
<em>The Cas9 protein bound to a DNA sequence when the PAM sequence is on the reverse (bottom) strand.</em></p>
<p>Note that DNA and RNA have a directionality based on their chemical structure. One end of the molecule is referred to as the 5<code>(‘five-prime’) end, and the other is referred to as the 3</code> (‘three-prime’) end. This is important, because the sequences 5<code>— AGG — 3</code> is not the same as 3<code>— AGG — 5</code>.</p>
<p>By convention, DNA and RNA sequences are assumed to be written 5<code>to 3</code> unless otherwise marked. Sequences read in the 5<code>— 3</code> direction are called ‘forward’ sequences. Sequences read the other way (3<code>— 5</code>) are called ‘reverse’ sequences. This is an arbitrary convention.</p>
<p>The diagram above shows an example of Cas9 bound when the PAM is on the reverse (bottom) strand.</p>
<h3 id="heading-your-first-crispr-program">Your first CRISPR program</h3>
<h4 id="heading-the-scenario">The scenario</h4>
<p>A scientist has a DNA sequence of interest and wants a list of all CRISPR targets contained in the sequence. Finding every target by hand is tedious and error prone.</p>
<p>The scientist wants a simple program where they can input a DNA sequence and have all possible Cas9 target sites returned. The scientist would also like the cut position and PAM sequence for each target site.</p>
<pre><code>EXAMPLE INPUT (<span class="hljs-keyword">from</span> Figure <span class="hljs-number">1</span>): <span class="hljs-string">'CCACGGTTTCTGTAGCCCCATACTTTGGATG'</span>
</code></pre><pre><code>EXAMPLE OUTPUT: [{    <span class="hljs-string">'cut_pos'</span>: <span class="hljs-number">6</span>,    <span class="hljs-string">'pam_seq'</span>: <span class="hljs-string">'TGG'</span>,    <span class="hljs-string">'target_seq'</span>: <span class="hljs-string">'GTATGGGGCTACAGAAACCG'</span>,    <span class="hljs-string">'strand'</span>: <span class="hljs-string">'reverse'</span>  }, {    <span class="hljs-string">'cut_pos'</span>: <span class="hljs-number">22</span>,    <span class="hljs-string">'pam_seq'</span>: <span class="hljs-string">'TGG'</span>,    <span class="hljs-string">'target_seq'</span>: <span class="hljs-string">'GTTTCTGTAGCCCCATACTT'</span>,    <span class="hljs-string">'strand'</span>: <span class="hljs-string">'forward'</span>  }]
</code></pre><p>First, how do we find CRISPR targets in the sequence? Remember that the Cas9 protein can bind anywhere there is a ‘NGG’ motif.</p>
<p>The first step is to loop through the sequence looking for matches. When the program finds a ‘NGG’ match, we want to subtract three positions from the start of the PAM site, since that is where Cas9 cuts the DNA.</p>
<p>Then, we want to record the twenty basepairs before the PAM as the target sequence. Sounds good?</p>
<p>Well, the algorithm described above would actually miss about half of all CRISPR sites — because DNA is double stranded. This means if a ‘CCN’ is the sequence on the forward strand, then ‘NGG’ is the sequence on the reverse strand.</p>
<p>The program must also search for ‘CCN’ using similar logic for the reverse strand.</p>
<h4 id="heading-example-program">Example program</h4>
<h3 id="heading-not-all-crispr-targets-are-equal">Not all CRISPR targets are equal</h3>
<p>When CRISPR was first catching on, researchers would often pull up a sequence on their computer and pick targets by hand. Designing the optimal sgRNA has now become much more complex. Below are brief introductions to this complexity.</p>
<h4 id="heading-off-targets">Off-targets</h4>
<p>Researchers soon realized that Cas9 would sometimes bind and cut at loci that did not exactly match the target sequence. These <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4320661/">off-target cuts</a> would cause unintended changes in a researcher’s experiment (or potentially a patient’s genome in the case of a therapy!)</p>
<p>To design a good guide, a program must look at the entire genome (which is approximately 3 billion nucleotides for humans) to calculate an off-target score. Researchers have also recently <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4714946/">engineered the Cas9 protein</a> to have less off-target activity.</p>
<h4 id="heading-knockout">Knockout</h4>
<p>When Cas9 binds, it creates a cut by making a double strand break to the DNA molecule. Most of the time, a cell can repair this break through a biochemcial pathway (called non-homologous end joining, or NHEJ).</p>
<p>This pathway is not always perfect, and sometimes when Cas9 cuts, the repair process makes a small insertion or deletion in the DNA sequence. In a protein-coding region of DNA, these small insertions and deletions cause a frameshift mutation — which will often disrupt the protein’s function.</p>
<p>Researchers will often knockout a gene to figure out how a protein affects a specific cell function or phenotype. Creating a knockout edit <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4262738/">adds extra constraints to the sgRNA design</a>, because now the guide must land in the coding region of the gene.</p>
<h4 id="heading-editing">Editing</h4>
<p>Instead of knocking out a gene, there are many times a scientist wants to make a precision edit. This is especially useful when trying to correct a disease causing a mutation. The best way to do this is still being researched. Most methods involve adding <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5363683/">an extra donor piece of DNA</a>.</p>
<h4 id="heading-on-target-score">On-target score</h4>
<p>Some sgRNA sequences will cause Cas9 to cut better than others. Researchers have <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4744125/">compared cutting efficiency</a> across thousands of Cas9 targets to create predictive models of a sgRNA’s cutting efficiency.</p>
<p>Microsoft even supports an <a target="_blank" href="https://github.com/MicrosoftResearch/Azimuth">open source repository</a> for ‘Machine Learning-Based Predictive Modeling of CRISPR/Cas9 guide efficiency’.</p>
<h4 id="heading-other-crispr-cas-systems">Other CRISPR-Cas systems</h4>
<p>Researchers have <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4638220/">discovered CRISPR-Cas systems in other bacteria</a>. These other systems have different PAMs.</p>
<h3 id="heading-final-notes">Final notes</h3>
<p>Hope you learned something new! If you want to learn more about the biology, medical applications, commercial applications, or ethical implications of CRISPR-Cas genome engineering, then I recommend reading <a target="_blank" href="http://www.acrackincreation.com/">A Crack in Creation</a> by Jennifer Doudna and Samuel Sternberg. Jennifer Doudna is one of the original discovers of CRISPR’s underpinnings.</p>
<h4 id="heading-about-the-author">About the Author</h4>
<p>I was previously an undergraduate researcher in the <a target="_blank" href="http://gersbach.bme.duke.edu/">Gersbach</a> Lab at Duke University, and I am currently a Software Engineer at a <a target="_blank" href="http://www.synthego.com/">Synthego</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Going deeper: A history of ideas in AI research ]]>
                </title>
                <description>
                    <![CDATA[ By Elena Nisioti Artificial Intelligence is moving fast. The vibe is all around. Facts are beginning to sound like science fiction movies and science fiction movies like a version of reality (with better graphics). It may be that AI has finally achie... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/deeper-ai-a104cf1bd04a/</link>
                <guid isPermaLink="false">66c348dbc8f6b2d81069b333</guid>
                
                    <category>
                        <![CDATA[ AI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Artificial Intelligence ]]>
                    </category>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 09 Feb 2018 13:12:22 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*0bKuRiAxs2z08cqg8y10oA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Elena Nisioti</p>
<p>Artificial Intelligence is moving fast. The vibe is all around. Facts are beginning to sound like science fiction movies and science fiction movies like a version of reality (with better graphics). It may be that AI has finally achieved the level of maturity it has been pursuing for decades and was stubbornly denied, making parts of its community, and the whole world, suspicious against its feasibility.</p>
<p><em>Frankenstein</em> may contain parallels relevant to the present day. Mary Shelley’s Gothic novel contains a discussion on the consequences of creating and introducing an artificial being into society. The Creature puzzles us with its inhuman atrocity and yet human manifestations of weakness, need for companionship and existential crisis.</p>
<p>One could say that we should focus on the future and the consequences of our discoveries. But how can one focus on the chaos created by injecting an army of Creatures into a system so complicated as contemporary society? One could also focus on the achievements, the success-stories that made these ideas sound veracious. But how can one <em>ex post</em> discriminate between correct intuition and luck?</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/91AiTJ6BkYpTH8wwwrJmVpQMaGSVvB75gxwk" alt="Image" width="422" height="599" loading="lazy"></p>
<p>It takes self-restraint, and wisdom, to set aside for a while the branches of your work and evaluate the firmness of its roots. A blooming tree can be distracting.</p>
<p>Whether you are tracing the rules of logical thinking in the ancient Greek philosophers, the formulation of reasoning in Arabic mathematicians or the power of mathematical knowledge in 19th century intellectuals — one unsettling notion becomes clear: the questions are deeper than the networks you can design (even taking <a target="_blank" href="https://en.wikipedia.org/wiki/Moore%27s_law">Moore’s law</a> into account).</p>
<blockquote>
<p><em>“I believe that what we become depends on what our fathers teach us at odd moments, when they aren’t trying to teach us. We are formed by little scraps of wisdom.”</em></p>
<p><em>Umberto Eco</em></p>
</blockquote>
<p>The rest of the discussion will emerge from the history of AI. Not the history of achievements, but the history of questions, arguments and beliefs of some significant individuals. Most of the events revolve around the ‘60s, the era AI acquired its official definition, its purpose, its scientific community and its opponents.</p>
<h4 id="heading-can-machines-think"><strong>Can machines think?</strong></h4>
<p>In 1950 Alan Turing attempts to answer this purposely simplistically-expressed, question in his seminal paper <a target="_blank" href="https://en.wikipedia.org/wiki/Computing_Machinery_and_Intelligence">Computing Machinery and Intelligence</a>. Acknowledging its ambiguity and the limits it imposes on understanding AI, he proceeds by formulating a thought-experiment, also known as the Turing test:</p>
<p><em>Player A is a man, player B is a woman and player C is of either sex. C plays the role of the interrogator and is unable to see either player, but can communicate with them by means of impersonal notes. By asking questions to A and B, C tries to determine which of the two is the man and which is the woman. A’s role is to trick the interrogator into making the wrong decision, while B attempts to assist the interrogator in making the right one.</em></p>
<p>The reformulated question is then:</p>
<p><em>What will happen when a machine takes the part of A in this game? Will the interrogator decide wrongly as often as he does when the game is played between two humans?</em></p>
<p>Turing’s approach seems to follow the doctrine of the duck test: If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.</p>
<p>His attitude when it comes to “human” aspects of intelligence, such as consciousness, is that you can’t blame someone (or something) for not possessing a characteristic that you have yet to define. Thus, consciousness is irrelevant in our quest for AI.</p>
<p>Gödel’s incompleteness theorems were an obstacle in one’s attempt to talk about AI. According to them mathematical logic cannot be both complete and consistent, thus, machines equipped with mathematical logic to learn, as is the case of AI, are expected to fail in learning some truths. Turing’s answer to this is fairly disarming: how do you know that human-intellect does not also come with its limitations?</p>
<p>Turing’s paper is lavish both in terms of arguments and a clear, dialectical structure, nevertheless constrained in speculations about technologies that had yet to be discovered.</p>
<h4 id="heading-steps-towards-artificial-intelligence"><strong>Steps towards artificial intelligence</strong></h4>
<p>Marvin Minsky was one of the fathers of AI as a research field. In the dusty album of AI family photos, Minsky would be this old man that brings some uneasiness to a family dinner: “Old uncle Minsky. He was charmingly peculiar and always had something interesting to say”.</p>
<p>Minsky was one of the organisers of the Dartmouth Conference in 1956, where Artificial Intelligence was first defined as a term and a field. He is mostly remembered for his vigour of believing that AI is feasible and his depreciation in pursuing it with wrong means.</p>
<p>Let’s see what Minsky had to say in 1961, when he was asked about the so far progress in AI.</p>
<blockquote>
<p><em>Should we ask what intelligence “really is”? My own view is that this is more of an aesthetic question, or one of sense of dignity, than a technical matter! To me “intelligence” seems to denote little more than the complex of performances which we happen to respect, but do not understand. So it is, usually, with the question of “depth” in mathematics. Once the proof of a theorem is really understood, its content seems to become trivial.</em></p>
</blockquote>
<p>Acknowledging the inherent difficulties in defining AI, and thus pursuing it, Minsky begins by setting the building pillars of it. According to him, these are search, pattern-recognition, learning, planning, and induction.</p>
<p>If the ultimate purpose of the program is to search and find solutions of its own, then pattern-recognition can help it recognise the appropriate tools, learning can help it improve through experience, and planning can lead to more efficient exploration. As regards the possibility of making a machine with inductive abilities and thus reasoning, Minsky has to say:</p>
<blockquote>
<p><em>Now [according to Gödel’s incompleteness theorem], there can be no system for inductive inference that will work well in all possible universes. But given a universe [our world], or an ensemble of universes, and a criterion of success, this (epistemological) problem for machines becomes technical rather than philosophical.</em></p>
</blockquote>
<p>The rest of the text contains a recurrent urge to clarify that the pursuit of AI should be conducted through complex, hierarchical architectures. For this reason he questions the <a target="_blank" href="https://en.wikipedia.org/wiki/Perceptron">perceptron</a> approach, as it will fail for moderately difficult problems. And frankly, we can’t expect reality to be simplistic.</p>
<p>Minsky can be attributed the responsibility of discouraging research in perceptrons, which probably delayed the bloom of deep learning. The realisation that, even using simple building blocks, one can solve complicated problems by going into deep architectures seems to have escaped his, nevertheless, ingenious insight.</p>
<p>Yet his remarks can be seen as ultimately constructive criticism, as they helped the community explore the weaknesses of the original approaches. Also, deep learning may be the best we have so far (and how marvellous the applications), but should not be regarded unconditionally as the Holy Grail of AI.</p>
<h4 id="heading-minds-brains-and-programs"><strong>Minds, brains, and programs</strong></h4>
<p>In 1980 John Searle got angry. Although he probably got angry earlier, this is the moment he decided to publicise his disagreement with <em>strong AI.</em> Indeed, even the title sounds sarcastic. I feel like Searle is grabbing me by the collar and, vigorously waving his finger, saying: “Let me help you make some fundamental distinctions young lad”.</p>
<blockquote>
<p><em>“One gets the impression that people in AI who write this sort of thing think they can get away with it because they don’t really take it seriously, and they don’t think anyone else will either. I propose for a moment at least, to take it seriously.”</em></p>
</blockquote>
<p>Searle is solely attacking the notion of strong AI, which he identifies as the capability of a computer to practice any human-like behaviour. He translates this to the ability of a machine to demonstrate consciousness which he disproves by analogy. His famous thought-experiment, the Chinese room, goes like this:</p>
<p><em>You are a monolingual English speaker locked in a room with the following things: a large batch of Chinese writing (called a script), another large batch of Chinese writing (called a story) and a set of English rules instructing you how to match Chinese symbols of the second batch to the first (called a program). Then, you are given another batch of Chinese writing (this time called questions) and another set of English instructions with rules that match the questions to the other two batches. Congratulations, you just learned Chinese!</em></p>
<p>This is the Chinese Room experiment, introduced by Searle in 1980 . A thought experiment is not an experiment per se, as its goal is not be conducted, but to explore the potential consequences of an idea. The oldest and most famous is, probably, <a target="_blank" href="https://en.wikipedia.org/wiki/Galileo%27s_Leaning_Tower_of_Pisa_experiment">Galileo’s Leaning Tower of Pisa experiment</a> (did you also think Galileo was actually dropping apples from the tower?).</p>
<p>Searle’s point is that the fact that you can produce Chinese answers by accepting Chinese questions does not mean that you <em>understand</em> Chinese, if this ability was created by following rules in another language. As a consequence, a machine that gives the expected output after it has been given the appropriate algorithm should not be considered a ‘thinking’ entity.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/2ZkVMQSjb0B7CrPycMebnNIrQSMRh20hqw-9" alt="Image" width="800" height="432" loading="lazy"></p>
<p>What Searle does not dispute is the ability of a program to think, as in terms of some functional reasoning. He accuses current AI researchers of being behaviouristic and operationalistic, as they attempt to equate a program with a mind (which is true), letting aside however the importance of the brain.</p>
<p>According to him consciousness comes only from biological operations and since a program is totally independent from its implementation (as it can run on any hardware) it cannot exhibit consciousness.</p>
<p>Reading the original text, one gets the feeling that he is attacking an immature community of computer scientists that has not bothered to reach a consensus on what intelligence is, nevertheless attempts to simulate it guided by teleological approaches and speculations.</p>
<p>Minsky’s response to Searle, and philosophical approaches in general, is as nihilistic as it gets: <em>“they misunderstand, and should be ignored”</em>.</p>
<h4 id="heading-elephants-dont-play-chess"><strong>Elephants don’t play chess.</strong></h4>
<p>And you should not make them feel bad about it. This paper, written by Rodney A. Brooks in 1990, is an attempt of a <em>Nouvelle AI</em> evangelist to persuade, employing both arguments and his robotic fleet, that the classical approach to AI should leave some space for his.</p>
<p>To get the feeling of that era, AI was experiencing its second winter. Funding was cut as companies and governments realised that the community had set the expectations too high.</p>
<p>So, time for introspection. When something fundamentally fails, there are two ways to go at it: either it’s impossible to achieve or your approach is flawed.</p>
<p>Brooks suggested that AI’s stagnation is due to its dogma of functional representations. The <em>symbol system hypothesis</em> is a long-standing view on how intelligence operates. According to it, the world involves entities, like people, cars and cosmic love, so it is natural to match them to symbols and feed machines with them. If this hypothesis is correct, then you have provided the machine with all the necessary information for it to “come up” with intelligence.</p>
<p>Although this assumption does not seem problematic, it has some far-reaching consequences that might account for the bad performance of AI:</p>
<ul>
<li>The symbol system is not adequate to describe the world. According to the <a target="_blank" href="https://en.wikipedia.org/wiki/Frame_problem">frame problem</a> it is a logical fallacy to assume anything that is not explicitly stated. To this point, Brooks charmingly suggests: why not take the world as its own model?</li>
<li>Intelligence cannot emerge from simple calculations. The immense use of heuristics, that are necessary to train intelligent algorithms is a contradiction to our attempt to create knowledge. (Your grid-search is insulting to human intellect.)</li>
<li>AI’s obsession with ensuring generality of a learned model has lead to a phenomenon Brooks calls puzzlitis: excessive effort given on proving that the algorithm works in obscure cases. It ιs certainly an attractive ability, but it does not seem to be a fundamental consequence of knowledge and our world is rather consistent.</li>
</ul>
<p>Brook’s counterproposal is the <em>physical grounding hypothesis</em>. That is, allow Artificial Intelligence to directly interact with the world and use it as its own representation. This certainly changes the standard practise of AI: from learning requiring immense computational resources, guidance from experts and a never-satisfied need for training data, Brook suggests equipping physical entities with cheap hardware and unleashing them in the world. But does this underestimate the problem?</p>
<p>Brooks sees intelligence rising from collective behaviour, not sophisticated parts. Perhaps the most profound observation of his experiments regards how <em>“goal-directed behaviour emerges from the interactions of simpler non goal-directed behaviours”</em>. There does not need to exist a predetermined coordination pattern, as an intelligent machine should draw its own strategies to optimally interact with the world.</p>
<p>Brook’s argument of evolution draws a long way along persuading us of the importance of the physical ground hypothesis: humans are the most common and closest example we have to intelligence. Thus, in our attempt to re-create this characteristic, isn’t it natural to observe the evolution, a slow, adaptive process that gradually led to the formulation of human civilisation? Now, if one considers the time it took us to evolve skills such as interacting, reproducing and surviving, in contrast to our still young abilities of using a language or playing chess, then one may reach the conclusion that these are the hardest skills to develop. So, why not focus on that?</p>
<p>Although ecstatic about the practicality of his approach, Brook acknowledges its theoretical limitations, which can be attributed to the fact that we have yet to develop a complete understanding of the dynamics of interacting populations. Once more, the disregard of an engineer towards philosophical objections is evident:</p>
<blockquote>
<p><em>“At least if our strategy does not convince the arm chair philosophers, our engineering approach will have radically changed the world we live in.”</em></p>
</blockquote>
<h4 id="heading-ai-manifests-progress">AI manifests progress</h4>
<p>Despite floating in a sea of questions, AI manifests something we cannot dispute: progress. Nevertheless, stripping current applications from the effect of technological advancements and heuristic advantages to acquire an accurate perception of the quality of the current research is a tedious task.</p>
<p>Will deep learning prove a worthy tool towards pleasing our ever-demanding criteria of intelligence? Or is this another interglacial period before AI reaches winter again?</p>
<p>What’s more, the concerns and questions have shifted from pure philosophical to social, as the consequences of AI in everyday life are becoming more obvious and pressing than the need for understanding consciousness, God and intelligence. Yet, this may be an even more difficult question to answer and urge us to dig even deeper.</p>
<p>When Wittgenstein wrote the Tractactus, he was confronted with the danger of a fundamental fallacy: his arguments fell victims to the doctrine of his work. That is, if one accepted his doctrine as true, his arguments were illogical and thus his doctrine should be false. But Wittgenstein thought differently:</p>
<blockquote>
<p><em>“My propositions are elucidatory in this way: he who understands me finally recognises them as senseless, when he has climbed out through them, on them, over them.”</em></p>
</blockquote>
<p>To understand the truth behind a complicated idea, we need to evolve. We must stand firm on our previous step and be willing to abandon it. Not every step has to be correct, but it has to be understood. When later confronted with this argument, Wittgenstein said that he does not need a ladder, as he is capable of directly approaching the truth.</p>
<p>We may still need it.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ 10 awkward moments in math history ]]>
                </title>
                <description>
                    <![CDATA[ By Elena Nisioti We have all experienced our awkward moments. Something unexpected happens, there is some social tense and a personal uneasiness and you would really like to get over it or forget that it ever happened. But what if you are a rigorous ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/10-awkward-moments-in-math-history-d364706d902d/</link>
                <guid isPermaLink="false">66c3411b160da468ed76f0e6</guid>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sat, 02 Dec 2017 22:47:40 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*L15oWZU2HC_x5SsKiIEBnw.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Elena Nisioti</p>
<p>We have all experienced our awkward moments. Something unexpected happens, there is some social tense and a personal uneasiness and you would really like to get over it or forget that it ever happened. But what if you are a rigorous mathematician and you just got your world disproven?</p>
<p>Math has always been about the pursuit of understanding the world through logic and expressing it in a strictly defined, mathematical language. It is really indicative, educative, and fun, to observe mathematics when it stopped (momentarily) making sense.</p>
<h4 id="heading-1-the-discovery-of-irrational-numbers"><strong>1. The discovery of irrational numbers</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/wm9o7b02fxsdBnOSZA9fFodqLCiYRvTbdjDw" alt="Image" width="619" height="480" loading="lazy">
<em>The School of Athens, depicting, among almost every possible ancient Greek philosopher, Pythagoras in the left corner</em></p>
<p>As the origins of mathematical rigor lie in ancient Greece, mathematical thought started close to religious beliefs, thus numbers were attributed divine characteristics.</p>
<p>The School of Pythagoras, an occult team of early mathematicians that pushed mathematical knowledge forward, like all cults, was based on some fundamentalistic beliefs. Astonished by the applicability of ratios to every practical problem, they believed that ratios (yes, simple divided numbers) are divine, as they can explain anything that is happening in the world.</p>
<p>Accordingly, everything that is happening in the world should be able to be expressed as a ratio, right?</p>
<p>Now, imagine their surprise when they discovered the number square root of 2, while applying the newly formulated Pythagorean Theorem. This irrational number (irrational meaning that it cannot be expressed as the ratio of two numbers) defied world order as expressed by divinity of ratios and questioned their whole philosophy.</p>
<p>Terrified by the consequences of this revolutionary discovery, they decided not to tell anyone about it. It is also said, that they even drowned the man who did the discovery, Hippasus. Quiet scientific, don’t you think?</p>
<h4 id="heading-2-infinity"><strong>2. Infinity</strong></h4>
<p>The discovery of irrational numbers, being already bad as it was, brought the Greeks in front of a more terrifying discovery: infinity. As irrational numbers are characterized by having an infinite number of decimal digits, Greeks had to come up with an explanation for how a never-ending series of numbers can be created. The notion of infinity is difficult to understand today, let alone an age when religion was connected with science and a mathematical belief should not challenge our understanding of God. So, what did the Greeks do? Philosophers, like Aristotle and Plato, rejected the notion of an absolut infinity and mathematicians came up with inventive ways to circumvent the need for infinity in geometry, like <a target="_blank" href="https://en.wikipedia.org/wiki/Eudoxus_of_Cnidus">Eudoxus of Cnidus</a> who developed the method of exhaustion to calculate the area of shapes. It was not until the late 17th century that Newton and Leibniz encouraged taking infinity into account through their use of infinitesimals and John Wallis introduced the well-known symbol of infinity in 1655.</p>
<h4 id="heading-3-zenos-paradoxes"><strong>3. Zeno’s paradoxes</strong></h4>
<p>The Greeks certainly went to extremes when it came to philosophical reasoning.</p>
<p>After his predecessor Heraclitus claimed that everything in the world is constantly changing, Parmenides claimed that nothing changes. As a result, motion is a mere illusion and therefore, using mathematics, the language of truth according to the Greeks, to describe it should be impossible.</p>
<p>Zeno, one of Parmenides’ students, devised a series of paradoxes aimed to prove the irrationality of motion. The most famous one, Achilles and his tortoise, goes like this: Achilles is racing against a tortoise, which being significantly slower is given the advantage of starting the race 100 meters ahead of him.</p>
<p>If we assume, for the shake of simplicity, that the speeds of the two contestants are constant and Achilles is 10 times faster than the tortoise then we can say that when Achilles reaches the starting point of the tortoise, this will have run 10 meters. So, Achilles will try to catch up and by the time he reaches this next point, the tortoise will have moved an extra one meter.</p>
<p>This high-school math problem, being as simple and clear as it is, leads us to the following paradoxical conclusion: Achilles will never reach the tortoise no matter how much faster he is. Congratulations Zeno, you made motion sound illogical.</p>
<p>Zeno’s paradoxes were believed to exist in the realm of metaphysics and troubled philosophers and mathematicians for ages, but today they can be explained with calculus, a mathematical tool the Greeks did not possess. Let’s “move” on then.</p>
<h4 id="heading-4-mobius-strip"><strong>4. Möbius</strong> <strong>strip</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/qxCpZDL9yY5B8fBT-WGptjZU2GXTNCGKOdh5" alt="Image" width="800" height="496" loading="lazy">
<em>A make-it-yourself Möbius strip</em></p>
<p>The funny looking Möbius strip, which was also independently discovered in 1858 by the unlucky Listing whose name left the history of mathematics untouched, is a surface with only one side and only one boundary, often used to puzzle young math students.</p>
<p>You can easily create it by taking a strip of paper, twisting it and then joining the ends of the strip.</p>
<p>Being the first example of a surface without orientation it did not shake the grounds of mathematics as much as the other discoveries of this list did, yet it provided a lot of practical applications, such as a resistant belt, and inspired mathematicians to come up with unorientable surfaces, like the Klein bottle. (The name of this surface possibly comes from a double coincidence: Klein, its conceptor, originally named it Fläche, which means surface in German and sounds similar to Flasche, which means bottle. The fact that it also looked like a bottle seems to have sealed the renaming).</p>
<h4 id="heading-5-cantors-uncountability-of-real-numbers"><strong>5.</strong> <strong>Cantor’s uncountability of real numbers</strong></h4>
<p>Dealing with infinity already being a drag, Cantor proved in 1874 that there are in fact different kinds of infinity. In particular, proving the uncountability of real numbers, Cantor proved that this set is bigger to the already infinite set of natural numbers.</p>
<p>In 1891, he also provided the diagonal argument, one proof so elegant that it was later adopted as a tool to prove through the use of a paradox. His remark gave birth to the theory of cardinal numbers, as well as <a target="_blank" href="https://ed.ted.com/lessons/the-infinite-hotel-paradox-jeff-dekofsky">paradoxes</a> dealing with the question: how many infinities can you handle?</p>
<h4 id="heading-6-russells-paradox"><strong>6. Russell’s paradox</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/TY4hqqvdCyfE6SspCrjz-3R8CelL6PVeUXK7" alt="Image" width="324" height="480" loading="lazy">
_Bertrand Russell was a mathematician, philosopher, [social critic](https://en.wikipedia.org/wiki/Mathematical_logic" rel="noopener" target="_blank" title="Mathematical logic"&gt;logician, mathematician, historian, writer, &lt;a href="https://en.wikipedia.org/wiki/Social_critic" rel="noopener" target="<em>blank" title="Social critic), political activist and, to my opinion, a personality worth studying and inspiring oneself from.</em></p>
<p>In 1901 Russell discovered a weak spot in Cantor’s so-far well-established set theory, which led him to a contradiction the mathematical world could not oversee. According to this theory, any collection of things can be a set.</p>
<p>Russell’s contradictory example, also called the Barber’s paradox, goes as follows: imagine a town that has a special rule; every man that is not shaved by himself must be shaved by the barber of the town. The awkward question, which you can try to answer yourselves, is: who shaves the barber?</p>
<p>This discovery led him to questioning the mere foundations of the previous set theory and creating a new one, which being more complicated than the later proposed Zermelo-Fraenkel set theory, did not catch up.</p>
<h4 id="heading-7-godels-incompleteness-theorems"><strong>7. Gödel’s incompleteness theorems</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/4wz5KZ6i36uyW86kBrwiuyaRbii4tqGFoPZO" alt="Image" width="212" height="270" loading="lazy">
<em>Kurt Gödel the logician, mathematician and philosopher that shook the grounds of mathematics and logic in the 19th century.</em></p>
<p>If the previous events seemed to create slightly uncomfortable moments, wait for the following awkward turtle (and this is worse than the one of Achilles).</p>
<p>We are talking about the 20th century. People did not just want to know. They wanted to know if it is possible to know, and prove it. Unluckily for them, and the human need for understanding the universe, Gödel published in 1931 two theorems, known as the incompleteness theorems.</p>
<p>Explaining the technicalities of them is as difficult as coming in terms with their conclusions, as what Gödel proved was that, considering a consistent and complete system, such as the language of arithmetic, there are statements that are both true and cannot be proven. He illustrated the truth of his theorem with this simple statement, inspired by <a target="_blank" href="http://www.iep.utm.edu/par-liar/">the liar’s paradox</a>: “This statement cannot be proven”. If this is true, then this statement is true and cannot be proven. If this is false, then this statement can be proven, which contradicts to the original argument that it cannot be proven.</p>
<p>These were very bad news for mathematics, depriving them of their original glare of explaining the absolute truth. It was also a terrible comeback to Hilbert’s quest for knowledge, expressed in his statement “We must know, we will know”.</p>
<h4 id="heading-8-tarskis-undefinability-theorem"><strong>8. Tarski’s undefinability theorem</strong></h4>
<p>It seems that Tarski was inspired by the despair created by Gödel. In 1936 he provided proof for the undefinability problem.</p>
<p>Although the observations made by Tarski are also included in Gödel’s work, it is argued that Tarski’s work has a more profound philosophical impact. Tarski managed to reach the general conclusion that a language cannot define truth in itself. Although this is an important limitation, he suggests that using a more powerful meta-language is sufficient to define truth in the simpler language.</p>
<p>Now, an ordinary person may think that this solves the problem, but for a mathematician looking for the “one language to rule them all” this is not that consoling.</p>
<h4 id="heading-9-the-halting-problem"><strong>9. The halting problem</strong></h4>
<p>Alan Turing attempted to tackle the decision problem, which, in simple words, dealt with finding an algorithm that can answer whether a statement is true or not. In order to tackle this conceptually simple, but hard-to-solve problem, he rephrased it to the halting problem: is there a machine that can tell you whether a program will halt on a given problem?</p>
<p>Halting means that it will not loop forever. But how do you prove the infeasibility of a machine you know so little about? This is where paradoxes come handy.</p>
<p>Alan Turing began by assuming the existence of a machine which given an input program and a problem answers the question of whether it will halt or not. He then augmented this machine by looping its output back to itself if the answer was yes and halting if the answer was no.</p>
<p>So, will the augmented machine halt on the halting problem? Alan’s answer is: if yes then no, if no then yes. Sounds like bad news for logic.</p>
<h4 id="heading-10-the-no-free-lunch-theorem"><strong>10. The No Free Lunch Theorem</strong></h4>
<p>The passage to the 21st century signified a transfer from pure, almost philosophical mathematics, to applied areas, such as statistics and optimization.</p>
<p>If you consider yourself being fond of optimization, don’t you think this will make you a perfectionist? And wouldn’t a perfectionist want to find the optimal way to optimize things?</p>
<p>It seems that <a target="_blank" href="https://en.wikipedia.org/wiki/David_Wolpert">David Wolpert</a> and <a target="_blank" href="https://en.wikipedia.org/w/index.php?title=William_G._Macready&amp;action=edit&amp;redlink=1">William Macready</a> sensed this need and came up with an answer, which, of course, was not encouraging at all (otherwise it would not be in our list). According to their No free lunch theorem for Optimization, published in 1997, “any two <a target="_blank" href="https://en.wikipedia.org/wiki/Optimization_(mathematics)">optimization</a> algorithms are equivalent when their performance is averaged across all possible problems.”</p>
<p>Heart-breaking this may be, it does not mean optimization is futile. We’ll just never find a generally optimal way to do it.</p>
<p>These moments made the world of mathematics feel awkward, which is a light term for the feelings of despair and chaos that scientists tend to experience when the universe stops making sense. But shock is the way to move science forward.</p>
<p>Mathematical fields were created, we got the Turing Machine, fancy looking surfaces and, most importantly, the ability to re-examine our perceptions and adapt our tools accordingly.</p>
<p>These questioning moments helped us evolve intellectually.</p>
<p>Except for the incompleteness theorems. These were just devastating.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Does Data Compression matter on a Quantum Internet? ]]>
                </title>
                <description>
                    <![CDATA[ By Colt McAnlis Disclaimer: This is a hypothetical think piece. It is a personal opinion and doesn’t represent the opinion of any of the companies (or secret societies) I may (..or may not) be involved with. If you tear a hole through space-time afte... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/does-data-compression-matter-on-a-quantum-internet-f6b986473c1c/</link>
                <guid isPermaLink="false">66c349845ced6d98e4bd32c1</guid>
                
                    <category>
                        <![CDATA[ data compression ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ quantum computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 28 Jun 2017 15:37:24 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*jB_VRVuG5z8Dtp2i4N1o9g.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Colt McAnlis</p>
<p><em>Disclaimer: This is a hypothetical think piece. It is a personal opinion and doesn’t represent the opinion of any of the companies (or secret societies) I may (..or may not) be involved with. If you tear a hole through space-time after reading this article… that’s your own fault.</em></p>
<p>If you haven’t heard, a research team out of China just made a huge leap with respect to realization of using <a target="_blank" href="http://science.sciencemag.org/cgi/doi/10.1126/science.aan3211">Quantum Entanglement as a valid communication vessel</a>. Their process was to use a low-earth satellite to create a pair of entangled photons and then send them to locations very far apart from each other. Even at never-before-done distances, the photons retained their entanglement, which has set the internet a buzz about the future of communication, and when the new quantum internet will happen.</p>
<p>Now, looking at the math, <strong>I’m still a bit dubious that quantum entanglement</strong> could be viably used for communication. This math person <a target="_blank" href="https://www.forbes.com/sites/chadorzel/2016/05/04/the-real-reasons-quantum-entanglement-doesnt-allow-faster-than-light-communication/#1c0c3f153a1e">explains</a> it a <a target="_blank" href="https://medium.com/starts-with-a-bang/ask-ethan-can-we-use-quantum-entanglement-to-communicate-faster-than-light-e0d7097c0322">bit better than</a> I ever could. However, there’s lots of people hypothesizing that this is the first steps in a new quantum internet where things like <a target="_blank" href="http://spectrum.ieee.org/telecom/security/two-steps-closer-to-a-quantum-internet">Entanglement Swapping</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Orbital_angular_momentum_of_light">Twisted Light</a> could bridge those gaps.</p>
<p><strong>Then let’s propose a thought experiment</strong>: let’s assume there’s future where an internet exists, whose technology is based on quantum entanglement. This means that data can be transmitted between two locations, at close to speed-of-light without a physical connecting medium between the locations.</p>
<p>In such a world, does data compression matter any more?</p>
<h3 id="heading-a-small-idea-on-how-a-qe-internet-would-work">A small idea on how a QE internet would work</h3>
<p>We have to assume that due to current technology, the first realization of a QE Internet (QEI) would be very similar to the telegraph systems of the past. The cost to maintain and run these early QEI sites would limit their availability, meaning that communication could only occur between a handful of sites.</p>
<p>These sites would require two primary features:</p>
<ol>
<li>A non-centralized system which can distribute entangled photon pairs to the sites (a low-orbit satellite, for example).</li>
<li>A recording system which logs the results of the entanglement tests and can store / retrieve them.</li>
</ol>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Xp0h0wKzejEnv3nQ4yA-OAbVQ0AZU064giIv" alt="Image" width="800" height="475" loading="lazy"></p>
<p>#2 would be most likely built on today’s modern technology. So you can expect a situation where a billion photon pairs are sent to a site, and sampled in unison, and stored as binary data at the location.</p>
<p>From that point, the data would be most likely distributed to it’s final destination using more conventional methods (e.g. fiber connection).</p>
<h3 id="heading-limitations-of-a-first-generation-qei">Limitations of a first generation QEI</h3>
<p>Obviously, we still end up with some data-based bottlenecks here:</p>
<ol>
<li>There is a physical limit to how many entangled pairs can be stored at a site, thus limiting it’s total bandwidth.</li>
<li>There is a physical limit to the speed in which entangled pairs can be sent from the distributor to the sites on a regular basis, thus limiting total system bandwidth.</li>
<li>Environmental factors will cause loss of data in the transfer of photons to the sites from the distributor system. Thus, there will be a need for redundancy in the process, limiting total system bandwidth.</li>
</ol>
<p>When observing the above, you can quickly seen that the overall bandwidth of a QEI would be limited by the above systems, regardless of the ability for information to travel between sites through quantum means. So obviously, reducing the size of the data being sent through the sites will be important, but will today’s data compression algorithms make sense?</p>
<h3 id="heading-data-compression-for-a-qei">Data compression for a QEI</h3>
<p>There’s a few definitions of “data” which represents it as a physical entity, and as the (potential) realization of a Quantum Internet is realized, the need for photon transferal makes this concept even more real.</p>
<p>In fact, that may be the largest ramification of a quantum entangled internet: your data now has a very physical manifestation and cost involved with it.</p>
<p>So it’s obvious that data compression, as a science, will still be needed in a QEI future, but the real question we should be asking ourselves is: <strong>Are today’s compression algorithms good enough to support a quantum internet?</strong></p>
<p>My opinion? Not even close.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/muYjkNnMLxY6BjdD-TiW37VflNvJOFyizCaS" alt="Image" width="256" height="336" loading="lazy"></p>
<p>As explained in “<a target="_blank" href="https://www.amazon.com/Understanding-Compression-Data-Modern-Developers/dp/1491961538">Understanding Compression</a>” today’s systems are still grounded around Shannon’s basic architecture of ‘<em>the most frequent symbol gets the smallest bits.</em>’ There’s a lot of power in this process, but until we move out of symbol space, and start gaining the computational power to handle compression entirely in bit-vector space, <a target="_blank" href="http://ieeexplore.ieee.org/abstract/document/1054929/">we’re going to be leaving a lot of information on the table</a>. (But <em>that’s my own unpopular opinion...</em>)</p>
<p>Let’s look beyond that. Are there potential systems where, rather than applying <a target="_blank" href="https://github.com/google/brotli">Brotli</a> to a data set, we instead can apply in to entangled photons directly? Will we start talking about algorithms to do diff’s against the photons on a site, and the data being transmitted, so we can reduce the number of updated pairs? What happens when we start thinking in terms of <a target="_blank" href="https://en.wikipedia.org/wiki/Qubit">qubits</a>, rather than just bits? Do we have to start thinking about LZ encoding in 8 dimensional space?</p>
<p>Obviously, the realization and standardization of Quantum Computing will create a massive technological shift in how our world works. And I’ve got every reason to believe that Data Compression will be right there, too.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ All we have is now ]]>
                </title>
                <description>
                    <![CDATA[ Within 10⁰ years your favorite rock star is gonna die. Within 10¹ years your favorite pet is gonna die. Within 1o² years you are gonna die. Within 1o³ years your great-great-great-great-great-great-great-great-great-great-great-great-great-great-grea... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/a-realists-guide-to-exponents-f832420e8726/</link>
                <guid isPermaLink="false">66b8d2002755c964523f0519</guid>
                
                    <category>
                        <![CDATA[ life ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ writing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Quincy Larson ]]>
                </dc:creator>
                <pubDate>Fri, 20 Jan 2017 03:36:30 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*gZUPu-r98Ma5aytXunR9qA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p><strong>Within 10⁰ years</strong> your favorite rock star is gonna die.</p>
<p><strong>Within 10¹ years</strong> your favorite pet is gonna die.</p>
<p><strong>Within 1o² years</strong> you are gonna die.</p>
<p><strong>Within 1o³ years</strong> your great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-great-grandkids are gonna die.</p>
<p><strong>Within 1o⁹ years</strong> Earth is gonna die. The sun will get so hot that it boils our oceans.</p>
<p><strong>Within 1o¹⁰ years</strong> the sun is gonna die. The changes in gravity will cause the charred remains of our solar system’s planets to collide with one another. Then they’ll spiral into our dead sun’s white dwarf core.</p>
<p><strong>Within 1o¹¹ years</strong> the Milky Way is gonna die. It’ll merge with the neighboring galaxy Andromeda, which is gonna die, too. After eons of cosmic violence, their supermassive black hole cores will merge.</p>
<p><strong>Within 1o¹⁵ years</strong> all stars are gonna die. There won’t be enough matter left to form new stars. It’ll be all used up. We’ll just have black dwarfs, black holes, and radiation. The universe will go black.</p>
<p><strong>Within 1o³⁰ years</strong> matter is gonna die. Any protons that haven’t been consumed by black holes will start to decay into neutrinos.</p>
<p><strong>Within 1o¹⁰⁰ years</strong> black holes are gonna die. They’ll evaporate completely. All that’ll be left is radiation.</p>
<p>For all we know, this is a one way trip. There’s no reason to expect that anything will ever exist again. And all that awaits us is absolute-zero blackness.</p>
<p>Lesson’s over. Go outside and play with your kids.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
