• Aucun résultat trouvé

A formalization of diagrammatic proofs in abstract rewriting

N/A
N/A
Protected

Academic year: 2021

Partager "A formalization of diagrammatic proofs in abstract rewriting"

Copied!
41
0
0

Texte intégral

(1)

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�

(2)

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".

(3)

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

(4)

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.

(5)

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 a

binaryrelationontheset

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.

(6)

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 thenitsstatus

isnotexistential.

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 isaninjetivefuntionfromthesetofvertiestotheverties

symbols

• s

A

: A → {H, C}

isafuntionfromthe setofarrowstothearrowsstatus

• s

V

: V → {∀, ∃, F }

is a funtion from the set of verties to the verties

status

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

(7)

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 −→

R

y

isrepresentedbyanarrowifthediagramon- tainsanarrowlabeledby

R

suhthat

s(f ) = x

and

d(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 −→

R

y

is

R(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 or

true

ifthe onjuntion isempty.

Bydenition thesemantiof the diagram

D

noted

JDK

is:

JDK := ∀u, H ⇒ ∃e, C

Notiethatinvirtueoftherstonditioninthedenitionofadiagram,the

onjuntion

C

isnotemptyand in virtueof theseond ondition,

H

doesnot

ontainanourreneofavariablewhihisin

e

Note also that we donot dene theorder of thevariables in

e

and

u

and the

orderofthetermsin

C

and

H

. Thisdoesnotintroduefundamentalambiguities astheformulasobtainedbypermutationareequivalent.

(8)

anbe representedby adiagram. Wean desribeonly formulas of theform

∀u V

i

H

i

⇒ ∃e V

i

C

i where thetermsin

H

i and

C

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

isanotationfor

x _ _ _ // 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:

(9)

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

notedalso

x // 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 diagrams

D

i share the

samesolidarrows, weknowthattheyhave asemantiofthe form:

∀− → u , H ⇒ ∃− → e

i

, C

i

The semantiof

D

isby denition:

JDK := ∀− → u , H ⇒ _

i∈1...n

∃− → e

i

, C

i

Forexample,herearethediagramswhihexpressthetwopossibleasesof

onstrutionoftheredutions

−→

+ and

−→

:

x I

+

// >>

_ u

y x

+

//

>

> >

> y

y

+

@@

2

Seesetion2.4forthedenitionoftherelations

+

−→and−→ .

(10)

∀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

ij

wherethe

H

iand

C

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. This

isalimitationasweannotdeneforexamplethenotionofnormalform. 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 notin

A

thenit

isin itsomplementary

¬A

.

2.4 Denitions and ommon properties

Wegivenowsomedenitions usingthediagrams wehavedened. Thesede-

nitionswillbeusedinthemainexampleofthenextsetion.

Weassoiatefourrelationstoagivenone:

thereexivelosure(

−→

=? ),

thetransitivelosure(

−→

+ ),

thereexiveandtransitivelosure(

−→

),

thesymmetrilosure(

↔ p

).

(11)

symmetri losure wedo not use the usual symbol(

). Indeed, this symbol

has 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 suessorof

x

if:

x _ _ _ // y

notedalso

x // y

Wesay that

y

isa suessor of

x

if :

x _

+

_ _ // y

notedalso

x

+

// y

3

Asthetransitiveandreexive-transitivelosurearenotrst-orderdenable,thisdenition

isnotomplete.Itwillbeompleteafterthedenitionoftheindutionprinipleinsetion5 .

(12)

Wesay that

x

and

y

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.

(13)

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

88

O T _ j o

y

a.b

// z

Références

Documents relatifs

Another point which had to be dealt with is that Coq’s standard library does not provide a rational number theory (used in the proof of theorem 1).. Actually, there are

In our own earlier work [2], based on a shallow embedding of higher-order separation logic in the Coq proof assistant, this goal was achieved and the programs were verified with-

[ 7 ]: an untrusted Ocaml backend performs most of the computations and outputs proof hints for the results it produces, which are used by a frontend developed in Coq to

This chapter provides a short introduction to the scientific background of our work: operational semantics, to define the meaning of programs; the Coq proof assistant, which is used