Metamath.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Metamath A Computer Language for Mathematical Proofs Norman Megill with extensive revisions by David A. Wheeler 2019-06-02 ∼ Public Domain ∼ This book (including its later revisions) has been released into the Public Domain by Norman Megill per the Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/). David A. Wheeler has done the same. The public domain release applies worldwide. In case this is not legally possible, the right is granted to use the work for any purpose, without any conditions, unless such conditions are required by law. Several short, attributed quotations from copyrighted works appear in this book under the \fair use" provision of Section 107 of the United States Copyright Act (Title 17 of the United States Code). The public-domain status of this book is not applicable to those quotations. Any trademarks used in this book are the property of their owners. ISBN: 978-0-359-70223-7 Lulu Press Morrisville, North Carolina USA Norman Megill 93 Bridge St., Lexington, MA 02421 E-mail address: [email protected] David A. Wheeler E-mail address: [email protected] http://metamath.org Contents Preface . ix 1 Introduction 1 1.1 Mathematics as a Computer Language . 4 1.1.1 Is Mathematics \User-Friendly"? . 4 1.1.2 Mathematics and the Non-Specialist . 12 1.1.3 An Impossible Dream? . 14 1.1.4 Beauty . 15 1.1.5 Simplicity . 16 1.1.6 Rigor . 18 1.2 Computers and Mathematicians . 20 1.2.1 Trusting the Computer . 21 1.2.2 Trusting the Mathematician . 22 1.3 The Use of Computers in Mathematics . 24 1.3.1 Computer Algebra Systems . 24 1.3.2 Automated Theorem Provers . 25 1.3.3 Interactive Theorem Provers . 27 1.3.4 Proof Verifiers . 28 1.3.5 Creating a Database of Formalized Mathematics . 29 1.3.6 In Summary . 31 1.4 Mathematics and Metamath . 31 1.4.1 Standard Mathematics . 31 1.4.2 Other Formal Systems . 32 1.4.3 Metamath and Its Philosophy . 33 1.4.4 A History of the Approach Behind Metamath . 33 1.4.5 Metamath and First-Order Logic . 34 2 Using the Metamath Program 37 2.1 Installation . 37 2.2 Your First Formal System . 38 2.2.1 From Nothing to Zero . 38 2.2.2 Converting It to Metamath . 40 2.3 A Trial Run . 44 2.3.1 Some Hints for Using the Command Line Interface . 49 iii iv CONTENTS 2.4 Your First Proof . 50 2.5 A Note About Editing a Database File . 57 3 Abstract Mathematics Revealed 59 3.1 Logic and Set Theory . 59 3.2 The Axioms for All of Mathematics . 62 3.2.1 Propositional Calculus . 62 3.2.2 Predicate Calculus . 64 3.2.3 Set Theory . 68 3.2.4 Other Axioms . 70 3.3 The Axioms in the Metamath Language . 70 3.3.1 Propositional Calculus . 70 3.3.2 Axioms of Predicate Calculus with Equality|Tarski's S2 ............................. 71 3.3.3 Axioms of Predicate Calculus with Equality|Auxiliary 71 3.3.4 Set Theory . 71 3.3.5 That's It . 72 3.4 A Hierarchy of Definitions . 72 3.4.1 Definitions for Propositional Calculus . 74 3.4.2 Definitions for Predicate Calculus . 76 3.4.3 Definitions for Set Theory . 77 3.5 Tricks of the Trade . 85 3.6 A Theorem Sampler . 86 3.7 Axioms for Real and Complex Numbers . 89 3.7.1 The Axioms for Real and Complex Numbers Themselves 90 3.7.2 Complex Number Axioms in Analysis Texts . 91 3.7.3 Eliminating Unnecessary Complex Number Axioms . 92 3.8 Two Plus Two Equals Four . 92 3.9 Deduction . 94 3.9.1 The Standard Deduction Theorem . 94 3.9.2 Weak Deduction Theorem . 95 3.9.3 Deduction Style . 97 3.9.4 Natural Deduction . 98 3.9.5 Strengths of Our Approach . 101 3.10 Exploring the Set Theory Database . 101 3.10.1 A Note on the \Compact" Proof Format . 109 4 The Metamath Language 111 4.1 Specification of the Metamath Language . 112 4.1.1 Preliminaries . 112 4.1.2 Preprocessing . 113 4.1.3 Basic Syntax . 113 4.1.4 Proof Verification . 115 4.2 The Basic Keywords . 116 4.2.1 User-Defined Tokens . 117 CONTENTS v 4.2.2 Constants and Variables . 119 4.2.3 The $c and $v Declaration Statements . 119 4.2.4 The $d Statement . 120 4.2.5 The $f and $e Statements . 125 4.2.6 Assertions ($a and $p Statements) . 127 4.2.7 Frames . 129 4.2.8 Scoping Statements ($f and $g) . 132 4.3 The Anatomy of a Proof . 135 4.3.1 The Concept of Unification . 139 4.4 Extensions to the Metamath Language . 139 4.4.1 Comments in the Metamath Language . 139 4.4.2 The Typesetting Comment ($t) . 144 4.4.3 Additional Information Comment ($j) . 147 4.4.4 Including Other Files in a Metamath Source File . 148 4.4.5 Compressed Proof Format . 149 4.4.6 Specifying Unknown Proofs or Subproofs . 150 4.5 Axioms vs. Definitions . 150 4.5.1 What is a Definition? . 151 4.5.2 The Approach to Definitions in set.mm . 152 4.5.3 Adding Constraints on Definitions . 154 4.5.4 Summary of Approach to Definitions . 155 5 The Metamath Program 157 5.1 Invoking Metamath . 157 5.2 Controlling Metamath . 158 5.2.1 exit Command . 159 5.2.2 open log Command . 159 5.2.3 close log Command . 160 5.2.4 submit Command . 160 5.2.5 erase Command . 160 5.2.6 set echo Command . 160 5.2.7 set scroll Command . 160 5.2.8 set width Command . 161 5.2.9 set height Command . 161 5.2.10 beep Command . 161 5.2.11 more Command . 161 5.2.12 Operating System Commands . 161 5.2.13 Size Limitations in Metamath . 162 5.3 Reading and Writing Files . 162 5.3.1 read Command . 162 5.3.2 write source Command . 163 5.4 Showing Status and Statements . 163 5.4.1 show settings Command . 163 5.4.2 show memory Command . 163 5.4.3 show labels Command . 163 vi CONTENTS 5.4.4 show statement Command . 164 5.4.5 search Command . 164 5.5 Displaying and Verifying Proofs . 165 5.5.1 show proof Command . 165 5.5.2 show usage Command . 166 5.5.3 show trace back Command . 166 5.5.4 verify proof Command . 166 5.5.5 verify markup Command . 167 5.5.6 save proof Command . 167 5.6 Creating Proofs . 168 5.6.1 prove Command . 170 5.6.2 set unification timeout Command . 170 5.6.3 set empty substitution Command . 171 5.6.4 set search limit Command . 171 5.6.5 show new proof Command . 171 5.6.6 assign Command . 172 5.6.7 match Command . 172 5.6.8 let Command . 173 5.6.9 unify Command . 173 5.6.10 initialize Command . 174 5.6.11 delete Command . 174 5.6.12 improve Command . 175 5.6.13 save new proof Command . 175 5.7 Creating LATEX Output . 176 5.7.1 open tex Command . 176 5.7.2 close tex Command . 177 5.8 Creating HTML Output . 177 5.8.1 write theorem list Command . 178 5.8.2 write bibliography Command . 178 5.8.3 write recent additions Command . 178 5.9 Text File Utilities . 179 5.9.1 tools Command . 179 5.9.2 help Command (in tools) . 179 5.9.3 Using tools to Build Metamath submit Scripts . 180 5.9.4 Example of a tools Session . 180 A Sample Representations 183 B Compressed Proofs 187 C Metamath's Formal System 189 C.1 Introduction . 189 C.2 The Formal Description . 190 C.2.1 Preliminaries . 190 C.2.2 Constants, Variables, and Expressions . ..