├── LICENSE ├── README.md ├── ajax.js ├── checkproof.php ├── fitch-checker.png ├── fol-exs.html ├── index.html ├── new.png ├── newb.png ├── newsp.png ├── newspb.png ├── normalize.css ├── phpinf.php ├── proofs.css ├── proofs.js ├── proofs.php ├── rules ├── Makefile ├── forallxyyc.sty └── texf │ ├── Ae.texf │ ├── Ai.texf │ ├── Ee.texf │ ├── Ei.texf │ ├── Ie.texf │ ├── Ii.texf │ ├── ae.texf │ ├── ai.texf │ ├── be.texf │ ├── bi.texf │ ├── ce.texf │ ├── ci.texf │ ├── dem.texf │ ├── dne.texf │ ├── ds.texf │ ├── ip.texf │ ├── lem.texf │ ├── mt.texf │ ├── ne.texf │ ├── ni.texf │ ├── oe.texf │ ├── oi.texf │ ├── qc.texf │ ├── r.texf │ ├── rule-template.tex │ └── xp.texf ├── sample.png ├── skeleton.css ├── syntax.js ├── syntax.php ├── tfl-exs.html └── wait.gif /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATION WARNING 2 | 3 | This project is not in active development. For the successor, please see LogicPenguin (). 4 | 5 | # fitch-checker 6 | 7 | Kevin Klement's JavaScript/PHP Fitch-style natural deduction proof editor and checker 8 | 9 | ## Description 10 | 11 | This is a demo of a proof checker for Fitch-style natural deduction 12 | systems found in many popular introductory logic textbooks, such as Barwise & 13 | Etchemendy's _Language, Proof, and Logic_ or Bergmann & Moore's _The 14 | Logic Book_. 15 | 16 | The specific system used here is the one found in _[forall x: Calgary 17 | Remix](http://forallx.openlogicproject.org/)_, by P. D. Magnus, Tim 18 | Button, J. Robert Loftis, Aaron Thomas-Bolduc and Richard Zach. It is 19 | based on [forall x: an Introduction to Formal 20 | Logic](https://www.fecundity.com/logic/), by P.D. Magnus. However, 21 | the proof system in the original version differs from the one used in 22 | the _Calgary Remix_. 23 | 24 | See it in action at 25 | [proofs.openlogicproject.org](http://proofs.openlogicproject.org/) 26 | 27 | ![Sample 28 | proof](https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/master/fitch-checker.png) 29 | 30 | ## Installation 31 | 32 | To install, put the entire contents of this repository into a 33 | directory served to the web. It requires that your web server runs 34 | *PHP 7+*. 35 | 36 | ## Credits 37 | 38 | This code was originally written by Kevin C. Klement . 39 | 40 | # DEPRECATION WARNING 41 | 42 | This project is not in active development. For the successor, please see LogicPenguin (). 43 | -------------------------------------------------------------------------------- /ajax.js: -------------------------------------------------------------------------------- 1 | 2 | function AJAXGetRequest(file, getstr, callback) { 3 | var xhr = new XMLHttpRequest(); 4 | // xhr.withCredentails = true; 5 | if (getstr != '') { 6 | var s = file + '?' + getstr; 7 | } else { 8 | s = file; 9 | } 10 | xhr.open("GET", s, true); 11 | xhr.onreadystatechange = function() { 12 | if ((xhr.readyState == 4) && (xhr.status == "200")) { 13 | callback(xhr.responseText); 14 | } 15 | } 16 | xhr.send(null); 17 | } 18 | 19 | function AJAXPostRequest(file, fD, callback) { 20 | var xhttp = new XMLHttpRequest(); 21 | // xhttp.withCredentails = true; 22 | xhttp.open("POST", file, true); 23 | xhttp.onreadystatechange = function() { 24 | if ((xhttp.readyState == 4) && (xhttp.status == "200")) { 25 | callback(xhttp.responseText); 26 | } 27 | } 28 | xhttp.send(fD); 29 | } 30 | -------------------------------------------------------------------------------- /checkproof.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fitch-checker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/fitch-checker.png -------------------------------------------------------------------------------- /fol-exs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | First-Order Logic sample proof exercises 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 178 | 183 | 184 | 185 |
186 |
187 |
188 | 189 |

First-Order Logic sample proof exercises

190 |

Chapter 32, Exercise E

191 |

Provide a proof of each claim.

192 |
    193 |
194 | 195 |

Chapter 34, Exercise A

196 |

Provide a proof of each claim.

197 |
    198 |
199 | 200 | Return to main demo page. 201 | 202 |
203 |
204 |
205 | 206 | 207 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Natural deduction proof editor and checker 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 96 | 115 | 116 | 117 |
118 |
119 |
120 | 121 |

Natural deduction proof editor and checker

122 | 123 |

This is a demo of a proof checker for Fitch-style natural 124 | deduction systems found in many popular introductory logic 125 | textbooks. The specific system used here is the one found in 126 | forall x: 127 | Calgary. (Although based on forall x: an Introduction 129 | to Formal Logic, the proof system in that original 130 | version differs from the one used here and in forall x: 131 | Calgary. However, the system also supports the rules used in 132 | the forall 134 | x: Cambridge remix.)

135 |
136 |
137 |
138 |
139 | 140 |

Create a new problem

141 | Select if TFL or FOL syntax:
142 | 143 |
144 | Premises (separate with “,” or “;”):
145 |
146 | Conclusion:
147 |
148 |

149 | 150 | 151 | 152 |
153 | 154 |

Sample exercise sets

155 | 156 | 160 | 161 | 162 |

Instructions

163 | 164 | 165 | 166 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 |
TFL atomic sentences:
(single uppercase letters)
A, B, X, etc.
FOL atomic sentences:
(single uppercase letters 167 | other than A or E followed by
lowercase letters a–w 168 | without parentheses, or identities)
Pa, 169 | Fcdc, a 170 | = d, etc.
For negation you may use any of the symbols: ¬ ~ ∼ - −
For conjunction you may use any of the symbols: ∧ ^ & . · *
For disjunction you may use any of the symbols: ∨ v
For the biconditional you may use any of the symbols: ↔ ≡ <-> <> (or in TFL only: =)
For the conditional you may use any of the symbols: → ⇒ ⊃ -> >
For the universal quantifier (FOL only), you may use any of the symbols: ∀x (∀x) Ax (Ax) (x) ⋀x
For the existential quantifier (FOL only), you may use any of the symbols: ∃x (∃x) Ex (Ex) ⋁x
For a contradiction you may use any of the symbols: ⊥ XX #
180 |

The following buttons do the following things:

181 | 182 | 183 | 184 | 185 | 186 | 187 |
×= delete this line
|+= add a line below this one
||+= add a new subproof below this line
<+= add a new line below this subproof to the parent subproof
<|+= add a new subproof below this subproof to the parent subproof
188 |

Apart from premises and assumptions, each line has a cell immediately to its right for entering the justifcation. Click on it to enter the justification as, e.g. “&I 1,2”.

189 |

Hopefully it is otherwise more or less obvious how to use it.

190 | 191 |
194 |
195 |

Rules

