Extension:WikiLogic

From MediaWiki.org
Jump to: navigation, search
Wikimedia-logo-meta.png

This page was moved from MetaWiki.
It probably requires cleanup – please feel free to help out. In addition, some links on the page may be red; respective pages might be found at Meta. Remove this template once cleanup is complete.


MediaWiki extensions manual
Crystal Clear action run.png
Wikilogic

Release status: experimental

WikiLogic.jpg
Implementation Tag
Description Specific vernacular text conversion for Formal Logic
Author(s) w:User:Alfakim
Latest version 0.93a (25-09-2006)
MediaWiki 1.6
License No license specified
Download Extension:WikiLogic/Syntax

Translate the WikiLogic extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
NOTE!: This is a development version. It has never been tested.

WikiLogic (previously, EasyLogic) is an extension for MediaWiki that adds the ability to informally write Formal Logic between <logic></logic> tags. By informally, what is meant is that a user could write, for instance:

"<logic>p AND s THEREFORE q OR ExFx</logic>", or maybe
"<logic>a&b SO q V EXISTENTIALxGx</logic>"

...and the extension would parse all the logical words into the correct characters. Non-logical words remain untouched, and certain short-cut phrases (e.g. "E" for an existential quantifier) are also parsed.

These logical symbols cannot usually be written using a keyboard, and at least not without great pains, so the idea of the extension is to make writing logic easier. In this sense it is an informal, logic-based version of LaTeX.

There are internal options to output images rather than text, and external, parameter-controlled options to output a LaTeX or template string. The LaTeX does not yet work.

Usage[edit | edit source]

CAPITALS are converted to logic, lowercase are left as they are (constants or variables). Furthermore, individual characters can be escaped with "\", e.g. "\E" produces a literal "E" rather than the existential quantifier.

Logical symbols supported[edit | edit source]

Below is a list of the symbols supported by the extension. If you are using images, then each requires an image on your server stored at a directory (e.g. "/logic/") designated in the code for the extension.

Currently there are 22 logical symbols that this extension can convert text into. They are the main symbols of Propositional Logic, Quantifier Logic and Modal Logic and Set Theory logic.

Image Symbol name Phrases parsed by extension into this symbol
EasyLogictherefore.png Therefore "therefore"
"thus"
"so"
EasyLogicturnstile1.png Syntactic turnstile "turnstile1"
"syntacticturnstile"
"proof"
EasyLogicturnstile2.png Semantic turnstile "semanticturnstile"
"turnstile2"
"turnstile"
"valid"
EasyLogicnotequal.png Not equal "notequal"
"¬="
"unequal"
"~="
"!="
"different"
EasyLogicand.png And "and"
"+"
"n"
"^"
"&"
EasyLogicor.png Or "or"
"v"
EasyLogiccond.png Material conditional "cond"
"implies"
"imply"
"then"
"conditional"
"material"
"-->"
"->"
"==>"
"=>"
EasyLogicbicond.png Biconditional "bicond"
"biconditional"
"equivalent"
"iff"
"==="
"<=>"
"<->"
"<>"
EasyLogicuniversal.png Universal quantifier "universal"
"univ"
"uni"
"un"
"A"
"qu"
EasyLogicexistential.png Existential quantifier "existential"
"exists"
"exist"
"exi"
"ex"
"E"
"qe"
EasyLogicunion.png Union _|"
"union"
"U"
EasyLogicintersect.png Intersect ^|"
"intersect"
"N"
EasyLogicelement.png Element of "element"
"elem"
"€"
"member"
"part"
"in"
Not an element of "notelement"
"notelem"
"!€"
"notmember"
"notpart"
"notin"
"¬element"
"¬elem"
"¬member"
"¬part"
"¬in"
EasyLogicsubset.png Subset "subset"
"contained"
"sub"
"<_"
Not subset "notsubset"
"notcontained"
"notsub"
"!<_"
"¬subset"
"¬notcontained"
"¬notsub"
EasyLogicpsubset.png Proper subset "propersubset"
"psubset"
"psub"
"<"
Not proper subset "notpropersubset"
"notpsubset"
"notpsub"
"!<"
"¬propersubset"
"¬psubset"
"¬psub"
EasyLogicempty.png Empty set "0"
"zero"
"emptyset"
"empty"
Necessity "necessity"
"necessarily"
"always"
"box"
"square"
"[]"
"L"
Possibility "possibly"
"possibility"
"sometimes"
"maybe"
"diamond"
"kite"
"lozenge"
"M"
Identity "identical"
"exactly"
"same"
"identity"
"is"

Parameters[edit | edit source]

Arguments can be specified when calling the extension:

<logic argument="value" argument2="value2">xyz</logic>

Argument "output" can be set to "latex" or "template" to output a LaTeX or wikitext template string instead.

The argument "width" can be specified to determine the width of images if in image mode. The width is in CSS units, e.g. "1em", "20px", "1cm", etc.

Installation[edit | edit source]

The extension is stored in a file called WikiLogic.php, the code for which is stored here. The file should be placed in your extensions folder.

To activate the extension, include it from your LocalSettings.php with:

require_once("extensions/WikiLogic.php");

...and change any internal variables you need to, to alter its functionality.

Development[edit | edit source]

This extension was written by w:User:Alfakim to make it easier and less daunting for philosophy students to write Formal logic on a Wiki.

Currently the extension is quite crude, and a major improvement to it would be to combine it with the LaTeX engine so that it generates a .PNG file all by itself.

However, in the meantime, the extension can be easily improved by adding more symbols that it can convert.