HAL Id: inria-00180065
https://hal.inria.fr/inria-00180065
Preprint submitted on 17 Oct 2007
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires
A formalization of diagrammatic proofs in abstract rewriting
Julien Narboux
To cite this version:
Julien Narboux. A formalization of diagrammatic proofs in abstract rewriting. 2006. �inria-00180065�
abstrat rewriting
Julien Narboux
September 12,2006
Abstrat
Diagrams are ommonly used in the rewriting ommunity. In this
paper, we present a formalization of this kindof diagrams. We give a
formaldenitionofthediagramswhihareusedtostateproperties. We
proposeinferenerulestoformalizesomediagrammatiproofssuhasthe
proofoftheNewman'slemma. Weshowthatthesystemproposedisboth
orretandompleteforalassofformulasalled"oherentlogi".
1 Introdution 3
2 Diagrammatirepresentationin abstrat rewriting 4
2.0.1 Firstnotations(N1): . . . . . . . . . . . . . . . . . . . . . 6
2.0.2 Seondnotations(N2):. . . . . . . . . . . . . . . . . . . . 7
2.1 Extensiontodisjuntions. . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Languageoftherepresentedformulas. . . . . . . . . . . . . . . . 9
2.3 Aboutthenegation. . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 Denitionsandommonproperties . . . . . . . . . . . . . . . . . 9
3 Diagrammatiproofs 11 3.1 Inferenerules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.1 intros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.2 apply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.3 substitute . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.4 reflexivity . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.5 onlusion . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.6 ut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Corretness and ompleteness 18 4.1 Intuitionistvslassiallogi . . . . . . . . . . . . . . . . . . . . . 18
4.2 Thesystemofreferene . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Corretness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.4 Completeness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.4.1 Systemwithoutequality . . . . . . . . . . . . . . . . . . . 21
4.4.2 Dealingwithequality . . . . . . . . . . . . . . . . . . . . 21
5 Extensionto proof by indution 24 5.1 Classialindution . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2 Well-foundedindution. . . . . . . . . . . . . . . . . . . . . . . . 25
6 Implementationusing Coq 30 6.1 Inferenerules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.1.1 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2 Impliitrules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7 Somediagrammatiproofs. 32 7.1 Conueneproperties . . . . . . . . . . . . . . . . . . . . . . . . 32
8 Conlusion and futurework 38
Some diagramsanbeseenasahighleveldesriptionofaproof,in thesense
that they onvine the reader that some fat is true. This kind of diagrams
appears in dierent domains of mathematis and omputer siene, suh as
eulidean geometry, number theory, real analysis,set theory, ategorytheory,
rewriting...
In [Jam01℄, Jamnik uses diagramsasa hintfor anautomated theorem prover
in the eld of numbertheory. In [BPB91℄, Dave Barker-Plummerand Sidney
C. Bailinuse alsodiagrams as ahintfor anautomatedtheorem proverin the
eld of abstrat rewriting. In this paper, wewantto giveto the lass of dia-
gramswhihareinusedtheabstratrewritingommunitythestatusofaproof
objet as we plan to use them as input languagefor the Coq proof assistant
[Coq04,HKPM04℄. Thisapproahrequires that wegiveaformal denition of
thediagrams,itssemantiandoftheorretnessofaproofdiagram. Workhas
beendone in this diretion forsome lassesof diagrams: Millerhas proposed
a formal system for some diagrammati proofs in eulidean geometry [Mil01℄
andWintersteinhasgivenanothersystemfordiagrammatiproofsintheeld
of realanalysis [Win04℄. Wefouson abstratrewriting beausediagrams are
ommonlyusedin papersandbooks aboutthis subjet,forexamplein [BN98℄
diagrams appear throughout thebook andare even givenapreise meaning 1
.
Inthispaperwewillgiveapresentationofabstratrewritingsimilarto[BN98℄
exeptthatourintentisnottoonsiderdiagramsasillustrationsforproofsbut
asaproofobjetsin themselves.
First,wereallthedenition ofanabstrattermrewritingsystemandgive
aformal denition of arewriting diagram. Seond, wedene someproperties
diagrammatially and present a formal proof system using a simple proof as
an example. Then, we introdue diagrammati inferene rules to formalize
proofs by indution as well as well-founded indution and thereby we prove
theNewman'slemma[New42℄. Finally,weputforwardtheimplementionofthe
infereneruleswithintheCoqproofassistant.
1
Notefullyformalthough,beausesometimesvariablesareimpliitlyuniversallyquantied
andsometimestheyarenot.
ing
In this setion, we reall the denitions of an abstrat term rewriting system
andweproposeadenitionforthediagramswhihareurrentintheliterature.
An abstrat redution system is apair
(A, →)
where theredution→
is abinaryrelationontheset
A
,i.e.→⊆ A × A
.Ouraim in thispaperisto formalizethekindof diagramswhih areom-
monlyusedintherewritingommunity. Wedonottrytoinventanewkindof
diagramsasin[BvOK98℄,ourgoalisto deneadiagrammatilanguagewhih
willbeusedlaterasaninputlanguagefortheCoqproofassistant.
The fat that
(x, y) ∈→
will be depited by an arrow in inx position:x −→ y
.Informally,weusetheusualonventionaordingtowhihsolidarrowsstand
forthehypothesesand dashedarrowsstandfortheonlusion. Vertieswhih
areonnetedonlytodashedarrowsaresupposedtobeexistentiallyquantied
bydefault. Vertieswhih areonnetedtoatleastonesolidarrowarealways
quantieduniversally.
Let's have a look at a rst example before giving a formal denition. A
well-knownpropertyofanabstrat rewritingrelationis thediamondproperty
whih is oftenused and is usually represented in the rewriting ommunity by
thefollowingdiagram:
x
?
? ?
? ?
? ?
?
y
>
> >
> z
t
Themeaning ofthisdiagramisthefollowing:
∀xyz, x −→ y ∧ x −→ z ⇒ ∃t, y −→ t ∧ z −→ t
Nowas ourgoal isto treatdiagrams asrst lass itizens, i.e. notasno-
tations for somemathematialobjetsbut asmathematialobjets. Toreah
thisgoal,weneedaformaldenition ofadiagramanditssemanti.
Webeginwiththedenitionofamulti-graphsineitisusedinthedenition
ofadiagram.
Denition1(diretedmulti-graph).Adiretedmulti-graphisa4-uple
(V, A, s, d)
where
• V
isthe setof verties.• A
isthe setof arrows.• s : A → V
isafuntion fromarrowstoverties(thesoureof thearrow)• d : A → V
isa funtion from arrows to verties (the destination of the arrow)Notethatanarrowanhavethesamesoureanddestination.
Denition 2 (Diagram). A rewriting diagram
D
is a nite direted multi-graphwhose arrowsarelabeledby arelationanda status(either onlusion or
hypothesis) and verties are labeled by a name and a status (either universal,
existentialor free)verifying the following onditions:
•
Ifavertex isinontatwith atleastonehypothesisarrow thenitsstatusisnotexistential.
•
Thereisatleast oneonlusion arrow.•
Thereisno vertexof degreezero.Formally, itisa10-uple
(Σ
V, Σ
A, V, A, s, d, l
A, l
V, s
A, s
V)
where :• Σ
V isthe setof verties symbols• Σ
A isthe set ofrelationsymbols• V
isthe setof verties• A
isthe setof arrows• s : A → V
isthe sourefuntion• d : A → V
isthedestination funtion• l
A: A → Σ
A isafuntionfrom the setofarrowstothe relationsymbols• l
V: V → Σ
V isaninjetivefuntionfromthesetofvertiestothevertiessymbols
• s
A: A → {H, C}
isafuntionfromthe setofarrowstothearrowsstatus• s
V: V → {∀, ∃, F }
is a funtion from the set of verties to the vertiesstatus
verifying that:
• ∀v ∈ V, (∃a ∈ A, (s(a) = v ∨ d(a) = v) ∧ s
A(a) = H) ⇒ s
V(v) 6= ∃
• ∃a ∈ A, s
A(a) = C
• ∀v ∈ V, ∃a ∈ A, s(a) = v ∨ d(a) = v
Whenarrowsarelabeledby thesamerelation, the labelof this relation is
omitted.
Arrowswhih aremarkedasonlusionwill berepresentedbyadashedarrow,
andhypothesesbyasolidarrow.
Theuniversalvertiesarelabeledusingthesymbol
∀
.Theexistentialvertiesarelabeledusingthesymbol
∃
.Thefreevertiesareunderlined.
Usingthesenotationsthediamondpropertyisrepresentedthisway:
x
∀}}|| || || ||
!! B
B B B B B B B
y
∀B
B B
B z
∀~~| | | |
t
∃Wesaythataterm
x −→
Ry
isrepresentedbyanarrowifthediagramon- tainsanarrowlabeledbyR
suhthats(f ) = x
andd(f ) = y
.Now, we need to give aformal semanti to oursdiagrams. Note that this
denitionisnotneessaryfortheonstrutionofaformalsystemtobuildproofs
in abstrat term rewriting. Indeed, we ould onsider that the semanti of
diagramsisimpliitlydenedbytheinferenerules. Wegiveherethesemanti
notonlytolarifythepresentationbutalsobeauseitisneessarytostatethe
orretnessandompletenesstheoremswithregardtothesequentalulus(see
setion4).
Denition3 (semanti).
The semantiofan arrow
x −→
Ry
isR(x, y)
.Let
−
→ e
bethe setof labels of existentialvertiesand−
→ u
the set of labels ofuni-versal verties.
Let
C
bethe onjuntion of the termsrepresentedby aonlusion arrow.Let
H
be the onjuntion of the terms represented by an hypothesis arrow ortrue
ifthe onjuntion isempty.Bydenition thesemantiof the diagram
D
notedJDK
is:JDK := ∀u, H ⇒ ∃e, C
Notiethatinvirtueoftherstonditioninthedenitionofadiagram,the
onjuntion
C
isnotemptyand in virtueof theseond ondition,H
doesnotontainanourreneofavariablewhihisin
e
Note also that we donot dene theorder of thevariables in
e
andu
and theorderofthetermsin
C
andH
. Thisdoesnotintroduefundamentalambiguities astheformulasobtainedbypermutationareequivalent.anbe representedby adiagram. Wean desribeonly formulas of theform
∀u V
i
H
i⇒ ∃e V
i
C
i where thetermsinH
i andC
iareprediatesofaritytwo.Remark 1. If adiagram ontains several onnex omponents, its semantiis
equivalent tothe onjuntionof the semantisofthe dierent omponents.
Proof: Byinjetivityof thefuntion
l
V.2.0.2 Seondnotations(N2):
Asourgoalisto giveadenitionofdiagramsasloseaspossibletotheomm
onusageintheommunity,weintroduetwoothernotations:
1. Intherepresentationofadiagramifweomitthestatusofavertex,ithas
thefollowingimpliitstatus:
If the vertex is in ontatwith only onlusion arrows its status is exis-
tential,otherwiseitsstatusisuniversal.
Now,wehavetheusualnotationforthediamondproperty:
x
?
? ?
? ?
? ?
?
y
>
> >
> z
t
2. Inthe representationof adiagram,if wedrawonly solidarrowsand we
omit thestatus of the verties, this is a notationto representthe same
diagramonsistingofonlydashedarrowsandfreeverties.
Example:
x −→ y
isanotationforx _ _ _ // y
Notethatthisnotationisnotambiguousaseverydiagramhasaleastone
onlusionarrow.
Note also that if we swapped the role of the dashed and solid arrows
in the denition of the semanti of a diagram we would not need this
notationrule. Wekeepthisdenitionto followtheommonusageinthe
ommunity.
Before goingfurther, here are some small examples of diagrams and their
semanti:
x −→ x x yy g W
notedalso a
x yy
∀x, x −→ x x
∀ww
g W
∃x, x −→ x x yy
g W
∃xy, x −→ y x _ _ _ // y
∀x∃y, x −→ y x
∀_ _ _ // y
∀xy, x −→ y x
∀_ _ _ // y
∀x −→ y x _ _ _ // y
notedalsox // y
a
intheabseneofotherarrowsinthediagram
2.1 Extension to disjuntions.
Usually, in theliterature aboutrewriting, disjuntionsare not representedby
diagrams. But,inordertodenethetransitivelosureofarelation,weneedto
dene diagrams representingdisjuntions. Indeedwewantto express thefat
that 2
:
∀xy, x −→
+y ⇒ (x −→ y ∨ ∃y
′, x −→ y
′−→
+y)
Denition 4 (disjuntive diagram). A disjuntive diagram is a nite set of
diagrams(inthesensofthedenition2)whosesub-diagramsrestrainedtosolid
arrowsanduniversalverties areidential.
Notation:Weseparatethesub-diagramsofthedisjuntionthroughtheuse
ofavertialbar
|
.Thesemantiisasfollows:
Denition5 (disjuntivediagrams'semanti).
Let
D = {D
1. . . D
n}
be a disjuntive diagram. As the diagramsD
i share thesamesolidarrows, weknowthattheyhave asemantiofthe form:
∀− → u , H ⇒ ∃− → e
i, C
iThe semantiof
D
isby denition:JDK := ∀− → u , H ⇒ _
i∈1...n
∃− → e
i, C
iForexample,herearethediagramswhihexpressthetwopossibleasesof
onstrutionoftheredutions
−→
+ and−→
∗ :x I
+// >>
_ u
y x
+//
>
> >
> y
y
′+
@@
2
Seesetion2.4forthedenitionoftherelations
+
−→and−→∗ .
∀xy, x −→
+y ⇒ (x −→ y ∨ ∃y
′, x −→ y
′−→
+y)
x
∗//
=
>>
I _ u
y x
∗//
>
> >
> y
y
′∗
@@
∀xy, x −→
∗y ⇒ (x −→
=y ∨ ∃y
′, x −→ y
′−→
∗y)
2.2 Language of the represented formulas
After theextension to disjuntivediagrams,theformulaswhih anbe repre-
sentedbyadiagramarethoseoftheform:
∀ u ^
i
H
i⇒ _
i
∃ e
i^
j
C
ijwherethe
H
iandC
ij areprediatesofaritytwo.These formulas form a sub-language of the oherent logi of Mar Bezem
andThierryCoquand. Formoreinformationaboutthislogisee[BC05,BC04℄.
Now,wewillall
D
this lassof formulas.2.3 About the negation
Thelass
D
offormulasthatwehavedeneddoesnotontainnegations. Thisisalimitationasweannotdeneforexamplethenotionofnormalform. But
this property is important beause the diagrams whih we use onsist in the
representationofgeneralfat byanexample. Itis diulttodenote diagram-
matially, byanexample,thefatthat somethingdoesnothold. Wehavethe
sameproblemingeometry,impossibleguresarehardto denotegraphially.
Insome domains, negations anbe represented diagrammatially. Forex-
ample, thefat thatanelementisnotin asetanberepresentedthroughthe
useof anEuler diagram. But, inthis ontext,negationsdonothavethesame
meaningasbefore sineimpliitlythelogiislassial: if
x
is notinA
thenitisin itsomplementary
¬A
.2.4 Denitions and ommon properties
Wegivenowsomedenitions usingthediagrams wehavedened. Thesede-
nitionswillbeusedinthemainexampleofthenextsetion.
Weassoiatefourrelationstoagivenone:
•
thereexivelosure(−→
=? ),•
thetransitivelosure(−→
+ ),•
thereexiveandtransitivelosure(−→
∗ ),•
thesymmetrilosure(↔ p
).symmetri losure wedo not use the usual symbol(
↔
). Indeed, this symbolhas thepropertyit denotes: itis symmetri ! This is oneof the reasonswhy
this representationis really diagrammati. We will see that in diagrammati
proofs,thesymmetrialnotationhide areasoningstep. Wewillexplainhowto
dealwiththiskindofimpliitreasoningstepsin setion6.2.
Denition 6 (symmetrilosure). The symmetri losure of arelation isde-
nedby thetwofollowing diagrams:
x u _ I //
= >>
I _ u
__ y
_ u I
? u _ I
x I // >>
_ u y
oo x // y
__ u _ I oo
Denition 7 (reexive losure). The reexive losureof a relation is dened
by thethreefollowingdiagrams:
x //
=?
>>
I _ u
y x
∀ =?gg
W
g x I
=?// >>
_ u
y x
=?//
=
>>
I _ u y
Denition8(transitivelosure).Thetransitivelosureofarelationisdened 3
by thethreefollowingdiagrams:
x //
+
>>
I _ u
y x //
+
88
O T _ j o
y
+// z
x I
+// >>
_ u
y x
+//
>
> >
> y
y
′+
@@
Denition 9 (transitive and reexive losure). The transitive and reexive
losureof arelationisdenedby thethreefollowingdiagrams:
x
∀ ∗gg
W
g x //
∗
88
O T _ j o
y
∗// z
x
∗//
=
>>
I _ u
y x
∗//
>
> >
> y
y
′∗
@@
Denition10 (Voabulary).
Wesay that
x
an be redued if:x _ _ _ // y
Wesay that
y
isthe diret suessorofx
if:x _ _ _ // y
notedalsox // y
Wesay that
y
isa suessor ofx
if :x _
+_ _ // y
notedalsox
+// y
3
Asthetransitiveandreexive-transitivelosurearenotrst-orderdenable,thisdenition
isnotomplete.Itwillbeompleteafterthedenitionoftheindutionprinipleinsetion5 .
Wesay that
x
andy
are joignableif:x
∗
>
> >
> y
∗
z
Denition11 (Conuene properties).
x
∗
?
? ?
? ?
? ?
?
∗
? ? ? ? ? ?
? ?
y
∗
>
> >
>
>
> >
> z
∗
t
Conuene
x
?
? ?
? ?
? ?
?
∗
? ? ? ? ? ?
? ?
y
∗
>
> >
>
>
> >
> z
∗
t
Semi-onuene
x
?
? ?
? ?
? ?
?
?
? ?
? ?
? ?
?
y
∗
>
> >
>
>
> >
> z
∗
t
Loal-onuene
x
?
? ?
? ?
? ?
?
?
? ?
? ?
? ?
?
y
=?
>
> >
>
>
> >
> z
∗
t
Strong-onuene
x
∗//
∗
>
> >
> oo y
∗
t
Churh-Rosser
x
?
? ?
? ?
? ?
?
?
? ?
? ?
? ?
?
y
>
> >
>
>
> >
> z
t
Diamondproperty
Denition12 (Transitivity).
A relation
−→
istransitive ifthe followingdiagramholds:x O T // _ j o 88 y // z
Denition13 (Reexivity).
A relation
−→
isreexive ifthe following diagram holds:x yy
Denition14 (Composition).
The omposition of two relations
−→
a and−→
b is dened by the following dia-grams:
x
a.b//
a
?
? ?
? z
y
b
??
x
a//
a.b
88
O T _ j o
y
b// z
3 Diagrammati proofs
In theprevious setionswehave formalizedthe diagrammatinotation whih
is ommonlyused in therewriting ommunity to deneformulas involvingre-
lations. Butthese diagramsare alsoused to representproofs. Beforegivinga
formal denition,wewill study onesimpleproof expressedby themeanof an
informaldiagram.
Example. If
−→
a and−→
b are tworelationswhih are transitive and−→⊆
b.a−→
a.b then−→
a.b istransitive.x
a//
a
88
O T _ j o
y
a// z ∧ x
b//
b
88
O T _ j o
y
b// z ∧ x
a.b
>>
I _ u
b.a
// y
⇓ x
a.b//
a.b