Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which use a logographic writing system and need larger font sizes.
***/

/*{{{*/
body {font-size:0.8em;}

#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}

.subtitle {font-size:0.8em;}

.viewer table.listView {font-size:0.95em;}

.htmlarea .toolbarHA table {border:1px solid ButtonFace; margin:0em 0em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
This site is an experimental [[TiddlyWiki|http://www.tiddlywiki.com/]] rendering of fragments of the [[IsarMathLib| http://www.nongnu.org/isarmathlib/]] project. IsarMathLib is a library of mathematical proofs  formally verified by the [[Isabelle|http://www.cl.cam.ac.uk/research/hvg/Isabelle/ ]] theorem proving environment. The formalization is based on the [[Zermelo-Fraenkel set theory|http://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraenkel_set_theory ]]. 

The software for translating Isabelle's Isar language to <nowiki>TiddlyWiki</nowiki> markup is at the early alpha stage, so some proofs may be rendered incorrectly. In case of doubts, compare with the Isabelle generated IsarMathLib [[proof document|http://www.nongnu.org/isarmathlib/IsarMathLib/document.pdf]].

+++[Comments|click to leave comment]
<html> <div> <iframe style="width:50%;height:400px" src="http://www.haloscan.com/comments/slawekk/tiddlyformalmath"></iframe> </div> </html>
This document has been  created from a ~TiddlyWiki from tiddlyspot.com.  A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.

 This tiddler is for me, the author of this TiddlyWiki.  Here I can configure privacy and other site settings at my [[control panel|http://formalmath.tiddlyspot.com/controlpanel]] (my control panel username is //formalmath//).
<<tiddler TspotControls>>
See also GettingStarted.

AboutThisSite
 ''theory'' Finite_ZF ''imports'' [[Nat_ZF]] [[Cardinal]]

 ''begin
'' 
Standard Isabelle Finite.thy contains a very useful notion of finite powerset: the set of finite subsets of a given set. The definition, however, is specific to Isabelle and based on the notion of "datatype", obviously not something that belongs to ZF set theory. This theory file devolopes the notion of finite powerset similarly as in Finite.thy, but based on standard library's Cardinal.thy. This theory file is intended to replace IsarMathLib's //Finite1// and //Finite_ZF_1// theories that are currently derived from the "datatype" approach.

!Definition and basic properties of finite powerset

The goal of this section is to prove an induction theorem about finite powersets: if the empty set has some property and this property is preserved by adding a single element of a set, then this property is true for all finite subsets of this set.

We defined the finite powerset $ FinPow(X)$ as those elements of the powerset that are finite.

 ''Definition
'' $ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$

The cardinality of an element of finite powerset is a natural number.

 ''lemma''  <nowiki>card_fin_is_nat</nowiki>:
 ''   assumes '' $ A \in  FinPow(X)$ ''   shows '' $ |A| \in  nat$ ''and '' $ A \approx  |A|$ ''using '' <nowiki>assms</nowiki> ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$===  ,  <nowiki>Finite_def</nowiki> ,  <nowiki>cardinal_cong</nowiki> ,  <nowiki>nat_into_Card</nowiki> ,  <nowiki>Card_cardinal_eq</nowiki>

We can decompose the finite powerset into collection of sets of the same natural cardinalities.

 ''lemma''  <nowiki>finpow_decomp</nowiki>:
 ''   shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \approx  n\})$ ''using '' <nowiki>Finite_def</nowiki> ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 

Finite powerset is the union of sets of cardinality bounded by natural numbers.

 ''lemma''  <nowiki>finpow_union_card_nat</nowiki>:
 ''   shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \preceq  n\})$+++[proof ]>
 ''have''  $ FinPow(X) \subseteq  (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \preceq  n\})$ ''using '' +++^[finpow_decomp | Finite_ZF ]...  ''lemma''  <nowiki>finpow_decomp</nowiki>:  '' shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \approx  n\})$ ===  ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$===  ,  <nowiki>eqpoll_imp_lepoll</nowiki>
 ''moreover''   ''have''  $ (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \preceq  n\}) \subseteq  FinPow(X)$ ''using '' <nowiki>lepoll_nat_imp_Finite</nowiki> ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 
 ''ultimately ''  ''show''  $ thesis$ 
 ''qed'' === 

A different form of //finpow_union_card_nat// (see above) - a subset that has not more elements than a given natural number is in the finite powerset.

 ''lemma''  <nowiki>lepoll_nat_in_finpow</nowiki>:
 ''   assumes '' $ n \in  nat$,  $ A \subseteq  X$,  $ A \preceq  n$ ''   shows '' $ A \in  FinPow(X)$ ''using '' <nowiki>assms</nowiki> ,  +++^[finpow_union_card_nat | Finite_ZF ]...  ''lemma''  <nowiki>finpow_union_card_nat</nowiki>:  '' shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \preceq  n\})$ === 

If we remove an element and put it back we get the set back.

 ''lemma''  <nowiki>rem_add_eq</nowiki>:
 ''   assumes '' $ a\in A$ ''   shows '' $ (A-\{a\}) \cup  \{a\} = A$ ''using '' <nowiki>assms</nowiki>

Induction for finite powerset. This is smilar to the standard Isabelle's //Fin_induct//.

 ''theorem''  <nowiki>FinPow_induct</nowiki>:
 ''   assumes '' A1: $ P(0)$ ''and '' A2: $ \forall A \in  FinPow(X).\  P(A) \longrightarrow  (\forall a\in X.\  P(A \cup  \{a\}))$ ''and '' A3: $ B \in  FinPow(X)$ ''   shows '' $ P(B)$+++[proof ]>

 ''{ ''  ''fix '' $ n$
 ''assume '' $ n \in  nat$
 ''moreover''   ''from '' A1  ''have''  I: $ \forall B\in Pow(X).\  B \preceq  0 \longrightarrow  P(B)$ ''using '' <nowiki>lepoll_0_is_0</nowiki>
 ''moreover''   ''have''  $ \forall  k \in  nat.\  $
$      (\forall B \in  Pow(X).\  (B \preceq  k \longrightarrow  P(B))) \longrightarrow  $
$      (\forall B \in  Pow(X).\  (B \preceq  succ(k) \longrightarrow  P(B)))$+++[proof ]>
 ''{ ''  ''fix '' $ k$
 ''assume '' A4: $ k \in  nat$
 ''assume '' A5: $ \forall  B \in  Pow(X).\  (B \preceq  k \longrightarrow  P(B))$
 ''fix '' $ B$
 ''assume '' A6: $ B \in  Pow(X)$,  $ B \preceq  succ(k)$
 ''have''  $ P(B)$+++[proof ]>
 ''have''  $ B = 0 \longrightarrow  P(B)$+++[proof ]>
 ''{ ''  ''assume '' $ B = 0$
 ''then ''  ''have''  $ B \preceq  0$ ''using '' <nowiki>lepoll_0_iff</nowiki>
 ''with '' I, A6  ''have''  $ P(B)$ 
 '' }'' 
 ''thus''  $ B = 0 \longrightarrow  P(B)$
 ''qed'' === 
 ''moreover''   ''have''  $ B\neq 0 \longrightarrow  P(B)$+++[proof ]>
 ''{ ''  ''assume '' $ B \neq  0$
 ''then ''  ''obtain '' $ a$ ''where '' II: $ a\in B$ 
 ''let '' $ A = B - \{a\}$
 ''from '' A6, II  ''have''  $ A \subseteq  X$ ''and '' $ A \preceq  k$ ''using '' <nowiki>Diff_sing_lepoll</nowiki>
 ''with '' A4, A5  ''have''  $ A \in  FinPow(X)$ ''and '' $ P(A)$ ''using '' +++^[lepoll_nat_in_finpow | Finite_ZF ]...  ''lemma''  <nowiki>lepoll_nat_in_finpow</nowiki>:  ''assumes '' $ n \in  nat$,   $ A \subseteq  X$,   $ A \preceq  n$  '' shows '' $ A \in  FinPow(X)$ ===  ,  +++^[finpow_decomp | Finite_ZF ]...  ''lemma''  <nowiki>finpow_decomp</nowiki>:  '' shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \approx  n\})$ === 
 ''with '' A2, A6, II  ''have''  $  P(A \cup  \{a\})$ 
 ''moreover''   ''from '' II  ''have''  $ A \cup  \{a\} = B$ 
 ''ultimately ''  ''have''  $ P(B)$ 
 '' }'' 
 ''thus''  $ B\neq 0 \longrightarrow  P(B)$
 ''qed'' === 
 ''ultimately ''  ''show''  $ P(B)$ 
 ''qed'' === 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''ultimately ''  ''have''  $ \forall B \in  Pow(X).\  (B \preceq  n \longrightarrow  P(B))$ ''   by (rule '' +++^[ind_on_nat | Nat_ZF ]...  ''theorem''  <nowiki>ind_on_nat</nowiki>:  ''assumes '' $ n\in nat$  ''and'' $ P(0)$  ''and'' $ \forall k\in nat.\  P(k)\longrightarrow P(succ(k))$  '' shows '' $ P(n)$ ===  '')'' 
 '' }'' 
 ''then ''  ''have''  $ \forall n \in  nat.\  \forall B \in  Pow(X).\  (B \preceq  n \longrightarrow  P(B))$ 
 ''with '' A3  ''show''  $ P(B)$ ''using '' +++^[finpow_union_card_nat | Finite_ZF ]...  ''lemma''  <nowiki>finpow_union_card_nat</nowiki>:  '' shows '' $ FinPow(X) = (\bigcup n \in  nat.\  \{A \in  Pow(X).\  A \preceq  n\})$ === 
 ''qed'' === 

If a family of sets is closed with respect to taking intersections of two sets then it is closed with respect to taking intersections of any nonempty finite collection.

 ''lemma''  <nowiki>inter_two_inter_fin</nowiki>:
 ''   assumes '' A1: $ \forall V\in T.\  \forall W\in T.\  V \cap  W \in  T$ ''and '' A2: $ N \neq  0$ ''and '' A3: $ N \in  FinPow(T)$ ''   shows '' $ (\bigcap N \in  T)$+++[proof ]>
 ''have''  $ 0 = 0 \vee  (\bigcap 0 \in  T)$ 
 ''moreover''   ''have''  $ \forall M \in  FinPow(T).\  (M = 0 \vee  \bigcap M \in  T) \longrightarrow  $
