2009: j paul gibsont&msp-csc 4504 : langages formels et applicationsevent-b/famille.1 csc 4504 :...
TRANSCRIPT
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.1
CSC 4504 : Langages formels et applications
(La méthode Event-B)
J Paul Gibson, A207
http://www-public.it-sudparis.eu/~gibson/Teaching/Event-B/
Famille
http://www-public.it-sudparis.eu/~gibson/Teaching/Event-B/Famille.pdf
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.2
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.3
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.4
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.5
wizards
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.6
ASCII
hommes <: P
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.7
ASCII Representations of the Mathematical Symbols
Atomic Symbols
http://www.b-core.com/ONLINEDOC/ASCIISymbols.html
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.8
ASCII Representations of the Mathematical Symbols
Unary Operators
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.9
ASCII Representations of the Mathematical Symbols
Unary Operators
Assignment Operators
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.10
ASCII Representations of the Mathematical Symbols
Binary Operators
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.11
ASCII Representations of the Mathematical Symbols
Quantifiers
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.12
Exemples
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.13
Les relations:
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.14
Exemples
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.15
Les relations:
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.16
Exemples
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.17
Les fonctions:
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.18
Bijection, injection and surjectionFrom Wikipedia, the free encyclopedia
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.19
hommes femmes
P
Preuve d'un théorème
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.20
Use the Event-B Keyboard (view) for editing complex expressions
! per. not ( per : P & not(per : hommes) & not (per : femmes))
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.21
thm1 Proven Automatically √ Proving
Comment?
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.22
Open perspective•Event-B•Proving•….Choose theorem
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.23
hommes femmes
P
Partial injection
ASCII - epoux : femmes >+> hommes
Specification: Epoux
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.24
hommes femmes
P
Partial injection
ASCII - epouse: hommes >+> femmes
Specification: Epouse
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.25
hommes femmes
P
Partial injection
ASCII - epoux : femmes >+> hommes epouse: hommes >+> femmes
Epoux-Epouse: Attention!
Partial injection
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.26
Problème: Theorem - epouse = epoux~ - n’est pas vrai
ASCII: epouse = epoux~ -1SYMBOL: epouse = epoux
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.27
Le prouveur n’est pas content
Problème: Theorem - epouse = epoux~ - n’est pas vrai
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.28
hommes femmes
P
Partial injection
ASCII - AXIOM epoux : femmes >+> hommes AXIOM epouse = epoux~
Specification: Epoux-Epouse - Corrigé
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.29
Specification: Epoux/Epouse - Verification/Test
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.30
Specification: Famille_ctx0 - Version finale
Pourquoi pas la transformer en pdf (en utilisant plugin B2latex)?
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.31
Specification: Famille_ctx0 - Version finale
B2Latex
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.32
Latex generated as
<contextnameDate>.tex
Convert to .pdf (using, eg, MiKTeX)
\documentclass[10pt,a4paper]{report}\usepackage[top=3cm, bottom=2.5cm, left=3cm, right=2.5cm] {geometry}\usepackage {bsymb,b2latex}\usepackage{fancyhdr,lastpage}\lhead{\rm An Event-B Specification of Famille\_ctx0}\rhead {\rm Page \thepage~of \pageref{LastPage}}\lfoot{}\cfoot{}\rfoot{}\pagestyle{fancy}%---------------------------------------------------------\begin{document}\thispagestyle{empty}\begin{description}\BTitle{Famille\_ctx0}{3 Mar 2009}{02:00:30 PM}\CONTEXT{Famille\_ctx0}\SETS
\begin{description}\Item{ P }
\end{description}\CONSTANTS
\begin{description}\Item{ hommes }\Item{ femmes }\Item{ epoux }\Item{ epouse }\Item{ f }\Item{ ff }\Item{ h }\Item{ hh }
\end{description}\AXIOMS
\begin{description}\nItem{ axm\_hommes }{ hommes \subseteq P }\nItem{ axm\_femmes }{ femmes = P\setminus hommes }\nItem{ axm\_epoux }{ epoux \in femmes \pinj hommes }\nItem{ axm\_epouse }{ epouse = epoux^{-1} }\nItem{ axm\_fhffhh }{ f\in femmes \land h\in hommes \land ff\in femmes \land hh\in
hommes }\end{description}
\THEOREMS\begin{description}
\nItem{ thm\_test\_axm\_femmes }{ \forall per\qdot \lnot ( per\in P \land \lnot (per \in hommes) \land \lnot (per \in femmes)) }
\nItem{ thm\_epouxepouse }{ epoux = epoux; epouse; epoux }\nItem{ thm\_test\_epouse1 }{ \lnot (hh=h) \land \lnot (ff=f) \land epoux = \{ f\mapsto h,
ff\mapsto hh\} \limp epouse(hh) = ff }\nItem{ thm\_test\_epouse2 }{ \lnot (hh=h) \land \lnot (ff=f) \land epoux = \{ f\mapsto h,
ff\mapsto hh\} \limp epouse(h) = f }\end{description}
\END\end{description}\end{document}
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.33
Specification: Famille_ctx0.pdf
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.34
Specification: Married - Famille_ctx1 extends Famille_ctx0
thm3 « married is a partial injection »
Prover cannot prove it automatically Should we add it as an axiom?
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.35
Specification: Married - Famille_ctx1 extends Famille_ctx0
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.36
Travaux Pratique (Context)– a completer (avant le 13)
Define:
•mere et pere•fille et fils•frere et soeur•cousin •oncle et tante
Validate Theorems, eg:
•oncle = cousin; pere•cousin = cousin~•pere; enfants = mere; enfants•pere; mere~ = {}•pere; frere; fille <: cousin
Before we look at the prover we first look (quickly) at Machines …
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.37
Machine Famile_M0
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.38
Machine Famile_M0
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.39
Machine Famile_M0
event marry respects the invariant
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.40
Machine Famile_M0
h1 h6 h7 h8 h9h4 h5h3h2
f1 f2 f3 f4 f5 f6 f7 f8
hommes
femmes
epoux
…
…
…
hms = {}
fms = {}
ep = {}
INITIALISATION: State0
add_h (h2)
hms = {h2}
fms = {}
ep = {}
State1
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.41
Machine Famile_M0
h1 h6 h7 h8 h9h4 h5h3h2
f1 f2 f3 f4 f5 f6 f7 f8
hommes
femmes
epoux
…
…
…
add_f (f3)
hms = {h2}
fms = {f3}
ep = {}
State2
hms = {h2}
fms = {}
ep = {}
State1
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.42
Machine Famile_M0
h1 h6 h7 h8 h9h4 h5h3h2
f1 f2 f3 f4 f5 f6 f7 f8
hommes
femmes
epoux
…
…
…
add_f (f2)
hms = {h2}
fms = {f3, f2}
ep = {}
State3
hms = {h2}
fms = {f3}
ep = {}
State2
2009: J Paul Gibson T&MSP-CSC 4504 : Langages formels et applications Event-B/Famille.43
Machine Famile_M0
h1 h6 h7 h8 h9h4 h5h3h2
f1 f2 f3 f4 f5 f6 f7 f8
hommes
femmes
epoux
…
…
…
hms = {h2}
fms = {f3, f2}
ep = { f3 |-> h2}State3
hms = {h2}
fms = {f3, f2}
ep = {}hms = {h2}
fms = {f3, f2}
ep = { f2 |-> h2}
marry(f3,h2)
marry(f2,h2)
X
√