196 |
Basic rules
197 |
198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 |
Derived rules
218 | 219 | 220 | 221 | 222 | 223 | 224 |
Rules for Cambridge
225 | 226 | 227 | 228 |
229 |
230 | 231 | 232 | -------------------------------------------------------------------------------- /new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/new.png -------------------------------------------------------------------------------- /newb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/newb.png -------------------------------------------------------------------------------- /newsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/newsp.png -------------------------------------------------------------------------------- /newspb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/newspb.png -------------------------------------------------------------------------------- /normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */ 2 | 3 | /** 4 | * 1. Set default font family to sans-serif. 5 | * 2. Prevent iOS text size adjust after orientation change, without disabling 6 | * user zoom. 7 | */ 8 | 9 | html { 10 | font-family: sans-serif; /* 1 */ 11 | -ms-text-size-adjust: 100%; /* 2 */ 12 | -webkit-text-size-adjust: 100%; /* 2 */ 13 | } 14 | 15 | /** 16 | * Remove default margin. 17 | */ 18 | 19 | body { 20 | margin: 0; 21 | } 22 | 23 | /* HTML5 display definitions 24 | ========================================================================== */ 25 | 26 | /** 27 | * Correct `block` display not defined for any HTML5 element in IE 8/9. 28 | * Correct `block` display not defined for `details` or `summary` in IE 10/11 29 | * and Firefox. 30 | * Correct `block` display not defined for `main` in IE 11. 31 | */ 32 | 33 | article, 34 | aside, 35 | details, 36 | figcaption, 37 | figure, 38 | footer, 39 | header, 40 | hgroup, 41 | main, 42 | menu, 43 | nav, 44 | section, 45 | summary { 46 | display: block; 47 | } 48 | 49 | /** 50 | * 1. Correct `inline-block` display not defined in IE 8/9. 51 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. 52 | */ 53 | 54 | audio, 55 | canvas, 56 | progress, 57 | video { 58 | display: inline-block; /* 1 */ 59 | vertical-align: baseline; /* 2 */ 60 | } 61 | 62 | /** 63 | * Prevent modern browsers from displaying `audio` without controls. 64 | * Remove excess height in iOS 5 devices. 65 | */ 66 | 67 | audio:not([controls]) { 68 | display: none; 69 | height: 0; 70 | } 71 | 72 | /** 73 | * Address `[hidden]` styling not present in IE 8/9/10. 74 | * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. 75 | */ 76 | 77 | [hidden], 78 | template { 79 | display: none; 80 | } 81 | 82 | /* Links 83 | ========================================================================== */ 84 | 85 | /** 86 | * Remove the gray background color from active links in IE 10. 87 | */ 88 | 89 | a { 90 | background-color: transparent; 91 | } 92 | 93 | /** 94 | * Improve readability when focused and also mouse hovered in all browsers. 95 | */ 96 | 97 | a:active, 98 | a:hover { 99 | outline: 0; 100 | } 101 | 102 | /* Text-level semantics 103 | ========================================================================== */ 104 | 105 | /** 106 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome. 107 | */ 108 | 109 | abbr[title] { 110 | border-bottom: 1px dotted; 111 | } 112 | 113 | /** 114 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. 115 | */ 116 | 117 | b, 118 | strong { 119 | font-weight: bold; 120 | } 121 | 122 | /** 123 | * Address styling not present in Safari and Chrome. 124 | */ 125 | 126 | dfn { 127 | font-style: italic; 128 | } 129 | 130 | /** 131 | * Address variable `h1` font-size and margin within `section` and `article` 132 | * contexts in Firefox 4+, Safari, and Chrome. 133 | */ 134 | 135 | h1 { 136 | font-size: 2em; 137 | margin: 0.67em 0; 138 | } 139 | 140 | /** 141 | * Address styling not present in IE 8/9. 142 | */ 143 | 144 | mark { 145 | background: #ff0; 146 | color: #000; 147 | } 148 | 149 | /** 150 | * Address inconsistent and variable font size in all browsers. 151 | */ 152 | 153 | small { 154 | font-size: 80%; 155 | } 156 | 157 | /** 158 | * Prevent `sub` and `sup` affecting `line-height` in all browsers. 159 | */ 160 | 161 | sub, 162 | sup { 163 | font-size: 75%; 164 | line-height: 0; 165 | position: relative; 166 | vertical-align: baseline; 167 | } 168 | 169 | sup { 170 | top: -0.5em; 171 | } 172 | 173 | sub { 174 | bottom: -0.25em; 175 | } 176 | 177 | /* Embedded content 178 | ========================================================================== */ 179 | 180 | /** 181 | * Remove border when inside `a` element in IE 8/9/10. 182 | */ 183 | 184 | img { 185 | border: 0; 186 | } 187 | 188 | /** 189 | * Correct overflow not hidden in IE 9/10/11. 190 | */ 191 | 192 | svg:not(:root) { 193 | overflow: hidden; 194 | } 195 | 196 | /* Grouping content 197 | ========================================================================== */ 198 | 199 | /** 200 | * Address margin not present in IE 8/9 and Safari. 201 | */ 202 | 203 | figure { 204 | margin: 1em 40px; 205 | } 206 | 207 | /** 208 | * Address differences between Firefox and other browsers. 209 | */ 210 | 211 | hr { 212 | -moz-box-sizing: content-box; 213 | box-sizing: content-box; 214 | height: 0; 215 | } 216 | 217 | /** 218 | * Contain overflow in all browsers. 219 | */ 220 | 221 | pre { 222 | overflow: auto; 223 | } 224 | 225 | /** 226 | * Address odd `em`-unit font size rendering in all browsers. 227 | */ 228 | 229 | code, 230 | kbd, 231 | pre, 232 | samp { 233 | font-family: monospace, monospace; 234 | font-size: 1em; 235 | } 236 | 237 | /* Forms 238 | ========================================================================== */ 239 | 240 | /** 241 | * Known limitation: by default, Chrome and Safari on OS X allow very limited 242 | * styling of `select`, unless a `border` property is set. 243 | */ 244 | 245 | /** 246 | * 1. Correct color not being inherited. 247 | * Known issue: affects color of disabled elements. 248 | * 2. Correct font properties not being inherited. 249 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. 250 | */ 251 | 252 | button, 253 | input, 254 | optgroup, 255 | select, 256 | textarea { 257 | color: inherit; /* 1 */ 258 | font: inherit; /* 2 */ 259 | margin: 0; /* 3 */ 260 | } 261 | 262 | /** 263 | * Address `overflow` set to `hidden` in IE 8/9/10/11. 264 | */ 265 | 266 | button { 267 | overflow: visible; 268 | } 269 | 270 | /** 271 | * Address inconsistent `text-transform` inheritance for `button` and `select`. 272 | * All other form control elements do not inherit `text-transform` values. 273 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. 274 | * Correct `select` style inheritance in Firefox. 275 | */ 276 | 277 | button, 278 | select { 279 | text-transform: none; 280 | } 281 | 282 | /** 283 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 284 | * and `video` controls. 285 | * 2. Correct inability to style clickable `input` types in iOS. 286 | * 3. Improve usability and consistency of cursor style between image-type 287 | * `input` and others. 288 | */ 289 | 290 | button, 291 | html input[type="button"], /* 1 */ 292 | input[type="reset"], 293 | input[type="submit"] { 294 | -webkit-appearance: button; /* 2 */ 295 | cursor: pointer; /* 3 */ 296 | } 297 | 298 | /** 299 | * Re-set default cursor for disabled elements. 300 | */ 301 | 302 | button[disabled], 303 | html input[disabled] { 304 | cursor: default; 305 | } 306 | 307 | /** 308 | * Remove inner padding and border in Firefox 4+. 309 | */ 310 | 311 | button::-moz-focus-inner, 312 | input::-moz-focus-inner { 313 | border: 0; 314 | padding: 0; 315 | } 316 | 317 | /** 318 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in 319 | * the UA stylesheet. 320 | */ 321 | 322 | input { 323 | line-height: normal; 324 | } 325 | 326 | /** 327 | * It's recommended that you don't attempt to style these elements. 328 | * Firefox's implementation doesn't respect box-sizing, padding, or width. 329 | * 330 | * 1. Address box sizing set to `content-box` in IE 8/9/10. 331 | * 2. Remove excess padding in IE 8/9/10. 332 | */ 333 | 334 | input[type="checkbox"], 335 | input[type="radio"] { 336 | box-sizing: border-box; /* 1 */ 337 | padding: 0; /* 2 */ 338 | } 339 | 340 | /** 341 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain 342 | * `font-size` values of the `input`, it causes the cursor style of the 343 | * decrement button to change from `default` to `text`. 344 | */ 345 | 346 | input[type="number"]::-webkit-inner-spin-button, 347 | input[type="number"]::-webkit-outer-spin-button { 348 | height: auto; 349 | } 350 | 351 | /** 352 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome. 353 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome 354 | * (include `-moz` to future-proof). 355 | */ 356 | 357 | input[type="search"] { 358 | -webkit-appearance: textfield; /* 1 */ 359 | -moz-box-sizing: content-box; 360 | -webkit-box-sizing: content-box; /* 2 */ 361 | box-sizing: content-box; 362 | } 363 | 364 | /** 365 | * Remove inner padding and search cancel button in Safari and Chrome on OS X. 366 | * Safari (but not Chrome) clips the cancel button when the search input has 367 | * padding (and `textfield` appearance). 368 | */ 369 | 370 | input[type="search"]::-webkit-search-cancel-button, 371 | input[type="search"]::-webkit-search-decoration { 372 | -webkit-appearance: none; 373 | } 374 | 375 | /** 376 | * Define consistent border, margin, and padding. 377 | */ 378 | 379 | fieldset { 380 | border: 1px solid #c0c0c0; 381 | margin: 0 2px; 382 | padding: 0.35em 0.625em 0.75em; 383 | } 384 | 385 | /** 386 | * 1. Correct `color` not being inherited in IE 8/9/10/11. 387 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 388 | */ 389 | 390 | legend { 391 | border: 0; /* 1 */ 392 | padding: 0; /* 2 */ 393 | } 394 | 395 | /** 396 | * Remove default vertical scrollbar in IE 8/9/10/11. 397 | */ 398 | 399 | textarea { 400 | overflow: auto; 401 | } 402 | 403 | /** 404 | * Don't inherit the `font-weight` (applied by a rule above). 405 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. 406 | */ 407 | 408 | optgroup { 409 | font-weight: bold; 410 | } 411 | 412 | /* Tables 413 | ========================================================================== */ 414 | 415 | /** 416 | * Remove most spacing between table cells. 417 | */ 418 | 419 | table { 420 | border-collapse: collapse; 421 | border-spacing: 0; 422 | } 423 | 424 | td, 425 | th { 426 | padding: 0; 427 | } -------------------------------------------------------------------------------- /phpinf.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /proofs.css: -------------------------------------------------------------------------------- 1 | var { 2 | margin-right: 1px; 3 | } 4 | button { 5 | margin-right: 1em; 6 | margin-bottom: 0.5ex; 7 | } 8 | div.resultsdiv { 9 | margin-top: 1ex; 10 | margin-bottom: 1ex; 11 | } 12 | table.prooftable { 13 | border-collapse: collapse; 14 | margin-bottom: 2ex; 15 | /* border-spacing: 0; */ 16 | } 17 | 18 | table.prooftable tr.spacerrow, table.prooftable tr.spacerrow td { 19 | height: 0.5ex; 20 | } 21 | 22 | table.prooftable td { 23 | padding: 0px; 24 | height: 3.3ex; 25 | border-bottom: none; 26 | } 27 | 28 | table.prooftable td.linenocell { 29 | text-align: right; 30 | padding-right: 0.5em; 31 | } 32 | table.prooftable td.midcell { 33 | min-width: 1em; 34 | } 35 | table.prooftable td.midcell, td.wffcell { 36 | border-left: 2px solid black; 37 | } 38 | table.prooftable td.wffcell input { 39 | font-size: inherit; 40 | width: 10em; 41 | margin-bottom: inherit; 42 | } 43 | table.prooftable td.wffcell { 44 | min-width: 11em; 45 | } 46 | table.prooftable td.wffcell span { 47 | padding-left: 0.5em; 48 | padding-right: 0.5em; 49 | } 50 | table.prooftable td.jcell input { 51 | font-size: inherit; 52 | width: 5em; 53 | margin-bottom: inherit; 54 | } 55 | table.prooftable td.jcell { 56 | border: 1px dashed transparent; 57 | min-width: 5.2em; 58 | } 59 | table.prooftable td.wffcell:hover, table.prooftable td.jcell:hover { 60 | background-color: LightGray; 61 | cursor: pointer; 62 | } 63 | table.prooftable td.wffcell.noclick:hover,table.prooftable td.jcell.noclick:hover { 64 | background-color: transparent; 65 | cursor: default; 66 | } 67 | table.prooftable td.sepcell span, table.prooftable td.sepcell input { 68 | border-bottom: 2px solid black; 69 | padding-bottom: 2px; 70 | } 71 | table.prooftable td.buttoncell a { 72 | visibility: hidden; 73 | } 74 | table.prooftable tr:hover td.buttoncell a { 75 | visibility: visible; 76 | } 77 | 78 | 79 | table.prooftable td.buttoncell a, #key a { 80 | color: blue; 81 | cursor: pointer; 82 | margin-left: 0.5em; 83 | padding: 3px; 84 | border: 1px solid blue; 85 | border-radius: 5px; 86 | } 87 | table.prooftable td.buttoncell a:hover { 88 | background-color: LightBlue; 89 | } 90 | table.prooftable td.jcell.showcell { 91 | border: 1px dashed gray; 92 | background-color: LightGray; 93 | } 94 | table.prooftable td.jcell.showcell:hover { 95 | border-bottom: 1px solid LightGray; 96 | background-color: DarkGray; 97 | } 98 | button img { 99 | margin-top: 0.2ex; 100 | margin-bottom: 0.2ex; 101 | margin-right: 0.5ex; 102 | vertical-align: middle; 103 | } 104 | -------------------------------------------------------------------------------- /proofs.js: -------------------------------------------------------------------------------- 1 | 2 | var proofBeingChecked = false; 3 | 4 | function processProofCheckResponse(text) { 5 | if (!(proofBeingChecked)) { 6 | return; 7 | } 8 | console.log("XX" + text); 9 | var res = JSON.parse(text); 10 | var restext = ''; 11 | if (res.issues.length == 0) { 12 | if (res.concReached == true) { 13 | restext += ' Congratulations! This proof is correct.'; 14 | } else { 15 | restext += '😐 No errors yet, but you haven’t reached the conclusion.'; 16 | } 17 | } else { 18 | restext += ' Sorry there were errors.
'; 19 | restext += res.issues.join('
'); 20 | } 21 | proofBeingChecked.results.innerHTML = restext; 22 | proofBeingChecked = false; 23 | } 24 | 25 | function maxdepth(prdata) { 26 | var rv = 0; 27 | for (var i=0; i 0)) { 207 | var addurowlink = document.createElement("a"); 208 | var addusplink = document.createElement("a"); 209 | newrow.bCell.appendChild(addurowlink); 210 | newrow.bCell.appendChild(addusplink); 211 | addurowlink.innerHTML = ''; 212 | addusplink.innerHTML = ''; 213 | addurowlink.myPos = (currln - 1); 214 | addurowlink.myProof = prf; 215 | addusplink.myPos = (currln - 1); 216 | addusplink.myProof = prf; 217 | addurowlink.title = "Add a new line to the parent of this subproof below."; 218 | addusplink.title = "Add a new subproof to the parent of this subproof below."; 219 | addurowlink.onclick = function() { 220 | this.myProof.registerInput(); 221 | this.myProof.addNewUPLine(this.myPos); 222 | this.myProof.displayMe(); 223 | } 224 | addusplink.onclick = function() { 225 | this.myProof.registerInput(); 226 | this.myProof.addNewUPSubProof(this.myPos); 227 | this.myProof.displayMe(); 228 | } 229 | } 230 | } 231 | rs.push(newrow); 232 | } 233 | } 234 | return rs; 235 | } 236 | 237 | function flat_array(a, dpar) { 238 | var b=[]; 239 | for (var i=0; i 0) && (n < fa.length)) { 257 | loc = fa[n].location; 258 | } else { 259 | loc = [n]; 260 | } 261 | return putNewLineAt(pd, loc, newsp, uppa); 262 | } 263 | 264 | function putNewLineAt(pd, loc, newsp, uppa) { 265 | if ((loc.length == 1) || ( (loc.length == 2) && (uppa) )) { 266 | if (newsp) { 267 | pd.splice(loc[0] + 1, 0, [ { "wffstr" : "", "jstr" : "Hyp" } ]); 268 | } else { 269 | pd.splice(loc[0] + 1, 0, { "wffstr" : "", "jstr" : "" }); 270 | } 271 | } else { 272 | pd[loc[0]] = putNewLineAt(pd[loc[0]], loc.slice(1), newsp, uppa); 273 | } 274 | return pd; 275 | } 276 | 277 | function changeWffAt(pd, loc, val) { 278 | if (loc.length == 1) { 279 | pd[loc[0]].wffstr = fixWffInputStr(val); 280 | } else { 281 | pd[loc[0]] = changeWffAt(pd[loc[0]], loc.slice(1), val); 282 | } 283 | return pd; 284 | } 285 | 286 | function changeWffValue(pd, pos, val) { 287 | var fa = flat_array(pd, []); 288 | if (fa.length > 0) { 289 | loc = fa[pos].location; 290 | } else { 291 | loc = [0]; 292 | } 293 | return changeWffAt(pd, loc, val); 294 | } 295 | 296 | function changeJAt(pd, loc, val) { 297 | if (loc.length == 1) { 298 | pd[loc[0]].jstr = fixJInputStr(val); 299 | } else { 300 | pd[loc[0]] = changeJAt(pd[loc[0]], loc.slice(1), val); 301 | } 302 | return pd; 303 | } 304 | 305 | function changeJValue(pd, pos, val) { 306 | var fa = flat_array(pd, []); 307 | if (fa.length > 0) { 308 | loc = fa[pos].location; 309 | } else { 310 | loc = [0]; 311 | } 312 | return changeJAt(pd, loc, val); 313 | } 314 | 315 | function deletePDLine(pd, pos) { 316 | var fa = flat_array(pd, []); 317 | if ((fa.length > 0) && (pos < fa.length)) { 318 | loc = fa[pos].location; 319 | } else { 320 | return; 321 | } 322 | if ((loc.length > 1) && (loc[(loc.length - 1)] == 0)) { 323 | if (confirm("Warning: this will delete the entire subproof.\nDelete anyway?")) { 324 | loc.pop(); 325 | } else { 326 | return pd; 327 | } 328 | } 329 | return delLineFromLocation(pd, loc); 330 | } 331 | 332 | function delLineFromLocation(pd, loc) { 333 | if (loc.length == 1) { 334 | pd.splice(loc[0], 1); 335 | } else { 336 | pd[loc[0]] = delLineFromLocation(pd[loc[0]], loc.slice(1)); 337 | } 338 | return pd; 339 | } 340 | 341 | function makeProof(pardiv, pstart, conc) { 342 | var p = document.createElement("table"); 343 | pardiv.appendChild(p); 344 | p.classList.add("prooftable"); 345 | p.proofdata = pstart; 346 | p.numPrems = 0; 347 | for (var i=0; i 0) { 473 | var a=document.createElement("button"); 474 | a.type = "button"; 475 | var im=document.createElement("img"); 476 | im.src = imgs[0].src; 477 | var sp=document.createElement("span"); 478 | console.log(im.src); 479 | if (im.src.match("new.png")) { 480 | sp.innerHTML = "new line"; 481 | a.title = "Add a new line at end."; 482 | } 483 | if (im.src.match("newsp.png")) { 484 | sp.innerHTML = "new subproof"; 485 | a.title = "Start a new subproof at end."; 486 | } 487 | if (im.src.match("newb.png")) { 488 | sp.innerHTML = "finish subproof; add line"; 489 | a.title = "Finish this subproof, and add a line to parent."; 490 | } 491 | if (im.src.match("newspb.png")) { 492 | sp.innerHTML = "finish subproof; start another"; 493 | a.title = "Finish this subproof, and add start a new one in parent."; 494 | } 495 | 496 | this.buttonDiv.appendChild(a); 497 | a.appendChild(im); 498 | a.appendChild(sp); 499 | a.myProof = bts[i].myProof; 500 | a.myPos = bts[i].myPos; 501 | a.onclick = bts[i].onclick; 502 | } 503 | } 504 | if (this.buttonDiv.getElementsByTagName("button").length == 0) { 505 | var a=document.createElement("button"); 506 | a.type = "button"; 507 | this.buttonDiv.appendChild(a); 508 | a.innerHTML = 'new line'; 509 | a.title = 'Add a new line.'; 510 | a.myProof = this; 511 | a.onclick = function() { 512 | this.myProof.addNewLine(0); 513 | this.myProof.openline = 1; 514 | this.myProof.displayMe(); 515 | }; 516 | var b=document.createElement("button"); 517 | b.type = "button"; 518 | this.buttonDiv.appendChild(b); 519 | b.innerHTML = 'new subproof'; 520 | b.title = 'Add a new subproof.'; 521 | b.myProof = this; 522 | b.onclick = function() { 523 | this.myProof.addNewSubProof(0); 524 | this.myProof.openline = 1; 525 | this.myProof.displayMe(); 526 | }; 527 | } 528 | 529 | try { this.oInput.focus(); } catch(err) { }; 530 | } 531 | /*if (pstart.length == 0) { 532 | p.proofdata = [ { "wffstr" : "", "jstr" : "" } ]; 533 | }*/ 534 | p.displayMe(); 535 | return p; 536 | } 537 | -------------------------------------------------------------------------------- /proofs.php: -------------------------------------------------------------------------------- 1 | array(2, 0), 8 | "∧E" => array(1, 0), 9 | "⊥I" => array(2, 0), 10 | "⊥E" => array(1, 0), 11 | "¬I" => array(0, 1), 12 | "¬E" => array(2, 0), 13 | "→I" => array(0, 1), 14 | "→E" => array(2, 0), 15 | "TND" => array(0, 2), 16 | "∨I" => array(1, 0), 17 | "∨E" => array(1, 2), 18 | "↔I" => array(0, 2), 19 | "↔E" => array(2, 0), 20 | "DS" => array(2, 0), 21 | "R" => array(1, 0), 22 | "MT" => array(2, 0), 23 | "DNE" => array(1, 0), 24 | "DeM" => array(1, 0), 25 | "∀E" => array(1, 0), 26 | "∀I" => array(1, 0), 27 | "∃I" => array(1, 0), 28 | "∃E" => array(1, 1), 29 | "=I" => array(0, 0), 30 | "=E" => array(2, 0), 31 | "CQ" => array(1, 0), 32 | "Hyp" => array(0,0), 33 | "Pr" => array(0,0), 34 | "X" => array(1, 0), 35 | "IP" => array(0, 1), 36 | "LEM" => array(0, 2) 37 | ); 38 | 39 | function followsByCQThisWay($a, $b) { 40 | return ( 41 | ($a->mainOp == "¬") 42 | && 43 | ($b->rightSide->mainOp == "¬") 44 | && 45 | ( 46 | (($a->rightSide->mainOp == "∀") && ($b->mainOp == "∃")) 47 | || 48 | (($a->rightSide->mainOp == "∃") && ($b->mainOp == "∀")) 49 | ) 50 | && 51 | ($b->myLetter == $a->rightSide->myLetter) 52 | && 53 | (sameWff($a->rightSide->rightSide, $b->rightSide->rightSide)) 54 | ); 55 | } 56 | 57 | function followsByCQ($a, $b) { 58 | return ( 59 | (followsByCQThisWay($a, $b)) 60 | || 61 | (followsByCQThisWay($b, $a)) 62 | ); 63 | } 64 | 65 | function isSelfId($w) { 66 | return ( 67 | ($w->wffType == "identity") 68 | && 69 | (!(isVar($w->myTerms[0]))) 70 | && 71 | ($w->myTerms[0] == $w->myTerms[1]) 72 | ); 73 | } 74 | 75 | function followsByLLThisWay($c, $a, $b) { 76 | return ( 77 | ($a->wffType == "identity") && 78 | ( 79 | (differsBySwappingFor($c, $b, $a->myTerms[0], $a->myTerms[1])) 80 | || 81 | (differsBySwappingFor($c, $b, $a->myTerms[1], $a->myTerms[0])) 82 | ) 83 | ); 84 | } 85 | 86 | function differsBySwappingFor($q, $p, $s, $t) { 87 | if ($p->wffType != $q->wffType) { 88 | return false; 89 | } 90 | if ($p->wffType == "splat") { 91 | return true; 92 | } 93 | if (($p->wffType == "atomic") || ($p->wffType == "identity")) { 94 | if (count($p->myTerms) != count($q->myTerms)) { 95 | return false; 96 | } 97 | if (($p->wffType == "atomic") && ($p->myLetter != $q->myLetter)) { 98 | return false; 99 | } 100 | for ($i=0; $imyTerms); $i++) { 101 | if ( 102 | ($p->myTerms[$i] != $q->myTerms[$i]) 103 | && 104 | (!( 105 | ($p->myTerms[$i] == $t) 106 | && 107 | ($q->myTerms[$i] == $s) 108 | )) 109 | ) { 110 | return false; 111 | } 112 | } 113 | return true; 114 | } 115 | if ($p->mainOp != $q->mainOp) { 116 | return false; 117 | } 118 | if (isMonOp($p->mainOp)) { 119 | return differsBySwappingFor($q->rightSide, $p->rightSide, $s, $t); 120 | } 121 | return ( 122 | (differsBySwappingFor($q->rightSide, $p->rightSide, $s, $t)) 123 | && 124 | (differsBySwappingFor($q->leftSide, $p->leftSide, $s, $t)) 125 | ); 126 | } 127 | 128 | 129 | function followsByLL($c, $a, $b) { 130 | return ( 131 | (followsByLLThisWay($c, $a, $b)) || 132 | (followsByLLThisWay($c, $b, $a)) 133 | ); 134 | } 135 | 136 | 137 | function followsByEG($c, $a) { 138 | if (!($c->mainOp == "∃")) { 139 | return false; 140 | } 141 | 142 | // vacuous instance 143 | if (!(in_array($c->myLetter, $c->rightSide->allFreeVars))) { 144 | return (sameWff($c->rightSide, $a)); 145 | } 146 | 147 | // regular instance 148 | // no double binding unless vacuous 149 | if (in_array($c->myLetter, $a->myTerms)) { 150 | return false; 151 | } 152 | 153 | foreach ($a->myTerms as $t) { 154 | if (!(isVar($t))) { 155 | if (sameWff($a, subTerm($c->rightSide, $t, $c->myLetter))) { 156 | return true; 157 | } 158 | } 159 | } 160 | return false; 161 | } 162 | 163 | function followsByUI($c, $a) { 164 | if (!($a->mainOp == "∀")) { 165 | return false; 166 | } 167 | // regular instance 168 | foreach ($c->myTerms as $t) { 169 | if (!(isVar($t))) { 170 | if (sameWff($c, subTerm($a->rightSide, $t, $a->myLetter))) { 171 | return true; 172 | } 173 | } 174 | } 175 | // vacuous binding instance 176 | if ((!(in_array($a->myLetter,$a->rightSide->allFreeVars))) && (sameWff($c ,$a->rightSide ))) { 177 | return true; 178 | } 179 | return false; 180 | } 181 | 182 | function followsByDeMThisWay($a, $b) { 183 | return ( 184 | ($b->mainOp == "¬") 185 | && 186 | ( 187 | (($a->mainOp == "∧") && ($b->rightSide->mainOp == "∨")) 188 | || 189 | (($a->mainOp == "∨") && ($b->rightSide->mainOp == "∧")) 190 | ) 191 | && 192 | (($a->rightSide->mainOp == "¬") && ($a->leftSide->mainOp == "¬")) 193 | && 194 | (sameWff($a->rightSide->rightSide, $b->rightSide->rightSide)) 195 | && 196 | (sameWff($a->leftSide->rightSide, $b->rightSide->leftSide)) 197 | ); 198 | } 199 | 200 | function followsByDeM($c, $a) { 201 | return ( 202 | (followsByDeMThisWay($c, $a)) 203 | || 204 | (followsByDeMThisWay($a, $c)) 205 | ); 206 | } 207 | 208 | function followsByDNE($c, $a) { 209 | return ( 210 | ($a->mainOp == "¬") 211 | && 212 | ($a->rightSide->mainOp == "¬") 213 | && 214 | (sameWff($c, $a->rightSide->rightSide)) 215 | ); 216 | } 217 | 218 | function followsByMTThisWay($c, $a, $b) { 219 | return ( 220 | ($a->mainOp == "→") 221 | && 222 | ($b->mainOp == "¬") 223 | && 224 | ($c->mainOp == "¬") 225 | && 226 | (sameWff($a->rightSide, $b->rightSide)) 227 | && 228 | (sameWff($a->leftSide, $c->rightSide)) 229 | ); 230 | } 231 | 232 | function followsByMT($c,$a,$b) { 233 | return ( 234 | (followsByMTThisWay($c,$a,$b)) 235 | || 236 | (followsByMTThisWay($c,$b,$a)) 237 | ); 238 | } 239 | 240 | function followsByDSThisWay($c,$a,$b) { 241 | return ( 242 | ($a->mainOp == "∨") 243 | and 244 | ($b->mainOp == "¬") 245 | and 246 | ( 247 | ( 248 | (sameWff($b->rightSide, $a->rightSide)) 249 | && 250 | (sameWff($c,$a->leftSide)) 251 | ) 252 | || 253 | ( 254 | (sameWff($b->rightSide, $a->leftSide)) 255 | && 256 | (sameWff($c,$a->rightSide)) 257 | ) 258 | ) 259 | ); 260 | } 261 | 262 | function followsByDS($c,$a,$b) { 263 | return ( 264 | (followsByDSThisWay($c,$a,$b)) 265 | || 266 | (followsByDSThisWay($c,$b,$a)) 267 | ); 268 | } 269 | 270 | function followsByConjIntroThisWay($rw,$a,$b) { 271 | return ( 272 | ($rw->mainOp == "∧") 273 | && 274 | (sameWff($rw->rightSide, $a)) 275 | && 276 | (sameWff($rw->leftSide, $b)) 277 | ); 278 | } 279 | 280 | function followsByConjIntro($rw,$a,$b) { 281 | return ( 282 | followsByConjIntroThisWay($rw,$a,$b) || 283 | followsByConjIntroThisWay($rw,$b,$a) 284 | ); 285 | } 286 | 287 | function followsByConjElim($rw, $a) { 288 | return ( 289 | ($a->mainOp == "∧") 290 | && 291 | ( 292 | (sameWff($a->rightSide, $rw)) 293 | || 294 | (sameWff($a->leftSide, $rw)) 295 | ) 296 | ); 297 | } 298 | 299 | function followsByContraIntro($c, $a, $b) { 300 | return ( 301 | ($c->wffType == "splat") 302 | && 303 | ( 304 | (($b->mainOp == "¬") && (sameWff($a, $b->rightSide))) 305 | || 306 | (($a->mainOp == "¬") && (sameWff($b, $a->rightSide))) 307 | ) 308 | ); 309 | } 310 | 311 | function followsByMPThisWay($c, $a, $b) { 312 | return ( 313 | ($a->mainOp == "→") 314 | && 315 | (sameWff($a->rightSide, $c)) 316 | && 317 | (sameWff($a->leftSide, $b)) 318 | ); 319 | } 320 | 321 | function followsByMP($c, $a, $b) { 322 | return ( 323 | (followsByMPThisWay($c, $a, $b)) 324 | || 325 | (followsByMPThisWay($c, $b, $a)) 326 | ); 327 | } 328 | 329 | function followsByCP($c, $a, $b) { 330 | return ( 331 | ($c->mainOp == "→") 332 | && 333 | (sameWff($c->leftSide, $a)) 334 | && 335 | (sameWff($c->rightSide, $b)) 336 | ); 337 | } 338 | 339 | function followsByRAA($c, $a, $b) { 340 | return ( 341 | ($c->mainOp == "¬") 342 | && 343 | (sameWff($c->rightSide, $a)) 344 | && 345 | ($b->wffType == "splat") 346 | ); 347 | } 348 | 349 | function followsByIP($c, $a, $b) { 350 | return ( 351 | ($a->mainOp == "¬") 352 | && 353 | (sameWff($a->rightSide, $c)) 354 | && 355 | ($b->wffType == "splat") 356 | ); 357 | } 358 | 359 | function followsByTNDThisWay($c, $i, $j, $k, $l) { 360 | return ( 361 | ($k->mainOp == "¬") 362 | && 363 | (sameWff($k->rightSide, $i)) 364 | && 365 | (sameWff($j, $l)) 366 | && 367 | (sameWff($c, $j)) 368 | ); 369 | } 370 | 371 | function followsByTND($c, $i, $j, $k, $l) { 372 | return ( 373 | (followsByTNDThisWay($c, $i, $j, $k, $l)) 374 | || 375 | (followsByTNDThisWay($c, $k, $l, $i, $j)) 376 | ); 377 | } 378 | 379 | function followsByAdd($c, $a) { 380 | return ( 381 | ($c->mainOp == "∨") 382 | && 383 | ( 384 | (sameWff($c->leftSide, $a)) 385 | || 386 | (sameWff($c->rightSide, $a)) 387 | ) 388 | ); 389 | } 390 | 391 | function followsByDisjElimThisWay($c, $m, $i, $j, $k, $l) { 392 | return ( 393 | ($m->mainOp == "∨") 394 | && 395 | (sameWff($m->leftSide, $i)) 396 | && 397 | (sameWff($m->rightSide, $k)) 398 | && 399 | (sameWff($j, $l)) 400 | && 401 | (sameWff($j,$c)) 402 | ); 403 | } 404 | 405 | function followsByDisjElim($c, $m, $i, $j, $k, $l) { 406 | return ( 407 | (followsByDisjElimThisWay($c, $m, $i, $j, $k, $l)) 408 | || 409 | (followsByDisjElimThisWay($c, $m, $k, $l, $i, $j)) 410 | ); 411 | } 412 | 413 | function followsByBiconIntroThisWay($c, $i, $j, $k, $l) { 414 | return ( 415 | ($c->mainOp == "↔") 416 | && 417 | (sameWff($c->leftSide, $i)) 418 | && 419 | (sameWff($c->rightSide, $j)) 420 | && 421 | (sameWff($c->rightSide, $k)) 422 | && 423 | (sameWff($c->leftSide, $l)) 424 | ); 425 | } 426 | 427 | function followsByBiconIntro($c, $i, $j, $k, $l) { 428 | return ( 429 | (followsByBiconIntroThisWay($c, $i, $j, $k, $l)) 430 | || 431 | (followsByBiconIntroThisWay($c, $k, $l, $i, $j)) 432 | ); 433 | } 434 | 435 | function followsByBiconElimThisWay($c, $a, $b) { 436 | return ( 437 | ($a->mainOp == "↔") 438 | && 439 | (( 440 | (sameWff($a->leftSide, $b)) 441 | && 442 | (sameWff($a->rightSide, $c)) 443 | ) 444 | || 445 | ( 446 | (sameWff($a->leftSide, $c)) 447 | && 448 | (sameWff($a->rightSide, $b)) 449 | )) 450 | ); 451 | } 452 | 453 | function followsByBiconElim($c, $a, $b) { 454 | return ( 455 | (followsByBiconElimThisWay($c, $a, $b)) 456 | || 457 | (followsByBiconElimThisWay($c, $b, $a)) 458 | ); 459 | } 460 | 461 | function newJ() { 462 | $j = new StdClass(); 463 | $j->rules = array(); 464 | $j->lines = array(); 465 | $j->subps = array(); 466 | $j->parsedOK = true; 467 | $j->errMsg = ''; 468 | return $j; 469 | } 470 | 471 | function parseJ($jstr) { 472 | global $predicateSettings, $tfl_rules, $fol_rules; 473 | $j = newJ(); 474 | 475 | $jstr = mb_ereg_replace('[;,\s]+',',',$jstr); 476 | $jstr = mb_ereg_replace('[-–]+','-',$jstr); 477 | 478 | $jparts = explode(',',$jstr); 479 | foreach ($jparts as $jpart) { 480 | if ($jpart == '') { 481 | $j->parsedOK = false; 482 | $j->errMsg = 'Justification left blank.'; 483 | return $j; 484 | } 485 | if (mb_ereg_match('[0-9]*$', $jpart)) { 486 | array_push($j->lines, intval($jpart) ); 487 | continue; 488 | } 489 | if (mb_ereg_match('[0-9]+-[0-9]+$', $jpart)) { 490 | $spc = new StdClass(); 491 | $jpbreak = explode('-', $jpart); 492 | $spc->spstart = intval($jpbreak[0]); 493 | $spc->spend = intval($jpbreak[1]); 494 | array_push($j->subps, $spc); 495 | continue; 496 | } 497 | if ((in_array($jpart, $tfl_rules)) || 498 | ( ($predicateSettings) && (in_array($jpart, $fol_rules )))) { 499 | array_push($j->rules, $jpart); 500 | } else { 501 | $j->parsedOK = false; 502 | $j->errMsg = 'Justification cites nonexistent rule (' . $jpart . ') or is badly formed.'; 503 | return $j; 504 | } 505 | } 506 | if (count($j->rules) > 1) { 507 | $j->parsedOK = false; 508 | $j->errMsg = 'More than one rule cited.'; 509 | } 510 | if (count($j->rules) < 1) { 511 | $j->parsedOK = false; 512 | $j->errMsg = 'No rule cited.'; 513 | } 514 | 515 | return $j; 516 | } 517 | 518 | function flatten_proof($pr, $dpth_ar) { 519 | $fpr = array(); 520 | for ($i=0; $ilocation = array_merge($dpth_ar, array($i) ); 526 | $x->issues = array(); 527 | array_push($fpr, $x); 528 | } 529 | } 530 | return $fpr; 531 | } 532 | 533 | 534 | function check_proof($pr, $numprems, $conc) { 535 | global $cite_nums; 536 | $rv = new StdClass(); 537 | $rv->issues = array(); 538 | $rv->concReached = false; 539 | 540 | $fpr = flatten_proof($pr, array() ); 541 | 542 | 543 | // check syntax for all 544 | foreach ($fpr as &$line) { 545 | $line->wff = parseIt($line->wffstr); 546 | if (!($line->wff->isWellFormed)) { 547 | array_push($line->issues, 'Not well-formed: ' . $line->wff->ErrMsg); 548 | } 549 | } 550 | unset($line); 551 | 552 | 553 | // parse jStr for all 554 | foreach ($fpr as &$line) { 555 | $line->j = parseJ($line->jstr); 556 | if (!($line->j->parsedOK)) { 557 | array_push($line->issues, 'Cannot parse justification: ' . $line->j->errMsg); 558 | } 559 | } 560 | unset($line); 561 | 562 | // ensure citation cites the right amount of stuff 563 | foreach ($fpr as &$line) { 564 | if ($line->j->parsedOK) { 565 | $cnums = $cite_nums[$line->j->rules[0]]; 566 | $good_lc=$cnums[0]; 567 | $good_spc=$cnums[1]; 568 | $act_lc = count($line->j->lines); 569 | $act_spc = count($line->j->subps); 570 | if ($act_lc < $good_lc) { 571 | array_push($line->issues, 'Cites too few line numbers for the rule ' . $line->j->rules[0] . '.'); 572 | } 573 | if ($act_lc > $good_lc) { 574 | array_push($line->issues, 'Cites too many line numbers for the rule ' . $line->j->rules[0] . '.'); 575 | } 576 | if ($act_spc < $good_spc) { 577 | array_push($line->issues, 'Cites too few ranges of lines for the rule ' . $line->j->rules[0] . '.'); 578 | } 579 | if ($act_spc > $good_spc) { 580 | array_push($line->issues, 'Cites too many ranges of lines for the rule ' . $line->j->rules[0] . '.'); 581 | } 582 | } 583 | } 584 | unset($line); 585 | 586 | 587 | // ensure cited lines are available 588 | for ($i=0; $ij->parsedOK) { 590 | $n = ($i + 1); 591 | $nloc = $fpr[$i]->location; 592 | // individual line citations 593 | foreach ($fpr[$i]->j->lines as $citedline) { 594 | if (($citedline > count($fpr)) || ($citedline < 1)) { 595 | array_push($fpr[$i]->issues, 'Cites nonexistent line (' . $citedline . ').'); 596 | continue; 597 | } 598 | if ($citedline == $n) { 599 | array_push($fpr[$i]->issues, 'Cites itself.'); 600 | continue; 601 | } 602 | if ($citedline > $n) { 603 | array_push($fpr[$i]->issues, 'Cites a line (' . $citedline . ') that occurs after it.'); 604 | continue; 605 | } 606 | $cloc = $fpr[($citedline - 1)]->location; 607 | if (count($cloc) > count($nloc)) { 608 | array_push($fpr[$i]->issues, 'Cites an unavailable line (' . $citedline . ').'); 609 | continue; 610 | } 611 | $problem = false; 612 | for ($d=0; $d<(count($cloc) - 1); $d++) { 613 | if ($cloc[$d] != $nloc[$d]) { 614 | $problem = true; 615 | break; 616 | } 617 | } 618 | if ($problem) { 619 | array_push($fpr[$i]->issues, 'Cites an unavailable line (' . $citedline . ').'); 620 | continue; 621 | } 622 | } 623 | // line range citations 624 | foreach ($fpr[$i]->j->subps as $citedsp) { 625 | $startcite = $citedsp->spstart; 626 | $endcite = $citedsp->spend; 627 | if ($startcite > $endcite) { 628 | array_push($fpr[$i]->issues, 'Cites a range of lines in the wrong order (' . $startcite . '–' . $endcite . ').'); 629 | continue; 630 | } 631 | if (($startcite > count($fpr)) || ($endcite > count($fpr)) || ($startcite < 1) || ($endcite < 0)) { 632 | array_push($fpr[$i]->issues, 'Cites a line nonexistent range of lines (' . $startcite . '–' . $endcite . ').'); 633 | continue; 634 | } 635 | if ($endcite >= $n) { 636 | array_push($fpr[$i]->issues, 'Cites a line range after or including itself (' . $startcite . '–' . $endcite . ').'); 637 | continue; 638 | } 639 | // ensure an actual subproof 640 | $endloc = $fpr[($endcite - 1)]->location; 641 | $startloc = $fpr[($startcite - 1)]->location; 642 | $problem = false; 643 | if (count($endloc) != count($startloc)) { 644 | $problem = true; 645 | } 646 | if ($startloc[count($startloc) - 1] != 0) { 647 | $problem = true; 648 | } 649 | for ($l=0; $l<(count($startloc) - 1); $l++) { 650 | if ($endloc[$l] != $startloc[$l]) { 651 | $problem = true; 652 | break; 653 | } 654 | } 655 | if ($problem) { 656 | array_push($fpr[$i]->issues, 'Cites a range of lines which do not make up a subproof (' . $startcite . '–' . $endcite . ').'); 657 | continue; 658 | } 659 | // ensure subproof is available 660 | $problem = false; 661 | $cloc = $startloc; 662 | array_pop($cloc); 663 | if ((count($cloc) > count($nloc)) || (count($cloc) < count($nloc))) { 664 | array_push($fpr[$i]->issues, 'Cites an unavailable subproof (' . $startcite . '–' . $endcite . ').'); 665 | continue; 666 | } 667 | for ($d=0; $d<(count($cloc) - 1); $d++) { 668 | if ($cloc[$d] != $nloc[$d]) { 669 | $problem = true; 670 | break; 671 | } 672 | } 673 | if ($problem) { 674 | array_push($fpr[$i]->issues, 'Cites an unavailable subproof (' . $startcite . '–' . $endcite . ').'); 675 | continue; 676 | } 677 | } 678 | } 679 | } 680 | 681 | 682 | // make sure cited lines are well-formed 683 | for ($i=0; $icanBeChecked = true; 685 | if ( count($fpr[$i]->issues) > 0 ) { 686 | $fpr[$i]->canBeChecked = false; 687 | continue; 688 | } 689 | foreach ($fpr[$i]->j->lines as $cl) { 690 | $cn = $cl - 1; 691 | if (!($fpr[$cn]->wff->isWellFormed)) { 692 | $fpr[$i]->canBeChecked = false; 693 | array_push($fpr[$i]->issues, 'Cites another line that is not well-formed (' . $cl . ').'); 694 | } 695 | } 696 | foreach ($fpr[$i]->j->subps as $csp) { 697 | $csn = $csp->spstart - 1; 698 | $cen = $csp->spend - 1; 699 | if (!($fpr[$csn]->wff->isWellFormed)) { 700 | $fpr[$i]->canBeChecked = false; 701 | array_push($fpr[$i]->issues, 'Cites another line that is not well-formed (' . $csp->spstart . ').'); 702 | } 703 | if (!($fpr[$cen]->wff->isWellFormed)) { 704 | $fpr[$i]->canBeChecked = false; 705 | array_push($fpr[$i]->issues, 'Cites another line that is not well-formed (' . $csp->spend . ').'); 706 | } 707 | } 708 | } 709 | 710 | 711 | // check lines that can be checked 712 | ////////////////////////////////// 713 | // ENFORCING RULES GOES HERE 714 | ////////////////////////////////// 715 | for ($i=0; $icanBeChecked)) { 719 | continue; 720 | } 721 | $worked = false; 722 | switch ($fpr[$i]->j->rules[0]) { 723 | case "Pr": 724 | $worked = (($i + 1) <= $numprems); 725 | break; 726 | case "Hyp": 727 | $worked = ($fpr[$i]->location[ (count($fpr[$i]->location) - 1) ] == 0); 728 | break; 729 | case "∧I": 730 | $worked = followsByConjIntro($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 731 | break; 732 | case "∧E": 733 | $worked = followsByConjElim($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 734 | break; 735 | case "⊥E": 736 | $worked = ( $fpr[ ($fpr[$i]->j->lines[0] - 1) ]->wff->wffType == "splat"); 737 | break; 738 | case "⊥I": 739 | $worked = followsByContraIntro($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 740 | break; 741 | case "→E": 742 | $worked = followsByMP( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 743 | break; 744 | case "→I": 745 | $worked = followsByCP( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff); 746 | break; 747 | case "¬I": 748 | $worked = followsByRAA( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff); 749 | break; 750 | case "¬E": 751 | $worked = followsByContraIntro($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 752 | break; 753 | case "IP": 754 | $worked = followsByIP( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff); 755 | break; 756 | case "TND": 757 | $worked = followsByTND( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spend - 1 )]->wff); 758 | case "LEM": 759 | $worked = followsByTND( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spend - 1 )]->wff); 760 | break; 761 | case "∨I": 762 | $worked = followsByAdd($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 763 | break; 764 | case "∨E": 765 | $worked = followsByDisjElim( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spend - 1 )]->wff); 766 | break; 767 | case "↔I": 768 | $worked = followsByBiconIntro( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spstart - 1 )]->wff, $fpr[( $fpr[$i]->j->subps[1]->spend - 1 )]->wff); 769 | break; 770 | case "↔E": 771 | $worked = followsByBiconElim( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 772 | break; 773 | case "X": 774 | $worked = ( $fpr[ ($fpr[$i]->j->lines[0] - 1) ]->wff->wffType == "splat"); 775 | break; 776 | case "DS": 777 | $worked = followsByDS( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff ); 778 | break; 779 | case "R": 780 | $worked = sameWff($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff ); 781 | break; 782 | case "MT": 783 | $worked = followsByMT($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff); 784 | break; 785 | case "DNE": 786 | $worked = followsByDNE($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 787 | break; 788 | case "DeM": 789 | $worked = followsByDeM($fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 790 | break; 791 | case "∀E": 792 | $worked = followsByUI( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 793 | break; 794 | case "∃I": 795 | $worked = followsByEG( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 796 | break; 797 | case "∀I": 798 | $univ = $fpr[$i]->wff; 799 | if ($univ->mainOp == "∀") { 800 | $inst = $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff; 801 | $bound_var = $univ->myLetter; 802 | if (in_array($univ->myLetter, $univ->rightSide->allFreeVars)) { 803 | $worked = false; 804 | foreach ($inst->myTerms as $t) { 805 | if (in_array($t, $univ->myTerms)) { 806 | continue; 807 | } 808 | if (!(isVar($t))) { 809 | if (sameWff($inst, subTerm($univ->rightSide, $t, $bound_var))) { 810 | $found = false; 811 | for ($j=0; $j<$i; $j++) { 812 | if (($fpr[$j]->j->rules[0] == "Pr") || ($fpr[$j]->j->rules[0] == "Hyp")) { 813 | $hyp_loc = $fpr[$j]->location; 814 | $this_loc = $fpr[$i]->location; 815 | 816 | 817 | if (count($hyp_loc) > count($this_loc)) { 818 | continue; 819 | } 820 | $problem = false; 821 | for ($d=0; $d<(count($hyp_loc) - 1); $d++) { 822 | if ($hyp_loc[$d] != $this_loc[$d]) { 823 | $problem = true; 824 | break; 825 | } 826 | } 827 | if (!($problem)) { 828 | if ( in_array($t, $fpr[$j]->wff->myTerms)) { 829 | $found = true; 830 | break; 831 | } 832 | } 833 | 834 | 835 | 836 | } 837 | } 838 | if ($found) { 839 | continue; 840 | } 841 | $worked = true; 842 | } 843 | } 844 | } 845 | } else { 846 | $worked = sameWff($univ->rightSide, $inst); 847 | } 848 | } else { 849 | $worked = false; 850 | } 851 | break; 852 | case "∃E": 853 | $exwff = $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff; 854 | if ($exwff->mainOp == "∃") { 855 | $sp_hyp = $fpr[( $fpr[$i]->j->subps[0]->spstart - 1 )]->wff; 856 | $sp_res = $fpr[( $fpr[$i]->j->subps[0]->spend - 1 )]->wff; 857 | $res = $fpr[$i]->wff; 858 | if (sameWff($sp_res, $res)) { 859 | if (in_array( $exwff->myLetter, $exwff->rightSide->allFreeVars )) { 860 | $worked = false; 861 | foreach ($sp_hyp->myTerms as $t) { 862 | if (!(isVar($t))) { 863 | if (sameWff($sp_hyp, subTerm($exwff->rightSide, $t, $exwff->myLetter ))) { 864 | if (in_array($t, $res->myTerms)) { 865 | continue; 866 | } 867 | if (in_array($t, $exwff->myTerms)) { 868 | continue; 869 | } 870 | 871 | $found = false; 872 | for ($j=0; $j<$i; $j++) { 873 | if (($fpr[$j]->j->rules[0] == "Pr") || ($fpr[$j]->j->rules[0] == "Hyp")) { 874 | $hyp_loc = $fpr[$j]->location; 875 | $this_loc = $fpr[$i]->location; 876 | 877 | 878 | if (count($hyp_loc) > count($this_loc)) { 879 | continue; 880 | } 881 | $problem = false; 882 | for ($d=0; $d<(count($hyp_loc) - 1); $d++) { 883 | if ($hyp_loc[$d] != $this_loc[$d]) { 884 | $problem = true; 885 | break; 886 | } 887 | } 888 | if (!($problem)) { 889 | if ( in_array($t, $fpr[$j]->wff->myTerms)) { 890 | $found = true; 891 | break; 892 | } 893 | } 894 | 895 | 896 | 897 | } 898 | } 899 | if ($found) { 900 | continue; 901 | } 902 | $worked = true; 903 | 904 | 905 | } 906 | } 907 | } 908 | } else { 909 | $worked = sameWff($exwff->rightSide, $sp_hyp); 910 | } 911 | } else { 912 | $worked = false; 913 | } 914 | } else { 915 | $worked = false; 916 | } 917 | 918 | break; 919 | case "=I": 920 | $worked = isSelfId( $fpr[$i]->wff ); 921 | break; 922 | case "=E": 923 | $worked = followsByLL( $fpr[$i]->wff, $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff, $fpr[( $fpr[$i]->j->lines[1] - 1 )]->wff ); 924 | break; 925 | case "CQ": 926 | $worked = followsByCQ($fpr[$i]->wff , $fpr[( $fpr[$i]->j->lines[0] - 1 )]->wff); 927 | break; 928 | } 929 | if (!($worked)) { 930 | array_push($fpr[$i]->issues, 'Is not a proper application of the rule ' . $fpr[$i]->j->rules[0] .' (for the line(s) cited).'); 931 | } 932 | 933 | } 934 | 935 | 936 | // merge issues 937 | for ($i = 0; $iissues as $issue) { 941 | array_push($rv->issues, 'Line ' . $n . ': ' . $issue); 942 | } 943 | } 944 | 945 | 946 | // if no issues look for conclusion 947 | if (count($rv->issues) == 0) { 948 | $conc_wff = parseIt($conc); 949 | if (!($conc_wff->isWellFormed)) { 950 | array_push($rv->issues, 'Desired conclusion is not a wff. Oops!'); 951 | } else { 952 | foreach ($fpr as $line) { 953 | if ((count($line->location) == 1) && (sameWff($line->wff, $conc_wff))) { 954 | $rv->concReached = true; 955 | } 956 | } 957 | unset($line); 958 | } 959 | } 960 | 961 | 962 | return $rv; 963 | } 964 | 965 | ?> -------------------------------------------------------------------------------- /rules/Makefile: -------------------------------------------------------------------------------- 1 | .PRECIOUS: %.tex 2 | 3 | objects := $(patsubst texf/%.texf,%.svg,$(wildcard texf/*.texf)) 4 | 5 | all: $(objects) 6 | 7 | %.tex: texf/%.texf texf/rule-template.tex forallxyyc.sty 8 | pandoc -f latex -t latex --template texf/rule-template.tex -o $@ $< 9 | 10 | %.pdf: %.tex 11 | pdflatex $* 12 | 13 | %.svg: %.pdf 14 | pdf2svg $< $@ 15 | 16 | clean: 17 | rm -f *.tex *.pdf *.aux *.out *.log 18 | -------------------------------------------------------------------------------- /rules/forallxyyc.sty: -------------------------------------------------------------------------------- 1 | %!TEX root = forallxyyc.tex 2 | \NeedsTeXFormat{LaTeX2e} 3 | \ProvidesPackage{forallxyyc}[2011/10/29 support for a logic textbook] 4 | \RequirePackage{amssymb,amsmath,hyperref,multicol,ifthen,graphicx,pifont,rotating,xcolor} 5 | %RZ: typefaces 6 | 7 | \usepackage[sfdefault]{universalis} 8 | \usepackage[osf]{Baskervaldx} % oldstyle figures 9 | \usepackage[bigdelims,baskervaldx]{newtxmath} 10 | \usepackage[cal=boondoxo]{mathalfa} 11 | 12 | %RZ: Make sure we have a copyright symbol 13 | 14 | 15 | 16 | % The original forallx.sty was written in 2005 17 | % Comments marked "TB" are additions by Tim Button in September 2012 18 | 19 | % **************************************** 20 | % * LOGICAL SYMBOLS * 21 | % **************************************** 22 | % 23 | % There are, of course, many different symbols used for the truth-functional 24 | % connectives. In order to make the book adaptable, the symbols are defined 25 | % here in the style sheet and these commands are used throughout the book. 26 | % To change conjunction from the ampersand to the carat, for instance, 27 | % change the definition of \eand from ~\&~ to \wedge. To change negation from 28 | % the hoe to the swung dash, change \enot from \neg to {\sim}. Other examples 29 | % are given below. 30 | % 31 | \def\therefore{\ensuremath{\mathrel{\ldotp\dot{}\,\ldotp}}} 32 | % disjunction 33 | \def\eor{\ensuremath{\vee}} 34 | % conjunction: 35 | % {\,^{_{_{_{_{\mbox{\footnotesize\textbullet}}}}}}} gives the dot 36 | \def\eand{\ensuremath{\wedge}} 37 | % conditional: \supset gives the horseshoe 38 | \def\eif{\ensuremath{\rightarrow}} 39 | % biconditional: \equiv gives the triple bar 40 | \def\eiff{\ensuremath{\leftrightarrow}} 41 | % negation: {\sim} gives the swung dash 42 | \def\enot{\ensuremath{\neg}} 43 | \def\ered{\ensuremath{\bot}}% TB: added to give an absurdity sign 44 | \def\maththe{\rotatebox[origin=c]{180}{$\iota$}} % TB: added to give definite description operator 45 | \def\proves{\ensuremath{\vdash}} 46 | \def\entails{\ensuremath{\vDash}} 47 | \def\nproves{\ensuremath{\nvdash}} 48 | \def\nentails{\ensuremath{\nvDash}} 49 | % **************************************** 50 | % * SYMBOLS AND SCRIPTY BITS * 51 | % **************************************** 52 | % equivalent to commenting something out, but usable on multiple lines 53 | \providecommand{\nix}[1]{} 54 | 55 | \newcommand*{\script}[1]{\ensuremath{\mathcal{#1}}} 56 | \newcommand*{\meta}[1]{\ensuremath{\mathcal{#1}}} % TB: used for all metavariables 57 | % create a blank 58 | \newcommand*{\blank}{\underline{\hspace*{2.5em}}} 59 | \newcommand*{\gap}[1]{\blank$_{#1}$} % TB: used for keys, to avoid use/mention confusion 60 | 61 | % These are included for discussing formal semantics in predicate logic. 62 | \newcommand*{\model}[1]{\ensuremath{\mathbb{#1}}} 63 | \newcommand*{\extension}[1]{\ensuremath{\mbox{extension}(#1)}} 64 | \newcommand*{\referent}[1]{\ensuremath{\mbox{referent}(#1)}} 65 | % I personally dislike the default LaTeX angle brackets. I think that 66 | % they are too narrow. If you want to use them, though, you can 67 | % replace < and > in the commands below with \langle and \rangle 68 | \newcommand*{\openntuple}{\langle} 69 | \newcommand*{\closentuple}{\rangle} 70 | \newcommand*{\ntuple}[1]{\ensuremath{\mathopen{\openntuple}}#1\ensuremath{\mathclose{\closentuple}}} 71 | 72 | 73 | 74 | 75 | % **************************************** 76 | % * PROOFS * 77 | % **************************************** 78 | 79 | % based on fitch.sty by Peter Selinger, University of Ottawa 80 | % v 0.4, (C) 2002 Peter Selinger 81 | % revised 2003--5 by P.D. Magnus 82 | 83 | % Selinger released this code under the GNU General Public License, 84 | % version 2 or later. So this bit of the style is free to you under 85 | % the GPL. 86 | 87 | % ---------------------------------------------------------------------- 88 | % The comments in this file are intended for programmers who 89 | % might want to hack this package. For information on how to use the 90 | % package, the file fitchdoc.tex is a better place to look. 91 | % ---------------------------------------------------------------------- 92 | 93 | % Global identifiers defined by this package start with '\nd*'. The 94 | % only exceptions are \ndref, \nddim, and the "nd" and "ndresume" 95 | % latex environments. 96 | 97 | {\chardef\x=\catcode`\* 98 | \catcode`\*=11 99 | \global\let\nd*astcode\x} 100 | \catcode`\*=11 101 | 102 | % The macros provided by this package mix TeX and LaTeX primitives. 103 | % LaTeX is used for \rule, \settowidth, \addtolength, \hspace... 104 | % All macros are assumed to be called in math mode. 105 | 106 | % Translation proceeds through several layers of macros. Each layer 107 | % consist of macros which expand into macros of the previous 108 | % layer. Each layer may have some global state and initialization 109 | % functions. Only the topmost layer (layer C) is directly 110 | % user-accessible. 111 | 112 | 113 | % References 114 | 115 | % We start with some macros to facilitate automatic line numbering, and 116 | % for referencing of lines by labels. The macros defined here are: 117 | % \nd*reset to reset the line number count. \nd*num{x}, to generate the next 118 | % line number and store it in reference x; \nd*ref{x} to print the line 119 | % number referenced by x, \ndref{xxx} to parse a list of references, 120 | % separated by commas, periods, and hyphens, and translate all references to 121 | % line numbers. Note: \ndref ignores spaces in its argument, but puts 122 | % a space after each comma or period in the output. Also note: \nd*ref can be 123 | % useful outside a natded environment, and thus it has a user 124 | % accessible name. Most general ``line numbers'' actually consist of a 125 | % name (such as ``n'') and a number (such as ``2''), to produce output 126 | % such as $n+2$. \nd*set{n}{m} is called to set the letter to n and 127 | % the number to m. As special cases, if the second argument is empty, 128 | % it is not set, and if the first argument is \relax, it is not set. 129 | 130 | % Example for references: 131 | 132 | % \nd*reset \nd*num{x}; \nd*num{y}; \nd*numopt{n+1}{z}; \nd*num{zz}; 133 | % \nd*ref{y}; \ndref{x, y-zz, z} 134 | % will produce: 1; 2; n+1; 3; 2; 1, 2-3, n+1 135 | 136 | \newcount\nd*ctr 137 | \def\nd*render{\expandafter\ifx\expandafter\nd*x\nd*base\nd*x\the\nd*ctr\else\nd*base\ifnum\nd*ctr<0\the\nd*ctr\else\ifnum\nd*ctr>0+\the\nd*ctr\fi\fi\fi} 138 | \expandafter\def\csname nd*-\endcsname{} 139 | 140 | %\def\nd*num#1{\global\advance\nd*ctr1\nd*numo{\the\nd*ctr}{#1}} 141 | \def\nd*num#1{\nd*numo{\nd*render}{#1}\global\advance\nd*ctr1} 142 | \def\nd*numopt#1#2{\nd*numo{$#1$}{#2}} 143 | \def\nd*numo#1#2{\edef\x{#1}\mbox{$\x$}\expandafter\global\expandafter\let\csname nd*-#2\endcsname\x} 144 | \def\nd*ref#1{\expandafter\let\expandafter\x\csname nd*-#1\endcsname\ifx\x\relax% 145 | \errmessage{Undefined natdeduction reference: #1}\else\mbox{$\x$}\fi} 146 | \def\nd*noop{} 147 | \def\nd*set#1#2{\ifx\relax#1\nd*noop\else\global\def\nd*base{#1}\fi\ifx\relax#2\relax\else\global\nd*ctr=#2\fi} 148 | \def\nd*reset{\nd*set{}{1}} 149 | \def\nd*refa#1{\nd*ref{#1}} 150 | \def\nd*aux#1#2{\ifx#2-\nd*refa{#1}--\def\c{\nd*aux{}}% 151 | \else\ifx#2,\nd*refa{#1}, \def\c{\nd*aux{}}% 152 | \else\ifx#2;\nd*refa{#1}; \def\c{\nd*aux{}}% 153 | \else\ifx#2.\nd*refa{#1}. \def\c{\nd*aux{}}% 154 | \else\ifx#2)\nd*refa{#1})\def\c{\nd*aux{}}% 155 | \else\ifx#2(\nd*refa{#1}(\def\c{\nd*aux{}}% 156 | \else\ifx#2\nd*end\nd*refa{#1}\def\c{}% 157 | \else\def\c{\nd*aux{#1#2}}% 158 | \fi\fi\fi\fi\fi\fi\fi\c} 159 | \def\ndref#1{\nd*aux{}#1\nd*end} 160 | 161 | 162 | % Layer A 163 | 164 | % Layer A provides primitive picture elements which can be combined 165 | % into natural deduction derivations. These are: \nd*t to make a 166 | % topmost vertical line segment; \nd*v to make a continuation vertical 167 | % line segment, \nd*i to produce the indentation for a subproof, 168 | % \nd*s to produce the horizontal space between a vertical line and a 169 | % formula, \nd*u{x} to underline x with appropriate spacing for a 170 | % hypothesis. \nd*f{x} typesets the formula x with the appropriate vertical 171 | % spacing. \nd*g{x} is like \nd*i, except it puts a guard in the 172 | % space it creates. These elements are spaced so that they are appropriate 173 | % as left-aligned array entries. Line numberings and justifications 174 | % must be provided manually in this layer. All explicit spacing 175 | % information is contained in this layer; higher layers manipulate only 176 | % layer A primitives. 177 | 178 | % define various dimensions (explained in fitchdoc.tex): 179 | \newlength{\nd*dim} 180 | \newdimen\nd*depthdim 181 | \newdimen\nd*hsep 182 | % user command to redefine dimensions 183 | \def\nddim#1#2#3#4#5#6#7#8{\nd*depthdim=#3\relax\nd*hsep=#6\relax% 184 | \def\nd*height{#1}\def\nd*thickness{#8}\def\nd*initheight{#2}% 185 | \def\nd*indent{#5}\def\nd*labelsep{#4}\def\nd*justsep{#7}} 186 | % set initial dimensions 187 | \nddim{4.5ex}{3.5ex}{1.5ex}{1em}{1.6em}{.5em}{2.5em}{.2mm} 188 | 189 | \def\nd*v{\rule[-\nd*depthdim]{\nd*thickness}{\nd*height}} 190 | \def\nd*t{\rule[-\nd*depthdim]{0mm}{\nd*height}\rule[-\nd*depthdim]{\nd*thickness}{\nd*initheight}} 191 | \def\nd*i{\hspace{\nd*indent}} 192 | \def\nd*s{\hspace{\nd*hsep}} 193 | \def\nd*g#1{\nd*f{\makebox[\nd*indent][c]{$#1$}}} 194 | \def\nd*f#1{\raisebox{0pt}[0pt][0pt]{$#1$}} 195 | \def\nd*u#1{\makebox[0pt][l]{\settowidth{\nd*dim}{\nd*f{#1}}% 196 | \addtolength{\nd*dim}{2\nd*hsep}\hspace{-\nd*hsep}\rule[-\nd*depthdim]{\nd*dim}{\nd*thickness}}\nd*f{#1}} 197 | 198 | % Example of a derivation using layer A syntax: 199 | 200 | %\begin{array}{lll} 201 | % 1 & \nd*t\nd*s\nd*f {P\vee Q} \\ 202 | % 2 & \nd*v\nd*s\nd*u {\neg Q} \\ 203 | % 3 & \nd*v\nd*i\nd*t\nd*s\nd*u {P} \\ 204 | % 4 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 3} \\ 205 | % 5 & \nd*v\nd*i\nd*t\nd*s\nd*u {Q} \\ 206 | % 6 & \nd*v\nd*i\nd*v\nd*s\nd*f {\neg Q} & \mbox{by 2} \\ 207 | % 7 & \nd*v\nd*i\nd*v\nd*s\nd*f {\bot} & \mbox{by 5, 6} \\ 208 | % 8 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 7} \\ 209 | % 9 & \nd*v\nd*s\nd*f {P} & \mbox{by 1, 3-4, 5-8} \\ 210 | %\end{array} 211 | 212 | 213 | % Lists 214 | 215 | % This is a bit of a hack. We implement linked lists as follows: a 216 | % list is either \nd*nil, or \nd*cons{T}{H}, where T is another list, 217 | % and H is some arbitrary code. Note that lists grow to the right. 218 | % The following macros operate on a list that is stored in a macro 219 | % \list. 220 | % \nd*push\list{item} pushes the item onto the list 221 | % \nd*pop\list{item} pops and discards the last item from the list 222 | % \nd*item\list{command} applies command to each element of the list 223 | % \nd*modify\list\n{elt} modifies the \n-th element of the 224 | % list, if there is such an element. Here \n is a counter. Elements 225 | % are counted from the right, starting from 1. 226 | 227 | \def\nd*push#1#2{\expandafter\gdef\expandafter#1\expandafter% 228 | {\expandafter\nd*cons\expandafter{#1}{#2}}} 229 | \def\nd*pop#1{{\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% 230 | {\gdef#1{##1}}#1}} 231 | \def\nd*iter#1#2{{\def\nd*nil{}\def\nd*cons##1##2{##1#2{##2}}#1}} 232 | \def\nd*modify#1#2#3{{\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% 233 | {\advance#2-1 ##1\advance#2 1 \ifnum#2=1\nd*push#1{#3}\else% 234 | \nd*push#1{##2}\fi}#1}} 235 | 236 | % we use lists of items of the forms \nd*t, \nd*v, \nd*i, and 237 | % \nd*g{...} to represent the current indentation level and 238 | % format (see Layer A, above). The following function 239 | % computes the indentation for the following line by replacing all 240 | % items of the form \nd*t by \nd*v and \nd*g{...} by \nd*i. 241 | 242 | \def\nd*cont#1{{\def\nd*t{\nd*v}\def\nd*v{\nd*v}\def\nd*g##1{\nd*i}% 243 | \def\nd*i{\nd*i}\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% 244 | {##1\expandafter\nd*push\expandafter#1\expandafter{##2}}#1}} 245 | 246 | % With the list syntax, a derivation can be expressed like this: 247 | 248 | % \[\begin{array}{lll} 249 | % \gdef\stack{\nd*nil} 250 | % \newcount\n 251 | % \nd*push\stack{\nd*t} 252 | % 1 & \nd*iter\stack\relax\nd*s\nd*u {\neg\exists xP(x)} \\ 253 | % \nd*cont\stack 254 | % \nd*push\stack{\nd*i} 255 | % \nd*push\stack{\nd*t} 256 | % \nd*n=2\nd*modify\stack\n{\nd*g{u}} 257 | % \nd*push\stack{\nd*i} 258 | % \nd*push\stack{\nd*t} 259 | % 2 & \nd*iter\stack\relax\nd*s\nd*u {P(u)} \\ 260 | % \nd*cont\stack 261 | % 3 & \nd*iter\stack\relax\nd*s\nd*f {\exists xP(x)} \\ 262 | % \nd*cont\stack 263 | % 4 & \nd*iter\stack\relax\nd*s\nd*f {\neg\exists xP(x)} \\ 264 | % \nd*cont\stack 265 | % 5 & \nd*iter\stack\relax\nd*s\nd*f {\bot} \\ 266 | % \nd*cont\stack 267 | % \nd*pop\stack 268 | % \nd*pop\stack 269 | % 6 & \nd*iter\stack\relax\nd*s\nd*f {\neg P(u)} \\ 270 | % \nd*cont\stack 271 | % \nd*pop\stack 272 | % \nd*pop\stack 273 | % 7 & \nd*iter\stack\relax\nd*s\nd*f {\forall y\neg P(y)} \\ 274 | % \nd*cont\stack 275 | % \end{array} 276 | % \] 277 | 278 | 279 | % Layer B 280 | 281 | % Layer B is simply a wrapper around layer A. It provides commands 282 | % \nd*beginb, \nd*resumeb, \nd*endb, \nd*openb, \nd*closeb, 283 | % \nd*guardb, \nd*hypob, and \nd*haveb which abstract from the layer A 284 | % primitives. This includes automatic line numbering, and automatic 285 | % indentation. \nd*beginb and \nd*endb enclose a natural deduction in 286 | % layer B syntax. \nd*resumeb is like \nd*beginb, except that it 287 | % resumes a deduction in progress (for instance, after a manual page 288 | % break). \nd*openb and \nd*closeb open, respectively close, a 289 | % subproof. \nd*guardb{n}{g} adds the guard g to the nth enclosing 290 | % subderivation (counted from 1 from the inside). \nd*hypob 291 | % introduces a hypothesis, and \nd*haveb introduces a non-hypothesis 292 | % line in a proof. Line numbering is integrated, but justifications 293 | % must still be given manually. Also, proof lines must still be 294 | % terminated by '\\'. An idiosyncracy of this layer is that in a list 295 | % of several hypotheses, all but the last one must be called with 296 | % \nd*haveb, not \nd*hypob, to avoid drawing a horizontal line under 297 | % each of them. 298 | 299 | \newcount\nd*n 300 | \def\nd*beginb{\begingroup\nd*reset\gdef\nd*stack{\nd*nil}\nd*push\nd*stack{\nd*t}% 301 | \begin{array}{l@{\hspace{\nd*labelsep}}l@{\hspace{\nd*justsep}}l}} 302 | \def\nd*resumeb{\begingroup\begin{array}{r@{\hspace{\nd*labelsep}}l@{\hspace{\nd*justsep}}l}} 303 | \def\nd*endb{\end{array}\endgroup} 304 | \def\nd*hypob#1#2{\nd*f{\nd*num{#1}}&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*u{#2}&} 305 | \def\nd*haveb#1#2{\nd*f{\nd*num{#1}}&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*f{#2}&} 306 | \def\nd*openb{\nd*push\nd*stack{\nd*i}\nd*push\nd*stack{\nd*t}} 307 | \def\nd*closeb{\nd*pop\nd*stack\nd*pop\nd*stack} 308 | \def\nd*guardb#1#2{\nd*n=#1\multiply\nd*n by 2 \nd*modify\nd*stack\nd*n{\nd*g{#2}}} 309 | % one must first \close the outermost layer of assumption 310 | % it's a bit of a hack 311 | 312 | % Example of a derivation using layer B syntax. Note that the "line 313 | % numbers" are really labels, which will be replaced by consecutive 314 | % line numbers in the output. 315 | 316 | % \[ 317 | % \nd*beginb 318 | % \nd*haveb {1}{P\vee Q} \\ 319 | % \nd*hypob {2}{\neg Q} \\ 320 | % \nd*openb 321 | % \nd*hypob {3}{P} \\ 322 | % \nd*haveb {4}{P} \mbox{by \ndref{3}} \\ 323 | % \nd*closeb 324 | % \nd*openb 325 | % \nd*hypob {5}{Q} \\ 326 | % \nd*haveb {6}{\neg Q} \mbox{by \ndref{2}} \\ 327 | % \nd*haveb {6a}{\bot} \mbox{by \ndref{5,6}} \\ 328 | % \nd*haveb {6b}{P} \mbox{by \ndref{6a}} \\ 329 | % \nd*closeb 330 | % \nd*haveb {8}{P} \mbox{by \ndref{1,3-4,5-6b}} \\ 331 | % \nd*endb 332 | % \] 333 | 334 | % Here is another example, using a guard. 335 | 336 | % \[ 337 | % \nd*beginb 338 | % \nd*hypob {1}{\neg\exists xP(x)} \\ 339 | % \nd*openb 340 | % \nd*guardb {1}{u} 341 | % \nd*openb 342 | % \nd*hypob {2}{P(u)} \\ 343 | % \nd*haveb {3}{\exists xP(x)} \mbox{by \ndref{2}} \\ 344 | % \nd*haveb {4}{\neg\exists xP(x)} \mbox{by \ndref{1}} \\ 345 | % \nd*haveb {5}{\bot} \mbox{by \ndref{3,4}}\\ 346 | % \nd*closeb 347 | % \nd*haveb {6}{\neg P(u)} \mbox{by \ndref{2-5}}\\ 348 | % \nd*closeb 349 | % \nd*haveb {7}{\forall y\neg P(y)} \mbox{by \ndref{2-6}}\\ 350 | % \nd*endb 351 | % \] 352 | 353 | 354 | % Layer C 355 | 356 | % Layer C is the syntax used by the end user. It is implemented as a 357 | % wrapper around layer B, providing six additional conveniences: 358 | % (1) no more need for explicit '\\', (2) all hypotheses 359 | % are denoted \hypo, (3) a convenient syntax for writing justification 360 | % labels, (4) a latex environment, (5) guard as optional argument to 361 | % \have, \hypo, or \open, (6) optional relabeling arguments. The user 362 | % level commands are similar to those of layer B: they are called 363 | % \begin{nd}, \end{nd}, \open, \close, \hypo, \have. In addition there 364 | % is a \by command for writing justification labels, in the style of 365 | % \by{$\vee$E}{1,2-4,5-6}. For convenience, a number of abbreviations 366 | % is also provided, for instance \ie for \by{$\Rightarrow$E} 367 | % etc. These commands are only visible inside an nd-environment; thus 368 | % they do not interfere with the global name space. There is also an 369 | % environment ndresume which is like nd, except that it continues a 370 | % proof in progress (with continuous nesting and labeling). 371 | 372 | % The layer C macros work by storing each line in a data structure 373 | % \ppp,\nd*typ,\nd*byt. The line is ejected when the beginning of the next 374 | % line is read, and once at the very end. In this way, we can put in 375 | % the correct line breaks (whether or not the line carries a 376 | % justification), and a hypothesis does not get typeset until we know 377 | % whether it is followed by another hypothesis. \nd*sto stores a new 378 | % line, \nd*clr clears the current line, \nd*cmd outputs the current 379 | % line. Finally, \nd*init puts all the commands which are visible 380 | % inside an nd-environment in the current name space. 381 | 382 | \def\nd*clr{\gdef\nd*cmd{}} 383 | \def\nd*sto#1#2#3{\gdef\nd*typ{#1}\gdef\nd*byt{}% 384 | \gdef\nd*cmd{\nd*typ{#2}{#3}\nd*byt\\}} 385 | \def\nd*hyc#1#2{\def\nd*typ{\nd*haveb}\nd*cmd\nd*sto{\nd*hypob}{#1}{#2}} 386 | \def\nd*hac#1#2{\nd*cmd\nd*sto{\nd*haveb}{#1}{#2}} 387 | %\def\nd*htc#1#2{\nd*cmd\nd*sto{\nd*theob}{#1}{#2}} 388 | 389 | % usage: \optarg{default}{continuation}xxx - reads an optional argument, 390 | % supplies default if necessary, then continues with continuation. 391 | % Continuation expects optional argument between [...]. I.e., 392 | % \optarg{d}{c}[xxx] => c[xxx], and \optarg{d}{c}x => c[d]x if x != '['. 393 | % Behavior is undefined if x is {[...}. \optargg is similar except it 394 | % takes two continuations: first one for optional argument present, second 395 | % for not present. It takes no default value. 396 | 397 | \def\optarg#1#2#3{\ifx[#3\def\c{#2#3}\else\def\c{#2[#1]{#3}}\fi\c} 398 | \def\optargg#1#2#3{\ifx[#3\def\c{#1#3}\else\def\c{#2{#3}}\fi\c} 399 | 400 | \def\nd*hyx[#1][#2]#3[#4]#5{\ifx\relax#4\relax\else\nd*guardb{1}{#4}\fi\nd*hyc{#3}{#5}\nd*set{#1}{#2}} 401 | \def\nd*hax[#1][#2]#3[#4]#5{\ifx\relax#4\relax\else\nd*guardb{1}{#4}\fi\nd*hac{#3}{#5}\nd*set{#1}{#2}} 402 | %\def\nd*htx[#1][#2]#3[#4]#5{\ifx\relax#4\relax\else\nd*guardb{1}{#4}\fi\nd*htc{#3}{#5}\nd*set{#1}{#2}} 403 | 404 | % \nd*five{\a}: read five, partly optional arguments of the shape [][]{}[]{}, 405 | % then call \a with these arguments. 406 | \def\nd*five#1{\optargg{\nd*four{#1}}{\nd*two{#1}}} 407 | \def\nd*four#1[#2]{\optarg{0}{\nd*three{#1}[#2]}} 408 | \def\nd*three#1[#2][#3]#4{\optarg{}{#1[#2][#3]{#4}}} 409 | \def\nd*two#1{\nd*three{#1}[\relax][]} 410 | 411 | \def\nd*have{\nd*five{\nd*hax}} 412 | \def\nd*theo{\nd*five{\nd*htx}} % To be like have 413 | \def\nd*hypo{\nd*five{\nd*hyx}} 414 | \def\nd*base{undefined} 415 | 416 | \def\nd*open{\optargg{\nd*openopt}{\nd*opennoopt}} 417 | \def\nd*openopt[#1]{\nd*cmd\nd*clr\nd*openb\nd*guard{#1}} 418 | \def\nd*opennoopt#1{\nd*cmd\nd*clr\nd*openb#1} 419 | \def\nd*close{\nd*cmd\nd*clr\nd*closeb} 420 | \def\nd*guard{\optarg{1}{\nd*guardc}} 421 | \def\nd*guardc[#1]#2{\nd*guardb{#1}{#2}} 422 | 423 | \def\nd*by#1#2{\ifx\nd*x#2\nd*x\gdef\nd*byt{\mbox{#1}}\else\gdef\nd*byt{\mbox{#1\ \ndref{#2}}}\fi} 424 | 425 | % * * * 426 | % This block defines the natural deduction rules. 427 | % Rules designated by ordinary letters may be specified with \by{RULE} 428 | % * * * 429 | 430 | \def\nd*init{% 431 | \let\open\nd*open% 432 | \let\close\nd*close% 433 | \let\hypo\nd*hypo% 434 | \let\have\nd*have% 435 | % \let\theo\nd*theo% 436 | \let\by\nd*by% 437 | \let\guard\nd*guard% 438 | \def\bi{\by{{\eiff}I}}% 439 | \def\be{\by{{\eiff}E}}% 440 | \def\ci{\by{{\eif}I}}% 441 | \def\ce{\by{{\eif}E}}% 442 | \def\Ai{\by{$\forall$I}}% 443 | \def\Ae{\by{$\forall$E}}% 444 | \def\Ei{\by{$\exists$I}}% 445 | \def\Ee{\by{$\exists$E}}% 446 | \def\ae{\by{{\eand}E}}% 447 | \def\ai{\by{{\eand}I}}% 448 | \def\oi{\by{{\eor}I}}% 449 | \def\oe{\by{{\eor}E}}% 450 | \def\ni{\by{{\enot}I}}% 451 | \def\ne{\by{{\enot}E}}% 452 | \def\ri{\by{{\enot}E}}% RZ: this is now \enot E 453 | \def\re{\by{X}}% RZ: explosion 454 | \def\ii{\by{$=$I}}% 455 | \def\ie{\by{$=$E}}% 456 | \def\tnd{\by{LEM}}% RZ: excluded middle 457 | \def\ip{\by{IP}}% RZ: indirect proof 458 | \def\dne{\by{DNE}}% TB: double negation elimination (derived rule) 459 | \def\mt{\by{MT}}% TB: modus tollens (derived rule) 460 | \def\ds{\by{DS}}% TB: disjunctive syllogism (a derived rule in Cambridge version) 461 | \def\dem{\by{DeM}}% TB: De Morgan rule (derived rule) 462 | \def\cq{\by{CQ}}% TB: conversion of quantifiers (derived rule) 463 | } 464 | \newenvironment{nd}{\begingroup\nd*init\nd*beginb\nd*clr}{\nd*cmd\nd*endb\endgroup} 465 | \newenvironment{ndresume}{\begingroup\nd*init\nd*resumeb\nd*clr}% 466 | {\nd*cmd\nd*endb\endgroup} 467 | 468 | % Example of a derivation using layer C syntax. As before, the "line 469 | % numbers" are really labels, which will be replaced by consecutive 470 | % line numbers in the output. 471 | 472 | % \[ 473 | % \begin{nd} 474 | % \hypo{1} {P\vee Q} 475 | % \hypo{2} {\neg Q} 476 | % \open 477 | % \hypo{3a} {P} 478 | % \have{3b} {P} \r{3a} 479 | % \close 480 | % \open 481 | % \hypo{4a} {Q} 482 | % \have{4b} {\neg Q} \r{2} 483 | % \have{4c} {\bot} \ne{4a,4b} 484 | % \have{4d} {P} \be{4c} 485 | % \close 486 | % \have{5} {P} \oe{1,3a-3b,4a-4d} 487 | % \end{nd} 488 | % \] 489 | 490 | % Another example of layer C syntax, using guards and relabelings: 491 | 492 | % \begin{nd} 493 | % \hypo {1} {P\vee Q} 494 | % \open 495 | % \hypo {2}[u] {P} 496 | % \have [\vdots] {3} {\vdots} 497 | % \have [n][-1] {4} {A\wedge B} 498 | % \close 499 | % \open 500 | % \hypo {5} {Q} 501 | % \have [\vdots] {6} {\vdots} 502 | % \have [m] {7} {A\wedge B} 503 | % \close 504 | % \have {8} {A\wedge B} \oe{1,2-(4),5-7} 505 | % \have [\vdots] {9} {\vdots} 506 | % \have [][100] {10} {A} \ae{8} 507 | % \end{nd} 508 | 509 | \catcode`\*=\nd*astcode 510 | 511 | % a command for indicating the goal in a proof or subproof 512 | \newcommand*{\want}[1]{\by{want \ensuremath{#1}}{}} 513 | % an environment that separates the proof from surrounding paragraphs 514 | \newenvironment{proof} 515 | {\begin{list}{}{}\item$\begin{nd}} 516 | {\end{nd}$\end{list}} 517 | 518 | % I keep mixing up the \ce and \ae commands, so I define a less ambiguous 519 | % alternate set of commands 520 | 521 | \newcommand*{\notI}{\ni} 522 | \newcommand*{\notE}{\ne} 523 | \newcommand*{\iffI}{\bi} 524 | \newcommand*{\iffE}{\be} 525 | \newcommand*{\ifI}{\ci} 526 | \newcommand*{\ifE}{\ce} 527 | \newcommand*{\andI}{\ai} 528 | \newcommand*{\andE}{\ae} 529 | \newcommand*{\orI}{\oi} 530 | \newcommand*{\orE}{\oe} 531 | \newcommand*{\forallI}{\Ai} 532 | \newcommand*{\forallE}{\Ae} 533 | \newcommand*{\existsI}{\Ei} 534 | \newcommand*{\existsE}{\Ee} 535 | 536 | 537 | 538 | -------------------------------------------------------------------------------- /rules/texf/Ae.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\forall \meta{x}\meta{A}(\ldots \meta{x} \ldots \meta{x}\ldots)} 3 | \have[\ ]{c}{\meta{A}(\ldots \meta{c} \ldots \meta{c}\ldots)} \Ae{a} 4 | \end{nd}$ 5 | -------------------------------------------------------------------------------- /rules/texf/Ai.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\meta{A}(\ldots \meta{c} \ldots \meta{c}\ldots)} 3 | \have[\ ]{c}{\forall \meta{x}\meta{A}(\ldots \meta{x} \ldots \meta{x}\ldots)} \Ai{a} 4 | \end{nd}$ 5 | -------------------------------------------------------------------------------- /rules/texf/Ee.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\exists \meta{x}\meta{A}(\ldots \meta{x} \ldots \meta{x}\ldots)} 3 | \open 4 | \hypo[i]{b}{\meta{A}(\ldots \meta{c} \ldots \meta{c}\ldots)} 5 | \have[j]{c}{\meta{B}} 6 | \close 7 | \have[\ ]{d}{\meta{B}} \Ee{a,b-c} 8 | \end{nd}$ 9 | -------------------------------------------------------------------------------- /rules/texf/Ei.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\meta{A}(\ldots \meta{c} \ldots \meta{c}\ldots)} 3 | \have[\ ]{c}{\exists \meta{x}\meta{A}(\ldots \meta{x} \ldots \meta{c}\ldots)} \Ei{a} 4 | \end{nd}$ 5 | -------------------------------------------------------------------------------- /rules/texf/Ie.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{e}{\meta{a}=\meta{b}} 3 | \have[n]{a}{\meta{A}(\ldots \meta{a} \ldots \meta{a}\ldots)} 4 | \have[\ ]{ea1}{\meta{A}(\ldots \meta{b} \ldots \meta{a}\ldots)} \by{=E}{e,a} 5 | 6 | \have[m]{e}{\meta{a}=\meta{b}} 7 | \\ \have[n]{a}{\meta{A}(\ldots \meta{b} \ldots \meta{b}\ldots)} 8 | \have[\ ]{ea2}{\meta{A}(\ldots \meta{a} \ldots \meta{b}\ldots)} \by{=E}{e,a} 9 | \end{nd}$ 10 | -------------------------------------------------------------------------------- /rules/texf/Ii.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[\ \,\,\,]{x}{\meta{c}=\meta{c}} \by{=I}{} 3 | \end{nd}$ 4 | -------------------------------------------------------------------------------- /rules/texf/ae.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A}\eand\meta{B}} 3 | \\ \have[\ ]{a}{\meta{A}} \ae{ab} 4 | 5 | \have[m]{ab}{\meta{A}\eand\meta{B}} 6 | \\ \have[\ ]{b}{\meta{B}} \ae{ab} 7 | \end{nd}$ 8 | 9 | -------------------------------------------------------------------------------- /rules/texf/ai.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\meta{A}} 3 | \have[n]{b}{\meta{B}} 4 | \have[\ ]{c}{\meta{A}\eand\meta{B}} \ai{a, b} 5 | \end{nd}$ 6 | -------------------------------------------------------------------------------- /rules/texf/be.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A}\eiff\meta{B}} 3 | \\ \have[n]{a}{\meta{A}} 4 | \have[\ ]{b}{\meta{B}} \be{ab,a} 5 | 6 | \have[m]{ab}{\meta{A}\eiff\meta{B}} 7 | \\ \have[n]{a}{\meta{B}} 8 | \have[\ ]{b}{\meta{A}} \be{ab,a} 9 | \end{nd}$ 10 | -------------------------------------------------------------------------------- /rules/texf/bi.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \open 3 | \hypo[i]{a1}{\meta{A}} 4 | \have[j]{b1}{\meta{B}} 5 | \close 6 | \open 7 | \hypo[k]{b2}{\meta{B}} 8 | \have[l]{a2}{\meta{A}} 9 | \close 10 | \have[\hskip .8em]{ab}{\meta{A}\eiff\meta{B}}\bi{a1-b1,b2-a2} 11 | \end{nd}$ 12 | -------------------------------------------------------------------------------- /rules/texf/ce.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A}\eif\meta{B}} 3 | \\ \have[n]{a}{\meta{A}} 4 | \have[\ ]{b}{\meta{B}} \ce{ab,a} 5 | \end{nd}$ 6 | 7 | -------------------------------------------------------------------------------- /rules/texf/ci.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \open 3 | \hypo[i]{a}{\meta{A}} 4 | \have[j]{b}{\meta{B}} 5 | \close 6 | \have[\hskip .8em]{ab}{\meta{A}\eif\meta{B}}\ci{a-b} 7 | \end{nd}$ 8 | -------------------------------------------------------------------------------- /rules/texf/dem.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\enot (\meta{A} \eor \meta{B})} 3 | \have[\ ]{dm}{\enot \meta{A} \eand \enot \meta{B}}\dem{ab} 4 | 5 | \have[m]{ab}{\enot \meta{A} \eand \enot \meta{B}} 6 | \\ \have[\ ]{dm}{\enot (\meta{A} \eor \meta{B})}\dem{ab} 7 | 8 | \have[m]{ab}{\enot (\meta{A} \eand \meta{B})} 9 | \\ \have[\ ]{dm}{\enot \meta{A} \eor \enot \meta{B}}\dem{ab} 10 | 11 | \have[m]{ab}{\enot \meta{A} \eor \enot \meta{B}} 12 | \\ \have[\ ]{dm}{\enot (\meta{A} \eand \meta{B})}\dem{ab} 13 | \end{nd}$ 14 | -------------------------------------------------------------------------------- /rules/texf/dne.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | 3 | \have[m]{dna}{\enot \enot \meta{A}} 4 | \have[ ]{a}{\meta{A}}\dne{dna} 5 | \end{nd}$ 6 | -------------------------------------------------------------------------------- /rules/texf/ds.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A} \eor \meta{B}} 3 | \have[n]{nb}{\enot \meta{A}} 4 | \have[\ ]{con}{\meta{B}}\by{DS}{ab, nb} 5 | 6 | \have[m]{ab}{\meta{A} \eor \meta{B}} 7 | \\ \have[n]{nb}{\enot \meta{B}} 8 | \have[\ ]{con}{\meta{A}}\by{DS}{ab, nb} 9 | \end{nd}$ 10 | 11 | -------------------------------------------------------------------------------- /rules/texf/ip.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \open 3 | \hypo[i]{a}{\enot\meta{A}} 4 | \have[j]{nb}{\ered} 5 | \close 6 | \have[\hskip .8em]{na}{\meta{A}}\ip{a-nb} 7 | \end{nd}$ 8 | -------------------------------------------------------------------------------- /rules/texf/lem.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \open 3 | \hypo[i]{a}{\meta{A}} 4 | \have[j]{c1}{\meta{B}} 5 | \close 6 | \open 7 | \hypo[k]{b}{\enot\meta{A}} 8 | \have[l]{c2}{\meta{B}} 9 | \close 10 | \have[\hskip .8em]{ab}{\meta{B}}\tnd{a-c1,b-c2} 11 | \end{nd}$ 12 | -------------------------------------------------------------------------------- /rules/texf/mt.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A}\eif\meta{B}} 3 | \have[n]{a}{\enot\meta{B}} 4 | \have[\ ]{b}{\enot\meta{A}} \by{MT}{ab,a} 5 | \end{nd}$ 6 | 7 | -------------------------------------------------------------------------------- /rules/texf/ne.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{na}{\enot\meta{A}} 3 | \\ \have[n]{a}{\meta{A}} 4 | \have[ ]{bot}{\ered}\ri{na, a} 5 | \end{nd}$ 6 | -------------------------------------------------------------------------------- /rules/texf/ni.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \open 3 | \hypo[i]{a}{\meta{A}} 4 | \have[j]{nb}{\ered} 5 | \close 6 | \have[\hskip .8em]{na}{\enot\meta{A}}\ni{a-nb} 7 | \end{nd}$ 8 | -------------------------------------------------------------------------------- /rules/texf/oe.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\meta{A}\eor\meta{B}} 3 | \\ \open 4 | \hypo[i]{a}{\meta{A}} 5 | \have[j]{c1}{\meta{C}} 6 | \close 7 | \open 8 | \hypo[k]{b}{\meta{B}} 9 | \have[l]{c2}{\meta{C}} 10 | \close 11 | \have[\ ]{c}{\meta{C}} \oe{ab,a-c1, b-c2} 12 | \end{nd}$ 13 | -------------------------------------------------------------------------------- /rules/texf/oi.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\meta{A}} 3 | \have[\ ]{ab}{\meta{A}\eor\meta{B}}\oi{a} 4 | 5 | \have[m]{a}{\meta{A}} 6 | \\ \have[\ ]{ba}{\meta{B}\eor\meta{A}}\oi{a} 7 | \end{nd}$ 8 | -------------------------------------------------------------------------------- /rules/texf/qc.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{ab}{\forall \meta{x}\enot \meta{A}} 3 | \have[\ ]{ac}{\enot \exists \meta{x} \meta{A}}\cq{ab} 4 | 5 | \have[m]{ab}{\enot \exists \meta{x} \meta{A}} 6 | \\ \have[\ ]{ac}{\forall \meta{x}\enot\meta{A}}\cq{ab} 7 | 8 | \have[m]{ab}{\exists \meta{x}\enot\meta{A}} 9 | \\ \have[\ ]{ac}{\enot \forall \meta{x} \meta{A}}\cq{ab} 10 | 11 | \have[m]{ab}{\enot \forall \meta{x} \meta{A}} 12 | \\ \have[\ ]{ac}{\exists \meta{x}\enot \meta{A}}\cq{ab} 13 | \end{nd}$ 14 | -------------------------------------------------------------------------------- /rules/texf/r.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{a}{\meta{A}} 3 | \have[\ ]{c}{\meta{A}} \by{R}{a} 4 | \end{nd}$ 5 | 6 | -------------------------------------------------------------------------------- /rules/texf/rule-template.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt]{standalone} 2 | \usepackage{forallxyyc} 3 | 4 | \begin{document} 5 | $body$ 6 | \end{document} 7 | -------------------------------------------------------------------------------- /rules/texf/xp.texf: -------------------------------------------------------------------------------- 1 | $\begin{nd} 2 | \have[m]{bot}{\ered} 3 | \\ \have[ ]{}{\meta{A}}\re{bot} 4 | \end{nd}$ 5 | -------------------------------------------------------------------------------- /sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/sample.png -------------------------------------------------------------------------------- /skeleton.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V2.0.4 3 | * Copyright 2014, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 12/29/2014 8 | */ 9 | 10 | 11 | /* Table of contents 12 | –––––––––––––––––––––––––––––––––––––––––––––––––– 13 | - Grid 14 | - Base Styles 15 | - Typography 16 | - Links 17 | - Buttons 18 | - Forms 19 | - Lists 20 | - Code 21 | - Tables 22 | - Spacing 23 | - Utilities 24 | - Clearing 25 | - Media Queries 26 | */ 27 | 28 | 29 | /* Grid 30 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 31 | .container { 32 | position: relative; 33 | width: 100%; 34 | max-width: 960px; 35 | margin: 0 auto; 36 | padding: 0 20px; 37 | box-sizing: border-box; } 38 | .column, 39 | .columns { 40 | width: 100%; 41 | float: left; 42 | box-sizing: border-box; } 43 | 44 | /* For devices larger than 400px */ 45 | @media (min-width: 400px) { 46 | .container { 47 | width: 85%; 48 | padding: 0; } 49 | } 50 | 51 | /* For devices larger than 550px */ 52 | @media (min-width: 550px) { 53 | .container { 54 | width: 80%; } 55 | .column, 56 | .columns { 57 | margin-left: 4%; } 58 | .column:first-child, 59 | .columns:first-child { 60 | margin-left: 0; } 61 | 62 | .one.column, 63 | .one.columns { width: 4.66666666667%; } 64 | .two.columns { width: 13.3333333333%; } 65 | .three.columns { width: 22%; } 66 | .four.columns { width: 30.6666666667%; } 67 | .five.columns { width: 39.3333333333%; } 68 | .six.columns { width: 48%; } 69 | .seven.columns { width: 56.6666666667%; } 70 | .eight.columns { width: 65.3333333333%; } 71 | .nine.columns { width: 74.0%; } 72 | .ten.columns { width: 82.6666666667%; } 73 | .eleven.columns { width: 91.3333333333%; } 74 | .twelve.columns { width: 100%; margin-left: 0; } 75 | 76 | .one-third.column { width: 30.6666666667%; } 77 | .two-thirds.column { width: 65.3333333333%; } 78 | 79 | .one-half.column { width: 48%; } 80 | 81 | /* Offsets */ 82 | .offset-by-one.column, 83 | .offset-by-one.columns { margin-left: 8.66666666667%; } 84 | .offset-by-two.column, 85 | .offset-by-two.columns { margin-left: 17.3333333333%; } 86 | .offset-by-three.column, 87 | .offset-by-three.columns { margin-left: 26%; } 88 | .offset-by-four.column, 89 | .offset-by-four.columns { margin-left: 34.6666666667%; } 90 | .offset-by-five.column, 91 | .offset-by-five.columns { margin-left: 43.3333333333%; } 92 | .offset-by-six.column, 93 | .offset-by-six.columns { margin-left: 52%; } 94 | .offset-by-seven.column, 95 | .offset-by-seven.columns { margin-left: 60.6666666667%; } 96 | .offset-by-eight.column, 97 | .offset-by-eight.columns { margin-left: 69.3333333333%; } 98 | .offset-by-nine.column, 99 | .offset-by-nine.columns { margin-left: 78.0%; } 100 | .offset-by-ten.column, 101 | .offset-by-ten.columns { margin-left: 86.6666666667%; } 102 | .offset-by-eleven.column, 103 | .offset-by-eleven.columns { margin-left: 95.3333333333%; } 104 | 105 | .offset-by-one-third.column, 106 | .offset-by-one-third.columns { margin-left: 34.6666666667%; } 107 | .offset-by-two-thirds.column, 108 | .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } 109 | 110 | .offset-by-one-half.column, 111 | .offset-by-one-half.columns { margin-left: 52%; } 112 | 113 | } 114 | 115 | 116 | /* Base Styles 117 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 118 | /* NOTE 119 | html is set to 62.5% so that all the REM measurements throughout Skeleton 120 | are based on 10px sizing. So basically 1.5rem = 15px :) */ 121 | html { 122 | font-size: 62.5%; } 123 | body { 124 | font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ 125 | line-height: 1.6; 126 | font-weight: 400; 127 | font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 128 | color: #222; } 129 | 130 | 131 | /* Typography 132 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 133 | h1, h2, h3, h4, h5, h6 { 134 | margin-top: 0; 135 | margin-bottom: 2rem; 136 | font-weight: 300; } 137 | h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} 138 | h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } 139 | h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } 140 | h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } 141 | h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } 142 | h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } 143 | 144 | /* Larger than phablet */ 145 | @media (min-width: 550px) { 146 | h1 { font-size: 5.0rem; } 147 | h2 { font-size: 4.2rem; } 148 | h3 { font-size: 3.6rem; } 149 | h4 { font-size: 3.0rem; } 150 | h5 { font-size: 2.4rem; } 151 | h6 { font-size: 1.5rem; } 152 | } 153 | 154 | p { 155 | margin-top: 0; } 156 | 157 | 158 | /* Links 159 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 160 | a { 161 | color: #1EAEDB; } 162 | a:hover { 163 | color: #0FA0CE; } 164 | 165 | 166 | /* Buttons 167 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 168 | .button, 169 | button, 170 | input[type="submit"], 171 | input[type="reset"], 172 | input[type="button"] { 173 | display: inline-block; 174 | height: 38px; 175 | padding: 0 30px; 176 | color: #555; 177 | text-align: center; 178 | font-size: 11px; 179 | font-weight: 600; 180 | line-height: 38px; 181 | letter-spacing: .1rem; 182 | text-transform: uppercase; 183 | text-decoration: none; 184 | white-space: nowrap; 185 | background-color: transparent; 186 | border-radius: 4px; 187 | border: 1px solid #bbb; 188 | cursor: pointer; 189 | box-sizing: border-box; } 190 | .button:hover, 191 | button:hover, 192 | input[type="submit"]:hover, 193 | input[type="reset"]:hover, 194 | input[type="button"]:hover, 195 | .button:focus, 196 | button:focus, 197 | input[type="submit"]:focus, 198 | input[type="reset"]:focus, 199 | input[type="button"]:focus { 200 | color: #333; 201 | border-color: #888; 202 | outline: 0; } 203 | .button.button-primary, 204 | button.button-primary, 205 | input[type="submit"].button-primary, 206 | input[type="reset"].button-primary, 207 | input[type="button"].button-primary { 208 | color: #FFF; 209 | background-color: #33C3F0; 210 | border-color: #33C3F0; } 211 | .button.button-primary:hover, 212 | button.button-primary:hover, 213 | input[type="submit"].button-primary:hover, 214 | input[type="reset"].button-primary:hover, 215 | input[type="button"].button-primary:hover, 216 | .button.button-primary:focus, 217 | button.button-primary:focus, 218 | input[type="submit"].button-primary:focus, 219 | input[type="reset"].button-primary:focus, 220 | input[type="button"].button-primary:focus { 221 | color: #FFF; 222 | background-color: #1EAEDB; 223 | border-color: #1EAEDB; } 224 | 225 | 226 | /* Forms 227 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 228 | input[type="email"], 229 | input[type="number"], 230 | input[type="search"], 231 | input[type="text"], 232 | input[type="tel"], 233 | input[type="url"], 234 | input[type="password"], 235 | textarea, 236 | select { 237 | height: 38px; 238 | padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ 239 | background-color: #fff; 240 | border: 1px solid #D1D1D1; 241 | border-radius: 4px; 242 | box-shadow: none; 243 | box-sizing: border-box; } 244 | /* Removes awkward default styles on some inputs for iOS */ 245 | input[type="email"], 246 | input[type="number"], 247 | input[type="search"], 248 | input[type="text"], 249 | input[type="tel"], 250 | input[type="url"], 251 | input[type="password"], 252 | textarea { 253 | -webkit-appearance: none; 254 | -moz-appearance: none; 255 | appearance: none; } 256 | textarea { 257 | min-height: 65px; 258 | padding-top: 6px; 259 | padding-bottom: 6px; } 260 | input[type="email"]:focus, 261 | input[type="number"]:focus, 262 | input[type="search"]:focus, 263 | input[type="text"]:focus, 264 | input[type="tel"]:focus, 265 | input[type="url"]:focus, 266 | input[type="password"]:focus, 267 | textarea:focus, 268 | select:focus { 269 | border: 1px solid #33C3F0; 270 | outline: 0; } 271 | label, 272 | legend { 273 | display: block; 274 | margin-bottom: .5rem; 275 | font-weight: 600; } 276 | fieldset { 277 | padding: 0; 278 | border-width: 0; } 279 | input[type="checkbox"], 280 | input[type="radio"] { 281 | display: inline; } 282 | label > .label-body { 283 | display: inline-block; 284 | margin-left: .5rem; 285 | font-weight: normal; } 286 | 287 | 288 | /* Lists 289 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 290 | ul { 291 | list-style: circle inside; } 292 | ol { 293 | list-style: decimal inside; } 294 | ol, ul { 295 | padding-left: 0; 296 | margin-top: 0; } 297 | ul ul, 298 | ul ol, 299 | ol ol, 300 | ol ul { 301 | margin: 1.5rem 0 1.5rem 3rem; 302 | font-size: 90%; } 303 | li { 304 | margin-bottom: 1rem; } 305 | 306 | 307 | /* Code 308 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 309 | code { 310 | padding: .2rem .5rem; 311 | margin: 0 .2rem; 312 | font-size: 90%; 313 | white-space: nowrap; 314 | background: #F1F1F1; 315 | border: 1px solid #E1E1E1; 316 | border-radius: 4px; } 317 | pre > code { 318 | display: block; 319 | padding: 1rem 1.5rem; 320 | white-space: pre; } 321 | 322 | 323 | /* Tables 324 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 325 | th, 326 | td { 327 | padding: 12px 15px; 328 | text-align: left; 329 | border-bottom: 1px solid #E1E1E1; } 330 | th:first-child, 331 | td:first-child { 332 | padding-left: 0; } 333 | th:last-child, 334 | td:last-child { 335 | padding-right: 0; } 336 | 337 | 338 | /* Spacing 339 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 340 | button, 341 | .button { 342 | margin-bottom: 1rem; } 343 | input, 344 | textarea, 345 | select, 346 | fieldset { 347 | margin-bottom: 1.5rem; } 348 | pre, 349 | blockquote, 350 | dl, 351 | figure, 352 | table, 353 | p, 354 | ul, 355 | ol, 356 | form { 357 | margin-bottom: 2.5rem; } 358 | 359 | 360 | /* Utilities 361 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 362 | .u-full-width { 363 | width: 100%; 364 | box-sizing: border-box; } 365 | .u-max-full-width { 366 | max-width: 100%; 367 | box-sizing: border-box; } 368 | .u-pull-right { 369 | float: right; } 370 | .u-pull-left { 371 | float: left; } 372 | 373 | 374 | /* Misc 375 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 376 | hr { 377 | margin-top: 3rem; 378 | margin-bottom: 3.5rem; 379 | border-width: 0; 380 | border-top: 1px solid #E1E1E1; } 381 | 382 | 383 | /* Clearing 384 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 385 | 386 | /* Self Clearing Goodness */ 387 | .container:after, 388 | .row:after, 389 | .u-cf { 390 | content: ""; 391 | display: table; 392 | clear: both; } 393 | 394 | 395 | /* Media Queries 396 | –––––––––––––––––––––––––––––––––––––––––––––––––– */ 397 | /* 398 | Note: The best way to structure the use of media queries is to create the queries 399 | near the relevant code. For example, if you wanted to change the styles for buttons 400 | on small devices, paste the mobile query code up in the buttons section and style it 401 | there. 402 | */ 403 | 404 | 405 | /* Larger than mobile */ 406 | @media (min-width: 400px) {} 407 | 408 | /* Larger than phablet (also point when grid becomes active) */ 409 | @media (min-width: 550px) {} 410 | 411 | /* Larger than tablet */ 412 | @media (min-width: 750px) {} 413 | 414 | /* Larger than desktop */ 415 | @media (min-width: 1000px) {} 416 | 417 | /* Larger than Desktop HD */ 418 | @media (min-width: 1200px) {} 419 | -------------------------------------------------------------------------------- /syntax.js: -------------------------------------------------------------------------------- 1 | var predicateSettings=false; 2 | 3 | function prettyStr(s) { 4 | var ps = s; 5 | ps = ps.replace(/\s*¬\s*/g,'¬'); 6 | ps = ps.replace(/\s*∨\s*/g,' ∨ '); 7 | ps = ps.replace(/\s*→\s*/g,' → '); 8 | ps = ps.replace(/\s*↔\s*/g,' ↔ '); 9 | ps = ps.replace(/\s*∧\s*/g,' ∧ '); 10 | ps = ps.replace(/\s*=\s*/g,' = '); 11 | ps = ps.replace(/([A-Za-z]*)/g, '$1'); 12 | return ps; 13 | } 14 | 15 | function symReplaceNN(s) { 16 | var fs = s; 17 | fs = fs.replace(/<[-−]*>/g,'↔'); 18 | fs = fs.replace(/[-−]*>/g,'→'); 19 | fs = fs.replace(/&/g,'∧'); 20 | fs = fs.replace(/\^/g,'∧'); 21 | fs = fs.replace(/\./g,'∧'); 22 | fs = fs.replace(/\*/g,'∧'); 23 | fs = fs.replace(/·/g,'∧'); 24 | fs = fs.replace(/v/g,'∨'); 25 | if (!(predicateSettings)) { 26 | fs = fs.replace(/=/g,'↔'); 27 | } 28 | fs = fs.replace(/≡/g,'↔'); 29 | fs = fs.replace(/⊃/g,'→'); 30 | fs = fs.replace(/⇒/g,'→'); 31 | fs = fs.replace(/XX/g,'⊥'); 32 | fs = fs.replace(/#/g,'⊥'); 33 | if (predicateSettings) { 34 | fs = fs.replace(/\([A∀⋀]([x-z])\)/g,"∀$1"); 35 | fs = fs.replace(/\([E∃⋁]([x-z])\)/g,"∃$1"); 36 | fs = fs.replace(/[E⋁]([x-z])/g,"∃$1"); 37 | fs = fs.replace(/[A⋀]([x-z])/g,"∀$1"); 38 | fs = fs.replace(/\(([x-z])\)/g,"∀$1"); 39 | } 40 | return fs; 41 | } 42 | 43 | function negReplace(s) { 44 | var fs = s; 45 | fs = fs.replace(/~/g,'¬'); 46 | fs = fs.replace(/∼/g,'¬'); 47 | fs = fs.replace(/−/g,'¬'); 48 | fs = fs.replace(/-/g,'¬'); 49 | return fs; 50 | } 51 | 52 | function symReplace(s) { 53 | return negReplace(symReplaceNN(s)); 54 | } 55 | 56 | function fixWffInputStr(s) { 57 | var fs = symReplace(s); 58 | fs = fs.replace(/ */g, ' '); 59 | fs = fs.replace(/^\s*/,''); 60 | fs = fs.replace(/\s*$/,''); 61 | return fs; 62 | } 63 | 64 | function fixJInputStr(s) { 65 | var fs = symReplaceNN(s); 66 | fs = fs.replace(/\s*,,*\s*/g, ', '); 67 | fs = fs.replace(/\s*[-−–][-−–]*\s*/g, '–'); 68 | fs = negReplace(fs); 69 | fs = fs.replace(/e/g,'E'); 70 | fs = fs.replace(/i/g,'I'); 71 | fs = fs.replace(/ */g, ' '); 72 | fs = fs.replace(/([∀∃¬∨∧→↔⊥=]) ([EI])/g, "$1$2"); 73 | fs = fs.replace(/[Tt][Nn][Dd]/g, "TND"); 74 | fs = fs.replace(/[Mm][Tt]/g, "MT"); 75 | fs = fs.replace(/[Cc][Qq]/g, "CQ"); 76 | fs = fs.replace(/[Dd][Ss]/g, "DS"); 77 | fs = fs.replace(/[Dd][Nn][Ee]/g, "DNE"); 78 | fs = fs.replace(/[Dd][Ee][Mm]/g, "DeM"); 79 | fs = fs.replace(/EE/g, "∃E"); 80 | fs = fs.replace(/AE/g, "∀E"); 81 | fs = fs.replace(/EI/g, "∃I"); 82 | fs = fs.replace(/AI/g, "∀I"); 83 | fs = fs.replace(/r/g, "R"); 84 | fs = fs.replace(/[Pp][Rr]/g, ""); 85 | fs = fs.replace(/[Hh][Yy][Pp]/g, ""); 86 | fs = fs.replace(/([^\s,0-9–-])([0-9])/g,"$1 $2") 87 | fs = fs.replace(/([0-9])([^\s,0-9–-])/g,"$1 $2") 88 | fs = fs.replace(/^[,\s]*/,''); 89 | fs = fs.replace(/[,\s]*$/,''); 90 | return fs; 91 | } 92 | 93 | 94 | function hasStrayChars(s) { 95 | if (predicateSettings) { 96 | if (s.match(/[^A-Za-z∀∃=¬∨∧↔→⊥\s\)\(\]\[\}\{]/)) { 97 | return true; 98 | } 99 | } else { 100 | if (s.match(/[^A-Z¬∨∧↔→⊥\s\)\(\]\[\}\{]/)) { 101 | return true; 102 | } 103 | } 104 | return false; 105 | } 106 | 107 | function regularizeMe(s) { 108 | s=s.replace(/\[/g,'('); 109 | s=s.replace(/\{/g,'('); 110 | s=s.replace(/\]/g,')'); 111 | s=s.replace(/\}/g,')'); 112 | s=s.replace(/\s/g,''); 113 | return s; 114 | } 115 | /* function fixNotation(s, autoUpperCase) { 116 | s = s.replace(/v/g,'∨'); 117 | if (autoUpperCase) { 118 | s = s.toUpperCase(); 119 | } 120 | s = s.replace(/¬/g,'~'); 121 | s = s.replace(/∼/g,'~'); 122 | s = s.replace(/⊃/g,'→'); 123 | s = s.replace(/⇒/g,'→'); 124 | s = s.replace(/≡/g,'↔'); 125 | s = s.replace(/⇔/g,'↔'); 126 | s = s.replace(/\^/g,'&'); 127 | s = s.replace(/∧/g,'&'); 128 | s = s.replace(/∙/g,'&'); 129 | s = s.replace(/\./g,'&'); 130 | s = s.replace(/<-*>/g,'↔'); 131 | s = s.replace(/<=*>/g,'↔'); 132 | s = s.replace(/==*>/g,'→'); 133 | s = s.replace(/-*>/g,'→'); 134 | s = s.replace(/=/g,'↔'); 135 | s = s.replace(/-/g,'~'); 136 | s = s.replace(/\#/g,'✖'); 137 | s = s.replace(/XX/,"✖"); 138 | s = s.replace(/×/g,"✖"); 139 | s = s.replace(/⨳/g,"✖"); 140 | if (predicateSettings) { 141 | s = s.replace(/A/g,"∀"); 142 | s = s.replace(/E/g,"∃"); 143 | s = s.replace(/\(∀*([xyz])\)/g,"∀$1"); 144 | s = s.replace(/\(∃([xyz])\)/g,"∃$1"); 145 | } 146 | return s; 147 | } */ 148 | 149 | function listUnion(z,x) { 150 | var y=z; 151 | for (var i=0; i0)); 352 | } 353 | if (theyMatch) { 354 | return parseIt(s.substring(1,s.length - 1)); 355 | } 356 | } 357 | // check if in atomic family 358 | if (!(s.match(/[¬∧∨→↔∀∃]/))) { 359 | // should be in atomic family 360 | 361 | // should not contain parentheses 362 | if (s.match(/[\(\)]/)) { 363 | wff.isWellFormed = false; 364 | wff.ErrMsg = "Misplaced parentheses."; 365 | return wff; 366 | } 367 | 368 | // check if splat 369 | if (s=="⊥") { 370 | wff.wffType="splat"; 371 | return wff; 372 | } 373 | 374 | // if still contains splat, that is no good 375 | if (s.match(/⊥/)) { 376 | wff.isWellFormed=false; 377 | wff.ErrMsg = "Formula contains ⊥ but not in isolation."; 378 | return wff; 379 | } 380 | 381 | // check for identity statement 382 | if (s.match(/=/)) { 383 | if (s.match(/^[a-z]=[a-z]$/)) { 384 | wff.wffType='identity'; 385 | wff.myTerms=s.split("="); 386 | for (var i=1; istr = ''; 35 | $rv->depth = 0; 36 | if ($w->wffType == "splat") { 37 | $rv->str = '⊥'; 38 | return $rv; 39 | } 40 | if ($w->wffType == "identity") { 41 | $rv->str = $w->myTerms[0] . ' = ' . $w->myTerms[1]; 42 | return $rv; 43 | } 44 | if ($w->wffType == "atomic") { 45 | $rv->str = $w->myLetter; 46 | if ($predicateSettings) { 47 | $rv->str .= implode($w->myTerms); 48 | } 49 | return $rv; 50 | } 51 | $rightResult = wffToStringAndDepth($w->rightSide); 52 | $rightAdd = $rightResult->str; 53 | $rightDepth = $rightResult->depth; 54 | if (isBinOp($w->rightSide->mainOp)) { 55 | switch ($rightDepth % 2) { 56 | case 0: 57 | $rightAdd='(' . $rightAdd . ')'; 58 | break; 59 | case 1: 60 | $rightAdd='[' . $rightAdd . ']'; 61 | break; 62 | } 63 | $rightDepth += 1; 64 | } 65 | if ($w->wffType == "quantified") { 66 | $rv->str = $w->mainOp . $w->myLetter . $rightAdd; 67 | $rv->depth=$rightDepth; 68 | return $rv; 69 | } 70 | if ($w->mainOp == "¬") { 71 | $rv->str = "¬" . $rightAdd; 72 | $rv->depth = $rightDepth; 73 | return $rv; 74 | } 75 | $leftResult=wffToStringAndDepth($w->leftSide); 76 | $leftAdd=$leftResult->str; 77 | $leftDepth=$leftResult->depth; 78 | if (isBinOp($w->leftSide->mainOp)) { 79 | switch($leftDepth % 2) { 80 | case 0: 81 | $leftAdd='(' . $leftAdd . ')'; 82 | break; 83 | case 1: 84 | $leftAdd='[' . $leftAdd . ']'; 85 | break; 86 | } 87 | $leftDepth += 1; 88 | } 89 | $rv->depth = max($rightDepth,$leftDepth); 90 | $rv->str = $leftAdd . " " . $w->mainOp . " " . $rightAdd; 91 | return $rv; 92 | } 93 | 94 | function wffToString($w) { 95 | return wffToStringAndDepth($w)->str; 96 | } 97 | 98 | function isBinOp($ch) { 99 | if (($ch=='→') || ($ch=='∨') || ($ch=='∧') || ($ch=='↔')) { 100 | return true; 101 | } 102 | return false; 103 | } 104 | 105 | function isMonOp($ch) { 106 | return (($ch=="¬") || ($ch=="∀") || ($ch=="∃")); 107 | } 108 | 109 | function isOp($ch) { 110 | return ((isBinOp($ch))||(isMonOp($ch))); 111 | } 112 | 113 | function isQuantifier($ch) { 114 | return (($ch=="∀") || ($ch=="∃")); 115 | } 116 | 117 | function isVar($ch) { 118 | return (($ch=="x") || ($ch=="y") || ($ch=="z")); 119 | } 120 | 121 | function getStLtrs($w) { 122 | $mL=array(); 123 | if ($w->wffType == "splat") { 124 | return $mL; 125 | } 126 | if ($w->wffType == "atomic") { 127 | $mL=array($w->myLetter); 128 | return $mL; 129 | } 130 | if (w.mainOp=="¬") { 131 | $mL=getStLtrs($w->rightSide); 132 | return $mL; 133 | } 134 | $mL = getStLtrs($w->leftSide); 135 | $x = getStLtrs($w->rightSide); 136 | $mL = listUnion($mL, $x); 137 | return mL; 138 | } 139 | 140 | function newSLWff() { 141 | $w = new StdClass(); 142 | $w->isWellFormed = true; 143 | $w->ErrMsg = "none"; 144 | $w->wffType = 'unknown'; 145 | $w->mainOp = '?'; 146 | $w->myLetter = ''; 147 | $w->leftSide = new StdClass(); 148 | $w->rightSide = new StdClass(); 149 | return $w; 150 | } 151 | 152 | function newPLWff() { 153 | $w = newSLWff(); 154 | $w->myTerms = array(); 155 | $w->allFreeVars = array(); 156 | return $w; 157 | } 158 | 159 | // parse string to formula 160 | function parseIt($s) { 161 | 162 | // initialize return formula 163 | global $predicateSettings; 164 | if ($predicateSettings) { 165 | $wff = newPLWff(); 166 | } else { 167 | $wff = newSLWff(); 168 | } 169 | $mainOpPos = 0; 170 | $depthArray=array(); 171 | $s=regularizeMe($s); 172 | 173 | // Check if non-empty 174 | if ($s=='') { 175 | $wff->isWellFormed=false; 176 | $wff->ErrMsg="Formula or subformula is blank."; 177 | return $wff; 178 | } 179 | 180 | // check for stray characters 181 | if (hasStrayChars($s)) { 182 | $wff->isWellFormed=false; 183 | if ($predicateSettings) { 184 | $wff->ErrMsg="Input field contains characters or punctuation not allowed in the language of FOL. A statement should contain only parentheses ( [ { } ] ), predicates A–Z and =, terms a–w, variables x–z, the contradiction symbol ⊥, and the operators ¬, ∨, ∧, →, ↔, ∃, ∀ (or their alternatives)."; 185 | } else { 186 | $wff->ErrMsg="Input field contains characters or punctuation not allowed in the language of TFL. A statement should contain only parentheses ( [ { } ] ), statement letters A–Z, the contradiction symbol ⊥, and the operators ¬, ∨, ∧, →, and ↔ (or their alternatives)."; 187 | } 188 | return $wff; 189 | } 190 | 191 | // Check depths and parentheses balance 192 | $d=0; 193 | for ($i=0; $iisWellFormed = false; 205 | $wff->ErrMsg = "Parentheses are unbalanced."; 206 | return $wff; 207 | } 208 | 209 | // remove matching outermost parentheses 210 | if ($depthArray[0]==1) { 211 | $theyMatch=true; 212 | for ($i=1; $i<(count($depthArray) -1); $i++) { 213 | $theyMatch=(($theyMatch) && ($depthArray[$i] > 0)); 214 | } 215 | if ($theyMatch) { 216 | return parseIt(mb_substr($s, 1, (mb_strlen($s) - 2) ) ); 217 | } 218 | } 219 | 220 | // check if in atomic family 221 | if (!( mb_ereg_match('.*[¬∧∨→↔∀∃]', $s) )) { 222 | // should be in atomic family 223 | 224 | // should not contain parentheses 225 | if (mb_ereg_match('.*[\(\)]', $s) ) { 226 | $wff->isWellFormed = false; 227 | $wff->ErrMsg = "Misplaced parentheses."; 228 | return $wff; 229 | } 230 | 231 | // check if splat 232 | if ($s=="⊥") { 233 | $wff->wffType="splat"; 234 | return $wff; 235 | } 236 | 237 | // if still contains splat, that is no good 238 | if ( mb_ereg_match('.*⊥', $s) ) { 239 | $wff->isWellFormed = false; 240 | $wff->ErrMsg = "Formula contains ⊥ but not in isolation."; 241 | return $wff; 242 | } 243 | 244 | // check for identity statement 245 | if ( mb_ereg_match('.*=', $s) ) { 246 | if ( mb_ereg_match('[a-z]=[a-z]$', $s) ) { 247 | $wff->wffType = 'identity'; 248 | $wff->myTerms = explode('=',$s); 249 | $wff->allFreeVars = array(); 250 | if (isVar($wff->myTerms[0])) { 251 | array_push($wff->allFreeVars, $wff->myTerms[0]); 252 | } 253 | if ((isVar($wff->myTerms[1])) && ($wff->myTerms[1] != $wff->myTerms[0])) { 254 | array_push($wff->allFreeVars, $wff->myTerms[1]); 255 | } 256 | return $wff; 257 | } else { 258 | $wff->isWellFormed = false; 259 | $wff->ErrMsg = "Poorly formed identity statement. Identity statement should be of the form t = s."; 260 | return $wff; 261 | } 262 | } 263 | 264 | // check for sentential atomic 265 | if (!($predicateSettings)) { 266 | if ( mb_ereg_match('[A-Z]$', $s) ) { 267 | $wff->wffType = "atomic"; 268 | $wff->myLetter = $s; 269 | return $wff; 270 | } else { 271 | $wff->isWellFormed = false; 272 | $wff->ErrMsg = "Poorly formed atomic statement. In TFL, an atomic statement should be a single statement letter."; 273 | return $wff; 274 | } 275 | } 276 | 277 | // should be predicate atomic 278 | if (!( mb_ereg_match('[A-Z]', $s) )) { 279 | $wff->isWellFormed = false; 280 | $wff->ErrMsg = "An atomic formula must begin with a predicate."; 281 | return $wff; 282 | } 283 | if (mb_strlen($s) == 1) { 284 | $wff->isWellFormed = false; 285 | $wff->ErrMsg = "An atomic formula must have terms, not just a predicate."; 286 | return $wff; 287 | } 288 | if (mb_ereg_match('..*[A-Z]', $s)) { 289 | $wff->isWellFormed=false; 290 | $wff->ErrMsg="Predicates may only appear at the beginning of an atomic formula."; 291 | return $wff; 292 | } 293 | if (mb_ereg_match('..*[^a-z]', $s)) { 294 | $wff->isWellFormed=false; 295 | $wff->ErrMsg="An atomic formula should contain only predicates followed by terms."; 296 | return $wff; 297 | } 298 | $wff->wffType='atomic'; 299 | $wff->myLetter=substr($s, 0 , 1); 300 | $wff->myTerms=str_split(substr($s, 1)); 301 | $wff->allFreeVars = array(); 302 | foreach ($wff->myTerms as $t) { 303 | if (isVar($t)) { 304 | array_push($wff->allFreeVars, $t); 305 | } 306 | } 307 | $wff->allFreeVars = array_unique($wff->allFreeVars); 308 | return $wff; 309 | } 310 | 311 | // find main operator 312 | for ($i=0; $imainOp=='?') { 316 | $wff->mainOp=$c; 317 | $mainOpPos=$i; 318 | } else { 319 | if ((isBinOp($wff->mainOp)) && (isBinOp($c))) { 320 | $wff->isWellFormed=false; 321 | $wff->ErrMsg="Too many operators or too few parentheses to disambiguate."; 322 | return $wff; 323 | } else { 324 | if ((isMonOp($wff->mainOp)) && (isBinOp($c))) { 325 | $wff->mainOp=$c; 326 | $mainOpPos=$i; 327 | } 328 | } 329 | } 330 | } 331 | } 332 | 333 | // if no operator found, return an error 334 | if ($wff->mainOp=='?') { 335 | $wff->isWellFormed=false; 336 | $wff->ErrMsg="Missing connective/operator or misplaced parentheses."; 337 | return $wff; 338 | } 339 | 340 | // quantified wff 341 | if (isQuantifier($wff->mainOp)) { 342 | $wff->wffType="quantified"; 343 | // quantifier must come first 344 | if ($mainOpPos != 0) { 345 | $wff->isWellFormed=false; 346 | $wff->ErrMsg="Misuse of a quantifier internally in a formula."; 347 | return $wff; 348 | } 349 | // variable must be next 350 | if (!(isVar( mb_substr($s, 1, 1) ))) { 351 | $wff->isWellFormed=false; 352 | $wff->ErrMsg="A quantifier is used without binding a variable."; 353 | } 354 | $wff->myLetter=mb_substr($s, 1, 1); 355 | 356 | // what comes after quantifier must be well-formed 357 | $wff->rightSide=parseIt(mb_substr($s, 2)); 358 | if (!($wff->rightSide->isWellFormed)) { 359 | $wff->isWellFormed=false; 360 | $wff->ErrMsg=$wff->rightSide->ErrMsg; 361 | return $wff; 362 | } 363 | // terms are same as right side except possibly adding bound variable 364 | $wff->myTerms=$wff->rightSide->myTerms; 365 | if (!(in_array($wff->myLetter, $wff->myTerms))) { 366 | array_push($wff->myTerms, $wff->myLetter); 367 | } 368 | // free variables are the same minus the one being bound 369 | $wff->allFreeVars = array(); 370 | foreach ($wff->rightSide->allFreeVars as $v) { 371 | if ($v != $wff->myLetter) { 372 | array_push($wff->allFreeVars, $v); 373 | } 374 | } 375 | return $wff; 376 | } 377 | 378 | $wff->wffType="molecular"; 379 | 380 | // negation 381 | if ($wff->mainOp == "¬") { 382 | // negation must be at start if main op 383 | if ($mainOpPos != 0) { 384 | $wff->isWellFormed=false; 385 | $wff->ErrMsg="Misuse of negation internally in formula."; 386 | return $wff; 387 | } 388 | // parse negated formula 389 | $wff->rightSide=parseIt( mb_substr($s, 1) ); 390 | if (!($wff->rightSide->isWellFormed)) { 391 | $wff->isWellFormed=false; 392 | $wff->ErrMsg=$wff->rightSide->ErrMsg; 393 | return $wff; 394 | } 395 | if ($predicateSettings) { 396 | $wff->myTerms=$wff->rightSide->myTerms; 397 | $wff->allFreeVars=$wff->rightSide->allFreeVars; 398 | } 399 | return $wff; 400 | } 401 | 402 | // binary molecular 403 | $wff->leftSide = parseIt(mb_substr($s, 0, $mainOpPos)); 404 | if (!($wff->leftSide->isWellFormed)) { 405 | $wff->isWellFormed=false; 406 | $wff->ErrMsg = $wff->leftSide->ErrMsg; 407 | return $wff; 408 | } 409 | 410 | $wff->rightSide = parseIt(mb_substr($s, $mainOpPos + 1)); 411 | if (!($wff->rightSide->isWellFormed)) { 412 | $wff->isWellFormed=false; 413 | $wff->ErrMsg=$wff->rightSide->ErrMsg; 414 | return $wff; 415 | } 416 | 417 | if ($predicateSettings) { 418 | $wff->myTerms = listUnion($wff->leftSide->myTerms, $wff->rightSide->myTerms); 419 | $wff->allFreeVars = listUnion($wff->leftSide->allFreeVars, $wff->rightSide->allFreeVars); 420 | } 421 | return $wff; 422 | } 423 | 424 | function subTerm($w, $n, $v) { 425 | if (!(in_array($v, $w->allFreeVars))) { 426 | return clone $w; 427 | } 428 | $x = newPLWff(); 429 | $x->wffType=$w->wffType; 430 | $x->mainOp=$w->mainOp; 431 | $x->myLetter=$w->myLetter; 432 | $x->allFreeVars = array(); 433 | foreach ($w->allFreeVars as $nv) { 434 | if ($nv != $v) { 435 | array_push($x->allFreeVars, $nv); 436 | } 437 | } 438 | 439 | if (($w->wffType=="atomic") || ($w->wffType=="identity")) { 440 | $x->myTerms = array(); 441 | foreach ($w->myTerms as $t) { 442 | if ($t == $v) { 443 | array_push($x->myTerms, $n); 444 | } else { 445 | array_push($x->myTerms, $t); 446 | } 447 | } 448 | return $x; 449 | } 450 | 451 | $x->rightSide=subTerm($w->rightSide,$n,$v); 452 | 453 | $x->myTerms=$x->rightSide->myTerms; 454 | 455 | if (isMonOp($x->mainOp)) { 456 | return $x; 457 | } 458 | $x->leftSide=subTerm($w->leftSide,$n,$v); 459 | $x->myTerms=listUnion($x->myTerms, $x->leftSide->myTerms); 460 | 461 | return $x; 462 | } 463 | 464 | function sameWff($a, $b) { 465 | global $predicateSettings; 466 | if ($a->wffType != $b->wffType) { 467 | return false; 468 | } 469 | if ($a->wffType == "splat") { 470 | return true; 471 | } 472 | if ($a->wffType == "identity") { 473 | return (($a->myTerms[0] == $b->myTerms[0]) && ($a->myTerms[1] == $b->myTerms[1])); 474 | } 475 | if ($a->wffType == "atomic") { 476 | if ($predicateSettings) { 477 | if ($a->myLetter != $b->myLetter) { 478 | return false; 479 | } 480 | if (count($a->myTerms) != count($b->myTerms)) { 481 | return false; 482 | } 483 | for ($i = 0; $imyTerms); $i++) { 484 | if ($a->myTerms[$i] != $b->myTerms[$i]) { 485 | return false; 486 | } 487 | } 488 | return true; 489 | } else { 490 | return ($a->myLetter == $b->myLetter); 491 | } 492 | } 493 | if ($a->mainOp != $b->mainOp) { 494 | return false; 495 | } 496 | if ((isQuantifier($a->mainOp)) && ($a->myLetter != $b->myLetter)) { 497 | return false; 498 | } 499 | if (isMonOp($a->mainOp)) { 500 | return sameWff($a->rightSide, $b->rightSide); 501 | } 502 | return ( (sameWff($a->leftSide, $b->leftSide)) && (sameWff($a->rightSide, $b->rightSide)) ); 503 | } 504 | 505 | ?> 506 | -------------------------------------------------------------------------------- /tfl-exs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Truth-Functional Logic sample proof exercises 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 162 | 167 | 168 | 169 |
170 |
171 |
172 | 173 |

Truth-Functional Logic sample proof exercises

174 |

Chapter 15, Exercise C

175 |

Give a proof for each of the following arguments:

176 |
    177 |
178 | 179 |

Chapter 17, Exercise B

180 |

Prove proofs to show each of the following:

181 |
    182 |
183 | 184 | Return to main demo page. 185 |
186 |
187 |
188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /wait.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenLogicProject/fitch-checker/e749234944579022814d0a5ee9cba2d61197384e/wait.gif --------------------------------------------------------------------------------