From ef6332ead611876edfa65d09f77d5bb1d0592f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Barrag=C3=A1n?= <4308533+rubenbarragan@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:36:08 -0700 Subject: [PATCH] Support loading files from Dropbox (#8271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This commit introduces the `DropboxLoader` class, a new document loader that allows loading files from Dropbox into the application. The loader relies on a Dropbox app, which requires creating an app on Dropbox, obtaining the necessary scope permissions, and generating an access token. Additionally, the dropbox Python package is required. The `DropboxLoader` class is designed to be used as a document loader for processing various file types, including text files, PDFs, and Dropbox Paper files. ## Dependencies `pip install dropbox` and `pip install unstructured` for PDF reading. ## Tag maintainer @rlancemartin, @eyurtsev (from Data Loaders). I'd appreciate some feedback here šŸ™ . ## Social Networks https://github.com/rubenbarragan https://www.linkedin.com/in/rgbarragan/ https://twitter.com/RubenBarraganP --------- Co-authored-by: Ruben Barragan --- .../integrations/dropbox.ipynb | 149 +++++++++++++++ .../langchain/document_loaders/__init__.py | 2 + .../langchain/document_loaders/dropbox.py | 172 ++++++++++++++++++ 3 files changed, 323 insertions(+) create mode 100644 docs/extras/modules/data_connection/document_loaders/integrations/dropbox.ipynb create mode 100644 libs/langchain/langchain/document_loaders/dropbox.py diff --git a/docs/extras/modules/data_connection/document_loaders/integrations/dropbox.ipynb b/docs/extras/modules/data_connection/document_loaders/integrations/dropbox.ipynb new file mode 100644 index 0000000000..43ec915b19 --- /dev/null +++ b/docs/extras/modules/data_connection/document_loaders/integrations/dropbox.ipynb @@ -0,0 +1,149 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Dropbox\n", + "\n", + "[Drobpox](https://en.wikipedia.org/wiki/Dropbox) is a file hosting service that brings everything-traditional files, cloud content, and web shortcuts together in one place.\n", + "\n", + "This notebook covers how to load documents from *Dropbox*. In addition to common files such as text and PDF files, it also supports *Dropbox Paper* files.\n", + "\n", + "## Prerequisites\n", + "\n", + "1. Create a Dropbox app.\n", + "2. Give the app these scope permissions: `files.metadata.read` and `files.content.read`.\n", + "3. Generate access token: https://www.dropbox.com/developers/apps/create.\n", + "4. `pip install dropbox` (requires `pip install unstructured` for PDF filetype).\n", + "\n", + "## Intructions\n", + "\n", + "`DropboxLoader`` requires you to create a Dropbox App and generate an access token. This can be done from https://www.dropbox.com/developers/apps/create. You also need to have the Dropbox Python SDK installed (pip install dropbox).\n", + "\n", + "DropboxLoader can load data from a list of Dropbox file paths or a single Dropbox folder path. Both paths should be relative to the root directory of the Dropbox account linked to the access token." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: dropbox in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (11.36.2)\n", + "Requirement already satisfied: requests>=2.16.2 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from dropbox) (2.31.0)\n", + "Requirement already satisfied: six>=1.12.0 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from dropbox) (1.16.0)\n", + "Requirement already satisfied: stone>=2 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from dropbox) (3.3.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from requests>=2.16.2->dropbox) (3.2.0)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from requests>=2.16.2->dropbox) (3.4)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from requests>=2.16.2->dropbox) (2.0.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from requests>=2.16.2->dropbox) (2023.7.22)\n", + "Requirement already satisfied: ply>=3.4 in /Users/rbarragan/.local/share/virtualenvs/langchain-kv0dsrF5/lib/python3.11/site-packages (from stone>=2->dropbox) (3.11)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "pip install dropbox" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.document_loaders import DropboxLoader" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate access token: https://www.dropbox.com/developers/apps/create.\n", + "dropbox_access_token = \"\"\n", + "# Dropbox root folder\n", + "dropbox_folder_path = \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "loader = DropboxLoader(\n", + " dropbox_access_token=dropbox_access_token,\n", + " dropbox_folder_path=dropbox_folder_path,\n", + " recursive=False\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "File /JHSfLKn0.jpeg could not be decoded as text. Skipping.\n", + "File /A REPORT ON WILESā€™ CAMBRIDGE LECTURES.pdf could not be decoded as text. Skipping.\n" + ] + } + ], + "source": [ + "documents = loader.load()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "page_content='# šŸŽ‰ Getting Started with Dropbox Paper\\nDropbox Paper is great for capturing ideas and gathering quick feedback from your team. You can use words, images, code, or media from other apps, or go ahead and connect your calendar and add to-dos for projects.\\n\\n*Explore and edit this doc to play with some of these features. This doc is all yours. No one will see your edits unless you share this doc.*\\n\\n\\n# The basics\\n\\n**Selecting text** activates the formatting toolbar, where you can apply basic formatting, create lists, and add comments.\\n\\n[ ] Create to-do lists\\n- Bulleted lists\\n1. Numbered lists\\n\\n**Starting a new line** activates the insert toolbar, where you can add media from other apps, links to Dropbox files, photos, and more.\\n\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523574441249_paper-insert.png)\\n\\n\\n\\n**Add emojis** to your doc or comment by typing `**:**` ****and choosing a character. \\n\\n# šŸ‘ šŸ‘Ž šŸ‘ āœ… āŒ ā¤ļø ā­ šŸ’” šŸ“Œ\\n\\n\\n# Images\\n\\n**Selecting images** activates the image toolbar, where you can align images left, center, right or expand them to full width.\\n\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523473869783_Hot_Sauce.jpg)\\n\\n\\nPaste images or gifs right next to each other and they\\'ll organize automatically. Click on an image twice to start full-screen gallery view.\\n\\n\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523564536543_Clock_Melt.png)\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523564528339_Boom_Box_Melt.png)\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523564549819_Soccerball_Melt.png)\\n\\n![You can add captions too](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523564518899_Cacti_Melt.png)\\n![What a strange, melting toaster!](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523564508553_Toaster_Melt.png)\\n\\n\\n \\n\\n\\n# Form meets function\\n\\nYou and your team can create the way you want, with what you want. Dropbox Paper adapts to the way your team captures ideas.\\n\\n**Add media from apps** like YouTube and Vimeo, or add audio from Spotify and SoundCloud. Files from Google Drive and Dropbox update automatically. Start a new line and choose add media, or drop in a link to try it out.\\n\\n\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523575138939_paper-embed.png)\\n\\n\\n\\n## YouTube\\nhttps://www.youtube.com/watch?v=fmsq1uKOa08&\\n\\n\\n[https://youtu.be/fmsq1uKOa08](https://youtu.be/fmsq1uKOa08)\\n\\n\\n\\n## SoundCloud\\nhttps://w.soundcloud.com/player/?url=https%3A%2F%2Fsoundcloud.com%2Ftycho%2Fspoon-inside-out-tycho-version&autoplay=false\\n\\n\\n[https://soundcloud.com/tycho/spoon-inside-out-tycho-version](https://soundcloud.com/tycho/spoon-inside-out-tycho-version) \\n\\n\\n\\n## Dropbox files\\nhttps://www.dropbox.com/s/bgi58tkovntch5e/Wireframe%20render.pdf?dl=0\\n\\n\\n\\n\\n## Code\\n\\n**Write code** in Dropbox Paper with automatic language detection and syntax highlighting. Start a new line and type three backticks (```).\\n\\n\\n public class HelloWorld { \\n public static void main(String[] args) { \\n System.out.println(\"Hello, World\");\\n }\\n }\\n\\n\\n\\n## Tables\\n\\n**Create a table** with the menu that shows up on the right when you start a new line.\\n\\n| To insert a row or column, hover over a dividing line and click the + | ā­ |\\n| ------------------------------------------------------------------------------------------------------- | ----- |\\n| To delete, select rows/columns and click the trash can | ā­ ā­ |\\n| To delete the entire table, click inside a cell, then click the dot in the top left corner of the table | ā­ ā­ ā­ |\\n\\n\\n\\n\\n\\n# Collaborate with people\\n\\n**Invite people to your doc** so they can view, comment, and edit. Invite anyone youā€™d likeā€”team members, contractors, stakeholdersā€”to give them access to your doc.\\n\\n![](https://paper-attachments.dropbox.com/s_72143DBFDAF4C9DE702BB246920BC47FE7E1FA76AC23CC699374430D94E96DD2_1523574876795_paper-invite.png)\\n\\n\\n**Make your docs discoverable to your team** by adding them to shared folders. Invite-only folders create more privacy.\\n\\n\\n## Comments\\n\\n**Add comments** on a single character, an entire document, or any asset by highlighting it. **Add stickers** by clicking the šŸ˜„ in the message box.\\n\\n\\n## To-dos\\n\\n**Bring someoneā€™s attention to a comment or to-do** by typing **@** and their name or email address. Reference a doc or folder by typing **+** and its name.\\n\\n[ ] Mentioning someone on a to-do assigns it to them and sends an email [@Patricia J](http://#)\\n[ ] Add a due date by clicking the calendar icon [@Jonathan C](http://#) [@Patricia J](http://#)\\n[ ] You can also mention docs [+šŸŽ‰ Getting Started with Dropbox Paper](http://#)\\n\\n\\n\\n# Go mobile\\n\\nEdit, create, and share Paper docs on Android or iOS phones and tablets. Download the apps in the [App Store](https://itunes.apple.com/us/app/paper-by-dropbox/id1126623662) and [Google Play Store](https://play.google.com/store/apps/details?id=com.dropbox.paper).\\n\\n\\n\\n# Help\\n\\n**Visit the** [**help center**](https://www.dropbox.com/help/topics/paper) for more about Dropbox Paper.\\n\\n**For more tips,** click the **?** in the bottom right of the screen and choose **Paper guide**.\\n\\n**Give us feedback** by selecting ā€œFeedbackā€ from the **?** in the bottom right of the screen. Weā€™d love to hear what you think. \\n\\n' metadata={'source': 'dropbox:///_ Getting Started with Dropbox Paper.paper', 'title': '_ Getting Started with Dropbox Paper.paper'}\n", + "page_content='# šŸ„‚ Toast to Droplets\\nā“ **Rationale:** Reflection, especially writing, is the key to deep learning! Letā€™s take a few minutes to reflect on your first day at Dropbox individually, and then one lucky person will have the chance to share their toast.\\n\\nāœļø **How to fill out this template:**\\n\\n- Option 1: You can sign in and then click ā€œCreate docā€ to make a copy of this template. Fill in the blanks!\\n- Option 2: If you donā€™t know your personal Dropbox login quickly, you can copy and paste this text into another word processing tool and start typing! \\n\\n\\n\\n## To my Droplet class:\\n\\nI feel so happy and excited to be making a toast to our newest Droplet class at Dropbox Basecamp.\\n\\nAt the beginning of our first day, I felt a bit underwhelmed with all information, and now, at the end of our first day at Dropbox, I feel I know enough for me to ramp up, but still a lot to learn**.**\\n\\nI canā€™t wait to explore every drl, but especially drl/(App Center)/benefits/allowance. I heard itā€™s so informative!\\n\\nDesigning an enlightened way of working is important, and to me, it means **a lot since I love what I do and I can help people around the globe**.\\n\\nI am excited to work with my team and flex my **technical and social** skills in my role as a **Software Engineer**.\\n\\nAs a Droplet, I pledge to:\\n\\n\\n1. Be worthy of trust by **working always with values and integrity**.\\n\\n\\n1. Keep my customers first by **caring about their happiness and the value that we provide as a company**.\\n\\n\\n1. Own it, keep it simple, and especially make work human by **providing value to people****.**\\n\\nCongrats, Droplets!\\n\\n' metadata={'source': 'dropbox:///_ Toast to Droplets.paper', 'title': '_ Toast to Droplets.paper'}\n", + "page_content='APPEARED IN BULLETIN OF THE AMERICAN MATHEMATICAL SOCIETY Volume 31, Number 1, July 1994, Pages 15-38\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n4 9 9 1\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nl u J\\n\\nAbstract. In lectures at the Newton Institute in June of 1993, Andrew Wiles announced a proof of a large part of the Taniyama-Shimura Conjecture and, as a consequence, Fermatā€™s Last Theorem. This report for nonexperts dis- cusses the mathematics involved in Wilesā€™ lectures, including the necessary background and the mathematical history.\\n\\n1\\n\\n] T N . h t a m\\n\\nIntroduction\\n\\nOn June 23, 1993, Andrew Wiles wrote on a blackboard, before an audience at the Newton Institute in Cambridge, England, that if p is a prime number, u, v, and w are rational numbers, and up + vp + wp = 0, then uvw = 0. In other words, he announced that he could prove Fermatā€™s Last Theorem. His announce- ment came at the end of his series of three talks entitled ā€œModular forms, elliptic curves, and Galois representationsā€ at the week-long workshop on ā€œp-adic Galois representations, Iwasawa theory, and the Tamagawa numbers of motivesā€.\\n\\n[\\n\\n1 v 0 2 2 7 0 4 9 / h t a m : v i X r a\\n\\nIn the margin of his copy of the works of Diophantus, next to a problem on\\n\\nPythagorean triples, Pierre de Fermat (1601ā€“1665) wrote:\\n\\nCubum autem in duos cubos, aut quadratoquadratum in duos quadrato- quadratos, et generaliter nullam in inļ¬nitum ultra quadratum potestatem in duos ejusdem nominis fas est dividere : cujus rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet.\\n\\n(It is impossible to separate a cube into two cubes, or a fourth power into two fourth powers, or in general, any power higher than the second into two like powers. I have discovered a truly marvelous proof of this, which this margin is too narrow to contain.)\\n\\nWe restate Fermatā€™s conjecture as follows.\\n\\nFermatā€™s Last Theorem. If n > 2, then an +bn = cn has no solutions in nonzero integers a, b, and c.\\n\\nA proof by Fermat has never been found, and the problem has remained open, inspiring many generations of mathematicians. Much of modern number theory has been built on attempts to prove Fermatā€™s Last Theorem. For details on the\\n\\nReceived by the editors November 29, 1993. 1991 Mathematics Subject Classiļ¬cation. Primary 11G05; Secondary 11D41, 11G18. The authors thank the National Science Foundation for ļ¬nancial support.\\n\\nc(cid:13)1994 American Mathematical Society 0273-0979/94 $1.00 + $.25 per page\\n\\n1\\n\\n2\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nhistory of Fermatā€™s Last Theorem (last because it is the last of Fermatā€™s questions to be answered) see [5], [6], and [26].\\n\\nWhat Andrew Wiles announced in Cambridge was that he could prove ā€œmanyā€ elliptic curves are modular, suļ¬ƒciently many to imply Fermatā€™s Last Theorem. In this paper we will explain Wilesā€™ work on elliptic curves and its connection with 1 we introduce elliptic curves and modularity, and Fermatā€™s Last Theorem. give the connection between Fermatā€™s Last Theorem and the Taniyama-Shimura Conjecture on the modularity of elliptic curves. In 2 we describe how Wiles re- duces the proof of the Taniyama-Shimura Conjecture to what we call the Modular Lifting Conjecture (which can be viewed as a weak form of the Taniyama-Shimura Conjecture), by using a theorem of Langlands and Tunnell. In 4 we show Ā§ how the Semistable Modular Lifting Conjecture is related to a conjecture of Mazur on deformations of Galois representations (Conjecture 4.2), and in 5 we describe Wilesā€™ method of attack on this conjecture. In order to make this survey as acces- sible as possible to nonspecialists, the more technical details are postponed as long as possible, some of them to the appendices.\\n\\nIn\\n\\nĀ§\\n\\nĀ§\\n\\n3 and Ā§\\n\\nĀ§\\n\\nMuch of this report is based on Wilesā€™ lectures in Cambridge. The authors apol- ogize for any errors we may have introduced. We also apologize to those whose mathematical contributions we, due to our incomplete understanding, do not prop- erly acknowledge.\\n\\nThe ideas Wiles introduced in his Cambridge lectures will have an important inļ¬‚uence on research in number theory. Because of the great interest in this subject and the lack of a publicly available manuscript, we hope this report will be useful to the mathematics community. In early December 1993, shortly before this paper went to press, Wiles announced that ā€œthe ļ¬nal calculation of a precise upper bound for the Selmer group in the semistable caseā€ (see 5.4 below) ā€œis not yet Ā§ complete as it stands,ā€ but that he believes he will be able to ļ¬nish it in the near future using the ideas explained in his Cambridge lectures. While Wilesā€™ proof of Theorem 5.3 below and Fermatā€™s Last Theorem depends on the calculation he referred to in his December announcement, Theorem 5.4 and Corollary 5.5 do not. Wilesā€™ work provides for the ļ¬rst time inļ¬nitely many modular elliptic curves over the rational numbers which are not isomorphic over the complex numbers (see 5.5 for an explicit inļ¬nite family).\\n\\n5.3 and\\n\\nĀ§\\n\\nĀ§\\n\\nNotation. The integers, rational numbers, complex numbers, and p-adic integers will be denoted Z, Q, C, and Zp, respectively. If F is a ļ¬eld, then ĀÆF denotes an algebraic closure of F .\\n\\n1. Connection between Fermatā€™s Last Theorem and elliptic curves\\n\\n1.1. Fermatā€™s Last Theorem follows from modularity of elliptic curves. Suppose Fermatā€™s Last Theorem were false. Then there would exist nonzero integers a, b, c, and n > 2 such that an + bn = cn. It is easy to see that no generality is lost by assuming that n is a prime greater than three (or greater than four million, by [2]; see [14] for n = 3 and 4) and that a and b are relatively prime. Write down the cubic curve:\\n\\ny2 = x(x + an)(x\\n\\nbn).\\n\\n(1)\\n\\nāˆ’\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n3\\n\\n1.4 we will explain what it means for an elliptic curve to be modular. Kenneth Ribet [27] proved that if n is a prime greater than three, a, b, and c are nonzero integers, and an + bn = cn, then the elliptic curve (1) is not modular. But the results announced by Wiles imply the following.\\n\\nIn\\n\\n1.3 we will see that such curves are elliptic curves, and in\\n\\nĀ§\\n\\nĀ§\\n\\nTheorem 1.1 (Wiles). If A and B are distinct, nonzero, relatively prime integers, and AB(A\\n\\nB) is divisible by 16, then the elliptic curve\\n\\nāˆ’\\n\\ny2 = x(x + A)(x + B)\\n\\nis modular.\\n\\nbn with a, b, c, and n coming from our hypothetical solution to a Fermat equation as above, we see that the conditions of Theorem 1.1 are satisļ¬ed since n 5 and one of a, b, and c is even. Thus Theorem 1.1 and Ribetā€™s result together imply Fermatā€™s Last Theorem!\\n\\nTaking A = an and B =\\n\\nāˆ’\\n\\nā‰„\\n\\n1.2. History. The story of the connection between Fermatā€™s Last Theorem and elliptic curves begins in 1955, when Yutaka Taniyama (1927ā€“1958) posed problems which may be viewed as a weaker version of the following conjecture (see [38]).\\n\\nTaniyama-Shimura Conjecture. Every elliptic curve over Q is modular.\\n\\nThe conjecture in the present form was made by Goro Shimura around 1962ā€“64 and has become better understood due to work of Shimura [33ā€“37] and of AndrĀ“e Weil [42] (see also [7]). The Taniyama-Shimura Conjecture is one of the major conjectures in number theory.\\n\\nBeginning in the late 1960s [15ā€“18], Yves Hellegouarch connected Fermat equa- tions an + bn = cn with elliptic curves of the form (1) and used results about Fer- matā€™s Last Theorem to prove results about elliptic curves. The landscape changed abruptly in 1985 when Gerhard Frey stated in a lecture at Oberwolfach that elliptic curves arising from counterexamples to Fermatā€™s Last Theorem could not be mod- ular [11]. Shortly thereafter Ribet [27] proved this, following ideas of Jean-Pierre Serre [32] (see [24] for a survey). In other words, ā€œTaniyama-Shimura Conjecture\\n\\nFermatā€™s Last Theoremā€. Thus, the stage was set. A proof of the Taniyama-Shimura Conjecture (or enough of it to know that elliptic curves coming from Fermat equations are modular) would be a proof of Fermatā€™s Last Theorem.\\n\\nā‡’\\n\\n1.3. Elliptic curves.\\n\\nDeļ¬nition. An elliptic curve over Q is a nonsingular curve deļ¬ned by an equation of the form\\n\\ny2 + a1xy + a3y = x3 + a2x2 + a4x + a6\\n\\n(2)\\n\\nwhere the coeļ¬ƒcients ai are integers. The solution ( on the elliptic curve.\\n\\n, āˆž\\n\\n) will be viewed as a point\\n\\nāˆž\\n\\n4\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nRemarks. (i) A singular point on a curve f (x, y) = 0 is a point where both partial derivatives vanish. A curve is nonsingular if it has no singular points.\\n\\n(ii) Two elliptic curves over Q are isomorphic if one can be obtained from the other by changing coordinates x = A2xā€² + B, y = A3yā€² + Cxā€² + D, with A, B, C, D\\n\\nQ and dividing through by A6.\\n\\nāˆˆ (iii) Every elliptic curve over Q is isomorphic to one of the form\\n\\ny2 = x3 + a2x2 + a4x + a6\\n\\nwith integers ai. A curve of this form is nonsingular if and only if the cubic on the right side has no repeated roots.\\n\\nExample. The equation y2 = x(x + 32)(x\\n\\n42) deļ¬nes an elliptic curve over Q.\\n\\nāˆ’\\n\\n1.4. Modularity. Let H denote the complex upper half plane C : Im(z) > 0 } where Im(z) is the imaginary part of z. If N is a positive integer, deļ¬ne a group of matrices\\n\\nz\\n\\n{\\n\\nāˆˆ\\n\\na b c d\\n\\nSL2(Z) : c is divisible by N\\n\\n.\\n\\nĪ“0(N ) =\\n\\nāˆˆ\\n\\n(z) = az+b The group Ī“0(N ) acts on H by linear fractional transformations cz+d . (cid:9) (cid:1) The quotient space H/Ī“0(N ) is a (noncompact) Riemann surface. It can be com- pleted to a compact Riemann surface, denoted X0(N ), by adjoining a ļ¬nite set of points called cusps. The cusps are the ļ¬nitely many equivalence classes of Q āˆž} under the action of Ī“0(N ) (see Chapter 1 of [35]). The complex points of an elliptic curve can also be viewed as a compact Riemann surface.\\n\\na b c d\\n\\n(cid:8)(cid:0)\\n\\n(cid:1)\\n\\n(cid:0)\\n\\ni\\n\\nāˆŖ{\\n\\nDeļ¬nition. An elliptic curve E is modular if, for some integer N , there is a holo- morphic map from X0(N ) onto E.\\n\\nExample. It can be shown that there is a (holomorphic) isomorphism from X0(15) onto the elliptic curve y2 = x(x + 32)(x\\n\\n42).\\n\\nāˆ’\\n\\nRemark . There are many equivalent deļ¬nitions of modularity (see II.4.D of [24] and appendix of [22]). In some cases the equivalence is a deep result. For Wilesā€™ 1.7 proof of Fermatā€™s Last Theorem it suļ¬ƒces to use only the deļ¬nition given in below.\\n\\nĀ§\\n\\nĀ§\\n\\n1.5. Semistability.\\n\\nDeļ¬nition. An elliptic curve over Q is semistable at the prime q if it is isomorphic to an elliptic curve over Q which modulo q either is nonsingular or has a singu- lar point with two distinct tangent directions. An elliptic curve over Q is called semistable if it is semistable at every prime.\\n\\nExample. The elliptic curve y2 = x(x + 32)(x isomorphic to y2 + xy + y = x3 + x2 x(x + 42)(x\\n\\n42) is semistable because it is āˆ’ 10, but the elliptic curve y2 =\\n\\n10x\\n\\nāˆ’\\n\\nāˆ’\\n\\n32) is not semistable (it is not semistable at 2).\\n\\nāˆ’\\n\\n2 we explain how Wiles shows that his main result on Galois representations (Theorem 5.3) implies the following part of the Taniyama-Shimura Conjecture.\\n\\nBeginning in\\n\\nĀ§\\n\\nSemistable Taniyama-Shimura Conjecture. Every semistable elliptic curve over Q is modular.\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n5\\n\\nProposition 1.2. The Semistable Taniyama-Shimura Conjecture implies Theorem 1.1.\\n\\nProof. If A and B are distinct, nonzero, relatively prime integers, write EA,B for the elliptic curve deļ¬ned by y2 = x(x + A)(x + B). Since EA,B and Eāˆ’A,āˆ’B are isomorphic over the complex numbers (i.e., as Riemann surfaces), EA,B is modular if and only if Eāˆ’A,āˆ’B is modular. If further AB(A B) is divisible by 16, then either EA,B or Eāˆ’A,āˆ’B is semistable (this is easy to check directly; see for example I.1 of [24]). The Semistable Taniyama-Shimura Conjecture now implies that both Ā§ EA,B and Eāˆ’A,āˆ’B are modular, and thus implies Theorem 1.1.\\n\\nāˆ’\\n\\nRemark . In 1.1 we saw that Theorem 1.1 and Ribetā€™s Theorem together imply Fermatā€™s Last Theorem. Therefore, the Semistable Taniyama-Shimura Conjecture implies Fermatā€™s Last Theorem.\\n\\nĀ§\\n\\n1.6. Modular forms. In this paper we will work with a deļ¬nition of modularity which uses modular forms.\\n\\nDeļ¬nition. If N is a positive integer, a modular form f of weight k for Ī“0(N ) is C which satisļ¬es a holomorphic function f : H\\n\\nā†’\\n\\nf (Ī³(z)) = (cz + d)kf (z)\\n\\na b c d\\n\\nH,\\n\\n(3)\\n\\nĪ“0(N ) and z\\n\\nfor every Ī³ =\\n\\nāˆˆ\\n\\nāˆˆ\\n\\n(cid:1)\\n\\n(cid:0)\\n\\nand is holomorphic at the cusps (see Chapter 2 of [35]).\\n\\n1 1 0 1\\n\\nĪ“0(N )), so āˆž n=0 ane2Ļ€inz, with complex numbers an and it has a Fourier expansion f (z) = (cid:1) . We say f is a cusp form if it with n vanishes at all the cusps; in particular for a cusp form the coeļ¬ƒcient a0 (the value at i\\n\\nA modular form f satisļ¬es f (z) = f (z + 1) (apply (3) to\\n\\nāˆˆ\\n\\n(cid:0)\\n\\n0 because f is holomorphic at the cusp i\\n\\nā‰„\\n\\nāˆž\\n\\nP\\n\\n) is zero. Call a cusp form normalized if a1 = 1.\\n\\nāˆž For ļ¬xed N there are commuting linear operators (called Hecke operators) Tm, 1, on the (ļ¬nite-dimensional) vector space of cusp forms of weight\\n\\nfor integers m two for Ī“0(N ) (see Chapter 3 of [35]). If f (z) =\\n\\nā‰„\\n\\nāˆž n=1 ane2Ļ€inz, then\\n\\nP danm/d2\\n\\nāˆž\\n\\ne2Ļ€inz\\n\\n(4)\\n\\nTmf (z) =\\n\\nn=1 X\\n\\n(d,N )=1 d|(n,m)\\n\\n(cid:0) X\\n\\n(cid:1)\\n\\nwhere (a, b) denotes the greatest common divisor of a and b and a b means that a divides b. The Hecke algebra T (N ) is the ring generated over Z by these operators.\\n\\n|\\n\\nDeļ¬nition. In this paper an eigenform will mean a normalized cusp form of weight two for some Ī“0(N ) which is an eigenfunction for all the Hecke operators.\\n\\nāˆž n=1 ane2Ļ€inz is an eigenform, then Tmf = amf for all m.\\n\\nBy (4), if f (z) =\\n\\nP\\n\\n6\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n1.7. Modularity, revisited. Suppose E is an elliptic curve over Q. If p is a prime, write Fp for the ļ¬nite ļ¬eld with p elements, and let E(Fp) denote the Fp- solutions of the equation for E (including the point at inļ¬nity). We now give a second deļ¬nition of modularity for an elliptic curve.\\n\\nDeļ¬nition. An elliptic curve E over Q is modular if there exists an eigenform\\n\\nāˆž n=1 ane2Ļ€inz such that for all but ļ¬nitely many primes q,\\n\\n#(E(Fq)).\\n\\n(5) P\\n\\naq = q + 1\\n\\nāˆ’ 2. An overview\\n\\nThe ļ¬‚ow chart shows how Fermatā€™s Last Theorem would follow if one knew the Semistable Modular Lifting Conjecture (Conjecture 2.1) for the primes 3 and 5. 1 we discussed the upper arrow, i.e., the implication ā€œSemistable Taniyama- In Ā§ Fermatā€™s Last Theoremā€. In this section we will discuss the Shimura Conjecture other implications in the ļ¬‚ow chart. The implication given by the lowest arrow is straightforward (Proposition 2.3), while the middle one uses an ingenious idea of Wiles (Proposition 2.4).\\n\\nā‡’\\n\\nFermatā€™s Last Theorem\\n\\nāœ»\\n\\nSemistable Taniyama-Shimura Conjecture\\n\\nāœ»\\n\\n(cid:0)\\n\\nā… ā…\\n\\n(cid:0)\\n\\nSemistable Taniyama-Shimura for ĀÆĻE,3 irreducible\\n\\nSemistable Modular Lifting for p = 5\\n\\nāœ»\\n\\n(cid:0) (cid:0)\\n\\nā…\\n\\nā…\\n\\nSemistable Modular Lifting for p = 3\\n\\nLanglands-Tunnell Theorem\\n\\nSemistable Modular Lifting Conjecture\\n\\nFermatā€™s Last Theorem .\\n\\nā‡’\\n\\nRemark . By the Modular Lifting Conjecture we will mean the Semistable Modular Lifting Conjecture with the hypothesis of semistability removed. The arguments of this section can also be used to show that the Modular Lifting Conjecture for p = 3 and 5, together with the Langlands-Tunnell Theorem, imply the full Taniyama- Shimura Conjecture.\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n7\\n\\n2.1. Semistable Modular Lifting. Let ĀÆQ denote the algebraic closure of Q in C, and let GQ be the Galois group Gal( ĀÆQ/Q). If p is a prime, write\\n\\nFƗ p\\n\\nĀÆĪµp : GQ\\n\\nā†’\\n\\nfor the character giving the action of GQ on the p-th roots of unity. For the facts about elliptic curves stated below, see [39]. If E is an elliptic curve over Q and F is a subļ¬eld of the complex numbers, there is a natural commutative group law on the set of F -solutions of E, with the point at inļ¬nity as the identity element. Denote this group E(F ). If p is a prime, write E[p] for the subgroup of points in E( ĀÆQ) of order dividing p. Then E[p] āˆ¼= F2 p. The action of GQ on E[p] gives a continuous representation\\n\\nGL2(Fp)\\n\\nĀÆĻE,p : GQ\\n\\nā†’\\n\\n(deļ¬ned up to isomorphism) such that\\n\\n(6)\\n\\ndet(ĀÆĻE,p) = ĀÆĪµp\\n\\nand for all but ļ¬nitely many primes q,\\n\\n#(E(Fq))\\n\\n(7)\\n\\ntrace(ĀÆĻE,p(Frobq))\\n\\nq + 1\\n\\n(mod p).\\n\\nā‰” (See Appendix A for the deļ¬nition of the Frobenius elements Frobq āˆˆ to each prime number q.)\\n\\nāˆ’\\n\\nGQ attached\\n\\nāˆž n=1 ane2Ļ€inz is an eigenform, let\\n\\nOf denote the ring of integers of the number ļ¬eld Q(a2, a3, . . . ). (Recall that our eigenforms are normalized so that a1 = 1.)\\n\\nIf f (z) =\\n\\nP\\n\\nThe following conjecture is in the spirit of a conjecture of Mazur (see Conjectures\\n\\n3.2 and 4.2).\\n\\nConjecture 2.1 (Semistable Modular Lifting Conjecture). Suppose p is an odd prime and E is a semistable elliptic curve over Q satisfying\\n\\n(a) ĀÆĻE,p is irreducible, (b) there are an eigenform f (z) =\\n\\nāˆž n=1 ane2Ļ€inz and a prime ideal Ī» of\\n\\nOf\\n\\nsuch that p\\n\\nĪ» and for all but ļ¬nitely many primes q,\\n\\nāˆˆ\\n\\nP\\n\\n#(E(Fq))\\n\\naq ā‰”\\n\\nq + 1\\n\\n(mod Ī»).\\n\\nāˆ’\\n\\nThen E is modular.\\n\\nThe Semistable Modular Lifting Conjecture is a priori weaker than the Semi- stable Taniyama-Shimura Conjecture because of the extra hypotheses (a) and (b). The more serious condition is (b); there is no known way to produce such a form in general. But when p = 3, the existence of such a form follows from the theorem below of Tunnell [41] and Langlands [20]. Wiles then gets around condition (a) by a clever argument (described below) which, when ĀÆĻE,3 is not irreducible, allows him to use p = 5 instead.\\n\\n8\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n2.2. Langlands-Tunnell Theorem. In order to state the Langlands-Tunnell Theorem, we need weight-one modular forms for a subgroup of Ī“0(N ). Let\\n\\na b c d\\n\\nSL2(Z) : c\\n\\n0 (mod N ), a\\n\\nd\\n\\n1 (mod N )\\n\\n.\\n\\nĪ“1(N ) =\\n\\nāˆˆ\\n\\nā‰”\\n\\nā‰”\\n\\nā‰”\\n\\n(cid:1)\\n\\n(cid:9)\\n\\n(cid:8)(cid:0)\\n\\nReplacing Ī“0(N ) by Ī“1(N ) in 1.6, one can deļ¬ne the notion of cusp forms on Ā§ Ī“1(N ). See Chapter 3 of [35] for the deļ¬nitions of the Hecke operators on the space of weight-one cusp forms for Ī“1(N ).\\n\\nTheorem 2.2 (Langlands-Tunnell). Suppose Ļ : GQ GL2(C) is a continuous irreducible representation whose image in PGL2(C) is a subgroup of S4 (the sym- metric group on four elements ), Ļ„ is complex conjugation, and det(Ļ(Ļ„ )) = 1. āˆž n=1 bne2Ļ€inz for some Ī“1(N ), which is an Then there is a weight-one cusp form eigenfunction for all the corresponding Hecke operators, such that for all but ļ¬nitely many primes q,\\n\\nā†’\\n\\nāˆ’\\n\\nP\\n\\n(8)\\n\\nbq = trace(Ļ(Frobq)).\\n\\nThe theorem as stated by Langlands [20] and by Tunnell [41] produces an auto- morphic representation rather than a cusp form. Using the fact that det(Ļ(Ļ„ )) = 1, standard techniques (see for example [12]) show that this automorphic repre-\\n\\nāˆ’ sentation corresponds to a weight-one cusp form as in Theorem 2.2.\\n\\n2.3. Semistable Modular Lifting\\n\\nSemistable Taniyama-Shimura.\\n\\nā‡’\\n\\nProposition 2.3. Suppose the Semistable Modular Lifting Conjecture is true for p = 3, E is a semistable elliptic curve, and ĀÆĻE,3 is irreducible. Then E is modular.\\n\\nProof. It suļ¬ƒces to show that hypothesis (b) of the Semistable Modular Lifting Conjecture is satisļ¬ed with the given curve E, for p = 3. There is a faithful representation\\n\\nGL2(Z[āˆš\\n\\nGL2(C)\\n\\nĻˆ : GL2(F3) ֒\\n\\n2])\\n\\nāˆ’\\n\\nāŠ‚\\n\\nā†’\\n\\nGL2(F3),\\n\\nsuch that for every g\\n\\nāˆˆ trace(Ļˆ(g))\\n\\n(mod(1 + āˆš\\n\\n(9)\\n\\ntrace(g)\\n\\n2))\\n\\nā‰”\\n\\nāˆ’\\n\\nand\\n\\n(10)\\n\\ndet(Ļˆ(g))\\n\\ndet(g)\\n\\n(mod 3).\\n\\nā‰”\\n\\nExplicitly, Ļˆ can be deļ¬ned on generators of GL2(F3) by\\n\\nāˆš\\n\\n1 1 1 0\\n\\n1 1 1 0\\n\\n1 1\\n\\n1 1\\n\\n2 1 1 0\\n\\n.\\n\\nĻˆ\\n\\n=\\n\\nand Ļˆ\\n\\n=\\n\\nāˆ’ āˆ’\\n\\nāˆ’ āˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\n(cid:19)\\n\\n(cid:18)(cid:18)\\n\\n(cid:19)(cid:19)\\n\\n(cid:18)\\n\\n(cid:18)(cid:18) ĀÆĻE,3. If Ļ„ is complex conjugation, then it follows from (6) and (10) that 1. The image of Ļˆ in PGL2(C) is a subgroup of PGL2(F3) āˆ¼= S4.\\n\\n(cid:19)\\n\\n(cid:19)(cid:19)\\n\\n(cid:18)\\n\\nLet Ļ = Ļˆ ā—¦ det(Ļ(Ļ„ )) = Using that ĀÆĻE,3 is irreducible, one can show that Ļ is irreducible.\\n\\nāˆ’\\n\\nāˆž n=1 bne2Ļ€inz be a weight-one cusp form for some Ī“1(N ) obtained by applying the Langlands-Tunnell\\n\\nLet p be a prime of ĀÆQ containing 1 + āˆš\\n\\n2. Let g(z) =\\n\\nāˆ’\\n\\nP\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n9\\n\\nTheorem (Theorem 2.2) to Ļ. It follows from (6) and (10) that N is divisible by 3. The function\\n\\n0 if d 1 if d 1 if d\\n\\n0 (mod 3), 1 (mod 3), 2 (mod 3)\\n\\nāˆž\\n\\nā‰” ā‰” ā‰”\\n\\nĻ‡(d)e2Ļ€inz where Ļ‡(d) =\\n\\nE(z) = 1 + 6\\n\\n\\uf8f1 \\uf8f2\\n\\nn=1 X\\n\\nXd|n\\n\\nāˆ’\\n\\nāˆž n=1 cne2Ļ€inz is a weight-one modular form for Ī“1(3). The product g(z)E(z) = It is now is a weight-two cusp form for Ī“0(N ) with cn ā‰” bn possible to ļ¬nd an eigenform f (z) = (mod p) for every n (see 6.10 and 6.11 of [4]). By (7), (8), and (9), f satisļ¬es (b) of the Semistable Modular Lifting Conjecture with p = 3 and with Ī» = p\\n\\n\\uf8f3\\n\\nbn (mod p) for all n. P n=1 ane2Ļ€inz on Ī“0(N ) such that an ā‰” āˆ© Of .\\n\\nāˆž\\n\\nP\\n\\nProposition 2.4 (Wiles). Suppose the Semistable Modular Lifting Conjecture is true for p = 3 and 5, E is a semistable elliptic curve over Q, and ĀÆĻE,3 is reducible. Then E is modular.\\n\\nProof. The elliptic curves over Q for which both ĀÆĻE,3 and ĀÆĻE,5 are reducible are all known to be modular (see Appendix B.1). Thus we can suppose ĀÆĻE,5 is irreducible. It suļ¬ƒces to produce an eigenform as in (b) of the Semistable Modular Lifting Conjecture, but this time there is no analogue of the Langlands-Tunnell Theorem to help. Wiles uses the Hilbert Irreducibility Theorem, applied to a parameter space of elliptic curves, to produce another semistable elliptic curve Eā€² over Q satisfying\\n\\n(i) ĀÆĻEā€²,5 is isomorphic to ĀÆĻE,5, and (ii) ĀÆĻEā€²,3 is irreducible.\\n\\n(In fact there will be inļ¬nitely many such Eā€²; see Appendix B.2.) Now by Proposi- āˆž n=1 ane2Ļ€inz be a corresponding eigenform. tion 2.3, Eā€² is modular. Let f (z) = Then for all but ļ¬nitely many primes q, P\\n\\n#(Eā€²(Fq)) trace(ĀÆĻE,5(Frobq))\\n\\naq = q + 1\\n\\ntrace(ĀÆĻEā€²,5(Frobq)) #(E(Fq)) q + 1\\n\\nāˆ’\\n\\nā‰” ā‰”\\n\\n(mod 5)\\n\\nā‰”\\n\\nāˆ’\\n\\nby (7). Thus the form f satisļ¬es hypothesis (b) of the Semistable Modular Lifting Conjecture, and we conclude that E is modular.\\n\\nTaken together, Propositions 2.3 and 2.4 show that the Semistable Modular Lifting Conjecture for p = 3 and 5 implies the Semistable Taniyama-Shimura Con- jecture.\\n\\n3. Galois representations\\n\\nThe next step is to translate the Semistable Modular Lifting Conjecture into a conjecture (Conjecture 3.2) about the modularity of liftings of Galois repre- sentations. Throughout this paper, if A is a topological ring, a representation GL2(A) will mean a continuous homomorphism and [Ļ] will denote the Ļ : GQ isomorphism class of Ļ. If p is a prime, let\\n\\nā†’\\n\\nZƗ p\\n\\nĪµp : GQ\\n\\nā†’\\n\\nbe the character giving the action of GQ on p-power roots of unity.\\n\\n10\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n3.1. The p-adic representation attached to an elliptic curve. Suppose E is an elliptic curve over Q and p is a prime number. For every positive integer n, write E[pn] for the subgroup in E( ĀÆQ) of points of order dividing pn and Tp(E) for the inverse limit of the E[pn] with respect to multiplication by p. For every n, E[pn] āˆ¼= (Z/pnZ)2, and so Tp(E) āˆ¼= Z2 p. The action of GQ induces a representation\\n\\nGL2(Zp)\\n\\nĻE,p : GQ\\n\\nā†’\\n\\nsuch that det(ĻE,p) = Īµp and for all but ļ¬nitely many primes q,\\n\\n#(E(Fq)).\\n\\n(11)\\n\\ntrace(ĻE,p(Frobq)) = q + 1\\n\\nāˆ’\\n\\nComposing ĻE,p with the reduction map from Zp to Fp gives ĀÆĻE,p of\\n\\n2.1. Ā§\\n\\n3.2. Modular representations. If f is an eigenform and Ī» is a prime ideal of Of at Ī». Of , let\\n\\nOf,Ī» denote the completion of\\n\\nDeļ¬nition. If A is a ring, a representation Ļ : GQ if there are an eigenform f (z) = homomorphism Ī¹ :\\n\\nGL2(A) is called modular āˆž n=1 ane2Ļ€inz, a ring Aā€² containing A, and a\\n\\nā†’\\n\\nAā€² such that for all but ļ¬nitely many primes q,\\n\\nOf ā†’\\n\\nP\\n\\ntrace(Ļ(Frobq)) = Ī¹(aq).\\n\\nāˆž n=1 ane2Ļ€inz and a prime ideal Ī» of\\n\\nExamples. (i) Given an eigenform f (z) = Of , Eichler and Shimura (see\\n\\n7.6 of [35]) constructed a representation\\n\\nĀ§\\n\\nP\\n\\nĻf,Ī» : GQ\\n\\nGL2(\\n\\nOf,Ī»)\\n\\nā†’\\n\\nZ = pZ) and for all but ļ¬nitely many primes q,\\n\\nsuch that det(Ļf,Ī») = Īµp (where Ī»\\n\\nāˆ©\\n\\n(12)\\n\\ntrace(Ļf,Ī»(Frobq)) = aq.\\n\\nThus Ļf,Ī» is modular with Ī¹ taken to be the inclusion of\\n\\nOf in\\n\\nOf,Ī».\\n\\n(ii) Suppose p is a prime and E is an elliptic curve over Q. If E is modular, then ĻE,p and ĀÆĻE,p are modular by (11), (7), and (5). Conversely, if ĻE,p is modular, then it follows from (11) that E is modular. This proves the following.\\n\\nTheorem 3.1. Suppose E is an elliptic curve over Q. Then\\n\\nE is modular\\n\\nĻE,p is modular for every p\\n\\nĻE,p is modular for one p.\\n\\nā‡”\\n\\nā‡”\\n\\nRemark . In this language, the Semistable Modular Lifting Conjecture says that if p is an odd prime, E is a semistable elliptic curve over Q, and ĀÆĻE,p is modular and irreducible, then ĻE,p is modular.\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n11\\n\\n3.3. Liftings of Galois representations. Fix a prime p and a ļ¬nite ļ¬eld k of characteristic p. Recall that ĀÆk denotes an algebraic closure of k.\\n\\nGiven a map Ļ† : A\\n\\nB, the induced map from GL2(A) to GL2(B) will also be\\n\\nā†’\\n\\ndenoted Ļ†. If Ļ : GQ Aā€² for the composition of Ļ with the inclusion of GL2(A) in GL2(Aā€²).\\n\\nGL2(A) is a representation and Aā€² is a ring containing A, we write\\n\\nā†’\\n\\nĻ\\n\\nāŠ—\\n\\nDeļ¬nition. If ĀÆĻ : GQ Ļ : GQ Zp-algebra and there exists a homomorphism Ī¹ : A\\n\\nGL2(k) is a representation, we say that a representation GL2(A) is a lifting of ĀÆĻ (to A) if A is a complete noetherian local\\n\\nā†’\\n\\nā†’\\n\\nĀÆk such that the diagram\\n\\nā†’ GL2(A)\\n\\nāœŸāœŸāœÆ\\n\\n[Ļ]\\n\\nāœŸāœŸ\\n\\nĪ¹ ā„ GL2(ĀÆk)\\n\\nāœ²\\n\\nGQ\\n\\n[ ĀÆĻ āŠ— ĀÆk]\\n\\nĀÆk].\\n\\ncommutes, in the sense that [Ī¹\\n\\nĻ] = [ĀÆĻ\\n\\n\\n\\nāŠ—\\n\\nExamples. (i) If E is an elliptic curve then ĻE,p is a lifting of ĀÆĻE,p.\\n\\n(ii) If E is an elliptic curve, p is a prime, and hypotheses (a) and (b) of Conjecture\\n\\n2.1 hold with an eigenform f and prime ideal Ī», then Ļf,Ī» is a lifting of ĀÆĻE,p.\\n\\n3.4. Deformation data. We will be interested not in all liftings of a given ĀÆĻ, but rather in those satisfying various restrictions. See Appendix A for the deļ¬nition of GQ associated to primes q. We say that a representation Ļ the inertia groups Iq āŠ‚ of GQ is unramiļ¬ed at a prime q if Ļ(Iq) = 1. If Ī£ is a set of primes, we say Ļ is unramiļ¬ed outside of Ī£ if Ļ is unramiļ¬ed at every q / āˆˆ\\n\\nĪ£.\\n\\nDeļ¬nition. By deformation data we mean a pair\\n\\n= (Ī£, t)\\n\\nD where Ī£ is a ļ¬nite set of primes and t is one of the words ordinary or ļ¬‚at.\\n\\nZƗ\\n\\nAƗ be the composition of the\\n\\nIf A is a Zp-algebra, let ĪµA : GQ\\n\\np ā†’\\n\\nā†’\\n\\ncyclotomic character Īµp with the structure map.\\n\\nDeļ¬nition. Given deformation data type- outside of Ī£, and Ļ is t at p (where t\\n\\nGL2(A) is if A is a complete noetherian local Zp-algebra, det(Ļ) = ĪµA, Ļ is unramiļ¬ed\\n\\n, a representation Ļ : GQ\\n\\nD\\n\\nā†’\\n\\nD\\n\\nordinary, ļ¬‚at }\\n\\n; see Appendix C).\\n\\nāˆˆ {\\n\\nDeļ¬nition. A representation ĀÆĻ : GQ eigenform f and a prime ideal Ī» of\\n\\nmodular if there are an\\n\\nGL2(k) is Of such that Ļf,Ī» is a type-\\n\\nā†’\\n\\nD\\n\\nlifting of ĀÆĻ.\\n\\nD\\n\\nRemarks. (i) A representation with a type- fore if a representation is\\n\\nlifting must itself be type-\\n\\n. There-\\n\\nD\\n\\nD and modular.\\n\\nmodular, then it is both type-\\n\\nD\\n\\nD\\n\\n(ii) Conversely, if ĀÆĻ is type-\\n\\n, modular, and satisļ¬es (ii) of Theorem 5.3 below, -modular, by work of Ribet and others (see [28]). This plays an important\\n\\nD\\n\\nthen ĀÆĻ is D role in Wilesā€™ work.\\n\\n12\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n3.5. Mazur Conjecture.\\n\\nDeļ¬nition. A representation ĀÆĻ : GQ ĀÆĻ\\n\\nGL2(k) is called absolutely irreducible if\\n\\nā†’\\n\\nĀÆk is irreducible.\\n\\nāŠ—\\n\\nThe following variant of a conjecture of Mazur (see Conjecture 18 of [23]; see\\n\\nalso Conjecture 4.2 below) implies the Semistable Modular Lifting Conjecture.\\n\\nConjecture 3.2 (Mazur). Suppose p is an odd prime, k is a ļ¬nite ļ¬eld of charac- GL2(k) is an absolutely irreducible teristic p, lifting of ĀÆĻ to the ring of integers of\\n\\nis deformation data, and ĀÆĻ : GQ -modular representation. Then every type-\\n\\nD\\n\\nā†’ D\\n\\nD a ļ¬nite extension of Qp is modular.\\n\\nRemark . Loosely speaking, Conjecture 3.2 says that if ĀÆĻ is modular, then every lifting which ā€œlooks modularā€ is modular.\\n\\nDeļ¬nition. An elliptic curve E over Q has good (respectively, bad ) reduction at a prime q if E is nonsingular (respectively, singular) modulo q. An elliptic curve E over Q has ordinary (respectively, supersingular) reduction at q if E has good reduction at q and E[q] has (respectively, does not have) a subgroup of order q stable under the inertia group Iq.\\n\\nProposition 3.3. Conjecture 3.2 implies Conjecture 2.1.\\n\\nProof. Suppose p is an odd prime and E is a semistable elliptic curve over Q which satisļ¬es (a) and (b) of Conjecture 2.1. We will apply Conjecture 3.2 with ĀÆĻ = ĀÆĻE,p. Write Ļ„ for complex conjugation. Then Ļ„ 2 = 1, and by (6), det(ĀÆĻE,p(Ļ„ )) = 1. Since ĀÆĻE,p is irreducible and p is odd, a simple linear algebra argument now shows that ĀÆĻE,p is absolutely irreducible.\\n\\nāˆ’\\n\\nSince E satisļ¬es (b) of Conjecture 2.1, ĀÆĻE,p is modular. Let\\n\\nĪ£ = t = ordinary if E has ordinary or bad reduction at p, t = ļ¬‚at if E has supersingular reduction at p,\\n\\np\\n\\nprimes q : E has bad reduction at q\\n\\n,\\n\\nā€¢\\n\\n{\\n\\n} āˆŖ {\\n\\n}\\n\\n= (Ī£, t).\\n\\nD\\n\\nUsing the semistability of E, one can show that ĻE,p is a type- (by combining results of several people; see [28]) that ĀÆĻE,p is 3.2 then says ĻE,p is modular. By Theorem 3.1, E is modular.\\n\\nlifting of ĀÆĻE,p and -modular. Conjecture\\n\\nD\\n\\nD\\n\\n4. Mazurā€™s deformation theory\\n\\nNext we reformulate Conjecture 3.2 as a conjecture (Conjecture 4.2) that the algebras which parametrize liftings and modular liftings of a given representation are isomorphic. It is this form of Mazurā€™s conjecture that Wiles attacks directly.\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n13\\n\\n4.1. The universal deformation algebra R. Fix an odd prime p, a ļ¬nite ļ¬eld k of characteristic p, deformation data representation ĀÆĻ : GQ extension of Qp with residue ļ¬eld k.\\n\\n, and an absolutely irreducible type-\\n\\nD\\n\\nD is the ring of integers of a ļ¬nite\\n\\nGL2(k). Suppose\\n\\nā†’\\n\\nO\\n\\nDeļ¬nition. We say Ļ : GQ complete noetherian local commutes\\n\\n)-lifting of ĀÆĻ if Ļ is type-\\n\\n, A is a ā†’ -algebra with residue ļ¬eld k, and the following diagram\\n\\nGL2(A) is a (\\n\\n,\\n\\nD\\n\\nO\\n\\nD\\n\\nO\\n\\nGL2(A)\\n\\nāœŸāœŸāœÆ\\n\\n[Ļ]\\n\\nāœŸāœŸ\\n\\nā„ GL2(k)\\n\\nāœ²\\n\\nGQ\\n\\n[ ĀÆĻ]\\n\\nwhere the vertical map is reduction modulo the maximal ideal of A.\\n\\nTheorem 4.1 (Mazur-Ramakrishna). With p, k, an that for every ( Ļ†Ļ : R\\n\\nas above, there are D GL2(R) of ĀÆĻ, with the property -algebra homomorphism\\n\\n, ĀÆĻ, and\\n\\nO\\n\\nalgebra R and a (\\n\\n)-lifting ĻR : GQ )-lifting Ļ of ĀÆĻ to A there is a unique\\n\\n,\\n\\nO\\n\\nD\\n\\nO\\n\\nā†’\\n\\n,\\n\\nD\\n\\nO\\n\\nO\\n\\nA such that the diagram\\n\\nā†’\\n\\n[ĻR]\\n\\nāœ²\\n\\nGQ\\n\\nGL2(R)\\n\\nā\\n\\nāā\\n\\nĻ†Ļ ā„ GL2(A)\\n\\n[Ļ]\\n\\nāāā„\\n\\ncommutes.\\n\\nThis theorem was proved by Mazur [21] in the case when\\n\\nis ordinary and is ļ¬‚at. Theorem 4.1 determines R and ĻR up to\\n\\nD\\n\\nby Ramakrishna [25] when isomorphism.\\n\\nD\\n\\n4.2. The universal modular deformation algebra T. Fix an odd prime p, a , and an absolutely irreducible ļ¬nite ļ¬eld k of characteristic p, deformation data -modular, and ļ¬x an type- representation ĀÆĻ : GQ eigenform f and a prime ideal Ī» of lifting of ĀÆĻ. is the ring of integers of a ļ¬nite extension of Qp with Suppose in addition that residue ļ¬eld k, Of,Ī» āŠ† O\\n\\nD\\n\\nGL2(k). Assume ĀÆĻ is\\n\\nD\\n\\nā†’\\n\\nD\\n\\nOf such that Ļf,Ī» is a type-\\n\\nD\\n\\nO , and the diagram\\n\\nGL2(\\n\\nOf,Ī») ā„ GL2(k)\\n\\nāœŸāœŸāœŸāœÆ āœ²\\n\\n[Ļf,Ī»] āœŸ\\n\\nGQ\\n\\n[ ĀÆĻ]\\n\\ncommutes, where the vertical map is the reduction map.\\n\\n)-lifting of ĀÆĻ, and Wiles constructs a generalized Hecke algebra T which has the following properties (recall that Hecke algebras T (N ) were deļ¬ned in\\n\\nUnder these assumptions Ļf,Ī» āŠ— O 1.6).\\n\\nis a (\\n\\n,\\n\\nD\\n\\nO\\n\\nĀ§\\n\\n(T1) T is a complete noetherian local\\n\\nalgebra with residue ļ¬eld k.\\n\\nO\\n\\n14\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n(T2) There are an integer N divisible only by primes in Ī£ and a homomorphism by the Ī£. By abuse of notation\\n\\nfrom the Hecke algebra T (N ) to T such that T is generated over images of the Hecke operators Tq for primes q / āˆˆ we write Tq also for its image in T.\\n\\nO\\n\\n(T3) There is a (\\n\\n,\\n\\n)-lifting\\n\\nD\\n\\nO\\n\\nGL2(T)\\n\\nĻT : GQ\\n\\nā†’\\n\\nof ĀÆĻ with the property that trace(ĻT(Frobq)) = Tq for every prime q / āˆˆ\\n\\nĪ£. )-lifting of ĀÆĻ to A, then there is a unique\\n\\n(T4) If Ļ is modular and is a (\\n\\n,\\n\\nD\\n\\nO\\n\\nalgebra homomorphism ĻˆĻ : T\\n\\nA such that the diagram\\n\\nO\\n\\nā†’ [Ļ T]\\n\\nāœ²\\n\\nGL2(T)\\n\\nGQ\\n\\nā\\n\\nāā\\n\\nĻˆĻ ā„ GL2(A)\\n\\n[Ļ]\\n\\nāāā„\\n\\ncommutes.\\n\\nSince ĻT is a (\\n\\n,\\n\\n)-lifting of ĀÆĻ, by Theorem 4.1 there is a homomorphism\\n\\nD\\n\\nO\\n\\nT\\n\\nĻ• : R\\n\\nā†’\\n\\nĻR. By (T3), Ļ•(trace(ĻR(Frobq))) = Tq for every\\n\\nsuch that ĻT is isomorphic to Ļ• prime q / āˆˆ\\n\\nĪ£, so it follows from (T2) that Ļ• is surjective.\\n\\n4.3. Mazur Conjecture, revisited. Conjecture 3.2 can be reformulated in the following way.\\n\\nConjecture 4.2 (Mazur). Suppose p, k, T is an isomorphism. above map Ļ• : R\\n\\n, ĀÆĻ, and\\n\\nare as in\\n\\n4.2. Then the\\n\\nD\\n\\nO\\n\\nĀ§\\n\\nā†’\\n\\nConjecture 4.2 was stated in [23] (Conjecture 18) for\\n\\nordinary, and Wiles\\n\\nD\\n\\nmodiļ¬ed the conjecture to include the ļ¬‚at case.\\n\\nProposition 4.3. Conjecture 4.2 implies Conjecture 3.2.\\n\\nProof. Suppose ĀÆĻ : GQ -modular, A is D the ring of integers of a ļ¬nite extension of Qp, and Ļ is a type- lifting of ĀÆĻ to A. to be the ring of integers of a suļ¬ƒciently large ļ¬nite extension of Qp, and Taking and its residue ļ¬eld, respectively, we may assume that Ļ is extending Ļ and ĀÆĻ to A, with Ļ†Ļ a ( as in Theorem 4.1. By (T3) and Theorem 4.1, Ļˆ(Tq) = trace(Ļ(Frobq)) for all but 3.5 of [35], given such a homomorphism Ļˆ (and viewing A as ļ¬nitely many q. By āˆž n=1 ane2Ļ€inz where aq = Ļˆ(Tq) for all but a subring of C), there is an eigenform ļ¬nitely many primes q. Thus Ļ is modular.\\n\\nGL2(k) is absolutely irreducible and\\n\\nā†’\\n\\nD\\n\\nO )-lifting of ĀÆĻ. Assuming Conjecture 4.2, let Ļˆ = Ļ†Ļ ā—¦\\n\\nO\\n\\nĻ•āˆ’1 : T\\n\\n,\\n\\nD\\n\\nO\\n\\nā†’\\n\\nĀ§\\n\\nP\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n15\\n\\n5. Wilesā€™ approach to the Mazur Conjecture\\n\\nIn this section we sketch the major ideas of Wilesā€™ attack on Conjecture 4.2. The ļ¬rst step (Theorem 5.2), and the key to Wilesā€™ proof, is to reduce Conjecture 4.2 to a bound on the order of the cotangent space at a prime of R. In 5.2 we Ā§ see that the corresponding tangent space is a Selmer group, and in 5.3 we outline a general procedure due to Kolyvagin for bounding sizes of Selmer groups. The input for Kolyvaginā€™s method is known as an Euler system. The most diļ¬ƒcult 5.4), and the part described as ā€œnot yet completeā€ in his part of Wilesā€™ work ( Ā§ December announcement, is his construction of a suitable Euler system. In 5.5 we state the results announced by Wiles (Theorems 5.3 and 5.4 and Corollary 5.5) and explain why Theorem 5.3 suļ¬ƒces for proving the Semistable Taniyama-Shimura Conjecture. As an application of Corollary 5.5 we write down an inļ¬nite family of modular elliptic curves. , ĀÆĻ, 5 ļ¬x p, k,\\n\\nĀ§\\n\\nĀ§\\n\\nāˆž n=1 ane2Ļ€inz, and Ī» as in\\n\\n4.2.\\n\\nFor O By property (T4) there is a homomorphism\\n\\n, f (z) =\\n\\nĀ§\\n\\nĀ§\\n\\nD\\n\\nP\\n\\nĻ€ : T\\n\\nā†’ O . By property (T2) and (12), Ļ€ satisļ¬es\\n\\nsuch that Ļ€ Ļ€(Tq) = aq for all but ļ¬nitely many q.\\n\\nĻT is isomorphic to Ļf,Ī» āŠ— O\\n\\n\\n\\n5.1. Key reduction. Wiles uses the following generalization of a theorem of Mazur, which says that T is Gorenstein.\\n\\nTheorem 5.1. There is a (noncanonical ) T-module isomorphism\\n\\n) āˆ¼ ā†’\\n\\nHomO(T,\\n\\nT.\\n\\nO\\n\\nLet Ī· denote the ideal of\\n\\ngenerated by the image under the composition\\n\\nO HomO(T,\\n\\n) āˆ¼ ā†’\\n\\nT Ļ€\\n\\nO\\n\\nā†’ O\\n\\nHomO(T,\\n\\nof the element Ļ€ āˆˆ choice of isomorphism in Theorem 5.1.\\n\\n). The ideal Ī· is well deļ¬ned independent of the\\n\\nO\\n\\nThe map Ļ€ determines distinguished prime ideals of T and R,\\n\\nĻ•) = Ļ•āˆ’1(pT).\\n\\npT = ker(Ļ€),\\n\\npR = ker(Ļ€\\n\\n\\n\\nTheorem 5.2 (Wiles). If\\n\\n#(pR/p2\\n\\nR)\\n\\n#(\\n\\n/Ī·) <\\n\\n, āˆž\\n\\nā‰¤\\n\\nO\\n\\nT is an isomorphism.\\n\\nthen Ļ• : R\\n\\nā†’\\n\\nThe proof is entirely commutative algebra. The surjectivity of Ļ• shows that /Ī·). Thus if\\n\\n#(pR/p2 #(pR/p2\\n\\n#(pT/p2 #(\\n\\nT), and Wiles proves that #(pT/p2\\n\\nR) R)\\n\\nT)\\n\\n#(\\n\\nā‰„ ā‰¤\\n\\nā‰„\\n\\nO\\n\\n/Ī·), then\\n\\nO\\n\\n#(pR/p2\\n\\nR) = #(pT/p2\\n\\n(13)\\n\\nT) = #(\\n\\n/Ī·).\\n\\nO\\n\\nThe ļ¬rst equality in (13) shows that Ļ• induces an isomorphism of tangent spaces. Wiles uses the second equality in (13) and Theorem 5.1 to deduce that T is a local\\n\\n16\\n\\nK. RUBIN AND A. SILVERBERG\\n\\ncomplete intersection over that\\n\\n(that is, there are f1, . . . , fr āˆˆ O\\n\\n[[x1, . . . , xr]] such\\n\\nO\\n\\nT āˆ¼=\\n\\n[[x1, . . . , xr]]/(f1, . . . , fr)\\n\\nO\\n\\nas morphism.\\n\\nalgebras). Wiles then combines these two results to prove that Ļ• is an iso-\\n\\nO\\n\\n5.2. Selmer groups. In general, if M is a torsion GQ-module, a Selmer group attached to M is a subgroup of the Galois cohomology group H 1(GQ, M ) deter- mined by certain ā€œlocal conditionsā€ in the following way. If q is a prime with decomposition group Dq āŠ‚\\n\\nGQ, then there is a restriction map\\n\\nresq : H 1(GQ, M )\\n\\nH 1(Dq, M ).\\n\\nā†’ Jq āŠ†\\n\\nH 1(Dq, M ) : q prime\\n\\n= For a ļ¬xed collection of subgroups { the particular problem under consideration, the corresponding Selmer group is\\n\\ndepending on\\n\\nJ\\n\\n}\\n\\nresāˆ’1\\n\\nH 1(GQ, M ).\\n\\nS(M ) =\\n\\nq (Jq)\\n\\nāŠ†\\n\\nq \\\\ Write H i(Q, M ) for H i(GQ, M ), and H i(Qq, M ) for H i(Dq, M ).\\n\\nExample. The original examples of Selmer groups come from elliptic curves. Fix an elliptic curve E and a positive integer m, and take M = E[m], the subgroup of points in E( ĀÆQ) of order dividing m. There is a natural inclusion\\n\\nH 1(Q, E[m])\\n\\nE(Q)/mE(Q) ֒\\n\\n(14)\\n\\nā†’\\n\\nE( ĀÆQ) is any\\n\\nE(Q) to the cocycle Ļƒ\\n\\nobtained by sending x point satisfying my = x. Similarly, for every prime q there is a natural inclusion\\n\\nĻƒ(y)\\n\\ny, where y\\n\\nāˆˆ\\n\\n7ā†’\\n\\nāˆ’\\n\\nāˆˆ\\n\\nH 1(Qq, E[m]).\\n\\nE(Qq)/mE(Qq) ֒\\n\\nā†’ Deļ¬ne the Selmer group S(E[m]) in this case by taking the group Jq to be the image of E(Qq)/mE(Qq) in H 1(Qq, E[m]), for every q. This Selmer group is an important tool in studying the arithmetic of E because it contains (via (14)) E(Q)/mE(Q).\\n\\n5, let m denote the maximal ideal /mn) can be\\n\\nRetaining the notation from the beginning of\\n\\nĀ§\\n\\nand ļ¬x a positive integer n. The tangent space HomO(pR/p2 R,\\n\\nof identiļ¬ed with a Selmer group as follows. Let Vn be the matrix algebra M2(\\n\\nO\\n\\nO\\n\\n/mn), with GQ acting via the adjoint repre-\\n\\nO\\n\\nsentation Ļƒ(B) = Ļf,Ī»(Ļƒ)BĻf,Ī»(Ļƒ)āˆ’1. There is a natural injection\\n\\ns : HomO(pR/p2 R,\\n\\n/mn) ֒\\n\\nH 1(Q, Vn)\\n\\nO\\n\\nā†’\\n\\nwhich is described in Appendix D (see also\\n\\n1.6 of [21]). Wiles deļ¬nes a collection . Let SD(Vn) denote the associated Selmer\\n\\nĀ§\\n\\nH 1(Qq, Vn) }\\n\\n=\\n\\nJq āŠ†\\n\\ndepending on\\n\\nJ group. Wiles proves that s induces an isomorphism\\n\\n{\\n\\nD\\n\\n/mn) āˆ¼ ā†’\\n\\nHomO(pR/p2 R,\\n\\nSD(Vn).\\n\\nO\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n17\\n\\n5.3. Euler systems. We have now reduced the proof of Mazurā€™s conjecture to bounding the size of the Selmer groups SD(Vn). About ļ¬ve years ago Kolyvagin [19], building on ideas of his own and of Thaine [40], introduced a revolutionary new method for bounding the size of a Selmer group. This new machinery, which is crucial for Wilesā€™ proof, is what we now describe.\\n\\nH 1(Qq,M ) is } 5.2. Let Ė†M = a system of subgroups with associated Selmer group S(M ) as in Hom(M, Āµm), where Āµm is the group of m-th roots of unity. For every prime q, the cup product gives a nondegenerate Tate pairing\\n\\nSuppose M is a GQ-module of odd exponent m and\\n\\n=\\n\\nJq āŠ† Ā§\\n\\nJ\\n\\n{\\n\\nH 2(Qq, Āµm) āˆ¼ ā†’ H 1(Q, Ė†M ), then\\n\\nH 1(Qq, Ė†M )\\n\\niq : H 1(Qq, M )\\n\\nZ/mZ\\n\\n,\\n\\nh\\n\\nƗ\\n\\nā†’\\n\\nH 1(Q, M ) and d\\n\\n(see Chapters VI and VII of [3]). If c\\n\\nāˆˆ\\n\\nāˆˆ\\n\\n(15)\\n\\nresq(c), resq(d) h\\n\\niq = 0.\\n\\nq X\\n\\nH 1(Q, Ė†M ) be the Selmer\\n\\nis a ļ¬nite set of primes. Let Sāˆ—\\n\\nSuppose that\\n\\nL āŠ† H 1(Qq, Ė†M ) }\\n\\nL group given by the local conditions\\n\\nāˆ— =\\n\\nJ āˆ— q āŠ†\\n\\n, where\\n\\nJ\\n\\n{\\n\\nthe orthogonal complement of Jq under H 1(Qq, Ė†M )\\n\\n,\\n\\nif q / if q\\n\\n, āˆˆ L . āˆˆ L\\n\\niq\\n\\nJ āˆ— q =\\n\\nh\\n\\n(\\n\\nH 1(Q, Ė†M ), deļ¬ne\\n\\nIf d\\n\\nāˆˆ\\n\\nZ/mZ\\n\\nĪød :\\n\\nJq ā†’\\n\\nYqāˆˆL\\n\\nby\\n\\nĪød((cq)) =\\n\\ncq, resq(d) h\\n\\niq.\\n\\nXqāˆˆL\\n\\nWrite resL : H 1(Q, M ) maps. By (15) and the deļ¬nition of J āˆ— in addition resL is injective on S(M ), then\\n\\nqāˆˆL H 1(Qq, M ) for the product of the restriction ker(Īød). If\\n\\nā†’\\n\\nSāˆ—\\n\\nq , if d\\n\\nL, then resL(S(M ))\\n\\nāˆˆ\\n\\nāŠ†\\n\\nQ\\n\\n#(S(M ))\\n\\n#\\n\\nker(Īød)\\n\\n.\\n\\nā‰¤\\n\\n(cid:0) \\\\dāˆˆSāˆ—\\n\\nL\\n\\n(cid:1)\\n\\nThe diļ¬ƒculty is to produce enough cohomology classes in Sāˆ—\\n\\nL to show that the right side of the above inequality is small. Following Kolyvagin, an Euler system is Sāˆ— L for a large (inļ¬nite) collection of sets of a compatible collection of classes Īŗ( )) primes is related to resā„“(Īŗ( )). Once an Euler system is given, Kolyvagin has an inductive procedure for choosing a set\\n\\n) L\\n\\nāˆˆ\\n\\n. Loosely speaking, compatible means that if ā„“ /\\n\\n, then resā„“(Īŗ(\\n\\nā„“\\n\\nL\\n\\nāˆˆ L\\n\\nL āˆŖ {\\n\\n}\\n\\nL\\n\\nsuch that\\n\\nL\\n\\nresL is injective on S(M ),\\n\\nā€¢\\n\\nPāŠ†L ker(ĪøĪŗ(P)) can be computed in terms of Īŗ( āˆ…\\n\\n).\\n\\nT\\n\\n18\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nSāˆ—\\n\\nSāˆ—\\n\\n, then Sāˆ—\\n\\nL.)\\n\\nL, so Īŗ(\\n\\n)\\n\\n(Note that if\\n\\nP āŠ†\\n\\nP For several important Selmer groups it is possible to construct Euler systems for\\n\\nāˆˆ\\n\\nP āŠ† L\\n\\nwhich Kolyvaginā€™s procedure produces a set\\n\\nactually giving an equality\\n\\nL ker(ĪøĪŗ(P))\\n\\n#(S(M )) = #\\n\\n.\\n\\n(cid:0) \\\\PāŠ†L This is what Wiles needs to do for the Selmer group SD(Vn). There are several examples in the literature where this kind of argument is worked out in some detail. For the simplest case, where the Selmer group in question is the ideal class group ) are constructed from cyclotomic units, of a real abelian number ļ¬eld and the Īŗ( L see [29]. For other cases involving ideal class groups and Selmer groups of elliptic curves, see [19], [31], [30], [13].\\n\\n(cid:1)\\n\\n5.4. Wilesā€™ geometric Euler system. The task now is to construct an Euler system of cohomology classes with which to bound #(SD(Vn)) using Kolyvaginā€™s method. This is the most technically diļ¬ƒcult part of Wilesā€™ proof and is the part of Wilesā€™ work he referred to as not yet complete in his December announcement. We give only general remarks about Wilesā€™ construction.\\n\\nThe ļ¬rst step in the construction is due to Flach [10]. He constructed classes consisting of just one prime. This allows one to bound the ) L\\n\\nSāˆ—\\n\\nĪŗ( exponent of SD(Vn), but not its order.\\n\\nL for sets\\n\\nāˆˆ\\n\\nL\\n\\nEvery Euler system starts with some explicit, concrete objects. Earlier examples of Euler systems come from cyclotomic or elliptic units, Gauss sums, or Heegner points on elliptic curves. Wiles (following Flach) constructs his cohomology classes from modular units, i.e., meromorphic functions on modular curves which are holo- morphic and nonzero away from the cusps. More precisely, Īŗ( ) comes from an explicit function on the modular curve X1(L, N ), the curve obtained by taking the quotient space of the upper half plane by the action of the group\\n\\nL\\n\\na b c d\\n\\nSL2(Z) : c\\n\\n1 (mod L) } ā‰” ā„“āˆˆL ā„“ and where N is the N of (T2) of\\n\\n0\\n\\n(mod LN ),\\n\\na\\n\\nd\\n\\n,\\n\\nĪ“1(L, N ) =\\n\\nāˆˆ\\n\\nā‰”\\n\\nā‰”\\n\\n{ (cid:1) (cid:0) and adjoining the cusps, where L = The construction and study of the classes Īŗ( [8], [9] and others.\\n\\n4.2. ) rely heavily on results of Faltings\\n\\nĀ§\\n\\nL\\n\\nQ\\n\\n5.5. Wilesā€™ results. Wiles announced two main results (Theorems 5.3 and 5.4 below) in the direction of Mazurā€™s conjecture, under two diļ¬€erent sets of hypotheses on the representation ĀÆĻ. Theorem 5.3 implies the Semistable Taniyama-Shimura Conjecture and Fermatā€™s Last Theorem. Wilesā€™ proof of Theorem 5.3 depends on the not-yet-complete construction of an appropriate Euler system (as in 5.4), while his proof of Theorem 5.4 (though not yet fully checked) does not. For Theorem 5.4, Wiles bounds the Selmer group of 5.2 without constructing a new Euler system, by using results from the Iwasawa theory of imaginary quadratic ļ¬elds. (These results in turn rely on Kolyvaginā€™s method and the Euler system of elliptic units; see [31].)\\n\\nĀ§\\n\\nĀ§\\n\\nSince for ease of exposition we deļ¬ned modularity of representations in terms of Ī“0(N ) instead of Ī“1(N ), the theorems stated below are weaker than those an- nounced by Wiles, but have the same applications to elliptic curves. (Note that by our deļ¬nition of type-\\n\\n, if ĀÆĻ is type-\\n\\n, then det(ĀÆĻ) = ĀÆĪµp.)\\n\\nD\\n\\nD\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n19\\n\\nIf ĀÆĻ is a representation of GQ on a vector space V , Sym2(ĀÆĻ) denotes the repre-\\n\\nsentation on the symmetric square of V induced by ĀÆĻ.\\n\\nTheorem 5.3 (Wiles). Suppose p, k, the following additional conditions :\\n\\n, ĀÆĻ, and\\n\\nare as in\\n\\n4.2 and ĀÆĻ satisļ¬es\\n\\nD\\n\\nO\\n\\nĀ§\\n\\n(i) Sym2(ĀÆĻ) is absolutely irreducible, (ii) if ĀÆĻ is ramiļ¬ed at q and q (iii) if p is 3 or 5, then for some prime q, p divides #(ĀÆĻ(Iq)).\\n\\n= p, then the restriction of ĀÆĻ to Dq is reducible,\\n\\n6\\n\\nT is an isomorphism.\\n\\nThen Ļ• : R\\n\\nā†’\\n\\nSince Theorem 5.3 does not yield the full Mazur Conjecture (Conjecture 4.2) for 2 to see which elliptic curves Ā§\\n\\np = 3 and 5, we need to reexamine the arguments of E can be proved modular using Theorem 5.3 applied to ĀÆĻE,3 and ĀÆĻE,5.\\n\\nHypothesis (i) of Theorem 5.3 will be satisļ¬ed if the image of ĀÆĻE,p is suļ¬ƒciently large in GL2(Fp) (for example, if ĀÆĻE,p is surjective). For p = 3 and p = 5, if ĀÆĻE,p satisļ¬es hypothesis (iii) and is irreducible, then it satisļ¬es hypothesis (i).\\n\\nIf E is semistable, p is an odd prime, and ĀÆĻE,p is irreducible and modular, then (see the proof of Proposition 3.3) and ĀÆĻE,p satisļ¬es (ii) ĀÆĻE,p is D 14 of Appendix C of [39]). Therefore by Propositions and (iii) (use Tate curves; see 4.3 and 3.3, Theorem 5.3 implies that the Semistable Modular Lifting Conjecture (Conjecture 2.1) holds for p = 3 and for p = 5. As shown in 2, the Semistable Taniyama-Shimura Conjecture and Fermatā€™s Last Theorem follow.\\n\\nmodular for some\\n\\nD\\n\\nĀ§\\n\\nĀ§\\n\\nTheorem 5.4 (Wiles). Suppose p, k, contains no nontrivial p-th roots of unity. Suppose also that there are an imaginary quadratic ļ¬eld F of discriminant prime to p and a character Ļ‡ : Gal( ĀÆQ/F ) Ɨ such that T is the induced representation IndĻ‡ of GQ is a ( an isomorphism.\\n\\n, ĀÆĻ, and\\n\\nare as in\\n\\n4.2 and\\n\\nD\\n\\nO\\n\\nĀ§\\n\\nO\\n\\nā†’ O\\n\\n)-lifting of ĀÆĻ. Then Ļ• : R\\n\\n,\\n\\nD\\n\\nO\\n\\nā†’\\n\\nCorollary 5.5 (Wiles). Suppose E is an elliptic curve over Q with complex mul- tiplication by an imaginary quadratic ļ¬eld F and p is an odd prime at which E has good reduction. If Eā€² is an elliptic curve over Q satisfying\\n\\nEā€² has good reduction at p and ĀÆĻEā€²,p is isomorphic to ĀÆĻE,p,\\n\\nā€¢\\n\\nthen Eā€² is modular.\\n\\nProof of corollary. Let p be a prime of F containing p, and deļ¬ne = the ring of integers of the completion of F at p,\\n\\nO ā€¢ ā€¢ ā€¢\\n\\n/p primes at which E or Eā€² has bad reduction\\n\\nk = Ī£ = t = ordinary if E has ordinary reduction at p, t = ļ¬‚at if E has supersingular reduction at p,\\n\\n,\\n\\nO {\\n\\nO\\n\\np\\n\\n,\\n\\n} āˆŖ {\\n\\n}\\n\\n= (Ī£, t).\\n\\nD\\n\\nLet\\n\\nĻ‡ : Gal( ĀÆQ/F )\\n\\nAutO(E[pāˆž]) āˆ¼=\\n\\nƗ\\n\\nā†’\\n\\nO\\n\\nbe the character giving the action of Gal( ĀÆQ/F ) on E[pāˆž] (where E[pāˆž] is the group of points of E killed by the endomorphisms of E which lie in some power of p). It is not hard to see that ĻE,p āŠ— O\\n\\nis isomorphic to IndĻ‡.\\n\\n20\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nSince E has complex multiplication, it is well known that E and ĀÆĻE,p are mod- ular. Since E has good reduction at p, it can be shown that the discriminant of contains no nontrivial p-th roots of unity. One can show F is prime to p and that all of the hypotheses of Theorem 5.4 are satisļ¬ed with ĀÆĻ = ĀÆĻE,p āŠ— k. By our assumptions on Eā€², ĻEā€²,p āŠ— O )-lifting of ĀÆĻ, and we conclude (using the D same reasoning as in the proofs of Propositions 3.3 and 4.3) that ĻEā€²,p is modular and hence Eā€² is modular.\\n\\nO\\n\\nis a (\\n\\n,\\n\\nO\\n\\nRemarks. (i) The elliptic curves Eā€² of Corollary 5.5 are not semistable.\\n\\n(ii) Suppose E and p are as in Corollary 5.5 and p = 3 or 5. As in Appendix B.2 one can show that the elliptic curves Eā€² over Q with good reduction at p and with ĀÆĻEā€²,p isomorphic to ĀÆĻE,p give inļ¬nitely many C-isomorphism classes.\\n\\nExample. Take E to be the elliptic curve deļ¬ned by\\n\\ny2 = x3\\n\\nx2\\n\\n3x\\n\\n1.\\n\\nāˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\nThen E has complex multiplication by Q(āˆš Deļ¬ne polynomials\\n\\n2), and E has good reduction at 3.\\n\\nāˆ’\\n\\n1512t3 3, a4(t) = a6(t) = 40824t6 + 31104t5 + 8370t4 + 504t3\\n\\n2430t4\\n\\n396t2\\n\\n56t\\n\\nāˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\n148t2\\n\\n24t\\n\\n1,\\n\\nāˆ’\\n\\nāˆ’\\n\\nāˆ’\\n\\nQ let Et be the elliptic curve\\n\\nand for each t\\n\\nāˆˆ\\n\\ny2 = x3\\n\\nx2 + a4(t)x + a6(t)\\n\\nāˆ’\\n\\nQ, ĀÆĻEt,3 is isomorphic to (note that E0 = E). It can be shown that for every t 0 or 1 (mod 3) (or more generally if t = 3a/b or t = 3a/b + 1 ĀÆĻE,3. If t with a and b integers and b not divisible by 3), then Et has good reduction at 3, for instance because the discriminant of Et is\\n\\nāˆˆ\\n\\nZ and t\\n\\nāˆˆ\\n\\nā‰”\\n\\n29(27t2 + 10t + 1)3(27t2 + 18t + 1)3.\\n\\nThus for these values of t, Corollary 5.5 shows that Et is modular and so is any elliptic curve over Q isomorphic over C to Et, i.e., any elliptic curve over Q with j-invariant equal to\\n\\n3\\n\\n4(27t2 + 6t + 1)(135t2 + 54t + 5) (27t2 + 10t + 1)(27t2 + 18t + 1)\\n\\n.\\n\\n(cid:18)\\n\\n(cid:19)\\n\\nThis explicitly gives inļ¬nitely many modular elliptic curves over Q which are\\n\\nnonisomorphic over C.\\n\\n(For deļ¬nitions of complex multiplication, discriminant, and j-invariant, see any\\n\\nstandard reference on elliptic curves, such as [39].)\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n21\\n\\nAppendix A. Galois groups and Frobenius elements\\n\\nWrite GQ = Gal( ĀÆQ/Q). If q is a prime number and\\n\\nis a prime ideal dividing\\n\\nQ\\n\\nq in the ring of integers of ĀÆQ, there is a ļ¬ltration\\n\\nGQ\\n\\nDQ āŠƒ\\n\\nIQ\\n\\nāŠƒ where the decomposition group DQ and the inertia group IQ are deļ¬ned by\\n\\nDQ = IQ =\\n\\nĻƒ\\n\\nGQ : Ļƒ āˆˆ Q āˆˆ DQ : Ļƒx\\n\\n=\\n\\n,\\n\\n{\\n\\nQ} x (mod\\n\\nĻƒ\\n\\n) for all algebraic integers x }\\n\\n.\\n\\nā‰” { There are natural identiļ¬cations\\n\\nQ\\n\\nDQ/IQ āˆ¼= Gal( ĀÆFq/Fq),\\n\\nDQ āˆ¼= Gal( ĀÆQq/Qq),\\n\\nxq of GQ\\n\\nand FrobQ āˆˆ Gal( ĀÆFq/Fq). If and\\n\\nDQ/IQ denotes the inverse image of the canonical generator x\\n\\n7ā†’ for some Ļƒ\\n\\nā€² is another prime ideal above q, then\\n\\nā€² = Ļƒ\\n\\nQ DQā€² = ĻƒDQĻƒāˆ’1,\\n\\nQ\\n\\nQ\\n\\nāˆˆ\\n\\nFrobQā€² = ĻƒFrobQĻƒāˆ’1.\\n\\nIQā€² = ĻƒIQĻƒāˆ’1,\\n\\nSince we will care about these objects only up to conjugation, we will write Dq and GQ for any representative of a FrobQ. If Ļ is a represen- Iq. We will write Frobq āˆˆ tation of GQ which is unramiļ¬ed at q, then trace(Ļ(Frobq)) and det(Ļ(Frobq)) are well deļ¬ned independent of any choices.\\n\\nAppendix B. Some details on the proof of Proposition 2.4\\n\\nB.1. The modular curve X0(15) can be viewed as a curve deļ¬ned over Q in such a way that the noncusp rational points correspond to isomorphism classes (over C) E( ĀÆQ) is a subgroup of pairs (Eā€², 42), of order 15 stable under GQ. An equation for X0(15) is y2 = x(x + 32)(x the elliptic curve discussed in 1. There are eight rational points on X0(15), four of Ā§ which are cusps. There are four modular elliptic curves, corresponding to a modular form for Ī“0(50) (see p. 86 of [1]), which lie in the four distinct C-isomorphism classes that correspond to the noncusp rational points on X0(15).\\n\\n) where Eā€² is an elliptic curve over Q and\\n\\nC\\n\\nC āŠ‚\\n\\nāˆ’\\n\\nTherefore every elliptic curve over Q with a GQ-stable subgroup of order 15 is modular. Equivalently, if E is an elliptic curve over Q and both ĀÆĻE,3 and ĀÆĻE,5 are reducible, then E is modular.\\n\\nB.2. Fix a semistable elliptic curve E over Q. We will show that there are inļ¬nitely many semistable elliptic curves Eā€² over Q such that\\n\\n(i) ĀÆĻEā€²,5 is isomorphic to ĀÆĻE,5, and (ii) ĀÆĻEā€²,3 is irreducible. Let\\n\\n1 0 0 1\\n\\na b c d\\n\\na b c d\\n\\nSL2(Z) :\\n\\n(mod 5) }\\n\\n.\\n\\nĪ“(5) =\\n\\nā‰”\\n\\nāˆˆ\\n\\n{\\n\\nLet X be the twist of the classical modular curve X(5) (see [35]) by the cocycle (cid:0) induced by ĀÆĻE,5, and let S be the set of cusps of X. Then X is a curve deļ¬ned over Q which has the following properties. The rational points on X āˆ’ (Eā€², Ļ†) where Eā€² is an elliptic curve over Q and Ļ† : E[5] module isomorphism.\\n\\n(cid:1)\\n\\n(cid:0)\\n\\n(cid:1)\\n\\n(cid:1)\\n\\n(cid:0)\\n\\nS correspond to isomorphism classes of pairs Eā€²[5] is a GQ-\\n\\n\\n\\nā†’\\n\\n22\\n\\nK. RUBIN AND A. SILVERBERG\\n\\nS is four copies of H/Ī“(5), so each component of\\n\\nAs a complex manifold X X has genus zero.\\n\\n\\n\\nāˆ’\\n\\nLet X 0 be the component of X containing the rational point corresponding to (E, identity). Then X 0 is a curve of genus zero deļ¬ned over Q with a rational point, so it has inļ¬nitely many rational points. We want to show that inļ¬nitely many of these points correspond to semistable elliptic curves Eā€² with ĀÆĻEā€²,3 irreducible.\\n\\nThere is another modular curve Ė†X deļ¬ned over Q, with a ļ¬nite set Ė†S of cusps,\\n\\nwhich has the following properties. The rational points on Ė†X (Eā€², Ļ†, module isomorphism, and As a complex manifold Ė†X The map that forgets the subgroup X deļ¬ned over Q and of degree [Ī“(5) : Ī“(5)\\n\\nĖ†S correspond to isomorphism classes of triples Eā€²[5] is a GQ-\\n\\n\\n\\nāˆ’\\n\\n) where Eā€² is an elliptic curve over Q, Ļ† : E[5]\\n\\nC\\n\\nā†’\\n\\nEā€²[3] is a GQ-stable subgroup of order 3.\\n\\nC āŠ‚ āˆ’\\n\\nĖ†S is four copies of H/(Ī“(5)\\n\\nĪ“0(3)).\\n\\nā€¢\\n\\nāˆ© induces a surjective morphism Īø : Ė†X\\n\\nC\\n\\nā†’\\n\\nĪ“0(3)] = 4.\\n\\nāˆ©\\n\\nLet Ė†X 0 be the component of Ė†X which maps to X 0. The function ļ¬eld of X 0 is Q(t), and the function ļ¬eld of Ė†X 0 is Q(t)[x]/f (t, x) where f (t, x) Q(t)[x] is irreducible and has degree 4 in x. If tā€² Q is suļ¬ƒciently close 5-adically to the value of t which corresponds to E, then the corresponding elliptic curve is semistable at Q so that f (t1, x) is 5. By the Hilbert Irreducibility Theorem we can ļ¬nd a t1 āˆˆ irreducible in Q[x]. It is possible to ļ¬x a prime ā„“ = 5 such that f (t1, x) has no roots modulo ā„“. If tā€² Q is suļ¬ƒciently close ā„“-adically to t1, then f (tā€², x) has no rational roots, and thus tā€² corresponds to a rational point of X 0 which is not the image of a rational point of Ė†X 0. Therefore there are inļ¬nitely many elliptic curves Eā€² over Q which are semistable at 5 and satisfy\\n\\nāˆˆ\\n\\nāˆˆ\\n\\n6\\n\\nāˆˆ\\n\\n(i) Eā€²[5] āˆ¼= E[5] as GQ-modules, and (ii) Eā€²[3] has no subgroup of order 3 stable under GQ.\\n\\nIt follows from (i) and the semistability of E that Eā€² is semistable at all primes = 5, and thus Eā€² is semistable. We therefore have inļ¬nitely many semistable q elliptic curves Eā€² which satisfy the desired conditions.\\n\\n6\\n\\nAppendix C. Representation types\\n\\nSuppose A is a complete noetherian local Zp-algebra and Ļ : GQ\\n\\nGL2(A) is a |Dp for the restriction of Ļ to the decomposition group Dp.\\n\\nā†’\\n\\nrepresentation. Write Ļ We say Ļ is\\n\\nordinary at p if Ļ\\n\\n|Dp is (after a change of basis, if necessary) of the form ļ¬‚at at p if Ļ is not ordinary, and for every ideal a of ļ¬nite index in A, the (cid:0) |Dp modulo a is the representation associated to the ĀÆQp-points reduction of Ļ of a ļ¬nite ļ¬‚at group scheme over Zp.\\n\\n\\n\\nāˆ— āˆ— 0 Ļ‡\\n\\nwhere Ļ‡ is unramiļ¬ed and the * are functions from Dp to A;\\n\\n(cid:1)\\n\\n\\n\\nAppendix D. Selmer groups\\n\\nWith notation as in\\n\\n5 (see especially Ā§\\n\\n5.2), deļ¬ne\\n\\nĀ§\\n\\n[Ē«]/(Ē«2, mn)\\n\\nOn =\\n\\nO\\n\\nA REPORT ON WILESā€™ CAMBRIDGE LECTURES\\n\\n23\\n\\nwhere Ē« is an indeterminate. Then v\\n\\n1 + Ē«v deļ¬nes an isomorphism\\n\\n7ā†’ On) : Ī“ GL2(\\n\\nāˆ¼ āˆˆ ā†’ { HomO(pR/p2 R,\\n\\n(16)\\n\\n1 (mod Ē«) } /mn) there is a unique -algebra homomorphism ā†’ On whose restriction to pR is Ē«Ī±. Composing with the representation ĻR On. (In particular Ļ0 )-lifting obtained when Ī± = 0.) Deļ¬ne a one-cocycle cĪ± on GQ\\n\\nĪ“\\n\\n.\\n\\nVn\\n\\nā‰”\\n\\nFor every Ī±\\n\\nO\\n\\nO\\n\\nāˆˆ\\n\\nĻˆĪ± : R of Theorem 4.1 gives a ( denotes the ( by\\n\\n,\\n\\n)-lifting ĻĪ± = ĻˆĪ± ā—¦\\n\\nĻR of ĀÆĻ to\\n\\nD\\n\\nO\\n\\n,\\n\\nD\\n\\nO\\n\\ncĪ±(g) = ĻĪ±(g)Ļ0(g)āˆ’1.\\n\\nH 1(Q, Vn). This deļ¬nes a\\n\\nSince ĻĪ± ā‰” homomorphism\\n\\nĻ0 (mod Ē«), using (16) we can view cĪ± āˆˆ\\n\\ns : HomO(pR/p2 R,\\n\\n/mn)\\n\\nH 1(Q, Vn),\\n\\nO and it is not diļ¬ƒcult to see that s is injective. The fact that Ļ0 and ĻĪ± are type- D gives information about the restrictions resq(cĪ±) for various primes q, and using this H 1(Q, Vn) and veriļ¬es that s information Wiles deļ¬nes a Selmer group SD(Vn) is an isomorphism onto SD(Vn).\\n\\nā†’\\n\\nāŠ‚\\n\\nReferences\\n\\n[1] B. Birch and W. Kuyk, eds., Modular functions of one variable. IV, Lecture Notes in Math.,\\n\\nvol. 476, Springer-Verlag, New York, 1975, pp. 74ā€“144.\\n\\n[2] J. Buhler, R. Crandall, R. Ernvall, and T. MetsĀØankylĀØa, Irregular primes and cyclotomic\\n\\ninvariants to four million, Math. Comp. 61 (1993), 151ā€“153.\\n\\n[3] J. W. S. Cassels and A. Frohlich, Algebraic number theory, Academic Press, London, 1967. [4] P. Deligne and J.-P. Serre, Formes modulaires de poids 1, Ann. Sci. Ā“Ecole Norm. Sup. (4) 7\\n\\n(1974), 507ā€“530.\\n\\n[5] L. E. Dickson, History of the theory of numbers (Vol. II), Chelsea Publ. Co., New York, 1971. [6] H. M. Edwards, Fermatā€™s Last Theorem. A genetic introduction to algebraic number theory,\\n\\nSpringer-Verlag, New York, 1977.\\n\\n[7] M. Eichler, QuaternĀØare quadratische Formen und die Riemannsche Vermutung fĀØur die Kon-\\n\\ngruenzzetafunktion, Arch. Math. (Basel) 5 (1954), 355ā€“366.\\n\\n[8] G. Faltings, p-adic Hodge theory, J. Amer. Math. Soc. 1 (1988), 255ā€“299. [9]\\n\\n, Crystalline cohomology and p-adic Galois representations, Algebraic Analysis, Ge- ometry and Number Theory, Proceedings of the JAMI Inaugural Conference (J. I. Igusa, ed.), Johns Hopkins Univ. Press, Baltimore, MD, 1989, pp. 25ā€“80.\\n\\n[10] M. Flach, A ļ¬niteness theorem for the symmetric square of an elliptic curve, Invent. Math.\\n\\n109 (1992), 307ā€“327.\\n\\n[11] G. Frey, Links between solutions of A āˆ’ B = C and elliptic curves, Number Theory, Ulm 1987, Proceedings, Lecture Notes in Math., vol. 1380, Springer-Verlag, New York, 1989, pp. 31ā€“62.\\n\\n[12] S. Gelbart, Automorphic forms on adele groups, Ann. of Math. Stud., vol. 83, Princeton\\n\\nUniv. Press, Princeton, NJ, 1975.\\n\\n[13] B. Gross, Kolyvaginā€™s work on modular elliptic curves, L-functions and Arithmetic, London Math. Soc. Lecture Note Ser., vol. 153, Cambridge Univ. Press, Cambridge, 1991, pp. 235ā€“256. [14] G. H. Hardy and E. M. Wright, An introduction to the theory of numbers, Fourth ed., Oxford\\n\\nUniv. Press, London, 1971.\\n\\n[15] Y. Hellegouarch, Ā“Etude des points dā€™ordre ļ¬ni des variĀ“etĀ“es de dimension un dĀ“eļ¬nies sur un\\n\\nanneau principal, J. Reine Angew. Math. 244 (1970), 20ā€“36.\\n\\n, Points dā€™ordre ļ¬ni des variĀ“etĀ“es abĀ“eliennes de dimension un, Colloque de ThĀ“eorie des Nombres (Univ. Bordeaux, Bordeaux, 1969), Bull. Soc. Math. France, MĀ“em. 25, Soc. Math. France, Paris, 1971, pp. 107ā€“112.\\n\\n[16]\\n\\n, Points dā€™ordre ļ¬ni sur les courbes elliptiques, C. R. Acad. Sci. Paris SĀ“er. A-B 273\\n\\n[17]\\n\\n(1971), A540ā€“A543.\\n\\n24\\n\\nK. RUBIN AND A. SILVERBERG\\n\\n, Points dā€™ordre 2ph sur les courbes elliptiques, Acta. Arith. 26 (1974/75), 253ā€“263. [18] [19] V. A. Kolyvagin, Euler systems, The Grothendieck Festschrift (Vol. II) (P. Cartier et al.,\\n\\neds.), BirkhĀØauser, Boston, 1990, pp. 435ā€“483.\\n\\n[20] R. Langlands, Base change for GL(2), Ann. of Math. Stud., vol. 96, Princeton Univ. Press,\\n\\nPrinceton, NJ, 1980.\\n\\n[21] B. Mazur, Deforming Galois representations, Galois groups over Q (Y. Ihara, K. Ribet, and J.-P. Serre, eds.), Math. Sci. Res. Inst. Publ., vol. 16, Springer-Verlag, New York, 1989, pp. 385ā€“437.\\n\\n, Number theory as gadļ¬‚y, Amer. Math. Monthly 98 (1991), 593ā€“610.\\n\\n[22] [23] B. Mazur and J. Tilouine, ReprĀ“esentations galoisiennes, diļ¬€Ā“erentielles de KĀØahler et ā€œconjec-\\n\\ntures principalesā€, Inst. Hautes Ā“Etudes Sci. Publ. Math. 71 (1990), 65ā€“103.\\n\\n[24] J. OesterlĀ“e, Nouvelles approches du ā€œthĀ“eor`emeā€ de Fermat, SĀ“eminaire Bourbaki no. 694\\n\\n(1987ā€“1988), AstĀ“erisque 161/162 (1988) 165ā€“186.\\n\\n, On a variation of Mazur ā€™s deformation functor, Compositio Math. 87 (1993), 269ā€“\\n\\n[25]\\n\\n286.\\n\\n[26] P. Ribenboim, 13 lectures on Fermat ā€™s Last Theorem, Springer-Verlag, New York, 1979. [27] K. Ribet, On modular representations of Gal( ĀÆQ/Q) arising from modular forms, Invent.\\n\\nMath. 100 (1990), 431ā€“476.\\n\\n, Report on mod ā„“ representations of Gal( ĀÆQ/Q), Motives (U. Jannsen, S. Kleiman, and J-P. Serre, eds.), Proc. Sympos. Pure Math., vol. 55 (Part 2), Amer. Math. Soc., Providence, RI, 1994 (to appear).\\n\\n[28]\\n\\n[29] K. Rubin, The main conjecture. (Appendix to Cyclotomic ļ¬elds I and II, S. Lang), Graduate\\n\\nTexts in Math., vol. 121, Springer-Verlag, New York, 1990, pp. 397ā€“419.\\n\\n, Kolyvaginā€™s system of Gauss sums, Arithmetic Algebraic Geometry (G. van der Geer, F. Oort, and J. Steenbrink, eds.), Progr. Math., vol. 89, BirkhĀØauser, Boston, 1991, pp. 309ā€“324.\\n\\n[30]\\n\\n, The ā€œmain conjecturesā€ of Iwasawa theory for imaginary quadratic ļ¬elds, Invent.\\n\\n[31]\\n\\nMath. 103 (1991), 25ā€“68.\\n\\n[32] J.-P. Serre, Sur les reprĀ“esentations modulaires de degrĀ“e 2 de Gal( ĀÆQ/Q), Duke Math. J. 54\\n\\n(1987), 179ā€“230.\\n\\n[33] G. Shimura, Correspondances modulaires et les fonctions Ī¶ de courbes algĀ“ebriques, J. Math.\\n\\nSoc. Japan 10 (1958), 1ā€“28.\\n\\n, Construction of class ļ¬elds and zeta functions of algebraic curves, Ann. of Math.\\n\\n[34]\\n\\n85 (1967), 58ā€“159.\\n\\n, Introduction to the arithmetic theory of automorphic functions, Princeton Univ.\\n\\n[35]\\n\\nPress, Princeton, NJ, 1971.\\n\\n, On elliptic curves with complex multiplication as factors of the Jacobians of modular\\n\\n[36]\\n\\nfunction ļ¬elds, Nagoya Math. J. 43 (1971), 199ā€“208.\\n\\n, On the factors of the jacobian variety of a modular function ļ¬eld, J. Math. Soc.\\n\\n[37]\\n\\nJapan 25 (1973), 523ā€“544.\\n\\n, Yutaka Taniyama and his time. Very personal recollections, Bull. London Math.\\n\\n[38]\\n\\nSoc. 21 (1989), 186ā€“196.\\n\\n[39] J. Silverman, The arithmetic of elliptic curves, Graduate Texts in Math., vol. 106, Springer-\\n\\nVerlag, New York, 1986.\\n\\n[40] F. Thaine, On the ideal class groups of real abelian number ļ¬elds, Ann. of Math. (2) 128\\n\\n(1988), 1ā€“18.\\n\\n[41] J. Tunnell, Artinā€™s conjecture for representations of octahedral type, Bull. Amer. Math. Soc.\\n\\n(N.S.) 5 (1981), 173ā€“175.\\n\\n[42] A. Weil, ĀØUber die Bestimmung Dirichletscher Reihen durch Funktionalgleichungen, Math.\\n\\nAnn. 168 (1967), 149ā€“156.\\n\\nDepartment of Mathematics, Ohio State University, Columbus, Ohio 43210 E-mail address: rubin@math.ohio-state.edu\\n\\nDepartment of Mathematics, Ohio State University, Columbus, Ohio 43210 E-mail address: silver@math.ohio-state.edu' metadata={'source': '/var/folders/l1/lphj87z16c3282pjwy91wtm80000gn/T/tmpdh5kk5yb/tmp.pdf'}\n", + "page_content='This is text file' metadata={'source': 'dropbox:///test.txt', 'title': 'test.txt'}\n" + ] + } + ], + "source": [ + "for document in documents:\n", + " print(document)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "langchain", + "language": "python", + "name": "langchain" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/libs/langchain/langchain/document_loaders/__init__.py b/libs/langchain/langchain/document_loaders/__init__.py index 6227d33064..bb285c1ef4 100644 --- a/libs/langchain/langchain/document_loaders/__init__.py +++ b/libs/langchain/langchain/document_loaders/__init__.py @@ -38,6 +38,7 @@ from langchain.document_loaders.diffbot import DiffbotLoader from langchain.document_loaders.directory import DirectoryLoader from langchain.document_loaders.discord import DiscordChatLoader from langchain.document_loaders.docugami import DocugamiLoader +from langchain.document_loaders.dropbox import DropboxLoader from langchain.document_loaders.duckdb_loader import DuckDBLoader from langchain.document_loaders.email import ( OutlookMessageLoader, @@ -194,6 +195,7 @@ __all__ = [ "DiscordChatLoader", "DocugamiLoader", "Docx2txtLoader", + "DropboxLoader", "DuckDBLoader", "EmbaasBlobLoader", "EmbaasLoader", diff --git a/libs/langchain/langchain/document_loaders/dropbox.py b/libs/langchain/langchain/document_loaders/dropbox.py new file mode 100644 index 0000000000..1197ef59c0 --- /dev/null +++ b/libs/langchain/langchain/document_loaders/dropbox.py @@ -0,0 +1,172 @@ +"""Loads data from Dropbox.""" + +# Prerequisites: +# 1. Create a Dropbox app. +# 2. Give the app these scope permissions: `files.metadata.read` +# and `files.content.read`. +# 3. Generate access token: https://www.dropbox.com/developers/apps/create. +# 4. `pip install dropbox` (requires `pip install unstructured` for PDF filetype). + + +import os +import tempfile +from pathlib import Path +from typing import Any, Dict, List, Optional + +from pydantic import BaseModel, root_validator + +from langchain.docstore.document import Document +from langchain.document_loaders.base import BaseLoader + + +class DropboxLoader(BaseLoader, BaseModel): + """Loads files from Dropbox. + + In addition to common files such as text and PDF files, it also supports + *Dropbox Paper* files. + """ + + dropbox_access_token: str + """Dropbox access token.""" + dropbox_folder_path: Optional[str] = None + """The folder path to load from.""" + dropbox_file_paths: Optional[List[str]] = None + """The file paths to load from.""" + recursive: bool = False + """Flag to indicate whether to load files recursively from subfolders.""" + + @root_validator + def validate_inputs(cls, values: Dict[str, Any]) -> Dict[str, Any]: + """Validate that either folder_path or file_paths is set, but not both.""" + if ( + values.get("dropbox_folder_path") is not None + and values.get("dropbox_file_paths") is not None + ): + raise ValueError("Cannot specify both folder_path and file_paths") + if values.get("dropbox_folder_path") is None and not values.get( + "dropbox_file_paths" + ): + raise ValueError("Must specify either folder_path or file_paths") + + return values + + def _create_dropbox_client(self) -> Any: + """Create a Dropbox client.""" + try: + from dropbox import Dropbox, exceptions + except ImportError: + raise ImportError("You must run " "`pip install dropbox") + + try: + dbx = Dropbox(self.dropbox_access_token) + dbx.users_get_current_account() + except exceptions.AuthError as ex: + raise ValueError( + "Invalid Dropbox access token. Please verify your token and try again." + ) from ex + return dbx + + def _load_documents_from_folder(self, folder_path: str) -> List[Document]: + """Load documents from a Dropbox folder.""" + dbx = self._create_dropbox_client() + + try: + from dropbox import exceptions + from dropbox.files import FileMetadata + except ImportError: + raise ImportError("You must run " "`pip install dropbox") + + try: + results = dbx.files_list_folder(folder_path, recursive=self.recursive) + except exceptions.ApiError as ex: + raise ValueError( + f"Could not list files in the folder: {folder_path}. " + "Please verify the folder path and try again." + ) from ex + + files = [entry for entry in results.entries if isinstance(entry, FileMetadata)] + documents = [ + doc + for doc in (self._load_file_from_path(file.path_display) for file in files) + if doc is not None + ] + return documents + + def _load_file_from_path(self, file_path: str) -> Optional[Document]: + """Load a file from a Dropbox path.""" + dbx = self._create_dropbox_client() + + try: + from dropbox import exceptions + except ImportError: + raise ImportError("You must run " "`pip install dropbox") + + try: + file_metadata = dbx.files_get_metadata(file_path) + + if file_metadata.is_downloadable: + _, response = dbx.files_download(file_path) + + # Some types such as Paper, need to be exported. + elif file_metadata.export_info: + _, response = dbx.files_export(file_path, "markdown") + + except exceptions.ApiError as ex: + raise ValueError( + f"Could not load file: {file_path}. Please verify the file path" + "and try again." + ) from ex + + try: + text = response.content.decode("utf-8") + except UnicodeDecodeError: + print(f"File {file_path} could not be decoded as text. Skipping.") + + file_extension = os.path.splitext(file_path)[1].lower() + + if file_extension == ".pdf": + from langchain.document_loaders import UnstructuredPDFLoader + + # Download it to a temporary file. + temp_dir = tempfile.TemporaryDirectory() + temp_pdf = Path(temp_dir.name) / "tmp.pdf" + with open(temp_pdf, mode="wb") as f: + f.write(response.content) + + try: + loader = UnstructuredPDFLoader(str(temp_pdf)) + docs = loader.load() + if docs: + return docs[0] + except Exception as pdf_ex: + print(f"Error while trying to parse PDF {file_path}: {pdf_ex}") + return None + + return None + + metadata = { + "source": f"dropbox://{file_path}", + "title": os.path.basename(file_path), + } + return Document(page_content=text, metadata=metadata) + + def _load_documents_from_paths(self) -> List[Document]: + """Load documents from a list of Dropbox file paths.""" + if not self.dropbox_file_paths: + raise ValueError("file_paths must be set") + + return [ + doc + for doc in ( + self._load_file_from_path(file_path) + for file_path in self.dropbox_file_paths + ) + if doc is not None + ] + + def load(self) -> List[Document]: + """Load documents.""" + if self.dropbox_folder_path is not None: + return self._load_documents_from_folder(self.dropbox_folder_path) + else: + return self._load_documents_from_paths()