$    (\forall W \in  T.\  M\cup \{W\} = 0 \vee  \bigcap (M \cup  \{W\}) \in  T)$+++[proof ]>
 ''{ ''  ''fix '' $ M$
 ''assume '' $ M \in  FinPow(T)$
 ''assume '' A4: $ M = 0 \vee  \bigcap M \in  T$
 ''{ ''  ''assume '' $ M = 0$
 ''hence''  $ \forall W \in  T.\  M\cup \{W\} = 0 \vee  \bigcap (M \cup  \{W\}) \in  T$
 '' }'' 
 ''moreover''  
 ''{ ''  ''assume '' $ M \neq  0$
 ''with '' A4  ''have''  $ \bigcap M \in  T$ 
 ''{ ''  ''fix '' $ W$
 ''assume '' $ W \in  T$
 ''from '' $ M \neq  0$  ''have''  $ \bigcap (M \cup  \{W\}) = (\bigcap M) \cap  W$ 
 ''with '' A1, $ \bigcap M \in  T$, $ W \in  T$  ''have''  $ \bigcap (M \cup  \{W\}) \in  T$ 
 '' }'' 
 ''hence''  $ \forall W \in  T.\  M\cup \{W\} = 0 \vee  \bigcap (M \cup  \{W\}) \in  T$
 '' }'' 
 ''ultimately ''  ''have''  $ \forall W \in  T.\  M\cup \{W\} = 0 \vee  \bigcap (M \cup  \{W\}) \in  T$ 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''moreover''   ''note '' $ N \in  FinPow(T)$
 ''ultimately ''  ''have''  $ N = 0 \vee  (\bigcap N \in  T)$ ''   by (rule '' +++^[FinPow_induct | Finite_ZF ]...  ''theorem''  <nowiki>FinPow_induct</nowiki>:  ''assumes '' $ P(0)$  ''and'' $ \forall A \in  FinPow(X).\  P(A) \longrightarrow  (\forall a\in X.\  P(A \cup  \{a\}))$  ''and'' $ B \in  FinPow(X)$  '' shows '' $ P(B)$ ===  '')'' 
 ''with '' A2  ''show''  $ (\bigcap N \in  T)$ 
 ''qed'' === 

If a family of sets contains the empty set and is closed with respect to taking unions of two sets then it is closed with respect to taking unions of any finite collection.

 ''lemma''  <nowiki>union_two_union_fin</nowiki>:
 ''   assumes '' A1: $ 0 \in  C$ ''and '' A2: $ \forall A\in C.\  \forall B\in C.\  A\cup B \in  C$ ''and '' A3: $ N \in  FinPow(C)$ ''   shows '' $ \bigcup N \in  C$+++[proof ]>
 ''from '' $ 0 \in  C$  ''have''  $ \bigcup 0 \in  C$ 
 ''moreover''   ''have''  $ \forall M \in  FinPow(C).\  \bigcup M \in  C \longrightarrow  (\forall A\in C.\  \bigcup (M \cup  \{A\}) \in  C)$+++[proof ]>
 ''{ ''  ''fix '' $ M$
 ''assume '' $ M \in  FinPow(C)$
 ''assume '' $ \bigcup M \in  C$
 ''fix '' $ A$
 ''assume '' $ A\in C$
 ''have''  $ \bigcup (M \cup  \{A\}) = (\bigcup M) \cup  A$ 
 ''with '' A2, $ \bigcup M \in  C$, $ A\in C$  ''have''  $ \bigcup (M \cup  \{A\}) \in  C$ 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''moreover''   ''note '' $ N \in  FinPow(C)$
 ''ultimately ''  ''show''  $ \bigcup N \in  C$ ''   by (rule '' +++^[FinPow_induct | Finite_ZF ]...  ''theorem''  <nowiki>FinPow_induct</nowiki>:  ''assumes '' $ P(0)$  ''and'' $ \forall A \in  FinPow(X).\  P(A) \longrightarrow  (\forall a\in X.\  P(A \cup  \{a\}))$  ''and'' $ B \in  FinPow(X)$  '' shows '' $ P(B)$ ===  '')'' 
 ''qed'' === 

Empty set is in finite power set.

 ''lemma''  <nowiki>empty_in_finpow</nowiki>:
 ''   shows '' $ 0 \in  FinPow(X)$ ''using '' +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 

Singleton is in the finite powerset.

 ''lemma''  <nowiki>singleton_in_finpow</nowiki>:
 ''   assumes '' $ x \in  X$ ''   shows '' $ \{x\} \in  FinPow(X)$ ''using '' <nowiki>assms</nowiki> ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 

Union of two finite subsets is a finite subset.

 ''lemma''  <nowiki>union_finpow</nowiki>:
 ''   assumes '' $ A \in  FinPow(X)$ ''and '' $ B \in  FinPow(X)$ ''   shows '' $ A \cup  B \in  FinPow(X)$ ''using '' <nowiki>assms</nowiki> ,  +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 

An image of a finite set is finite.

 ''lemma''  <nowiki>fin_image_fin</nowiki>:
 ''   assumes '' $ \forall V\in B.\  K(V)\in C$ ''and '' $ N \in  FinPow(B)$ ''   shows '' $ \{K(V).\  V\in N\} \in  FinPow(C)$+++[proof ]>
 ''have''  $ \{K(V).\  V\in 0\} \in  FinPow(C)$ ''using '' +++^[FinPow_def | Finite_ZF ]... Definition of <nowiki>FinPow</nowiki>:
$ FinPow(X) \equiv  \{A \in  Pow(X).\  Finite(A)\}$=== 
 ''moreover''   ''have''  $ \forall A \in  FinPow(B).\  $
$    \{K(V).\  V\in A\} \in  FinPow(C) \longrightarrow  (\forall a\in B.\  \{K(V).\  V \in  (A \cup  \{a\})\} \in  FinPow(C))$+++[proof ]>
 ''{ ''  ''fix '' $ A$
 ''assume '' $ A \in  FinPow(B)$
 ''assume '' $ \{K(V).\  V\in A\} \in  FinPow(C)$
 ''fix '' $ a$
 ''assume '' $ a\in B$
 ''have''  $ \{K(V).\  V \in  (A \cup  \{a\})\} \in  FinPow(C)$+++[proof ]>
 ''have''  $ \{K(V).\  V \in  (A \cup  \{a\})\} = \{K(V).\  V\in A\} \cup  \{K(a)\}$ 
 ''moreover''   ''note '' $ \{K(V).\  V\in A\} \in  FinPow(C)$
 ''moreover''   ''from '' $ \forall V\in B.\  K(V)\in C$, $ a\in B$  ''have''  $ \{K(a)\} \in   FinPow(C)$ ''using '' +++^[singleton_in_finpow | Finite_ZF ]...  ''lemma''  <nowiki>singleton_in_finpow</nowiki>:  ''assumes '' $ x \in  X$  '' shows '' $ \{x\} \in  FinPow(X)$ === 
 ''ultimately ''  ''show''  $ thesis$ ''using '' +++^[union_finpow | Finite_ZF ]...  ''lemma''  <nowiki>union_finpow</nowiki>:  ''assumes '' $ A \in  FinPow(X)$  ''and'' $ B \in  FinPow(X)$  '' shows '' $ A \cup  B \in  FinPow(X)$ === 
 ''qed'' === 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''moreover''   ''note '' $ N \in  FinPow(B)$
 ''ultimately ''  ''show''  $ \{K(V).\  V\in N\} \in  FinPow(C)$ ''   by (rule '' +++^[FinPow_induct | Finite_ZF ]...  ''theorem''  <nowiki>FinPow_induct</nowiki>:  ''assumes '' $ P(0)$  ''and'' $ \forall A \in  FinPow(X).\  P(A) \longrightarrow  (\forall a\in X.\  P(A \cup  \{a\}))$  ''and'' $ B \in  FinPow(X)$  '' shows '' $ P(B)$ ===  '')'' 
 ''qed'' === 

 ''end

'' +++![Comments on Finite_ZF|click to add comment] <html> <div> <iframe style="width:60%;height:500px" src="http://www.haloscan.com/comments/slawekk/Finite_ZF"></iframe> </div> </html>
=== 
Click on the items to the left to browse the IsarMathLib theories. Be patient, your browser may take a couple of seconds to render them.  If you want to edit a local copy of this Wiki you may want to enter your username for signing the edits: <<option txtUserName>>. 
 ''theory'' Group_ZF ''imports'' [[Monoid_ZF]]

 ''begin
'' 
This theory file covers basics of group theory.

!Definition and basic properties of groups

In this section we define the notion of a group and set up the notation for discussing groups. We prove some basic theorems about groups.

To define a group we take a monoid and add a requirement that the right inverse needs to exist for every element of the group.

 ''Definition
'' $ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$

We define the group inverse as the set $\{\langle x,y \rangle \in G\times G: x\cdot y = e \}$, where $e$ is the neutral element of the group. This set (which can be written as $(\cdot)^{-1}\{ e\}$) is a certain relation on the group (carrier). Since, as we show later, for every $x\in G$ there is exactly one $y\in G$ such that $x \cdot y = e$ this relation is in fact a function from $G$ to $G$.

 ''Definition
'' $ GroupInv(G,f) \equiv  \{\langle x,y\rangle  \in  G\times G.\  f\langle x,y\rangle  = TheNeutralElement(G,f)\}$

We will use the miltiplicative notation for groups. The neutral element is denoted $1$.

 ''Locale '' group0
 ''fixes '' $ G$
 ''fixes '' $ P$
 ''assumes '' groupAssum: $ \text{IsAgroup}(G,P)$
 ''fixes '' $ neut$
 ''defines '' $ 1  \equiv  TheNeutralElement(G,P)$
 ''fixes '' $ groper$
 ''defines '' $ a \cdot  b \equiv  P\langle a,b\rangle $
 ''fixes '' $ inv$
 ''defines '' $ x^{-1} \equiv  GroupInv(G,P)(x)$


First we show a lemma that says that we can use theorems proven in the //monoid0// context (locale).

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L1</nowiki>:
 ''   shows '' $ monoid0(G,P)$ ''using '' <nowiki>groupAssum</nowiki> ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  <nowiki>monoid0_def</nowiki>

In some strange cases Isabelle has difficulties with applying the definition of a group. The next lemma defines a rule to be applied in such cases.

 ''lemma''  <nowiki>definition_of_group</nowiki>:
 ''   assumes '' $ \text{IsAmonoid}(G,f)$ ''and '' $ \forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)$ ''   shows '' $ \text{IsAgroup}(G,f)$ ''using '' <nowiki>assms</nowiki> ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$=== 

A technical lemma that allows to use $1$ as the neutral element of the group without referencing a list of lemmas and definitions.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:
 ''   shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ ''using '' +++^[group0_2_L1 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L1</nowiki>:  '' shows '' $ monoid0(G,P)$ ===  ,  +++^[unit_is_neutral | Monoid_ZF ]...  ''lemma''   ''(in '' monoid0 '') '' <nowiki>unit_is_neutral</nowiki>:  ''assumes '' $ e = TheNeutralElement(G,f)$  '' shows '' $ e \in  G \wedge  (\forall g\in G.\  e \oplus  g = g \wedge  g \oplus  e = g)$ === 

The group is closed under the group operation. Used all the time, useful to have handy.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:
 ''   assumes '' $ a\in G$,  $ b\in G$ ''   shows '' $ a\cdot b \in  G$ ''using '' <nowiki>assms</nowiki> ,  +++^[group0_2_L1 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L1</nowiki>:  '' shows '' $ monoid0(G,P)$ ===  ,  +++^[group0_1_L1 | Monoid_ZF ]...  ''lemma''   ''(in '' monoid0 '') '' <nowiki>group0_1_L1</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\oplus b \in  G$ === 

The group operation is associative. This is another technical lemma that allows to shorten the list of referenced lemmas in some proofs.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:
 ''   assumes '' $ a\in G$,  $ b\in G$,  $ c\in G$ ''   shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ ''using '' <nowiki>groupAssum</nowiki> ,  <nowiki>assms</nowiki> ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$===  ,  +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ === 

The group operation maps $G\times G$ into $G$. It is conveniet to have this fact easily accessible in the //group0// context.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assocA</nowiki>:
 ''   shows '' $ P : G\times G\rightarrow G$ ''using '' <nowiki>groupAssum</nowiki> ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 

The definition of a group requires the existence of the right inverse. We show that this is also the left inverse.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T1</nowiki>:
 ''   assumes '' A1: $ g\in G$ ''and '' A2: $ b\in G$ ''and '' A3: $ g\cdot b = 1 $ ''   shows '' $ b\cdot g = 1 $+++[proof ]>
 ''from '' A2, groupAssum  ''obtain '' $ c$ ''where '' I: $ c \in  G \wedge  b\cdot c = 1 $ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$=== 
 ''then ''  ''have''  $ c\in G$ 
 ''have''  $ 1 \in G$ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''with '' A1, A2, I  ''have''  $ b\cdot g =  b\cdot (g\cdot (b\cdot c))$ ''using '' +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A1, A2, $ c\in G$  ''have''  $ b\cdot (g\cdot (b\cdot c)) = b\cdot (g\cdot b\cdot c)$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A3, A2, I  ''have''  $ b\cdot (g\cdot b\cdot c)= 1 $ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''finally ''  ''show''  $ b\cdot g = 1 $ 
 ''qed'' === 

For every element of a group there is only one inverse.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L4</nowiki>:
 ''   assumes '' A1: $ x\in G$ ''   shows '' $ \exists !y.\  y\in G \wedge  x\cdot y = 1 $+++[proof ]>
 ''from '' A1, groupAssum  ''show''  $ \exists y.\  y\in G \wedge   x\cdot y = 1 $ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$=== 
 ''fix '' $ y$ $ n$
 ''assume '' A2: $ y\in G \wedge   x\cdot y = 1 $ ''and '' A3: $ n\in G \wedge  x\cdot n = 1 $
 ''show''  $ y=n$+++[proof ]>
 ''from '' A1, A2  ''have''  T1: $ y\cdot x = 1 $ ''using '' +++^[group0_2_T1 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T1</nowiki>:  ''assumes '' $ g\in G$  ''and'' $ b\in G$  ''and'' $ g\cdot b = 1 $  '' shows '' $ b\cdot g = 1 $ === 
 ''from '' A2, A3  ''have''  $ y = y\cdot (x\cdot n)$ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''also''   ''from '' A1, A2, A3  ''have''  $ \ldots  = (y\cdot x)\cdot n$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' T1, A3  ''have''  $ \ldots  = n$ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''finally ''  ''show''  $ y=n$ 
 ''qed'' === 
 ''qed'' === 

The group inverse is a function that maps G into G.

 ''theorem''  <nowiki>group0_2_T2</nowiki>:
 ''   assumes '' A1: $ \text{IsAgroup}(G,f)$ ''   shows '' $ GroupInv(G,f) : G\rightarrow G$+++[proof ]>
 ''have''  $ GroupInv(G,f) \subseteq  G\times G$ ''using '' +++^[GroupInv_def | Group_ZF ]... Definition of <nowiki>GroupInv</nowiki>:
$ GroupInv(G,f) \equiv  \{\langle x,y\rangle  \in  G\times G.\  f\langle x,y\rangle  = TheNeutralElement(G,f)\}$=== 
 ''moreover''   ''from '' A1  ''have''  $ \forall x\in G.\  \exists !y.\  y\in G \wedge  \langle x,y\rangle  \in  GroupInv(G,f)$ ''using '' <nowiki>group0_def</nowiki> ,  +++^[group0_2_L4 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L4</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ \exists !y.\  y\in G \wedge  x\cdot y = 1 $ ===  ,  +++^[GroupInv_def | Group_ZF ]... Definition of <nowiki>GroupInv</nowiki>:
$ GroupInv(G,f) \equiv  \{\langle x,y\rangle  \in  G\times G.\  f\langle x,y\rangle  = TheNeutralElement(G,f)\}$=== 
 ''ultimately ''  ''show''  $ thesis$ ''using '' <nowiki>func1_1_L11</nowiki>
 ''qed'' === 

We can think about the group inverse (the function) as the inverse image of the neutral element. Recall that in Isabelle $ f^{-1}(A)$ denotes the inverse image of the set $A$.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T3</nowiki>:
 ''   shows '' $ P^{-1}\{1 \} = GroupInv(G,P)$+++[proof ]>
 ''from '' groupAssum  ''have''  $ P : G\times G \rightarrow  G$ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 
 ''then ''  ''show''  $ P^{-1}\{1 \} = GroupInv(G,P)$ ''using '' <nowiki>func1_1_L14</nowiki> ,  +++^[GroupInv_def | Group_ZF ]... Definition of <nowiki>GroupInv</nowiki>:
$ GroupInv(G,f) \equiv  \{\langle x,y\rangle  \in  G\times G.\  f\langle x,y\rangle  = TheNeutralElement(G,f)\}$=== 
 ''qed'' === 

The inverse is in the group.

 ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:
 ''   assumes '' A1: $ x\in G$ ''   shows '' $ x^{-1}\in G$+++[proof ]>
 ''from '' groupAssum  ''have''  $ GroupInv(G,P) : G\rightarrow G$ ''using '' +++^[group0_2_T2 | Group_ZF ]...  ''theorem''  <nowiki>group0_2_T2</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  '' shows '' $ GroupInv(G,f) : G\rightarrow G$ === 
 ''with '' A1  ''show''  $ thesis$ ''using '' <nowiki>apply_type</nowiki>
 ''qed'' === 

The notation for the inverse means what it is supposed to mean.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:
 ''   assumes '' A1: $ x\in G$ ''   shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $+++[proof ]>
 ''from '' groupAssum  ''have''  $ GroupInv(G,P) : G\rightarrow G$ ''using '' +++^[group0_2_T2 | Group_ZF ]...  ''theorem''  <nowiki>group0_2_T2</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  '' shows '' $ GroupInv(G,f) : G\rightarrow G$ === 
 ''with '' A1  ''have''  $ \langle x,x^{-1}\rangle  \in   GroupInv(G,P)$ ''using '' <nowiki>apply_Pair</nowiki>
 ''then ''  ''show''  $ x\cdot x^{-1} = 1 $ ''using '' +++^[GroupInv_def | Group_ZF ]... Definition of <nowiki>GroupInv</nowiki>:
$ GroupInv(G,f) \equiv  \{\langle x,y\rangle  \in  G\times G.\  f\langle x,y\rangle  = TheNeutralElement(G,f)\}$=== 
 ''with '' A1  ''show''  $ x^{-1}\cdot x = 1 $ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group0_2_T1 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T1</nowiki>:  ''assumes '' $ g\in G$  ''and'' $ b\in G$  ''and'' $ g\cdot b = 1 $  '' shows '' $ b\cdot g = 1 $ === 
 ''qed'' === 

The next two lemmas state that unless we multiply by the neutral element, the result is always different than any of the operands.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L7</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ b\in G$ ''and '' A3: $ a\cdot b = a$ ''   shows '' $ b=1 $+++[proof ]>
 ''from '' A3  ''have''  $ a^{-1} \cdot  (a\cdot b) = a^{-1}\cdot a$ 
 ''with '' A1, A2  ''show''  $ thesis$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''qed'' === 

See the comment to //group0_2_L7//.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ b\in G$ ''and '' A3: $ a\cdot b = b$ ''   shows '' $ a=1 $+++[proof ]>
 ''from '' A3  ''have''  $ (a\cdot b)\cdot b^{-1}  = b\cdot b^{-1}$ 
 ''with '' A1, A2  ''have''  $ a\cdot (b\cdot b^{-1})  = b\cdot b^{-1}$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''with '' A1, A2  ''show''  $ thesis$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''qed'' === 

The inverse of the neutral element is the neutral element.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_one</nowiki>:
 ''   shows '' $ 1 ^{-1} = 1 $ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ ===  ,  +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L7 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L7</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = a$  '' shows '' $ b=1 $ === 

if $a^{-1} = 1$, then $a=1$.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8A</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ a^{-1} = 1 $ ''   shows '' $ a = 1 $+++[proof ]>
 ''from '' A1  ''have''  $ a\cdot a^{-1} = 1 $ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ === 
 ''with '' A1, A2  ''show''  $ a = 1 $ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''qed'' === 

If $a$ is not a unit, then its inverse is not a unit either.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8B</nowiki>:
 ''   assumes '' $ a\in G$ ''and '' $ a \neq  1 $ ''   shows '' $ a^{-1} \neq  1 $ ''using '' <nowiki>assms</nowiki> ,  +++^[group0_2_L8A | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8A</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ a^{-1} = 1 $  '' shows '' $ a = 1 $ === 

If $a^{-1}$ is not a unit, then a is not a unit either.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8C</nowiki>:
 ''   assumes '' $ a\in G$ ''and '' $ a^{-1} \neq  1 $ ''   shows '' $ a\neq 1 $ ''using '' <nowiki>assms</nowiki> ,  +++^[group0_2_L8A | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L8A</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ a^{-1} = 1 $  '' shows '' $ a = 1 $ ===  ,  +++^[group_inv_of_one | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_one</nowiki>:  '' shows '' $ 1 ^{-1} = 1 $ === 

If a product of two elements of a group is equal to the neutral element then they are inverses of each other.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ b\in G$ ''and '' A3: $ a\cdot b = 1 $ ''   shows '' $ a = b^{-1}$ ''and '' $ b = a^{-1}$+++[proof ]>
 ''from '' A3  ''have''  $ a\cdot b\cdot b^{-1} = 1 \cdot b^{-1}$ 
 ''with '' A1, A2  ''have''  $ a\cdot (b\cdot b^{-1}) = 1 \cdot b^{-1}$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''with '' A1, A2  ''show''  $ a = b^{-1}$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''from '' A3  ''have''  $ a^{-1}\cdot (a\cdot b) = a^{-1}\cdot 1 $ 
 ''with '' A1, A2  ''show''  $ b = a^{-1}$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''qed'' === 

It happens quite often that we know what is (have a meta-function for) the right inverse in a group. The next lemma shows that the value of the group inverse (function) is equal to the right inverse (meta-function).

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9A</nowiki>:
 ''   assumes '' A1: $ \forall g\in G.\  b(g) \in  G \wedge  g\cdot b(g) = 1 $ ''   shows '' $ \forall g\in G.\  b(g) = g^{-1}$+++[proof ]>
 ''fix '' $ g$
 ''assume '' $ g\in G$
 ''moreover''   ''from '' A1, $ g\in G$  ''have''  $ b(g) \in  G$ 
 ''moreover''   ''from '' A1, $ g\in G$  ''have''  $ g\cdot b(g) = 1 $ 
 ''ultimately ''  ''show''  $ b(g) = g^{-1}$ ''   by (rule '' +++^[group0_2_L9 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = 1 $  '' shows '' $ a = b^{-1}$  ''and'' $ b = a^{-1}$ ===  '')'' 
 ''qed'' === 

What is the inverse of a product?

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ b\in G$ ''   shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$+++[proof ]>
 ''from '' A1, A2  ''have''  $ b^{-1}\in G$,  $ a^{-1}\in G$,  $ a\cdot b\in G$,  $ b^{-1}\cdot a^{-1} \in  G$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ === 
 ''from '' A1, A2, $ b^{-1}\cdot a^{-1} \in  G$  ''have''  $ a\cdot b\cdot (b^{-1}\cdot a^{-1}) = a\cdot (b\cdot (b^{-1}\cdot a^{-1}))$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''moreover''   ''from '' A2, $ b^{-1}\in G$, $ a^{-1}\in G$  ''have''  $ b\cdot (b^{-1}\cdot a^{-1}) = b\cdot b^{-1}\cdot a^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''moreover''   ''from '' A2, $ a^{-1}\in G$  ''have''  $ b\cdot b^{-1}\cdot a^{-1} = a^{-1}$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''ultimately ''  ''have''  $ a\cdot b\cdot (b^{-1}\cdot a^{-1}) = a\cdot a^{-1}$ 
 ''with '' A1  ''have''  $ a\cdot b\cdot (b^{-1}\cdot a^{-1}) = 1 $ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ === 
 ''with '' $ a\cdot b \in  G$, $ b^{-1}\cdot a^{-1} \in  G$  ''show''  $ b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ ''using '' +++^[group0_2_L9 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = 1 $  '' shows '' $ a = b^{-1}$  ''and'' $ b = a^{-1}$ === 
 ''qed'' === 

What is the inverse of a product of three elements?

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_three</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$,  $ c\in G$ ''   shows '' $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (a\cdot b)^{-1}$,  $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (b^{-1}\cdot a^{-1})$,  $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot b^{-1}\cdot a^{-1}$+++[proof ]>
 ''from '' A1  ''have''  T: $ a\cdot b \in  G$,  $ a^{-1} \in  G$,  $ b^{-1} \in  G$,  $ c^{-1} \in  G$ ''using '' +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ ===  ,  +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ === 
 ''with '' A1  ''show''  $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (a\cdot b)^{-1}$ ''and '' $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (b^{-1}\cdot a^{-1})$ ''using '' +++^[group_inv_of_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  '' shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ === 
 ''with '' T  ''show''  $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot b^{-1}\cdot a^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''qed'' === 

The inverse of the inverse is the element.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:
 ''   assumes '' $ a\in G$ ''   shows '' $ a = (a^{-1})^{-1}$ ''using '' <nowiki>assms</nowiki> ,  +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L9 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = 1 $  '' shows '' $ a = b^{-1}$  ''and'' $ b = a^{-1}$ === 

If $a^{-1}\cdot b=1$, then $a=b$.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L11</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$ ''and '' A2: $ a^{-1}\cdot b = 1 $ ''   shows '' $ a=b$+++[proof ]>
 ''from '' A1, A2  ''have''  $ a^{-1} \in  G$,  $ b\in G$,  $ a^{-1}\cdot b = 1 $ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ === 
 ''then ''  ''have''  $ b = (a^{-1})^{-1}$ ''   by (rule '' +++^[group0_2_L9 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = 1 $  '' shows '' $ a = b^{-1}$  ''and'' $ b = a^{-1}$ ===  '')'' 
 ''with '' A1  ''show''  $ a=b$ ''using '' +++^[group_inv_of_inv | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:  ''assumes '' $ a\in G$  '' shows '' $ a = (a^{-1})^{-1}$ === 
 ''qed'' === 

If $a\cdot b^{-1}=1$, then $a=b$.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L11A</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$ ''and '' A2: $ a\cdot b^{-1} = 1 $ ''   shows '' $ a=b$+++[proof ]>
 ''from '' A1, A2  ''have''  $ a \in  G$,  $ b^{-1}\in G$,  $ a\cdot b^{-1} = 1 $ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ === 
 ''then ''  ''have''  $ a = (b^{-1})^{-1}$ ''   by (rule '' +++^[group0_2_L9 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L9</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = 1 $  '' shows '' $ a = b^{-1}$  ''and'' $ b = a^{-1}$ ===  '')'' 
 ''with '' A1  ''show''  $ a=b$ ''using '' +++^[group_inv_of_inv | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:  ''assumes '' $ a\in G$  '' shows '' $ a = (a^{-1})^{-1}$ === 
 ''qed'' === 

If if the inverse of $b$ is different than $a$, then the inverse of $a$ is different than $b$.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L11B</nowiki>:
 ''   assumes '' A1: $ a\in G$ ''and '' A2: $ b^{-1} \neq  a$ ''   shows '' $ a^{-1} \neq  b$+++[proof ]>

 ''{ ''  ''assume '' $ a^{-1} = b$
 ''then ''  ''have''  $ (a^{-1})^{-1} = b^{-1}$ 
 ''with '' A1, A2  ''have''  $ False$ ''using '' +++^[group_inv_of_inv | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:  ''assumes '' $ a\in G$  '' shows '' $ a = (a^{-1})^{-1}$ === 
 '' }'' 
 ''then ''  ''show''  $ a^{-1} \neq  b$ 
 ''qed'' === 

What is the inverse of $ab^{-1}$ ?

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L12</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$ ''   shows '' $ (a\cdot b^{-1})^{-1} = b\cdot a^{-1}$,  $ (a^{-1}\cdot b)^{-1} = b^{-1}\cdot a$+++[proof ]>
 ''from '' A1  ''have''  $ (a\cdot b^{-1})^{-1} = (b^{-1})^{-1}\cdot  a^{-1}$ ''and '' $ (a^{-1}\cdot b)^{-1} = b^{-1}\cdot (a^{-1})^{-1}$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_inv_of_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  '' shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ === 
 ''with '' A1  ''show''  $ (a\cdot b^{-1})^{-1} = b\cdot a^{-1}$,  $ (a^{-1}\cdot b)^{-1} = b^{-1}\cdot a$ ''using '' +++^[group_inv_of_inv | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:  ''assumes '' $ a\in G$  '' shows '' $ a = (a^{-1})^{-1}$ === 
 ''qed'' === 

A couple useful rearrangements with three elements: we can insert a $b\cdot b^{-1}$ between two group elements (another version) and one about a product of an element and inverse of a product, and two others.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L14A</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$,  $ c\in G$ ''   shows '' $ a\cdot c^{-1}= (a\cdot b^{-1})\cdot (b\cdot c^{-1})$,  $ a^{-1}\cdot c = (a^{-1}\cdot b)\cdot (b^{-1}\cdot c)$,  $ a\cdot (b\cdot c)^{-1} = a\cdot c^{-1}\cdot b^{-1}$,  $ a\cdot (b\cdot c^{-1}) = a\cdot b\cdot c^{-1}$,  $ (a\cdot b^{-1}\cdot c^{-1})^{-1} = c\cdot b\cdot a^{-1}$,  $ a\cdot b\cdot c^{-1}\cdot (c\cdot b^{-1}) = a$,  $ a\cdot (b\cdot c)\cdot c^{-1} = a\cdot b$+++[proof ]>
 ''from '' A1  ''have''  T: $ a^{-1} \in  G$,  $ b^{-1}\in G$,  $ c^{-1}\in G$,  $ a^{-1}\cdot b \in  G$,  $ a\cdot b^{-1} \in  G$,  $ a\cdot b \in  G$,  $ c\cdot b^{-1} \in  G$,  $ b\cdot c \in  G$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ === 
 ''from '' A1, T  ''have''  $ a\cdot c^{-1} =  a\cdot (b^{-1}\cdot b)\cdot c^{-1}$,  $ a^{-1}\cdot c =  a^{-1}\cdot (b\cdot b^{-1})\cdot c$ ''using '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ === 
 ''with '' A1, T  ''show''  $ a\cdot c^{-1}= (a\cdot b^{-1})\cdot (b\cdot c^{-1})$,  $ a^{-1}\cdot c = (a^{-1}\cdot b)\cdot (b^{-1}\cdot c)$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''from '' A1  ''have''  $ a\cdot (b\cdot c)^{-1} = a\cdot (c^{-1}\cdot b^{-1})$ ''using '' +++^[group_inv_of_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  '' shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ === 
 ''with '' A1, T  ''show''  $ a\cdot (b\cdot c)^{-1} =a\cdot c^{-1}\cdot b^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''from '' A1, T  ''show''  $ a\cdot (b\cdot c^{-1}) = a\cdot b\cdot c^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''from '' A1, T  ''show''  $ (a\cdot b^{-1}\cdot c^{-1})^{-1} = c\cdot b\cdot a^{-1}$ ''using '' +++^[group_inv_of_three | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_three</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (a\cdot b)^{-1}$,  
$ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot (b^{-1}\cdot a^{-1})$,  
$ (a\cdot b\cdot c)^{-1} = c^{-1}\cdot b^{-1}\cdot a^{-1}$ ===  ,  +++^[group_inv_of_inv | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_inv</nowiki>:  ''assumes '' $ a\in G$  '' shows '' $ a = (a^{-1})^{-1}$ === 
 ''from '' T  ''have''  $ a\cdot b\cdot c^{-1}\cdot (c\cdot b^{-1}) = a\cdot b\cdot (c^{-1}\cdot (c\cdot b^{-1}))$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A1, T  ''have''  $ \ldots  =  a\cdot b\cdot b^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ ===  ,  +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''also''   ''from '' A1, T  ''have''  $ \ldots  = a\cdot (b\cdot b^{-1})$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A1  ''have''  $ \ldots  = a$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''finally ''  ''show''  $ a\cdot b\cdot c^{-1}\cdot (c\cdot b^{-1}) = a$ 
 ''from '' A1, T  ''have''  $ a\cdot (b\cdot c)\cdot c^{-1} =  a\cdot (b\cdot (c\cdot c^{-1}))$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A1, T  ''have''  $ \ldots  = a\cdot b$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''finally ''  ''show''  $ a\cdot (b\cdot c)\cdot c^{-1} = a\cdot b$ 
 ''qed'' === 

Another lemma about rearranging a product of four group elements.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L15</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$,  $ c\in G$,  $ d\in G$ ''   shows '' $ (a\cdot b)\cdot (c\cdot d)^{-1} = a\cdot (b\cdot d^{-1})\cdot a^{-1}\cdot (a\cdot c^{-1})$+++[proof ]>
 ''from '' A1  ''have''  T1: $ d^{-1}\in G$,  $ c^{-1}\in G$,  $ a\cdot b\in G$,  $ a\cdot (b\cdot d^{-1})\in G$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ === 
 ''with '' A1  ''have''  $ (a\cdot b)\cdot (c\cdot d)^{-1} = (a\cdot b)\cdot (d^{-1}\cdot c^{-1})$ ''using '' +++^[group_inv_of_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  '' shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ === 
 ''also''   ''from '' A1, T1  ''have''  $ \ldots  = a\cdot (b\cdot d^{-1})\cdot c^{-1}$ ''using '' +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''also''   ''from '' A1, T1  ''have''  $ \ldots  = a\cdot (b\cdot d^{-1})\cdot a^{-1}\cdot (a\cdot c^{-1})$ ''using '' +++^[group0_2_L14A | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L14A</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot c^{-1}= (a\cdot b^{-1})\cdot (b\cdot c^{-1})$,  
$ a^{-1}\cdot c = (a^{-1}\cdot b)\cdot (b^{-1}\cdot c)$,  
$ a\cdot (b\cdot c)^{-1} = a\cdot c^{-1}\cdot b^{-1}$,  
$ a\cdot (b\cdot c^{-1}) = a\cdot b\cdot c^{-1}$,  
$ (a\cdot b^{-1}\cdot c^{-1})^{-1} = c\cdot b\cdot a^{-1}$,  
$ a\cdot b\cdot c^{-1}\cdot (c\cdot b^{-1}) = a$,   $ a\cdot (b\cdot c)\cdot c^{-1} = a\cdot b$ === 
 ''finally ''  ''show''  $ thesis$ 
 ''qed'' === 

We can cancel an element with its inverse that is written next to it.

 ''lemma''   ''(in '' group0 '') '' <nowiki>inv_cancel_two</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$ ''   shows '' $ a\cdot b^{-1}\cdot b = a$,  $ a\cdot b\cdot b^{-1} = a$,  $ a^{-1}\cdot (a\cdot b) = b$,  $ a\cdot (a^{-1}\cdot b) = b$+++[proof ]>
 ''from '' A1  ''have''  $ a\cdot b^{-1}\cdot b = a\cdot (b^{-1}\cdot b)$,  $ a\cdot b\cdot b^{-1} = a\cdot (b\cdot b^{-1})$,  $ a^{-1}\cdot (a\cdot b) = a^{-1}\cdot a\cdot b$,  $ a\cdot (a^{-1}\cdot b) = a\cdot a^{-1}\cdot b$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''with '' A1  ''show''  $ a\cdot b^{-1}\cdot b = a$,  $ a\cdot b\cdot b^{-1} = a$,  $ a^{-1}\cdot (a\cdot b) = b$,  $ a\cdot (a^{-1}\cdot b) = b$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''qed'' === 

Another lemma about cancelling with two group elements.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L16A</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$ ''   shows '' $ a\cdot (b\cdot a)^{-1} = b^{-1}$+++[proof ]>
 ''from '' A1  ''have''  $ (b\cdot a)^{-1} = a^{-1}\cdot b^{-1}$,  $ b^{-1} \in  G$ ''using '' +++^[group_inv_of_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_inv_of_two</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  '' shows '' $  b^{-1}\cdot a^{-1} = (a\cdot b)^{-1}$ ===  ,  +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ === 
 ''with '' A1  ''show''  $ a\cdot (b\cdot a)^{-1} = b^{-1}$ ''using '' +++^[inv_cancel_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inv_cancel_two</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b^{-1}\cdot b = a$,  
$ a\cdot b\cdot b^{-1} = a$,   $ a^{-1}\cdot (a\cdot b) = b$,   $ a\cdot (a^{-1}\cdot b) = b$ === 
 ''qed'' === 

Adding a neutral element to a set that is closed under the group operation results in a set that is closed under the group operation.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L17</nowiki>:
 ''   assumes '' $ H\subseteq G$ ''and '' $ H \text{ is closed under } P$ ''   shows '' $ (H \cup  \{1 \}) \text{ is closed under } P$ ''using '' <nowiki>assms</nowiki> ,  +++^[IsOpClosed_def | func_ZF ]... Definition of <nowiki>IsOpClosed</nowiki>:
$ A \text{ is closed under } f \equiv  \forall x\in A.\  \forall y\in A.\  f\langle x,y\rangle  \in  A$===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 

We can put an element on the other side of an equation.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L18</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$,  $ c\in G$ ''and '' A2: $ c = a\cdot b$ ''   shows '' $ c\cdot b^{-1} = a$,  $ a^{-1}\cdot c = b$+++[proof ]>
 ''from '' A2, A1  ''have''  $ c\cdot b^{-1} =  a\cdot (b\cdot b^{-1})$,  $ a^{-1}\cdot c = (a^{-1}\cdot a)\cdot b$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_oper_assoc | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_oper_assoc</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$,   $ c\in G$  '' shows '' $ a\cdot (b\cdot c) = a\cdot b\cdot c$ === 
 ''moreover''   ''from '' A1  ''have''  $ a\cdot (b\cdot b^{-1}) = a$,  $ (a^{-1}\cdot a)\cdot b = b$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 
 ''ultimately ''  ''show''  $ c\cdot b^{-1} = a$,  $ a^{-1}\cdot c = b$ 
 ''qed'' === 

Multiplying different group elements by the same factor results in different group elements.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L19</nowiki>:
 ''   assumes '' A1: $ a\in G$,  $ b\in G$,  $ c\in G$ ''and '' A2: $ a\neq b$ ''   shows '' $ a\cdot c \neq  b\cdot c$ ''and '' $ c\cdot a \neq  c\cdot b$+++[proof ]>

 ''{ ''  ''assume '' $ a\cdot c = b\cdot c \vee  c\cdot a =c\cdot b$
 ''then ''  ''have''  $ a\cdot c\cdot c^{-1} = b\cdot c\cdot c^{-1} \vee  c^{-1}\cdot (c\cdot a) = c^{-1}\cdot (c\cdot b)$ 
 ''with '' A1, A2  ''have''  $ False$ ''using '' +++^[inv_cancel_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inv_cancel_two</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b^{-1}\cdot b = a$,  
$ a\cdot b\cdot b^{-1} = a$,   $ a^{-1}\cdot (a\cdot b) = b$,   $ a\cdot (a^{-1}\cdot b) = b$ === 
 '' }'' 
 ''then ''  ''show''  $ a\cdot c \neq  b\cdot c$ ''and '' $ c\cdot a \neq  c\cdot b$ 
 ''qed'' === 


!Subgroups

There are two common ways to define subgroups. One requires that the group operation is closed in the subgroup. The second one defines subgroup as a subset of a group which is itself a group under the group operations. We use the second approach because it results in shorter definition.
The rest of this section is devoted to proving the equivalence of these two definitions of the notion of a subgroup.

A pair $(H,P)$ is a subgroup if $H$ forms a group with the operation $P$ restricted to $H\times H$. It may be surprising that we don't require $H$ to be a subset of $G$. This however can be inferred from the definition if the pair $(G,P)$ is a group, see lemma //group0_3_L2//.

 ''Definition
'' $ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$

Formally the group operation in a subgroup is different than in the group as they have different domains. Of course we want to use the original operation with the associated notation in the subgroup. The next couple of lemmas will allow for that. The next lemma states that the neutral element of a subgroup is in the subgroup and it is both right and left neutral there. The notation is very ugly because we don't want to introduce a separate notation for the subgroup operation.

 ''lemma''  <nowiki>group0_3_L1</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,f)$ ''and '' A2: $ n = TheNeutralElement(H,restrict(f,H\times H))$ ''   shows '' $ n \in  H$,  $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  $ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$+++[proof ]>
 ''let '' $ b = restrict(f,H\times H)$
 ''let '' $ e = TheNeutralElement(H,restrict(f,H\times H))$
 ''from '' A1  ''have''  $ group0(H,b)$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  <nowiki>group0_def</nowiki>
 ''then ''  ''have''  I: $ e \in  H \wedge  (\forall h\in H.\  (b\langle e,h \rangle  = h \wedge  b\langle h,e\rangle  = h))$ ''   by (rule '' +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ ===  '')'' 
 ''with '' A2  ''show''  $ n \in  H$ 
 ''from '' A2, I  ''show''  $ \forall h\in H.\  b\langle n,h\rangle  = h$ ''and '' $ \forall h\in H.\  b\langle h,n\rangle  = h$ 
 ''qed'' === 

A subgroup is contained in the group.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L2</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''   shows '' $ H \subseteq  G$+++[proof ]>
 ''fix '' $ h$
 ''assume '' $ h\in H$
 ''let '' $ b = restrict(P,H\times H)$
 ''let '' $ n = TheNeutralElement(H,restrict(P,H\times H))$
 ''from '' A1  ''have''  $ b \in  H\times H\rightarrow H$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 
 ''moreover''   ''from '' A1, $ h\in H$  ''have''  $ \langle  n,h\rangle  \in  H\times H$ ''using '' +++^[group0_3_L1 | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L1</nowiki>:  ''assumes '' $ IsAsubgroup(H,f)$  ''and'' $ n = TheNeutralElement(H,restrict(f,H\times H))$  '' shows '' $ n \in  H$,   $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  
$ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$ === 
 ''moreover''   ''from '' A1, $ h\in H$  ''have''  $ h = b\langle n,h \rangle $ ''using '' +++^[group0_3_L1 | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L1</nowiki>:  ''assumes '' $ IsAsubgroup(H,f)$  ''and'' $ n = TheNeutralElement(H,restrict(f,H\times H))$  '' shows '' $ n \in  H$,   $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  
$ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$ === 
 ''ultimately ''  ''have''  $ \langle \langle n,h\rangle ,h\rangle  \in  b$ ''using '' <nowiki>func1_1_L5A</nowiki>
 ''then ''  ''have''  $ \langle \langle n,h\rangle ,h\rangle  \in  P$ ''using '' <nowiki>restrict_subset</nowiki>
 ''moreover''   ''from '' groupAssum  ''have''  $ P:G\times G\rightarrow G$ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 
 ''ultimately ''  ''show''  $ h\in G$ ''using '' <nowiki>func1_1_L5</nowiki>
 ''qed'' === 

The group's neutral element (denoted $1$ in the group0 context) is a neutral element for the subgroup with respect to the group action.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L3</nowiki>:
 ''   assumes '' $ IsAsubgroup(H,P)$ ''   shows '' $ \forall h\in H.\  1 \cdot h = h \wedge  h\cdot 1  = h$ ''using '' <nowiki>assms</nowiki> ,  <nowiki>groupAssum</nowiki> ,  +++^[group0_3_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ H \subseteq  G$ ===  ,  +++^[group0_2_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L2</nowiki>:  '' shows '' $ 1 \in G \wedge  (\forall g\in G.\ (1 \cdot g = g \wedge  g\cdot 1  = g))$ === 

The neutral element of a subgroup is the same as that of the group.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L4</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''   shows '' $ TheNeutralElement(H,restrict(P,H\times H)) = 1 $+++[proof ]>
 ''let '' $ n = TheNeutralElement(H,restrict(P,H\times H))$
 ''from '' A1  ''have''  $ n \in  H$ ''using '' +++^[group0_3_L1 | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L1</nowiki>:  ''assumes '' $ IsAsubgroup(H,f)$  ''and'' $ n = TheNeutralElement(H,restrict(f,H\times H))$  '' shows '' $ n \in  H$,   $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  
$ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$ === 
 ''with '' groupAssum, A1  ''have''  $ n\in G$ ''using '' +++^[group0_3_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ H \subseteq  G$ === 
 ''with '' A1, $ n \in  H$  ''show''  $ thesis$ ''using '' +++^[group0_3_L1 | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L1</nowiki>:  ''assumes '' $ IsAsubgroup(H,f)$  ''and'' $ n = TheNeutralElement(H,restrict(f,H\times H))$  '' shows '' $ n \in  H$,   $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  
$ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$ ===  ,  <nowiki>restrict_if</nowiki> ,  +++^[group0_2_L7 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L7</nowiki>:  ''assumes '' $ a\in G$  ''and'' $ b\in G$  ''and'' $ a\cdot b = a$  '' shows '' $ b=1 $ === 
 ''qed'' === 

The neutral element of the group (denoted $1$ in the group0 context) belongs to every subgroup.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L5</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''   shows '' $ 1 \in H$+++[proof ]>
 ''from '' A1  ''show''  $ 1 \in H$ ''using '' +++^[group0_3_L1 | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L1</nowiki>:  ''assumes '' $ IsAsubgroup(H,f)$  ''and'' $ n = TheNeutralElement(H,restrict(f,H\times H))$  '' shows '' $ n \in  H$,   $ \forall h\in H.\  restrict(f,H\times H)\langle n,h \rangle  = h$,  
$ \forall h\in H.\  restrict(f,H\times H)\langle h,n\rangle  = h$ ===  ,  +++^[group0_3_L4 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L4</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ TheNeutralElement(H,restrict(P,H\times H)) = 1 $ === 
 ''qed'' === 

Subgroups are closed with respect to the group operation.

 ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L6</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''and '' A2: $ a\in H$,  $ b\in H$ ''   shows '' $ a\cdot b \in  H$+++[proof ]>
 ''let '' $ f = restrict(P,H\times H)$
 ''from '' A1  ''have''  $ monoid0(H,f)$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  <nowiki>monoid0_def</nowiki>
 ''with '' A2  ''have''  $ f (\langle a,b\rangle ) \in  H$ ''using '' +++^[group0_1_L1 | Monoid_ZF ]...  ''lemma''   ''(in '' monoid0 '') '' <nowiki>group0_1_L1</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\oplus b \in  G$ === 
 ''with '' A2  ''show''  $ a\cdot b \in  H$ ''using '' <nowiki>restrict_if</nowiki>
 ''qed'' === 

A preliminary lemma that we need to show that taking the inverse in the subgroup is the same as taking the inverse in the group.

 ''lemma''  <nowiki>group0_3_L7A</nowiki>:
 ''   assumes '' A1: $ \text{IsAgroup}(G,f)$ ''and '' A2: $ IsAsubgroup(H,f)$ ''and '' A3: $ g = restrict(f,H\times H)$ ''   shows '' $ GroupInv(G,f) \cap  H\times H = GroupInv(H,g)$+++[proof ]>
 ''let '' $ e = TheNeutralElement(G,f)$
 ''let '' $ e_1 = TheNeutralElement(H,g)$
 ''from '' A1  ''have''  $ group0(G,f)$ ''using '' <nowiki>group0_def</nowiki>
 ''from '' A2, A3  ''have''  $ group0(H,g)$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  <nowiki>group0_def</nowiki>
 ''from '' $ group0(G,f)$, A2, A3  ''have''  $ GroupInv(G,f) = f^{-1}\text{ e_1 }$ ''using '' +++^[group0_3_L4 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L4</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ TheNeutralElement(H,restrict(P,H\times H)) = 1 $ ===  ,  +++^[group0_2_T3 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T3</nowiki>:  '' shows '' $ P^{-1}\{1 \} = GroupInv(G,P)$ === 
 ''moreover''   ''have''  $ g^{-1}\text{ e_1 } = f^{-1}\text{ e_1 } \cap  H\times H$+++[proof ]>
 ''from '' A1  ''have''  $ f \in  G\times G\rightarrow G$ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$===  ,  +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 
 ''moreover''   ''from '' A2, $ group0(G,f)$  ''have''  $ H\times H \subseteq  G\times G$ ''using '' +++^[group0_3_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ H \subseteq  G$ === 
 ''ultimately ''  ''show''  $ g^{-1}\text{ e_1 } = f^{-1}\text{ e_1 } \cap  H\times H$ ''using '' <nowiki>A3</nowiki> ,  <nowiki>func1_2_L1</nowiki>
 ''qed'' === 
 ''moreover''   ''from '' A3, $ group0(H,g)$  ''have''  $ GroupInv(H,g) = g^{-1}\text{ e_1 }$ ''using '' +++^[group0_2_T3 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_2_T3</nowiki>:  '' shows '' $ P^{-1}\{1 \} = GroupInv(G,P)$ === 
 ''ultimately ''  ''show''  $ thesis$ 
 ''qed'' === 

Using the lemma above we can show the actual statement: taking the inverse in the subgroup is the same as taking the inverse in the group.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T1</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''and '' A2: $ g = restrict(P,H\times H)$ ''   shows '' $ GroupInv(H,g) = restrict(GroupInv(G,P),H)$+++[proof ]>
 ''from '' groupAssum  ''have''  $ GroupInv(G,P) : G\rightarrow G$ ''using '' +++^[group0_2_T2 | Group_ZF ]...  ''theorem''  <nowiki>group0_2_T2</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  '' shows '' $ GroupInv(G,f) : G\rightarrow G$ === 
 ''moreover''   ''from '' A1, A2  ''have''  $ GroupInv(H,g) : H\rightarrow H$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  +++^[group0_2_T2 | Group_ZF ]...  ''theorem''  <nowiki>group0_2_T2</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  '' shows '' $ GroupInv(G,f) : G\rightarrow G$ === 
 ''moreover''   ''from '' A1  ''have''  $ H \subseteq  G$ ''using '' +++^[group0_3_L2 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ H \subseteq  G$ === 
 ''moreover''   ''from '' groupAssum, A1, A2  ''have''  $ GroupInv(G,P) \cap  H\times H = GroupInv(H,g)$ ''using '' +++^[group0_3_L7A | Group_ZF ]...  ''lemma''  <nowiki>group0_3_L7A</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  ''and'' $ IsAsubgroup(H,f)$  ''and'' $ g = restrict(f,H\times H)$  '' shows '' $ GroupInv(G,f) \cap  H\times H = GroupInv(H,g)$ === 
 ''ultimately ''  ''show''  $ thesis$ ''using '' <nowiki>func1_2_L3</nowiki>
 ''qed'' === 

A sligtly weaker, but more convenient in applications, reformulation of the above theorem.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T2</nowiki>:
 ''   assumes '' $ IsAsubgroup(H,P)$ ''and '' $ g = restrict(P,H\times H)$ ''   shows '' $ \forall h\in H.\  GroupInv(H,g)(h) = h^{-1}$ ''using '' <nowiki>assms</nowiki> ,  +++^[group0_3_T1 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T1</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  ''and'' $ g = restrict(P,H\times H)$  '' shows '' $ GroupInv(H,g) = restrict(GroupInv(G,P),H)$ ===  ,  <nowiki>restrict_if</nowiki>

Subgroups are closed with respect to taking the group inverse.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T3A</nowiki>:
 ''   assumes '' A1: $ IsAsubgroup(H,P)$ ''and '' A2: $ h\in H$ ''   shows '' $ h^{-1}\in  H$+++[proof ]>
 ''let '' $ g = restrict(P,H\times H)$
 ''from '' A1  ''have''  $ GroupInv(H,g) \in  H\rightarrow H$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  +++^[group0_2_T2 | Group_ZF ]...  ''theorem''  <nowiki>group0_2_T2</nowiki>:  ''assumes '' $ \text{IsAgroup}(G,f)$  '' shows '' $ GroupInv(G,f) : G\rightarrow G$ === 
 ''with '' A2  ''have''  $ GroupInv(H,g)(h) \in  H$ ''using '' <nowiki>apply_type</nowiki>
 ''with '' A1, A2  ''show''  $ h^{-1}\in  H$ ''using '' +++^[group0_3_T2 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  ''and'' $ g = restrict(P,H\times H)$  '' shows '' $ \forall h\in H.\  GroupInv(H,g)(h) = h^{-1}$ === 
 ''qed'' === 

The next theorem states that a nonempty subset of a group $G$ that is closed under the group operation and taking the inverse is a subgroup of the group.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T3</nowiki>:
 ''   assumes '' A1: $ H\neq 0$ ''and '' A2: $ H\subseteq G$ ''and '' A3: $ H \text{ is closed under } P$ ''and '' A4: $ \forall x\in H.\  x^{-1} \in  H$ ''   shows '' $ IsAsubgroup(H,P)$+++[proof ]>
 ''let '' $ g = restrict(P,H\times H)$
 ''let '' $ n = TheNeutralElement(H,g)$
 ''from '' A3  ''have''  I: $ \forall x\in H.\ \forall y\in H.\  x\cdot y \in  H$ ''using '' +++^[IsOpClosed_def | func_ZF ]... Definition of <nowiki>IsOpClosed</nowiki>:
$ A \text{ is closed under } f \equiv  \forall x\in A.\  \forall y\in A.\  f\langle x,y\rangle  \in  A$=== 
 ''from '' A1  ''obtain '' $ x$ ''where '' $ x\in H$ 
 ''with '' A4, I, A2  ''have''  $ 1 \in H$ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ === 
 ''with '' A3, A2  ''have''  T2: $ \text{IsAmonoid}(H,g)$ ''using '' +++^[group0_2_L1 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L1</nowiki>:  '' shows '' $ monoid0(G,P)$ ===  ,  +++^[group0_1_T1 | Monoid_ZF ]...  ''theorem''   ''(in '' monoid0 '') '' <nowiki>group0_1_T1</nowiki>:  ''assumes '' $ H \text{ is closed under } f$  ''and'' $ H\subseteq G$  ''and'' $ TheNeutralElement(G,f) \in  H$  '' shows '' $ \text{IsAmonoid}(H,restrict(f,H\times H))$ === 
 ''moreover''   ''have''  $ \forall h\in H.\ \exists b\in H.\  g\langle h,b\rangle  = n$+++[proof ]>
 ''fix '' $ h$
 ''assume '' $ h\in H$
 ''with '' A4, A2  ''have''  $ h\cdot h^{-1} = 1 $ ''using '' +++^[group0_2_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_2_L6</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x\cdot x^{-1} = 1  \wedge  x^{-1}\cdot x = 1 $ === 
 ''moreover''   ''from '' groupAssum, A2, A3, $ 1 \in H$  ''have''  $ 1  = n$ ''using '' +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$===  ,  +++^[group0_1_L6 | Monoid_ZF ]...  ''lemma''  <nowiki>group0_1_L6</nowiki>:  ''assumes '' $ \text{IsAmonoid}(G,f)$  ''and'' $ H \text{ is closed under } f$  ''and'' $ H\subseteq G$  ''and'' $ TheNeutralElement(G,f) \in  H$  '' shows '' $ TheNeutralElement(H,restrict(f,H\times H)) = TheNeutralElement(G,f)$ === 
 ''moreover''   ''from '' A4, $ h\in H$  ''have''  $ g\langle h,h^{-1}\rangle  = h\cdot h^{-1}$ ''using '' <nowiki>restrict_if</nowiki>
 ''ultimately ''  ''have''  $ g\langle h,h^{-1}\rangle  = n$ 
 ''with '' A4, $ h\in H$  ''show''  $ \exists b\in H.\  g\langle h,b\rangle  = n$ 
 ''qed'' === 
 ''ultimately ''  ''show''  $ IsAsubgroup(H,P)$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$=== 
 ''qed'' === 

Intersection of subgroups is a subgroup.

 ''lemma''  <nowiki>group0_3_L7</nowiki>:
 ''   assumes '' A1: $ \text{IsAgroup}(G,f)$ ''and '' A2: $ IsAsubgroup(H_1,f)$ ''and '' A3: $ IsAsubgroup(H_2,f)$ ''   shows '' $ IsAsubgroup(H_1\cap H_2,restrict(f,H_1\times H_1))$+++[proof ]>
 ''let '' $ e = TheNeutralElement(G,f)$
 ''let '' $ g = restrict(f,H_1\times H_1)$
 ''from '' A1  ''have''  I: $ group0(G,f)$ ''using '' <nowiki>group0_def</nowiki>
 ''from '' A2  ''have''  $ group0(H_1,g)$ ''using '' +++^[IsAsubgroup_def | Group_ZF ]... Definition of <nowiki>IsAsubgroup</nowiki>:
$ IsAsubgroup(H,P) \equiv  \text{IsAgroup}(H, restrict(P,H\times H))$===  ,  <nowiki>group0_def</nowiki>
 ''moreover''   ''have''  $ H_1\cap H_2 \neq  0$+++[proof ]>
 ''from '' A1, A2, A3  ''have''  $ e \in  H_1\cap H_2$ ''using '' <nowiki>group0_def</nowiki> ,  +++^[group0_3_L5 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L5</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  '' shows '' $ 1 \in H$ === 
 ''thus''  $ thesis$
 ''qed'' === 
 ''moreover''   ''have''  $ H_1\cap H_2 \subseteq  H_1$ 
 ''moreover''   ''from '' A2, A3, I, $ H_1\cap H_2 \subseteq  H_1$  ''have''  $ H_1\cap H_2 \text{ is closed under } g$ ''using '' +++^[group0_3_L6 | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group0_3_L6</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  ''and'' $ a\in H$,   $ b\in H$  '' shows '' $ a\cdot b \in  H$ ===  ,  +++^[IsOpClosed_def | func_ZF ]... Definition of <nowiki>IsOpClosed</nowiki>:
$ A \text{ is closed under } f \equiv  \forall x\in A.\  \forall y\in A.\  f\langle x,y\rangle  \in  A$===  ,  +++^[func_ZF_4_L7 | func_ZF ]...  ''lemma''  <nowiki>func_ZF_4_L7</nowiki>:  ''assumes '' $ A \text{ is closed under } f$,   $ B \text{ is closed under } f$  '' shows '' $ A\cap B \text{ is closed under } f$ ===  ,  +++^[func_ZF_4_L5 | func_ZF ]...  ''lemma''  <nowiki>func_ZF_4_L5</nowiki>:  ''assumes '' $ A \text{ is closed under } f$  ''and'' $ A\subseteq B$  '' shows '' $ A \text{ is closed under } restrict(f,B\times B)$ === 
 ''moreover''   ''from '' A2, A3, I  ''have''  $ \forall x \in  H_1\cap H_2.\  GroupInv(H_1,g)(x) \in  H_1\cap H_2$ ''using '' +++^[group0_3_T2 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T2</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  ''and'' $ g = restrict(P,H\times H)$  '' shows '' $ \forall h\in H.\  GroupInv(H,g)(h) = h^{-1}$ ===  ,  +++^[group0_3_T3A | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T3A</nowiki>:  ''assumes '' $ IsAsubgroup(H,P)$  ''and'' $ h\in H$  '' shows '' $ h^{-1}\in  H$ === 
 ''ultimately ''  ''show''  $ thesis$ ''using '' +++^[group0_3_T3 | Group_ZF ]...  ''theorem''   ''(in '' group0 '') '' <nowiki>group0_3_T3</nowiki>:  ''assumes '' $ H\neq 0$  ''and'' $ H\subseteq G$  ''and'' $ H \text{ is closed under } P$  ''and'' $ \forall x\in H.\  x^{-1} \in  H$  '' shows '' $ IsAsubgroup(H,P)$ === 
 ''qed'' === 

 ''end

'' +++![Comments on Group_ZF|click to add comment] <html> <div> <iframe style="width:60%;height:500px" src="http://www.haloscan.com/comments/slawekk/Group_ZF"></iframe> </div> </html>
=== 
 ''theory'' Group_ZF_1 ''imports'' [[Group_ZF]]

 ''begin
'' 
In a typical textbook a group is defined as a set $G$ with an associative operation such that two conditions hold: A: there is an element $e\in G$ such that for all $g\in G$ we have $e\cdot g = g$ and $g\cdot e =g$. We call this element a "unit" or a "neutral element" of the group.
B: for every $a\in G$ there exists a $b\in G$ such that $a\cdot b = e$, where $e$ is the element of $G$ whose existence is guaranteed by A. The validity of this definition is rather dubious to me, as condition A does not define any specific element $e$ that can be referred to in condition B - it merely states that a set of such units $e$ is not empty. Of course it does work in the end as we can prove that the set of such neutral elements has exactly one element, but still the definition by itself is not valid. You just can't reference a variable bound by a quantifier outside of the scope of that quantifier.
One way around this is to first use condition A to define the notion of a monoid, then prove the uniqueness of $e$ and then use the condition B to define groups. Another way is to write conditions A and B together as follows: $$\exists_{e \in G} \ (\forall_{g \in G} \ e\cdot g = g \wedge g\cdot e = g) \wedge (\forall_{a\in G}\exists_{b\in G}\ a\cdot b = e).$$ This is rather ugly. What I want to talk about is an amusing way to define groups directly without any reference to the neutral elements. Namely, we can define a group as a non-empty set $G$ with an associative operation "$\cdot $" such that
C: for every $a,b\in G$ the equations $a\cdot x = b$ and $y\cdot a = b$ can be solved in $G$.
This theory file aims at proving the equivalence of this alternative definition with the usual definition of the group, as formulated in //Group_ZF.thy//. The informal proofs come from an Aug. 14, 2005 post by buli on the matematyka.org forum.

!An alternative definition of group

First we will define notation for writing about groups.

We will use the multiplicative notation for the group operation. To do this, we define a context (locale) that tells Isabelle to interpret $a\cdot b$ as the value of function $P$ on the pair $\langle a,b \rangle$.

 ''Locale '' group2
 ''fixes '' $ P$
 ''fixes '' $ dot$
 ''defines '' $ a \cdot  b \equiv  P\langle a,b\rangle $


The next theorem states that a set $G$ with an associative operation that satisfies condition C is a group, as defined in IsarMathLib //Group_ZF// theory.

 ''theorem''   ''(in '' group2 '') '' <nowiki>altgroup_is_group</nowiki>:
 ''   assumes '' A1: $ G\neq 0$ ''and '' A2: $ P \text{ is associative on } G$ ''and '' A3: $ \forall a\in G.\ \forall b\in G.\  \exists x\in G.\  a\cdot x = b$ ''and '' A4: $ \forall a\in G.\ \forall b\in G.\  \exists y\in G.\  y\cdot a = b$ ''   shows '' $ \text{IsAgroup}(G,P)$+++[proof ]>
 ''from '' A1  ''obtain '' $ a$ ''where '' $ a\in G$ 
 ''with '' A3  ''obtain '' $ x$ ''where '' $ x\in G$ ''and '' $ a\cdot x = a$ 
 ''from '' A4, $ a\in G$  ''obtain '' $ y$ ''where '' $ y\in G$ ''and '' $ y\cdot a = a$ 
 ''have''  I: $ \forall b\in G.\  b = b\cdot x \wedge  b = y\cdot b$+++[proof ]>
 ''fix '' $ b$
 ''assume '' $ b\in G$
 ''with '' A4, $ a\in G$  ''obtain '' $ y_b$ ''where '' $ y_b\in G$ ''and '' $ y_b\cdot a = b$ 
 ''from '' A3, $ a\in G$, $ b\in G$  ''obtain '' $ x_b$ ''where '' $ x_b\in G$ ''and '' $ a\cdot x_b = b$ 
 ''from '' $ a\cdot x = a$, $ y\cdot a = a$, $ y_b\cdot a = b$, $ a\cdot x_b = b$  ''have''  $ b = y_b\cdot (a\cdot x)$ ''and '' $ b = (y\cdot a)\cdot x_b$ 
 ''moreover''   ''from '' A2, $ a\in G$, $ x\in G$, $ y\in G$, $ x_b\in G$, $ y_b\in G$  ''have''  $ (y\cdot a)\cdot x_b = y\cdot (a\cdot x_b)$,  $ y_b\cdot (a\cdot x) = (y_b\cdot a)\cdot x$ ''using '' +++^[IsAssociative_def | func_ZF ]... Definition of <nowiki>IsAssociative</nowiki>:
$ P \text{ is associative on } G \equiv  P \in  G\times G\rightarrow G \wedge  $
$  (\forall  x \in  G.\  \forall  y \in  G.\  \forall  z \in  G.\  $
$  ( P(\langle P(\langle x,y\rangle ),z\rangle ) = P( \langle x,P(\langle y,z\rangle )\rangle  )))$=== 
 ''moreover''   ''from '' $ y_b\cdot a = b$, $ a\cdot x_b = b$  ''have''  $ (y_b\cdot a)\cdot x = b\cdot x$,  $ y\cdot (a\cdot x_b) = y\cdot b$ 
 ''ultimately ''  ''show''  $ b = b\cdot x \wedge  b = y\cdot b$ 
 ''qed'' === 
 ''moreover''   ''have''  $ x = y$+++[proof ]>
 ''from '' $ x\in G$, I  ''have''  $ x = y\cdot x$ 
 ''also''   ''from '' $ y\in G$, I  ''have''  $ y\cdot x = y$ 
 ''finally ''  ''show''  $ x = y$ 
 ''qed'' === 
 ''ultimately ''  ''have''  $ \forall b\in G.\  b\cdot x = b \wedge  x\cdot b = b$ 
 ''with '' A2, $ x\in G$  ''have''  $ \text{IsAmonoid}(G,P)$ ''using '' +++^[IsAmonoid_def | Monoid_ZF ]... Definition of <nowiki>IsAmonoid</nowiki>:
$ \text{IsAmonoid}(G,f) \equiv $
$  f \text{ is associative on } G \wedge  $
$  (\exists e\in G.\  (\forall  g\in G.\  ( (f(\langle e,g\rangle ) = g) \wedge  (f(\langle g,e\rangle ) = g))))$=== 
 ''with '' A3  ''show''  $ \text{IsAgroup}(G,P)$ ''using '' <nowiki>monoid0_def</nowiki> ,  +++^[unit_is_neutral | Monoid_ZF ]...  ''lemma''   ''(in '' monoid0 '') '' <nowiki>unit_is_neutral</nowiki>:  ''assumes '' $ e = TheNeutralElement(G,f)$  '' shows '' $ e \in  G \wedge  (\forall g\in G.\  e \oplus  g = g \wedge  g \oplus  e = g)$ ===  ,  +++^[IsAgroup_def | Group_ZF ]... Definition of <nowiki>IsAgroup</nowiki>:
$ \text{IsAgroup}(G,f) \equiv  $
$  (\text{IsAmonoid}(G,f) \wedge  (\forall g\in G.\  \exists b\in G.\  f\langle g,b\rangle  = TheNeutralElement(G,f)))$=== 
 ''qed'' === 

The converse of //altgroup_is_group//: in every (classically defined) group condition C holds. In informal mathematics we can say "Obviously condition C holds in any group." In formalized mathematics the word "obviously" is not in the language. The next theorem is proven in the context called //group0// defined in the theory //Group_ZF.thy//. Similarly to the //group2// that context defines $a\cdot b$ as $P\langle a,b\rangle$ It also defines notation related to the group inverse and adds an assumption that the pair $(G,P)$ is a group to all its theorems. This is why in the next theorem we don't explicitely assume that $(G,P)$ is a group - this assumption is implicit in the context.

 ''theorem''   ''(in '' group0 '') '' <nowiki>group_is_altgroup</nowiki>:
 ''   shows '' $ \forall a\in G.\ \forall b\in G.\  \exists x\in G.\  a\cdot x = b$ ''and '' $ \forall a\in G.\ \forall b\in G.\  \exists y\in G.\  y\cdot a = b$+++[proof ]>

 ''{ ''  ''fix '' $ a$ $ b$
 ''assume '' $ a\in G$,  $ b\in G$
 ''let '' $ x = a^{-1}\cdot  b$
 ''let '' $ y = b\cdot a^{-1}$
 ''from '' $ a\in G$, $ b\in G$  ''have''  $ x \in  G$,  $ y \in  G$ ''and '' $ a\cdot x = b$,  $ y\cdot a = b$ ''using '' +++^[inverse_in_group | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inverse_in_group</nowiki>:  ''assumes '' $ x\in G$  '' shows '' $ x^{-1}\in G$ ===  ,  +++^[group_op_closed | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>group_op_closed</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b \in  G$ ===  ,  +++^[inv_cancel_two | Group_ZF ]...  ''lemma''   ''(in '' group0 '') '' <nowiki>inv_cancel_two</nowiki>:  ''assumes '' $ a\in G$,   $ b\in G$  '' shows '' $ a\cdot b^{-1}\cdot b = a$,  
$ a\cdot b\cdot b^{-1} = a$,   $ a^{-1}\cdot (a\cdot b) = b$,   $ a\cdot (a^{-1}\cdot b) = b$ === 
 ''hence''  $ \exists x\in G.\  a\cdot x = b$ ''and '' $ \exists y\in G.\  y\cdot a = b$
 '' }'' 
 ''thus''  $ \forall a\in G.\ \forall b\in G.\  \exists x\in G.\  a\cdot x = b$ ''and '' $ \forall a\in G.\ \forall b\in G.\  \exists y\in G.\  y\cdot a = b$
 ''qed'' === 

 ''end

'' +++![Comments on Group_ZF_1|click to add comment] <html> <div> <iframe style="width:60%;height:500px" src="http://www.haloscan.com/comments/slawekk/Group_ZF_1"></iframe> </div> </html>
=== 
 ''theory'' Introduction ''imports'' [[equalities]]

 ''begin
'' 
This theory does not contain any formalized mathematics used in other theories, but is an introduction to IsarMathLib project.

!How to read IsarMathLib proofs - a tutorial

Isar (the Isabelle's formal proof language) was designed to be similar to the standard language of mathematics. Any person able to read proofs in a typical mathematical paper should be able to read and understand Isar proofs without having to learn a special proof language. However, Isar is a formal proof language and as such it does contain a couple of constructs whose meaning is hard to guess. In this tutorial we will define a notion and prove an example theorem about that notion, explaining Isar syntax along the way. This tutorial may also serve as a style guide for IsarMathLib contributors. Note that this tutorial aims to help in reading the presentation of the Isar language that is used in IsarMathLib proof document and TiddlyWiki rendering on the Tiddly Formal Math site, but does not teach how to write proofs that can be verified by Isabelle. This presentation is different than the source processed by Isabelle (the concept that the source and presentation look different should be familiar to any LaTeX user). To learn how to write Isar proofs one needs to study the source of this tutorial as well.

The first thing that mathematicians typically do is to define notions. In Isar this is done with the //definition// keyword. In our case we define a notion of two sets being disjoint. We will use the infix notation, i.e. the string $ \text{ is disjoint with }$ put between two sets to denote our notion of disjointness. The left side of the $ \equiv $ symbol is the notion being defined, the right side says how we define it. In Isabelle //0// is used to denote both zero (of natural numbers) and the empty set, which is not surprising as those two things are the same in set theory.

 ''Definition
'' $ A \text{ is disjoint with } B \equiv  A \cap  B = 0$

We are ready to prove a theorem. Here we show that the relation of being disjoint is symmetric. We start with one of the keywords ''theorem'', ''lemma'' or ''corollary''. In Isar they are synonymous. Then we provide a name for the theorem. In standard mathematics theorems are numbered. In Isar we can do that too, but it is considered better to give theorems meaningful names. After the ''shows'' keyword we give the statement to show. The $ \longleftrightarrow $ symbol denotes the equivalence in Isabelle/ZF. Here we want to show that "A is disjoint with B iff and only if B is disjoint with A". To prove this fact we show two implications - the first one that $ A \text{ is disjoint with } B$ implies $ B \text{ is disjoint with } A$ and then the converse one. Each of these implications is formulated as a statement to be proved and then proved in a subproof like a mini-theorem. Each subproof uses a proof block to show the implication. Proof blocks are delimited with curly brackets in Isar. Proof block is one of the constructs that does not exist in informal mathematics, so it may be confusing. When reading a proof containing a proof block I suggest to focus first on what is that we are proving in it. This can be done by looking at the first line or two of the block and then at the last statement. In our case the block starts with "assume $ A \text{ is disjoint with } B$ and the last statement is "then have $ B \text{ is disjoint with } A$". It is a typical pattern when someone needs to prove an implication: one assumes the antecedent and then shows that the consequent follows from this assumption. Implications are denoted with the $ \longrightarrow $ symbol in Isabelle. After we prove both implications we collect them using the ''moreover'' construct. The keyword ''ultimately'' indicates that what follows is the conclusion of the statements collected with ''moreover''. The ''show'' keyword is like ''have'', except that it indicates that we have at arrived the claim of the theorem (or a subproof).

 ''theorem''  <nowiki>disjointness_symmetric</nowiki>:
 ''   shows '' $ A \text{ is disjoint with } B \longleftrightarrow  B \text{ is disjoint with } A$+++[proof ]>
 ''have''  $ A \text{ is disjoint with } B \longrightarrow  B \text{ is disjoint with } A$+++[proof ]>
 ''{ ''  ''assume '' $ A \text{ is disjoint with } B$
 ''then ''  ''have''  $ A \cap  B = 0$ ''using '' +++^[AreDisjoint_def | Introduction ]... Definition of <nowiki>AreDisjoint</nowiki>:
$ A \text{ is disjoint with } B \equiv  A \cap  B = 0$=== 
 ''hence''  $ B \cap  A = 0$
 ''then ''  ''have''  $ B \text{ is disjoint with } A$ ''using '' +++^[AreDisjoint_def | Introduction ]... Definition of <nowiki>AreDisjoint</nowiki>:
$ A \text{ is disjoint with } B \equiv  A \cap  B = 0$=== 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''moreover''   ''have''  $ B \text{ is disjoint with } A \longrightarrow  A \text{ is disjoint with } B$+++[proof ]>
 ''{ ''  ''assume '' $ B \text{ is disjoint with } A$
 ''then ''  ''have''  $ B \cap  A = 0$ ''using '' +++^[AreDisjoint_def | Introduction ]... Definition of <nowiki>AreDisjoint</nowiki>:
$ A \text{ is disjoint with } B \equiv  A \cap  B = 0$=== 
 ''hence''  $ A \cap  B = 0$
 ''then ''  ''have''  $ A \text{ is disjoint with } B$ ''using '' +++^[AreDisjoint_def | Introduction ]... Definition of <nowiki>AreDisjoint</nowiki>:
$ A \text{ is disjoint with } B \equiv  A \cap  B = 0$=== 
 '' }'' 
 ''thus''  $ thesis$
 ''qed'' === 
 ''ultimately ''  ''show''  $ thesis$ 
 ''qed'' === 


!Overview of the project

The //Fol1//, // ZF1// and //Nat_ZF// theory files contain some background material that is needed for the remaining theories. //Order_ZF// reformulates material from standard Isabelle's //Order// theory in terms of non-strict (less-or-equal) order relations. //Order_ZF_1// on the other hand directly continues the //Order// theory file using strict order relations (less and not equal). This is useful for translating theorems from Metamath.
The //func1// theory provides basic facts about functions. //func_ZF// continues this development with more advanced topics that relate to algebraic properties of binary operations, like lifting a binary operation to a function space, associative, commutative and distributive operations and properties of functions related to order relations. The standard Isabelle's //Finite// theory defines the finite powerset of a set as a certain "datatype" (?) with some recursive properties. IsarMathLib's //Finite1// and //Finite_ZF_1// theories develope more facts about this notion. These two theories are obsolete now. They will be gradually replaced by an approach based on set theory rather than tools specific to Isabelle. This approach is presented in //Finite_ZF// theory file. The //EquivClass1// theory file is a reformulation of the material in the standard Isabelle's //EquivClass// theory in the spirit of ZF set theory.
//FiniteSeq_ZF// discusses the notion of finite sequences (a.k.a. lists). //InductiveSeq_ZF// provides the definition and properties of (what is known in basic calculus as) sequences defined by induction, i. e. by a formula of the form $a_0 = x,\ a_{n+1} = f(a_n)$. //Fold_ZF// shows how the familiar from functional programming notion of fold can be interpreted in set theory. //Semigroup_ZF// treats the expressions of the form $a_0\cdot a_1\cdot .. \cdot a_n$, (i.e. products of finite sequences), where "$\cdot$" is an associative binary operation. The //Topology_ZF// series covers basics of general topology: interior, closure, boundary, compact sets, separation axioms and continuous functions.
//Group_ZF//, //Group_ZF_1//, and //Group_ZF_2// provide basic facts of the group theory. //Group_ZF_3// considers the notion of almost homomorphisms that is nedeed for the real numbers construction in //Real_ZF//.
//Ring_ZF// defines rings. //Ring_ZF_1// covers the properties of rings that are specific to the real numbers construction in //Real_ZF//.
//Int_ZF// theory considers the integers as a monoid (multiplication) and an abelian ordered group (addition). In //Int_ZF_1// we show that integers form a commutative ring. //Int_ZF_2// contains some facts about slopes (almost homomorphisms on integers) needed for real numbers construction, used in //Real_ZF_1//. //Field_ZF// and //OrderedField_ZF// contain basic facts about (you guessed it) fields and ordered fields.
The //Real_ZF// and //Real_ZF_1// theories contain the construction of real numbers based on the paper \cite{Arthan2004} by R. D. Arthan (not Cauchy sequences, not Dedekind sections). The heavy lifting is done mostly in //Group_ZF_3//, //Ring_ZF_1// and //Int_ZF_2//. //Real_ZF// contains the part of the construction that can be done starting from generic abelian groups (rather than additive group of integers). This allows to show that real num