{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "HaitaoZHU_CIS521_midterm notes.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "brNDGX-kvzds"
      },
      "source": [
        "# Template for Notes for CIS 521 Midterm 1\n",
        "\n",
        "The midterm exam for CIS 521 will be **open notes**. No other matierals are allowed for the exam - you may not use the textbook, the internet, a Python envionement, or communicate with anyone during the exam. \n",
        "\n",
        "This python notebook is where you should save all of your notes.  It provides a structured template that allows you to add summaries for each of the textbook sections that are part of the required reading, plus room for lecture notes and definitions.\n",
        "\n",
        "Your summaries must be written in your own words.  Do not copy and paste from the textbook.  Do not share your notes with classmates, or copy any of your classmates' notes.  "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aPtM8g7R0Pds"
      },
      "source": [
        "# Instructions\n",
        "\n",
        "1. Make a copy of this Google Colab file. From the colab menu, pick **File > Save a copy in Drive**.  That will save a copy of this notebook in your Google drive.\n",
        "2. Go through each section of the notebook, and fill in all the summaries for each chapter and its corresponding sections.  Be sure to save your work frequently!\n",
        "3. Read the notes below about how you can format your summaries.\n",
        "4. In addition to these notes, you are allowed 1 page (both sides) for figures or handwritten notes.\n",
        "5. Submit your version of this notebook to Gradescope before you start the exam.\n",
        "6. If you are taking the exam in person, then you must print a copy of your notes for yourself.   Here's how to print: \n",
        "* Run the last cell of this notebook\n",
        "* Click the \"Mirror cell in tab\" button (this is located in the upper right corner of the cell, immediately to the right of the trash can).  This will open the cell.  \n",
        "* In Chrome, you can then print your notes using the **File > Print** option from the browser's menu.  \n",
        "* In the print options, change the layout from Landscape to Portrait. \n",
        "* Clicking the Save, will save a PDF that you can then print.\n",
        "\n",
        "## Formatting Notes\n",
        "\n",
        "1. The max length for each section's summary is 500 words / 3000 characters.\n",
        "2. You can also write a 2000 word summary of the lectures for each module.\n",
        "3. You may also write definitions of concepts for each module.  The definitions should be written in your own words (not copy and pasted), and they should be no more than 20 words long for each concept. \n",
        "2. You can use Markdown formatting for your summaries. \n",
        "3. You can use Latex formatting for equations. Put two dollar signs before and after your equation like this: \n",
        "$$ \\epsilon = \\frac{1}{mc^2} $$\n",
        "4. When you write python code or psuedocode algorithms, you should surround it with triple backticks like this:\n",
        "```\n",
        "def function():\n",
        "      print('hello world')\n",
        "```\n",
        "5. Write \\ whenever you want to keep writing on the next line without a newline being inserted."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cw5IpDLCZa4W"
      },
      "source": [
        "## Example summary\n",
        "\n",
        "This is a sample summary of [Section 2.1.1](https://web.stanford.edu/~jurafsky/slp3/2.pdf ) of Jurfasky and Martin's Speech and Language Processing's book\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lzaavW96tcxM",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "17cce02b-6d22-4bb7-943a-89044ca1ece1"
      },
      "source": [
        "chapter_2_1_example = \"\"\"\n",
        "Regular expressions are an algebraic notation for characterizing \\\n",
        "a set of strings that are useful for searching for a pattern or through a corpus.\\\n",
        "Only the first matching result will be shown. The search string is case sensitive, \\\n",
        "but it can consist of a single character or a sequence of characters. \\\n",
        "While square braces specify a disjunction of characters, the dash can more easily look \\\n",
        "for characters over a range. The caret specifies the non-existence of a character. \\\n",
        "Additionally, the (?) is used to for flexibility on a single character, meaning \\\n",
        "\"the preceding character or nothing\". More importantly, the Kleene star means zero or \\\n",
        "more occurrences of the immediately previous character or regular expression in square braces.\\\n",
        "...\n",
        "\"\"\"\n",
        "\n",
        "length = len(chapter_2_1_example.split(\" \"))\n",
        "print(\"The example summary is {len} words long, so you could write an additional \\\n",
        "{remaining} words.\".format(len=length, remaining=(500-length)))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The example summary is 116 words long, so you could write an additional 384 words.\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "s3Uk9gQTevcj"
      },
      "source": [
        "## Example summary length\n",
        "\n",
        "The maximum summary length for each section is 500 words / 3000 characters.  Hopefully you'll find that to be quite generous. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "8DvZ57A-djo1",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "11923c1f-8e71-4413-94f7-f050ddc75733"
      },
      "source": [
        "# This is an example of a 500 word placeholder\n",
        "placeholder = \"\"\"ultrices vitae auctor eu augue ut lectus arcu bibendum at varius \\\n",
        " vel pharetra vel turpis nunc eget lorem dolor sed viverra ipsum nunc aliquet \\\n",
        " bibendum enim facilisis gravida neque convallis a cras semper auctor neque vitae \\\n",
        " tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh \\\n",
        " venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut \\\n",
        " faucibus pulvinar elementum integer enim neque volutpat ac tincidunt vitae semper \\ \n",
        " quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu \\\n",
        " scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque \\ \n",
        " laoreet suspendisse interdum consectetur libero id faucibus nisl tincidunt eget \\\n",
        " nullam non nisi est sit amet facilisis magna etiam tempor orci eu lobortis \\\n",
        " elementum nibh tellus molestie nunc non blandit massa enim nec dui nunc mattis \\\n",
        " enim ut tellus elementum sagittis vitae et leo duis ut diam quam nulla porttitor \\\n",
        " massa id neque aliquam vestibulum morbi blandit cursus risus at ultrices mi tempus \\\n",
        " imperdiet nulla malesuada pellentesque elit eget gravida cum sociis natoque \\\n",
        " penatibus et magnis dis parturient montes nascetur ridiculus mus mauris vitae \\\n",
        " ultricies leo integer malesuada nunc vel risus commodo viverra maecenas accumsan \\\n",
        " lacus vel facilisis volutpat est velit egestas dui id ornare arcu odio ut sem nulla \\\n",
        " pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies integer \\\n",
        " quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa \\\n",
        " tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc \\\n",
        " consequat interdum varius sit amet mattis vulputate enim nulla aliquet porttitor \\\n",
        " lacus luctus accumsan tortor posuere ac ut consequat semper viverra nam libero \\\n",
        " justo laoreet sit amet cursus sit amet dictum sit amet justo donec enim diam \\\n",
        " vulputate ut pharetra sit amet aliquam id diam maecenas ultricies mi eget mauris \\\n",
        " pharetra et ultrices neque ornare aenean euismod elementum nisi quis eleifend quam \\\n",
        " adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna neque viverra justo \\\n",
        " nec ultrices dui sapien eget mi proin sed libero enim sed faucibus turpis in \\\n",
        " eu mi bibendum neque egestas congue quisque egestas diam in arcu cursus euismod \\\n",
        " quis viverra nibh cras pulvinar mattis nunc sed blandit libero volutpat sed cras \\\n",
        " ornare arcu dui vivamus arcu felis bibendum ut tristique et egestas quis ipsum \\\n",
        " suspendisse ultrices gravida dictum fusce ut placerat orci nulla pellentesque \\\n",
        " dignissim enim sit amet venenatis urna cursus eget nunc scelerisque viverra mauris \\\n",
        " in aliquam sem fringilla ut morbi tincidunt augue interdum velit euismod in \\\n",
        " pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id aliquet \\\n",
        " risus feugiat in ante metus dictum at tempor commodo ullamcorper a lacus vestibulum \\\n",
        " sed arcu non odio euismod lacinia at quis risus sed vulputate odio ut enim blandit \\\n",
        " volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque in \\\n",
        " dictum non consectetur a erat nam at lectus urna\"\"\"\n",
        "\n",
        "print(\"The length in words is\", len(placeholder.split(' ')))\n",
        "print(\"The length in characters is\", len(placeholder))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The length in words is 500\n",
            "The length in characters is 3030\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5yG3-YncJfTB"
      },
      "source": [
        "# Permissions to use your summaries\n",
        "\n",
        "We'd like to use your summaries to help develop better educational resources like [remember.school](https://remember.school) or a question-answering system about the textbook.  \n",
        "\n",
        "1. Please enter your name.  \n",
        "\n",
        "2. If you grant permission for us to use your summaries under a [Creative Commons License](https://creativecommons.org/licenses/by/4.0/), please set ```permission = True```.  If you do not grant permission, please set it to false. Your answer won't affect your grade.\n",
        "\n",
        "3. If you grant us permission, and you'd like to remain anonymous, set ```anonymous = True```.  We'll remove your name before sharing your summaries with anyone. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "2RECnJArJew4"
      },
      "source": [
        "name = \"\"\n",
        "permission = True\n",
        "anonymous = True"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GZZXyrV-xuAp"
      },
      "source": [
        "# Module 1 - Intro to AI"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Y2NfE1CKxzS-"
      },
      "source": [
        "# Russell and Norvig, AIMA 4th Edition, Chapter 1 “Introduction”, Section 1.1 “What is AI”\n",
        "\n",
        "chapter1_1 = \"\"\" Turing test: can machine think? need NLP,knowledge presentation,\\\n",
        "Automated reasoning,ML;total turing test:requires interaction with objects and people in the real world, need\\\n",
        "CV and robotics; \\n\n",
        "Syllogisms or Logicist\"\"\" \n",
        "\n",
        "# Russell and Norvig, AIMA 4th Edition, Chapter 27 “Philosophical Foundations”, Sections 27.1 “The Limits of AI” and 27.2 “Can Machines Really Think?”\n",
        "chapter27_1 = \"\"\" weak AI acts like intelligent; strong AI actually really thinking. \\\n",
        "**Infomality** humans must be using some informal guidelines that could never be \\\n",
        "captured in a formal set of rules and thus could never be codified in a computer program.\n",
        "**disability** a machine can never do X. ** mathematical objection ** certain \\\n",
        "mathematical questions are in principle unanswerable by particular formal systems\"\"\"\n",
        "chapter27_2 = \"\"\" Alan Turing rejected the question “Can machines think?” and replaced \\\n",
        "it with a behavioral test. He anticipated many objections to the possibility of thinking \\\n",
        "machines. Few AI researchers pay attention to the Turing test, preferring to concentrate \\\n",
        "on their systems’ performance on practical tasks, rather than the ability to imitate humans.\\\n",
        "Consciousness remains a mystery. \"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA 4th Edition, Chapter 2 “Intelligent Agents” (whole chapter)\n",
        "chapter2_1 = \"\"\"  An agent’s percept sequence is the complete history of everything \\\n",
        "the agent has ever perceived. In general, an agent’s choice of action at any given \\\n",
        "instant can depend on its built-in knowledge and on the entire percept sequence \\\n",
        "observed to date, but not on anything it hasn’t perceived \\n\n",
        "An agent’s behavior is described by the **agent function** that maps any given \\\n",
        "percept sequence to an action. The agent function for an artificial agent will \\\n",
        "be implemented by an **agent program**.\"\"\"\n",
        "chapter2_2 = \"\"\" COnsequentialism:a performance measure. Rationality:\n",
        "The performance measure that defines the criterion of success;The agent’s prior \\\n",
        "knowledge of the environment;The actions that the agent can perform;The agent’s \\\n",
        "percept sequence to date. Rational is not omniscience,rational->expect.A rational \\\n",
        "agent should be autonomous—it should learn what it can to compensate for partial \\\n",
        "or incorrect prior knowledge\"\"\"\n",
        "chapter2_3 = \"\"\" PEAS Performance, Environment, Actuators, Sensors;Fully/partial observaible,\\\n",
        "single/multi agents, (non)deterministic(stochastic), episodic/sequential, static/dynamic,\\\n",
        "discrete/continuous,known/unknown,\"\"\"\n",
        "chapter2_4 = \"\"\" agent = program+ architecture.\\n\n",
        "The agent program implements the  agent function. There exists a variety of basic agent program designs reflecting \\\n",
        "the kind of information made explicit and used in the decision process. The designs \\\n",
        "vary in efficiency, compactness, and flexibility. The appropriate design of the \\\n",
        "agent program depends on the nature of the environment.\\n\n",
        "architecture:Simple reflex agents respond directly to percepts, whereas model-based \\\n",
        "reflex agents maintain internal state to track aspects of the world that are not \\\n",
        "evident in the current percept. Goal-based agents act to achieve their goals, \\\n",
        "and utility-based agents try to maximize their own expected “happiness. \"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module1_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "\n",
        "# Definitions of concepts from Module 1.\n",
        "# You can define any bolded term in the textbook, \n",
        "# but you most use your own words for the definitions.\n",
        "# Each definition should be at most 20 words long.\n",
        "module1_definitions = {\n",
        "\"agent\" : \"anything that can perceive and act in an environment\",\n",
        "\"percept\" : \" the content an agent’s sensors are perceiving the content an agent’s sensors are perceivin\",\n",
        "\"rational agents\" : \"acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome  \",\n",
        "\n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "elCCgY64spuq"
      },
      "source": [
        "## Preview of your notes for Module 1\n",
        "\n",
        "Here's a preview of your how your notes will be displayed.  At the end of this Python notebook, we'll aggregate your notes for all modules together into a single display.\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gYYeNcdM_maE",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "cellView": "form",
        "outputId": "4ebf474c-b342-4c5a-d12b-eaa37e743bd2"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "from IPython.display import display, Markdown, Latex\n",
        "\n",
        "module1_sections = [\n",
        "  (\"AIMA Chapter 1.1 What is AI?\", chapter1_1),\n",
        "  (\"AIMA Chapter 27.1 The Limits of AI\", chapter27_1),\n",
        "  (\"AIMA Chapter 27.1 Can Machines Really Think?\", chapter27_2),\n",
        "  (\"AIMA 2.1 Agents and Environments\", chapter2_1),\n",
        "  (\"AIMA 2.2 Good Behavior: The Concept of Rationality\", chapter2_2),\n",
        "  (\"AIMA 2.3 The Nature of Environments\", chapter2_3),\n",
        "  (\"AIMA 2.4 The Structure of Agents\", chapter2_4),\n",
        "  (\"Module 1 Lecture Notes\", module1_lecture_notes),\n",
        "]\n",
        "\n",
        "\n",
        "def length_check(sections):\n",
        "  warnings = \"\"\n",
        "  for section, summary in sections:\n",
        "    max_word_length = 500\n",
        "    max_character_length = 3000\n",
        "    if \"lecture\" in section.lower():\n",
        "      # It's OK to do longer summaries of the lectures\n",
        "      max_word_length = 2000\n",
        "      max_character_length = 12000  \n",
        "    if (len(summary) > max_character_length or len(summary.split(' ')) > max_word_length):\n",
        "      warnings += \"WARNING: Your summary of '{section}' is too long!\\n\".format(section=section)\n",
        "  return warnings\n",
        "\n",
        "def length_check_definitions(definitions):\n",
        "  warnings = \"\"\n",
        "  for concept, definition in definitions.items():\n",
        "    if(len(definition.split(' ')) > 20):\n",
        "      warnings += \"WARNING: Your definition of '{concept}' is too long!\\n\".format(concept=concept)\n",
        "  return warnings\n",
        "\n",
        "\n",
        "def format_module(module_num, title, sections, definitions, show_placeholder=False):\n",
        "  markdown = \"\"\n",
        "\n",
        "  # Check summary lengths\n",
        "  warnings = length_check(sections)\n",
        "  if warnings != \"\":\n",
        "    markdown += \"## \" + warnings\n",
        "\n",
        "  # Check definition lengths\n",
        "  warnings = length_check_definitions(definitions)\n",
        "  if warnings != \"\":\n",
        "    markdown += \"## \" + warnings\n",
        "\n",
        "  markdown += \"# Module {num}: {title}\\n\".format(num=module_num, title=title)\n",
        "\n",
        "\n",
        "  for section, summary in sections:\n",
        "    if show_placeholder and summary == \" Your summary here \":\n",
        "      summary = placeholder\n",
        "    markdown += \"## {section}\\n{summary}\\n\\n\".format(section=section, summary=summary)\n",
        "  \n",
        "  markdown += \"## Module {num} Definitions\\n\".format(num=module_num)\n",
        "  for concept, definition in definitions.items():\n",
        "    markdown += \"* **{concept}** - {definition}\\n\".format(concept=concept.capitalize(), definition=definition)\n",
        "  return markdown\n",
        "\n",
        "\n",
        "module1_markdown = format_module(1, \"Rational Agents and Task Environments\", module1_sections, module1_definitions)\n",
        "display(Markdown(module1_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\n Turing test: can machine think? need NLP,knowledge presentation,Automated reasoning,ML;total turing test:requires interaction with objects and people in the real world, needCV and robotics; \n\nSyllogisms or Logicist\n\n## AIMA Chapter 27.1 The Limits of AI\n weak AI acts like intelligent; strong AI actually really thinking. **Infomality** humans must be using some informal guidelines that could never be captured in a formal set of rules and thus could never be codified in a computer program.\n**disability** a machine can never do X. ** mathematical objection ** certain mathematical questions are in principle unanswerable by particular formal systems\n\n## AIMA Chapter 27.1 Can Machines Really Think?\n Alan Turing rejected the question “Can machines think?” and replaced it with a behavioral test. He anticipated many objections to the possibility of thinking machines. Few AI researchers pay attention to the Turing test, preferring to concentrate on their systems’ performance on practical tasks, rather than the ability to imitate humans.Consciousness remains a mystery. \n\n## AIMA 2.1 Agents and Environments\n  An agent’s percept sequence is the complete history of everything the agent has ever perceived. In general, an agent’s choice of action at any given instant can depend on its built-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived \n\nAn agent’s behavior is described by the **agent function** that maps any given percept sequence to an action. The agent function for an artificial agent will be implemented by an **agent program**.\n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n COnsequentialism:a performance measure. Rationality:\nThe performance measure that defines the criterion of success;The agent’s prior knowledge of the environment;The actions that the agent can perform;The agent’s percept sequence to date. Rational is not omniscience,rational->expect.A rational agent should be autonomous—it should learn what it can to compensate for partial or incorrect prior knowledge\n\n## AIMA 2.3 The Nature of Environments\n PEAS Performance, Environment, Actuators, Sensors;Fully/partial observaible,single/multi agents, (non)deterministic(stochastic), episodic/sequential, static/dynamic,discrete/continuous,known/unknown,\n\n## AIMA 2.4 The Structure of Agents\n agent = program+ architecture.\n\nThe agent program implements the  agent function. There exists a variety of basic agent program designs reflecting the kind of information made explicit and used in the decision process. The designs vary in efficiency, compactness, and flexibility. The appropriate design of the agent program depends on the nature of the environment.\n\narchitecture:Simple reflex agents respond directly to percepts, whereas model-based reflex agents maintain internal state to track aspects of the world that are not evident in the current percept. Goal-based agents act to achieve their goals, and utility-based agents try to maximize their own expected “happiness. \n\n## Module 1 Lecture Notes\n Your summary here \n\n## Module 1 Definitions\n* **Agent** - anything that can perceive and act in an environment\n* **Percept** -  the content an agent’s sensors are perceiving the content an agent’s sensors are perceivin\n* **Rational agents** - acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome  \n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9xRbdqDox2zD"
      },
      "source": [
        "#Module 2 - Python"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "DpBvu7EMx7sy"
      },
      "source": [
        "# No readings for this module.  Instead you can summarize the lecture instead.\n",
        "\n",
        "# Lecture notes \n",
        "module2_lecture_notes = \"\"\" All data treated as objects; Sequence: list,mutable(unhashable)\\\n",
        " string and tuple unmutable(hashable); Dictionary: key:value , key hashable, no add; \\\n",
        " set:hashable, no repeated element, no add. \\n\n",
        " Function: could return multiple value or default value,no overloading,\\*args and \\*\\*kwargs ,\\\n",
        " could be assigned to variables, passed to other functions, returned. \\n\n",
        " Class: function defined in class:method, magic method, inheritance. \\n\n",
        " For loop : for \\<item\\> in \\<collection\\>: \\<statement\\> list comprehension;[\\<expression\\> for \\<name\\> in \\<seq\\> if \\<filter\\>]\\n\n",
        " Iterator: __iter__() and __next__() method; generator : yield instead of return.\\n\n",
        "\n",
        " \"\"\"\n",
        "\n",
        "# Each definition should be at most 20 words long.\n",
        "module2_definitions = {\n",
        "\"Strong Typing\" : \"Every object has a fixed type, interpreter doesn’t allow things incompatible with that type\",\n",
        "\"dynamic typing\" : \"Variables come into existence when first assigned.If assigned again, type is updated\",\n",
        "\"dynamic scope\" : \"Function sees the most current value of variables\"\n",
        "}"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ydOK__lwWgdp",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 352
        },
        "outputId": "90691722-790f-4885-def4-03a721f50e84"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "\n",
        "module2_sections = [\n",
        "  (\"Module 2 Lecture Notes\", module2_lecture_notes),\n",
        "]\n",
        "\n",
        "module2_markdown = format_module(2, \"Python\", module2_sections, module2_definitions)\n",
        "display(Markdown(module2_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 2: Python\n## Module 2 Lecture Notes\n All data treated as objects; Sequence: list,mutable(unhashable) string and tuple unmutable(hashable); Dictionary: key:value , key hashable, no add;  set:hashable, no repeated element, no add. \n\n Function: could return multiple value or default value,no overloading,\\*args and \\*\\*kwargs , could be assigned to variables, passed to other functions, returned. \n\n Class: function defined in class:method, magic method, inheritance. \n\n For loop : for \\<item\\> in \\<collection\\>: \\<statement\\> list comprehension;[\\<expression\\> for \\<name\\> in \\<seq\\> if \\<filter\\>]\n\n Iterator: __iter__() and __next__() method; generator : yield instead of return.\n\n\n \n\n## Module 2 Definitions\n* **Strong typing** - Every object has a fixed type, interpreter doesn’t allow things incompatible with that type\n* **Dynamic typing** - Variables come into existence when first assigned.If assigned again, type is updated\n* **Dynamic scope** - Function sees the most current value of variables\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "46MQLR-Gx8dZ"
      },
      "source": [
        "#Module 3 - Search Problems"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BN0b1eVYx-nd"
      },
      "source": [
        "# Russell and Norvig, AIMA 4th Edition, AIMA Chapter 3 “Problem Solving by Search” (3.1-3.4)\n",
        "chapter3_1 = \"\"\" **solution**: fixed sequence of actions. **State space**:A set of \\\n",
        "possible states that the environment can be in; optimal solution \\\n",
        "has the lowest path cost among all solutions.\"\"\"\n",
        "chapter3_2 = \"\"\" states; initial state; goal states; actions; transition model; action \\\n",
        "cost function; \"\"\"\n",
        "chapter3_3 = \"\"\" search tree, node, frontier, reached; Best first search,expand \\\n",
        "with minimum evaluation function. Structure, queue:priority->Best first search,FIFO->\\\n",
        "breath first search, LIFO->depth first tree. Redundant path,graph search checks for\\\n",
        "redundant path thus faster, tree search doesn't check using less memory. Measure\\\n",
        "completeness:guaranteed to find a solution when there is one, and to correctly \\\n",
        "report failure when there is no,complexity(time space)how long/how much memory \\\n",
        ",cost optimal,it find a solution with the lowest path cost of all solution; \\\n",
        "depth d branch factor b, maximum number of action m;\"\"\"\n",
        "chapter3_4 = \"\"\" BFS optimal complete O(b^d) in space and time ; Dijkstra or uniform \\\n",
        "-cost search, complete cost-optimal time and space O(b^1+C/epsilon) cost of optimal \\\n",
        "and lower bound of each action. DFS space O(bm) time O(b^m) not optimal or complete.\\\n",
        "Depth limited search limit depth l, time O(b^l) spaceO(bl) not complete or optimal \\\n",
        "depend on l. Iterative deepening search, space O(bd) for solution or O(bm) with no \\\n",
        "solution; bidirection search O(b^(d/2) complete optimal.)\"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module3_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions of concepts from Module 3.\n",
        "# You can define any bolded term in the textbook, \n",
        "# but you most use your own words for the definitions.\n",
        "# Each definition should be at most 20 words long.\n",
        "module3_definitions = {\n",
        "\"problem-solving agent\" : \"an agent that can formulate a plan via search\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lvtN3p7ET3Tx",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 576
        },
        "outputId": "81c22fed-8aab-4327-a463-63098c36f002"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module3_sections = [\n",
        "  (\"AIMA Chapter 3.1 Problem-Solving Agents\", chapter3_1),\n",
        "  (\"AIMA Chapter 3.2 Example Problems\", chapter3_2),\n",
        "  (\"AIMA Chapter 3.3 Search Algorithms\", chapter3_3),\n",
        "  (\"AIMA Chapter 3.4 Uninformed Search Strategies\", chapter3_4),\n",
        "  (\"Module 3 Lecture Notes\", module3_lecture_notes),\n",
        "]\n",
        "\n",
        "module3_markdown = format_module(3, \"Search Problems\", module3_sections, module3_definitions)\n",
        "display(Markdown(module3_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 3: Search Problems\n## AIMA Chapter 3.1 Problem-Solving Agents\n **solution**: fixed sequence of actions. **State space**:A set of possible states that the environment can be in; optimal solution has the lowest path cost among all solutions.\n\n## AIMA Chapter 3.2 Example Problems\n states; initial state; goal states; actions; transition model; action cost function; \n\n## AIMA Chapter 3.3 Search Algorithms\n search tree, node, frontier, reached; Best first search,expand with minimum evaluation function. Structure, queue:priority->Best first search,FIFO->breath first search, LIFO->depth first tree. Redundant path,graph search checks forredundant path thus faster, tree search doesn't check using less memory. Measurecompleteness:guaranteed to find a solution when there is one, and to correctly report failure when there is no,complexity(time space)how long/how much memory ,cost optimal,it find a solution with the lowest path cost of all solution; depth d branch factor b, maximum number of action m;\n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n BFS optimal complete O(b^d) in space and time ; Dijkstra or uniform -cost search, complete cost-optimal time and space O(b^1+C/epsilon) cost of optimal and lower bound of each action. DFS space O(bm) time O(b^m) not optimal or complete.Depth limited search limit depth l, time O(b^l) spaceO(bl) not complete or optimal depend on l. Iterative deepening search, space O(bd) for solution or O(bm) with no solution; bidirection search O(b^(d/2) complete optimal.)\n\n## Module 3 Lecture Notes\n Your summary here \n\n## Module 3 Definitions\n* **Problem-solving agent** - an agent that can formulate a plan via search\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WHREsHSSyA-h"
      },
      "source": [
        "#Module 4 - Informed Search"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "tuFC8w7CyCns"
      },
      "source": [
        "# Russell and Norvig, AIMA Chapter 3 “Problem Solving by Search” (3.5-3.6)\n",
        "chapter3_5 = \"\"\" informed search with a heuristic function: estimated cost of the \\\n",
        "cheapest path from the state at node n to a goal state. Greedy best-first search \\\n",
        "with lowest h(n),complete,not optimal, worst case O(|V|) best O(bm) . A* search \\\n",
        "f(n)=g(n)+h(n). An admissibile heuristic never over-estimates cost to the goal(optimistic). \\\n",
        "Consistency, triangle inequality;h(n)<=c(n,a,n')+h(n'). A* is efficient because \\\n",
        "it prunes away search tree nodes that are not necessary for finding an optimal solution. \\\n",
        "The number of nodes expanded can be exponential in the length of the solution. \\\n",
        "Weighted A* suboptimal but faster. Memory bounded search-> beam search, keep k \\\n",
        "best node;Iterative-deepening A* search,cut off at f-cost; Recursive best-first \\\n",
        "search,backed-up f value;RBFS is more efficient IDA*, but suffers from excessive \\\n",
        "node regeneration, optimal if the heuristic admissible.space complexity linear, \\\n",
        "time complex.SMA*(simplified bounded), drop worst when nodes exceeds memory limit.\\\n",
        "complete if there is reachable solution, optimal if any optimal solution reachable.\n",
        "\"\"\"\n",
        "chapter3_6 = \"\"\"**effective branching factor b** lower better; admissible h higher \\\n",
        "better, dominates. relaxed problem. Admissible heuristics can also be derived from \\\n",
        "the solution cost of a subproblem of a given problem, making landmark,learning from \\\n",
        "experience with the problem class.\"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module4_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module4_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "vqtEs0gHs9sO",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 460
        },
        "outputId": "5dbd040c-404e-48e4-f7de-6954beca6e52"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module4_sections = [\n",
        "  (\"AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\", chapter3_5),\n",
        "  (\"AIMA Chapter 3.6 Heuristic Functions\", chapter3_6),\n",
        "  (\"Module 4 Lecture Notes\", module3_lecture_notes),\n",
        "]\n",
        "\n",
        "module4_markdown = format_module(4, \"Informed Search\", \n",
        "                         module4_sections, \n",
        "                         module4_definitions)\n",
        "display(Markdown(module4_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 4: Informed Search\n## AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\n informed search with a heuristic function: estimated cost of the cheapest path from the state at node n to a goal state. Greedy best-first search with lowest h(n),complete,not optimal, worst case O(|V|) best O(bm) . A* search f(n)=g(n)+h(n). An admissibile heuristic never over-estimates cost to the goal(optimistic). Consistency, triangle inequality;h(n)<=c(n,a,n')+h(n'). A* is efficient because it prunes away search tree nodes that are not necessary for finding an optimal solution. The number of nodes expanded can be exponential in the length of the solution. Weighted A* suboptimal but faster. Memory bounded search-> beam search, keep k best node;Iterative-deepening A* search,cut off at f-cost; Recursive best-first search,backed-up f value;RBFS is more efficient IDA*, but suffers from excessive node regeneration, optimal if the heuristic admissible.space complexity linear, time complex.SMA*(simplified bounded), drop worst when nodes exceeds memory limit.complete if there is reachable solution, optimal if any optimal solution reachable.\n\n\n## AIMA Chapter 3.6 Heuristic Functions\n**effective branching factor b** lower better; admissible h higher better, dominates. relaxed problem. Admissible heuristics can also be derived from the solution cost of a subproblem of a given problem, making landmark,learning from experience with the problem class.\n\n## Module 4 Lecture Notes\n Your summary here \n\n## Module 4 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "F3FPMzG9yUls"
      },
      "source": [
        "#Module 5 - Adversarial Search and Games"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "iEIOpL7vyWcc"
      },
      "source": [
        "# Russell and Norvig, AIMA chapter 5 \"Adversarial Search\"”\" (5.1-5.3, and 5.5).\n",
        "chapter5_1 = \"\"\" deterministic, two-player, turn-taking, perfect information,\\ \n",
        "zero-sum games. consist of initial state,action,transition model,terminal states \\\n",
        "utility function:the final numeric value to player when the game ends in terminal \\\n",
        "state.\n",
        "\"\"\"\n",
        "chapter5_2 = \"\"\" minimax search , assume both players play optimally; the minimax \\\n",
        "value is the utility in terminal state, highest value for max player and lowest value \\\n",
        "for min. Time O(b^m) space(bm) depth first search. Alpha-beta pruning; alpha best \\\n",
        "value for max, update under max and prune in min;beta lowest value for min;affected \\\n",
        "by moving order,best time O(b^m/2) worst O(b^m);could iterative deepen.\\\n",
        "Type As strategy:wide but shallow; B,deep but narrow.\n",
        "\"\"\"\n",
        "chapter5_3 = \"\"\" heuristic evalutaiton function returns an estimate of the expected \\\n",
        " utility of state to player; cutting off search by **cutoff test**; Evaluation function \\\n",
        "should be applied only to **quiescent** position, no pending move that would swing the \\\n",
        "evalutaion. Horizen effect delay the unavoidable result, use singular extensions to \\\n",
        "mitigate. Forward pruning prunes saves computation time at the risk of making an error:\\\n",
        "beam search consider only n best move;probcut;late move reduction.\"\"\"\n",
        "chapter5_5 = \"\"\" chance node,calculate expected value,expectiminimax time O(b^m n^m); \"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA Chapter 16 “Making Simple Decisions” (16.1-16.3)\n",
        "chapter16_1 = \"\"\" The principle of maximum expected utility says that a rational \\\n",
        "agent should choose the action that maximizes the agent’s expected utility \"\"\"\n",
        "chapter16_2 = \"\"\" orderability, transitivity A>B B>C ->A>C,continuity \\\n",
        "A>B>C [p,A;1-p,C]~B , substitutability(indifferent) , monotonicity , decomposability\\\n",
        ". Preference->utility function \"\"\"\n",
        "chapter16_3 = \"\"\" Utility theory shows that an agent whose preferences between \\\n",
        "lotteries are consistent with a set of simple axioms can be described as possessing \\\n",
        "a utility function; furthermore, the agent selects actions as if maximizing its \\\n",
        "expected utility \"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module5_lecture_notes = \"\"\" The alpha–beta search algorithm computes the same \\\n",
        "optimal move as minimax, but achieves much greater efficiency by eliminating \\\n",
        "subtrees that are provably irrelevant. It's not feasible to consider the whole \\\n",
        "game tree, cut the search off and apply a heuristic evaluation function\"\"\"\n",
        "\n",
        "# Definitions\n",
        "module5_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "KUc_LgzDvWf-",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 793
        },
        "outputId": "8475a4e4-5061-4c6b-f9a9-5e82fb3681f5"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module5_sections = [\n",
        "  (\"AIMA Chapter 5.1 Game Theory\", chapter5_1),\n",
        "  (\"AIMA Chapter 5.2 Optimal Decisions in Games\", chapter5_2),\n",
        "  (\"AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\", chapter5_3),\n",
        "  (\"AIMA Chapter 5.5 Stochastic Games\", chapter5_5),\n",
        "  (\"AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\", chapter16_1),\n",
        "  (\"AIMA Chapter 16.2 The Basis of Utility Theory\", chapter16_2),\n",
        "  (\"AIMA Chapter 16.3 Utility Functions\", chapter16_3),\n",
        "  (\"Module 5 Lecture Notes\", module5_lecture_notes),\n",
        "]\n",
        "\n",
        "module5_markdown = format_module(5, \"Adversarial Search and Games\", \n",
        "                         module5_sections, \n",
        "                         module5_definitions)\n",
        "display(Markdown(module5_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 5: Adversarial Search and Games\n## AIMA Chapter 5.1 Game Theory\n deterministic, two-player, turn-taking, perfect information,\\ \nzero-sum games. consist of initial state,action,transition model,terminal states utility function:the final numeric value to player when the game ends in terminal state.\n\n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n minimax search , assume both players play optimally; the minimax value is the utility in terminal state, highest value for max player and lowest value for min. Time O(b^m) space(bm) depth first search. Alpha-beta pruning; alpha best value for max, update under max and prune in min;beta lowest value for min;affected by moving order,best time O(b^m/2) worst O(b^m);could iterative deepen.Type As strategy:wide but shallow; B,deep but narrow.\n\n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n heuristic evalutaiton function returns an estimate of the expected  utility of state to player; cutting off search by **cutoff test**; Evaluation function should be applied only to **quiescent** position, no pending move that would swing the evalutaion. Horizen effect delay the unavoidable result, use singular extensions to mitigate. Forward pruning prunes saves computation time at the risk of making an error:beam search consider only n best move;probcut;late move reduction.\n\n## AIMA Chapter 5.5 Stochastic Games\n chance node,calculate expected value,expectiminimax time O(b^m n^m); \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n The principle of maximum expected utility says that a rational agent should choose the action that maximizes the agent’s expected utility \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n orderability, transitivity A>B B>C ->A>C,continuity A>B>C [p,A;1-p,C]~B , substitutability(indifferent) , monotonicity , decomposability. Preference->utility function \n\n## AIMA Chapter 16.3 Utility Functions\n Utility theory shows that an agent whose preferences between lotteries are consistent with a set of simple axioms can be described as possessing a utility function; furthermore, the agent selects actions as if maximizing its expected utility \n\n## Module 5 Lecture Notes\n The alpha–beta search algorithm computes the same optimal move as minimax, but achieves much greater efficiency by eliminating subtrees that are provably irrelevant. It's not feasible to consider the whole game tree, cut the search off and apply a heuristic evaluation function\n\n## Module 5 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qVSQhTVSyYYO"
      },
      "source": [
        "#Module 6 - \"Constraint Satisfaction Problems\""
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Wm4mfW82yaRH"
      },
      "source": [
        "# Russell and Norvig, AIMA, Chapter 6 “Constraint Satisfaction Problems” (6.1-6.5)\n",
        "chapter6_1 = \"\"\" Constraint satisfaction problems:represent state with a set of variable, \\\n",
        "value pairs and represent the conditions for solution by set of constraints \\ \n",
        "on the variables.\\n\n",
        "CSP deals with assignment, a solution is consistent, complete \\\n",
        "assignment;-> a constraint graph;reason->yield a natural representation;fast and  \n",
        "efficient;quickly prune.  unary constraint(node);binary constraint(arc); global \\\n",
        "constraint; preference constraints->constrained optimization problem; represent \\\n",
        "a state with a set of variable/value pairs. search->states are black boxes with \\\n",
        "a transition model to move,CSP the agent can see inside the states and move \\\n",
        "between states accordingly.\"\"\"\n",
        "chapter6_2 = \"\"\" CSP uses inference and search; inference constraint propagation; \\\n",
        "node/arc/path;k-consistency:for any set of k-1 variables and for any consistent \\\n",
        "assignment to the variables, a consistent value can be assigned to any k-th \\\n",
        "variables; strongly k-consistent if meet k,k-1...,1 consistent; bad side,could \\\n",
        "take n exponential time and space. \\\n",
        "global constraint involves any arbitrary number of variables;resource constraint, \\\n",
        "atmost constraint. Domains could be written as upper lower bounds;bound propagation \\\n",
        "\"\"\"\n",
        "chapter6_3 = \"\"\" **backtracking** search for CSP, depth first, happens when no \\\n",
        "available value for a variable,improved by domain- \\\n",
        "specific or independent heuristic;\\n \n",
        "Minimum-remaining value heuristic,most constrained fail-first,reduce backtrack; degree heuristic,choose the variable with largest \\\n",
        "number of constraints,reduce branching factor.least-constraining-value heuristic, \\\n",
        "choose value roles out fewest choice, most likely.\\n\n",
        "Interleaving search and inference \\\n",
        ": forward-checking and Maintaining Arc consistency,MAC recursively propogrates \\\n",
        "constraints, whereas forward checking does not;MAC is a way of interleaving search \\\n",
        "and inference. AC-3 is pure inference. backjumping to the conflict set; \\\n",
        "Constrained learning:record conflicts/no good. \n",
        "\"\"\"\n",
        "chapter6_4 = \"\"\" Local search: min-conflict heuristic->select the value that \\\n",
        "results in the minimum number of conflicts with other variables;tabu search: \\\n",
        "keeping a small list of recently visited states and forbidding the algorithm \\\n",
        "to return to those states , deal plateau.constraint weighting aims to concentrate \\\n",
        "the search on the important constraints.  min conflict could use online setting;\"\"\"\n",
        "chapter6_5 = \"\"\" tree-structured CSP, cutset conditioning, cutoff size c time \\\n",
        "O(d^c (n-c)d^2); Tree decomposition,depend on tree width w, time O(nd^w). time \\\n",
        "consideration favors tree decomposition, but the advantage of the cycle-cutset \\\n",
        "approach is that it can be executed in linear memory, while tree decomposition \\\n",
        "requires memory exponential in w. symmetry-breaking constraint\"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module6_lecture_notes = \"\"\" The minimum-remaining-values and degree heuristics \\\n",
        "are domain-independent methods for deciding which variable to choose next in a \\\n",
        "backtracking search. The least- constraining-value heuristic helps in deciding \\\n",
        "which value to try first for a given variable. Backtracking occurs when no legal \\\n",
        " assignment can be found for a variable.  AC3: Place all the arcs in a queue. \\\n",
        " Pop arcs. For each arc, remove inconsistent values. If we change the values of \\\n",
        " a node, add its arcs to the queue. Terminate when the queue is empty.\n",
        "\"\"\"\n",
        "\n",
        "# Definitions\n",
        "module6_definitions = {\n",
        "\"concept\" : \"defination\",\n",
        "\n",
        "\n",
        "}\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "kKWbCsbfxL3R",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 865
        },
        "cellView": "form",
        "outputId": "deb1e8b3-34f9-48f2-bcb0-e38c02196403"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module6_sections = [\n",
        "  (\"AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\", chapter6_1),\n",
        "  (\"AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\", chapter6_2),\n",
        "  (\"AIMA Chapter 6.3 Backtracking Search for CSPs\", chapter6_3),\n",
        "  (\"AIMA Chapter 6.4 Local Search for CSPs\", chapter6_4),\n",
        "  (\"AIMA Chapter 6.5 The Structure of Problems\", chapter6_5),\n",
        "  (\"Module 6 Lecture Notes\", module6_lecture_notes),\n",
        "]\n",
        "\n",
        "module6_markdown = format_module(6, \"Constraint Satisfaction Problems\", \n",
        "                         module6_sections, \n",
        "                         module6_definitions)\n",
        "display(Markdown(module6_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 6: Constraint Satisfaction Problems\n## AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\n Constraint satisfaction problems:represent state with a set of variable, value pairs and represent the conditions for solution by set of constraints \\ \non the variables.\n\nCSP deals with assignment, a solution is consistent, complete assignment;-> a constraint graph;reason->yield a natural representation;fast and  \nefficient;quickly prune.  unary constraint(node);binary constraint(arc); global constraint; preference constraints->constrained optimization problem; represent a state with a set of variable/value pairs. search->states are black boxes with a transition model to move,CSP the agent can see inside the states and move between states accordingly.\n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n CSP uses inference and search; inference constraint propagation; node/arc/path;k-consistency:for any set of k-1 variables and for any consistent assignment to the variables, a consistent value can be assigned to any k-th variables; strongly k-consistent if meet k,k-1...,1 consistent; bad side,could take n exponential time and space. global constraint involves any arbitrary number of variables;resource constraint, atmost constraint. Domains could be written as upper lower bounds;bound propagation \n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n **backtracking** search for CSP, depth first, happens when no available value for a variable,improved by domain- specific or independent heuristic;\n \nMinimum-remaining value heuristic,most constrained fail-first,reduce backtrack; degree heuristic,choose the variable with largest number of constraints,reduce branching factor.least-constraining-value heuristic, choose value roles out fewest choice, most likely.\n\nInterleaving search and inference : forward-checking and Maintaining Arc consistency,MAC recursively propogrates constraints, whereas forward checking does not;MAC is a way of interleaving search and inference. AC-3 is pure inference. backjumping to the conflict set; Constrained learning:record conflicts/no good. \n\n\n## AIMA Chapter 6.4 Local Search for CSPs\n Local search: min-conflict heuristic->select the value that results in the minimum number of conflicts with other variables;tabu search: keeping a small list of recently visited states and forbidding the algorithm to return to those states , deal plateau.constraint weighting aims to concentrate the search on the important constraints.  min conflict could use online setting;\n\n## AIMA Chapter 6.5 The Structure of Problems\n tree-structured CSP, cutset conditioning, cutoff size c time O(d^c (n-c)d^2); Tree decomposition,depend on tree width w, time O(nd^w). time consideration favors tree decomposition, but the advantage of the cycle-cutset approach is that it can be executed in linear memory, while tree decomposition requires memory exponential in w. symmetry-breaking constraint\n\n## Module 6 Lecture Notes\n The minimum-remaining-values and degree heuristics are domain-independent methods for deciding which variable to choose next in a backtracking search. The least- constraining-value heuristic helps in deciding which value to try first for a given variable. Backtracking occurs when no legal  assignment can be found for a variable.  AC3: Place all the arcs in a queue.  Pop arcs. For each arc, remove inconsistent values. If we change the values of  a node, add its arcs to the queue. Terminate when the queue is empty.\n\n\n## Module 6 Definitions\n* **Concept** - defination\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "RYESi2kMybL8"
      },
      "source": [
        "#Module 7 - Logical Agents"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qIRJ4YYCzNHL"
      },
      "source": [
        "# Russell and Norvig, AIMA Chapter 7 “Logical Agents” (Sections 7.1-7.5)\n",
        "\n",
        "chapter7_1 = \"\"\" A KB contains a set of sentence that are written in a knowledge representation\\\n",
        "language. Given sentences(axioms) and derived sentences.Also background knowledge.\\\n",
        "Ask and tell: way to add new sentence to KB and query what is known\\n\n",
        "Building agent, declarative:telling the agents; proedural:encodes behaviors by code\"\"\"\n",
        "chapter7_2 = \"\"\" PEAS definition: Performance measure,Environment,Actuator,Sensor  \"\"\"\n",
        "chapter7_3 = \"\"\"  Sentences are expressed according to the syntax of the representation language.\\\n",
        "Logic defines the semantics of sentences. The semantics define the truth of sentence to model.\\\n",
        "a sentence **a** is true in model,M(**a**) set of all models of **a**.logical entailment \\\n",
        "between sentences->a sentence follows logically from another sentence. Logic inference.\n",
        "\"\"\"\n",
        "chapter7_4 = \"\"\" not,and(disjunction),or(conjunction),implies,iif(if and only if)\\\n",
        "implies is true unless P is true but Q is false.\"\"\"\n",
        "chapter7_5 = \"\"\"Equivalance: commutativity and associativity of conj/disconj , demorgen:not inverse conj,disconj\\\n",
        "bidirectional eliminate: iif to 2-and implies , implication eliminate:(not a) or b , \n",
        "distributivity of conj/disconj over disconj/conj\\n\n",
        "Inference rule:  Equivalance + and eliminate. monotonicity KB entails **a**,KB and **b** still entail **a** \\n\n",
        "Search for a proof, proof by resolution; Conjunctive normal form\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module7_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module7_definitions = {\n",
        "\"knowledge base\" : \" KB,a set of sentences\",\n",
        "\"Inference\" : \"deriving new sentences from old\",\n",
        "\n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "lXNcHuKjyNXa",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 695
        },
        "outputId": "93712757-07ea-4f29-bfc9-b99b24b55981"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module7_sections = [\n",
        "  (\"AIMA Chapter 7.1 Knowledge-Based Agents\", chapter7_1),\n",
        "  (\"AIMA Chapter 7.2 The Wumpus World\", chapter7_2),\n",
        "  (\"AIMA Chapter 7.3 Logic\", chapter7_3),\n",
        "  (\"AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\", chapter7_4),\n",
        "  (\"AIMA 7.5 Propositional Theorem Proving\", chapter7_5),\n",
        "  (\"Module 7 Lecture Notes\", module7_lecture_notes),\n",
        "]\n",
        "\n",
        "module7_markdown = format_module(7, \"Logical Agents\", \n",
        "                         module7_sections, \n",
        "                         module7_definitions)\n",
        "display(Markdown(module7_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 7: Logical Agents\n## AIMA Chapter 7.1 Knowledge-Based Agents\n A KB contains a set of sentence that are written in a knowledge representationlanguage. Given sentences(axioms) and derived sentences.Also background knowledge.Ask and tell: way to add new sentence to KB and query what is known\n\nBuilding agent, declarative:telling the agents; proedural:encodes behaviors by code\n\n## AIMA Chapter 7.2 The Wumpus World\n PEAS definition: Performance measure,Environment,Actuator,Sensor  \n\n## AIMA Chapter 7.3 Logic\n  Sentences are expressed according to the syntax of the representation language.Logic defines the semantics of sentences. The semantics define the truth of sentence to model.a sentence **a** is true in model,M(**a**) set of all models of **a**.logical entailment between sentences->a sentence follows logically from another sentence. Logic inference.\n\n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n not,and(disjunction),or(conjunction),implies,iif(if and only if)implies is true unless P is true but Q is false.\n\n## AIMA 7.5 Propositional Theorem Proving\nEquivalance: commutativity and associativity of conj/disconj , demorgen:not inverse conj,disconjbidirectional eliminate: iif to 2-and implies , implication eliminate:(not a) or b , \ndistributivity of conj/disconj over disconj/conj\n\nInference rule:  Equivalance + and eliminate. monotonicity KB entails **a**,KB and **b** still entail **a** \n\nSearch for a proof, proof by resolution; Conjunctive normal form\n\n## Module 7 Lecture Notes\n Your summary here \n\n## Module 7 Definitions\n* **Knowledge base** -  KB,a set of sentences\n* **Inference** - deriving new sentences from old\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "vX7lbnJd4sT5"
      },
      "source": [
        "# Your Exam Notes\n",
        "\n",
        "Here are your full set of exam notes that you can use on your midterm.  Choose **Runtime > Run all**, then your notes will be displayed.\n",
        "\n",
        "If you are taking the exam in person, then you must print a copy of your notes for yourself.   Here's how to print:\n",
        "* Run the cell below. \n",
        "* Click its \"Mirror cell in tab\" button (this is located in the upper right corner of the cell, immediately to the right of the trash can).  This will open the cell.  \n",
        "* In Chrome, you can then print your notes using the **File > Print** option from the browser's menu.  \n",
        "* In the print options, change the layout from Landscape to Portrait. \n",
        "* Clicking the Save, will save a PDF that you can then print.\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "T3cm1WV542_a",
        "cellView": "code",
        "outputId": "8822f748-c1e3-425b-9e97-2a67cc67b12c"
      },
      "source": [
        "# This will generate the full set of notes that you can use for your exam.\n",
        "full_markdown = \"\\n\\n\".join([module1_markdown, \n",
        "                             module2_markdown, \n",
        "                             module3_markdown, \n",
        "                             module4_markdown, \n",
        "                             module5_markdown,\n",
        "                             module6_markdown,\n",
        "                             module7_markdown,]\n",
        "                       )\n",
        "display(Markdown(full_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\n Turing test: can machine think? need NLP,knowledge presentation,Automated reasoning,ML;total turing test:requires interaction with objects and people in the real world, needCV and robotics; \n\nSyllogisms or Logicist\n\n## AIMA Chapter 27.1 The Limits of AI\n weak AI acts like intelligent; strong AI actually really thinking. **Infomality** humans must be using some informal guidelines that could never be captured in a formal set of rules and thus could never be codified in a computer program.\n**disability** a machine can never do X. ** mathematical objection ** certain mathematical questions are in principle unanswerable by particular formal systems\n\n## AIMA Chapter 27.1 Can Machines Really Think?\n Alan Turing rejected the question “Can machines think?” and replaced it with a behavioral test. He anticipated many objections to the possibility of thinking machines. Few AI researchers pay attention to the Turing test, preferring to concentrate on their systems’ performance on practical tasks, rather than the ability to imitate humans.Consciousness remains a mystery. \n\n## AIMA 2.1 Agents and Environments\n  An agent’s percept sequence is the complete history of everything the agent has ever perceived. In general, an agent’s choice of action at any given instant can depend on its built-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived \n\nAn agent’s behavior is described by the **agent function** that maps any given percept sequence to an action. The agent function for an artificial agent will be implemented by an **agent program**.\n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n COnsequentialism:a performance measure. Rationality:\nThe performance measure that defines the criterion of success;The agent’s prior knowledge of the environment;The actions that the agent can perform;The agent’s percept sequence to date. Rational is not omniscience,rational->expect.A rational agent should be autonomous—it should learn what it can to compensate for partial or incorrect prior knowledge\n\n## AIMA 2.3 The Nature of Environments\n PEAS Performance, Environment, Actuators, Sensors;Fully/partial observaible,single/multi agents, (non)deterministic(stochastic), episodic/sequential, static/dynamic,discrete/continuous,known/unknown,\n\n## AIMA 2.4 The Structure of Agents\n agent = program+ architecture.\n\nThe agent program implements the  agent function. There exists a variety of basic agent program designs reflecting the kind of information made explicit and used in the decision process. The designs vary in efficiency, compactness, and flexibility. The appropriate design of the agent program depends on the nature of the environment.\n\narchitecture:Simple reflex agents respond directly to percepts, whereas model-based reflex agents maintain internal state to track aspects of the world that are not evident in the current percept. Goal-based agents act to achieve their goals, and utility-based agents try to maximize their own expected “happiness. \n\n## Module 1 Lecture Notes\n Your summary here \n\n## Module 1 Definitions\n* **Agent** - anything that can perceive and act in an environment\n* **Percept** -  the content an agent’s sensors are perceiving the content an agent’s sensors are perceivin\n* **Rational agents** - acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome  \n\n\n# Module 2: Python\n## Module 2 Lecture Notes\n All data treated as objects; Sequence: list,mutable(unhashable) string and tuple unmutable(hashable); Dictionary: key:value , key hashable, no add;  set:hashable, no repeated element, no add. \n\n Function: could return multiple value or default value,no overloading,\\*args and \\*\\*kwargs , could be assigned to variables, passed to other functions, returned. \n\n Class: function defined in class:method, magic method, inheritance. \n\n For loop : for \\<item\\> in \\<collection\\>: \\<statement\\> list comprehension;[\\<expression\\> for \\<name\\> in \\<seq\\> if \\<filter\\>]\n\n Iterator: __iter__() and __next__() method; generator : yield instead of return.\n\n\n \n\n## Module 2 Definitions\n* **Strong typing** - Every object has a fixed type, interpreter doesn’t allow things incompatible with that type\n* **Dynamic typing** - Variables come into existence when first assigned.If assigned again, type is updated\n* **Dynamic scope** - Function sees the most current value of variables\n\n\n# Module 3: Search Problems\n## AIMA Chapter 3.1 Problem-Solving Agents\n **solution**: fixed sequence of actions. **State space**:A set of possible states that the environment can be in; optimal solution has the lowest path cost among all solutions.\n\n## AIMA Chapter 3.2 Example Problems\n states; initial state; goal states; actions; transition model; action cost function; \n\n## AIMA Chapter 3.3 Search Algorithms\n search tree, node, frontier, reached; Best first search,expand with minimum evaluation function. Structure, queue:priority->Best first search,FIFO->breath first search, LIFO->depth first tree. Redundant path,graph search checks forredundant path thus faster, tree search doesn't check using less memory. Measurecompleteness:guaranteed to find a solution when there is one, and to correctly report failure when there is no,complexity(time space)how long/how much memory ,cost optimal,it find a solution with the lowest path cost of all solution; depth d branch factor b, maximum number of action m;\n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n BFS optimal complete O(b^d) in space and time ; Dijkstra or uniform -cost search, complete cost-optimal time and space O(b^1+C/epsilon) cost of optimal and lower bound of each action. DFS space O(bm) time O(b^m) not optimal or complete.Depth limited search limit depth l, time O(b^l) spaceO(bl) not complete or optimal depend on l. Iterative deepening search, space O(bd) for solution or O(bm) with no solution; bidirection search O(b^(d/2) complete optimal.)\n\n## Module 3 Lecture Notes\n Your summary here \n\n## Module 3 Definitions\n* **Problem-solving agent** - an agent that can formulate a plan via search\n\n\n# Module 4: Informed Search\n## AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\n informed search with a heuristic function: estimated cost of the cheapest path from the state at node n to a goal state. Greedy best-first search with lowest h(n),complete,not optimal, worst case O(|V|) best O(bm) . A* search f(n)=g(n)+h(n). An admissibile heuristic never over-estimates cost to the goal(optimistic). Consistency, triangle inequality;h(n)<=c(n,a,n')+h(n'). A* is efficient because it prunes away search tree nodes that are not necessary for finding an optimal solution. The number of nodes expanded can be exponential in the length of the solution. Weighted A* suboptimal but faster. Memory bounded search-> beam search, keep k best node;Iterative-deepening A* search,cut off at f-cost; Recursive best-first search,backed-up f value;RBFS is more efficient IDA*, but suffers from excessive node regeneration, optimal if the heuristic admissible.space complexity linear, time complex.SMA*(simplified bounded), drop worst when nodes exceeds memory limit.complete if there is reachable solution, optimal if any optimal solution reachable.\n\n\n## AIMA Chapter 3.6 Heuristic Functions\n**effective branching factor b** lower better; admissible h higher better, dominates. relaxed problem. Admissible heuristics can also be derived from the solution cost of a subproblem of a given problem, making landmark,learning from experience with the problem class.\n\n## Module 4 Lecture Notes\n Your summary here \n\n## Module 4 Definitions\n* **Concept** - definition\n\n\n# Module 5: Adversarial Search and Games\n## AIMA Chapter 5.1 Game Theory\n deterministic, two-player, turn-taking, perfect information,\\ \nzero-sum games. consist of initial state,action,transition model,terminal states utility function:the final numeric value to player when the game ends in terminal state.\n\n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n minimax search , assume both players play optimally; the minimax value is the utility in terminal state, highest value for max player and lowest value for min. Time O(b^m) space(bm) depth first search. Alpha-beta pruning; alpha best value for max, update under max and prune in min;beta lowest value for min;affected by moving order,best time O(b^m/2) worst O(b^m);could iterative deepen.Type As strategy:wide but shallow; B,deep but narrow.\n\n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n heuristic evalutaiton function returns an estimate of the expected  utility of state to player; cutting off search by **cutoff test**; Evaluation function should be applied only to **quiescent** position, no pending move that would swing the evalutaion. Horizen effect delay the unavoidable result, use singular extensions to mitigate. Forward pruning prunes saves computation time at the risk of making an error:beam search consider only n best move;probcut;late move reduction.\n\n## AIMA Chapter 5.5 Stochastic Games\n chance node,calculate expected value,expectiminimax time O(b^m n^m); \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n The principle of maximum expected utility says that a rational agent should choose the action that maximizes the agent’s expected utility \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n orderability, transitivity A>B B>C ->A>C,continuity A>B>C [p,A;1-p,C]~B , substitutability(indifferent) , monotonicity , decomposability. Preference->utility function \n\n## AIMA Chapter 16.3 Utility Functions\n Utility theory shows that an agent whose preferences between lotteries are consistent with a set of simple axioms can be described as possessing a utility function; furthermore, the agent selects actions as if maximizing its expected utility \n\n## Module 5 Lecture Notes\n The alpha–beta search algorithm computes the same optimal move as minimax, but achieves much greater efficiency by eliminating subtrees that are provably irrelevant. It's not feasible to consider the whole game tree, cut the search off and apply a heuristic evaluation function\n\n## Module 5 Definitions\n* **Concept** - definition\n\n\n# Module 6: Constraint Satisfaction Problems\n## AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\n Constraint satisfaction problems:represent state with a set of variable, value pairs and represent the conditions for solution by set of constraints \\ \non the variables.\n\nCSP deals with assignment, a solution is consistent, complete assignment;-> a constraint graph;reason->yield a natural representation;fast and  \nefficient;quickly prune.  unary constraint(node);binary constraint(arc); global constraint; preference constraints->constrained optimization problem; represent a state with a set of variable/value pairs. search->states are black boxes with a transition model to move,CSP the agent can see inside the states and move between states accordingly.\n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n CSP uses inference and search; inference constraint propagation; node/arc/path;k-consistency:for any set of k-1 variables and for any consistent assignment to the variables, a consistent value can be assigned to any k-th variables; strongly k-consistent if meet k,k-1...,1 consistent; bad side,could take n exponential time and space. global constraint involves any arbitrary number of variables;resource constraint, atmost constraint. Domains could be written as upper lower bounds;bound propagation \n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n **backtracking** search for CSP, depth first, happens when no available value for a variable,improved by domain- specific or independent heuristic;\n \nMinimum-remaining value heuristic,most constrained fail-first,reduce backtrack; degree heuristic,choose the variable with largest number of constraints,reduce branching factor.least-constraining-value heuristic, choose value roles out fewest choice, most likely.\n\nInterleaving search and inference : forward-checking and Maintaining Arc consistency,MAC recursively propogrates constraints, whereas forward checking does not;MAC is a way of interleaving search and inference. AC-3 is pure inference. backjumping to the conflict set; Constrained learning:record conflicts/no good. \n\n\n## AIMA Chapter 6.4 Local Search for CSPs\n Local search: min-conflict heuristic->select the value that results in the minimum number of conflicts with other variables;tabu search: keeping a small list of recently visited states and forbidding the algorithm to return to those states , deal plateau.constraint weighting aims to concentrate the search on the important constraints.  min conflict could use online setting;\n\n## AIMA Chapter 6.5 The Structure of Problems\n tree-structured CSP, cutset conditioning, cutoff size c time O(d^c (n-c)d^2); Tree decomposition,depend on tree width w, time O(nd^w). time consideration favors tree decomposition, but the advantage of the cycle-cutset approach is that it can be executed in linear memory, while tree decomposition requires memory exponential in w. symmetry-breaking constraint\n\n## Module 6 Lecture Notes\n The minimum-remaining-values and degree heuristics are domain-independent methods for deciding which variable to choose next in a backtracking search. The least- constraining-value heuristic helps in deciding which value to try first for a given variable. Backtracking occurs when no legal  assignment can be found for a variable.  AC3: Place all the arcs in a queue.  Pop arcs. For each arc, remove inconsistent values. If we change the values of  a node, add its arcs to the queue. Terminate when the queue is empty.\n\n\n## Module 6 Definitions\n* **Concept** - defination\n\n\n# Module 7: Logical Agents\n## AIMA Chapter 7.1 Knowledge-Based Agents\n A KB contains a set of sentence that are written in a knowledge representationlanguage. Given sentences(axioms) and derived sentences.Also background knowledge.Ask and tell: way to add new sentence to KB and query what is known\n\nBuilding agent, declarative:telling the agents; proedural:encodes behaviors by code\n\n## AIMA Chapter 7.2 The Wumpus World\n PEAS definition: Performance measure,Environment,Actuator,Sensor  \n\n## AIMA Chapter 7.3 Logic\n  Sentences are expressed according to the syntax of the representation language.Logic defines the semantics of sentences. The semantics define the truth of sentence to model.a sentence **a** is true in model,M(**a**) set of all models of **a**.logical entailment between sentences->a sentence follows logically from another sentence. Logic inference.\n\n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n not,and(disjunction),or(conjunction),implies,iif(if and only if)implies is true unless P is true but Q is false.\n\n## AIMA 7.5 Propositional Theorem Proving\nEquivalance: commutativity and associativity of conj/disconj , demorgen:not inverse conj,disconjbidirectional eliminate: iif to 2-and implies , implication eliminate:(not a) or b , \ndistributivity of conj/disconj over disconj/conj\n\nInference rule:  Equivalance + and eliminate. monotonicity KB entails **a**,KB and **b** still entail **a** \n\nSearch for a proof, proof by resolution; Conjunctive normal form\n\n## Module 7 Lecture Notes\n Your summary here \n\n## Module 7 Definitions\n* **Knowledge base** -  KB,a set of sentences\n* **Inference** - deriving new sentences from old\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    }
  ]
}