formalizing projective geometry in coq - unistra.frnarboux/slides/gdr-ltp-09.pdfformalizing...
TRANSCRIPT
Formalizing projective geometry in Coq
Nicolas Magaud Julien Narboux Pascal Schreck
Universite de Strasbourg, France
GDR LTP, 21 Octobre 2009, Universite Paris XII
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 1 / 23
Outline
1 Objectives
2 Formal proofs in geometry
3 Projective geometry
4 A case study : Desargues’ theorem
5 Formalization in Coq
6 Future work and conclusion
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 2 / 23
Geometric contraint solving and automated deduction in
geometry
1 Proofs of theorems in geometry are needed for solving geometriccontraint systems.
2 Most methods in automated deduction in geometry (Wu’s method,the area method) can only deal with geometric statements expressedas a ruler and compass construction.
We need a system to prove both mathematical theorems and programs!
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 3 / 23
Related work
Geometry
Hilbert’s Grundlagen [DDS00, MF03]
Tarski’s geometry [Nar07]
High-school geometry [Gui05]
Hessenberg’s theorem [BH08]
Convex-hulls algorithm [MF05] [PB01]
Image segmentation algorithm [Duf07]
Degenerated cases
Using Three-Valued Logic to Specify and Verify, Brandt andSchneider [BS05]
Using matroids
Incidence constraints, a combinatorial approach,Schreck-Michelucci[MS06]
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 4 / 23
Why projective geometry ?
Non degeneracy conditions
A simple framework
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 5 / 23
Axiom system (2D)
Line-Existence∀A B : Point, (∃l : Line,A ∈ l ∧ B ∈ l)
Point-Existence∀l m : Line, (∃A : Point,A ∈ l ∧ A ∈ m)
Axiom Uniqueness
∀A B : Point,∀l m : Line,A ∈ l ⇒ B ∈ l ⇒ A ∈ m ⇒ B ∈ m ⇒ A = B ∨ l = m
Axiom Four Points
∃A : Point,∃B : Point,∃C : Point,∃D : Point,distinct4A B C D ∧(∀l : Line, (A ∈ l ∧ B ∈ l ⇒ C /∈ l ∧ D /∈ l)∧(A ∈ l ∧ C ∈ l ⇒ B /∈ l ∧ D /∈ l)∧(A ∈ l ∧ D ∈ l ⇒ B /∈ l ∧ C /∈ l)∧(B ∈ l ∧ C ∈ l ⇒ A /∈ l ∧ D /∈ l)∧(B ∈ l ∧ D ∈ l ⇒ A /∈ l ∧ C /∈ l)∧(C ∈ l ∧ D ∈ l ⇒ A ∈ l ∧ B ∈ l))
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 6 / 23
Axiom system (≥ 3D)
Line-Existence ∀A B : Point,∃l : Line,A ∈ l ∧ B ∈ l
Pasch
∀A B C D : Point,∀lAB lCD lAC lBD : Line,A 6=B ∧ A 6=C ∧ A 6=D ∧ B 6=C ∧ B 6=D ∧ C 6=D∧A ∈ lAB ∧ B ∈ lAB ∧ C ∈ lCD ∧ D ∈ lCD∧A ∈ lAC ∧ C ∈ lAC ∧ B ∈ lBD ∧ D ∈ lBD∧(∃I : Point, I ∈ lAB ∧ I ∈ lCD) ⇒(∃J : Point, J ∈ lAC ∧ J ∈ lBD)
bA
bB
b Cb
D
bI
b J
Uniqueness ∀A B : Point,∀l m : Line,A ∈ l ∧ B ∈ l ∧ A ∈ m ∧ B ∈ m ⇒ A = B ∨ l = m
Three-Points ∀l : Line,∃A B C : Point,A 6= B ∧ B 6= C ∧ A 6= C ∧ A ∈ l ∧ B ∈ l ∧ C ∈ l
Lower-Dimension ∃l m : Line,∀p : Point, p 6∈ l ∨ p 6∈ m
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 7 / 23
Duality
Proving some theorems by duality:
3 points on a line ⇒ 3 lines through a point
A
BbC
b
b
⇒
Pb
1 point outside l1 and l2 ⇒ 1 line not through P1 and P2
b P
⇒
b P1
b P2
The solution: a functor from Projective Plane Geometry to itself
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 8 / 23
Implementation in Coq !
Module types (boxes) and Functors (arrows)
duality55
ProjectivePlane′ A1A2A′
3
back
44ProjectivePlane A1A2A3
forth
ss
Duality as a functorModule swap (M’: ProjectivePlane’) <: ProjectivePlane’.
Definition Point := M’.Line.
Definition Line := M’.Point.
Definition Incid := fun (x:Point) (y:Line) => M’.Incid y x.
[...]
Definition a1_exist := M’.a2_exist.
Definition a2_exist := M’.a1_exist.
[...]
ApplicationLemma outsider : forall l1 l2: Line, { P:Point | ~Incid P l1/\~Incid P l2}.
Proof. [...] Qed.
Lemma dual_example :
forall P1 P2 : Point,{l : Line | ~ Incid P1 l /\ ~ Incid P2 l}.
Proof. apply ProjectivePlaneFacts_m.outsider. Qed.
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 9 / 23
Models
Finite ModelsPG (dim, b) where given a point on a line, b is the number of otherlines through the point.
Fano’s plane ( = PG(2, 2) the smallest projective plane)
b
Ab
B
b
bC
b E
b
F
bDbG
PG(2,5) (31 points and as many lines, thus 923 521 cases)
Infinite Model: Homogeneous Coordinates
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 10 / 23
Desargues’ theorem
let E be a 3D or higher projective space, if the 3 lines joining the corres-ponding vertices of triangles ABC and A′B ′C ′ all meet in a point O, thenthe 3 intersections of pairs of corresponding sides α, β and γ lie on a line.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 11 / 23
Why 3D ?
Desargue’s theorem is false in some 2D models.
Moulton’s plane
b b
b
b
b
b
b
bb
b A BC
A’B’
C’
O
α
γ
β
b b
b
b
b
b
b
b
b
b
β
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 12 / 23
Hessenberg’s theorem
If Pappus holds then Desargues holds as well.
Pappus
b
Ab
Bb
C
b
A’
b
B’
b
C’
b
Pb
Qb
R
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 13 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba
b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba
b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba
b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba
b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba
b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
bab b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b c
ba b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
The proof
Outline of the proof:
We prove the 3D versionof Desargues’ theorem.
We lift the 2D statementto a 3D version ofDesargues’ theoremwhich projects into the2D statement.
b
A
b
B
b
C
b O
b
C’
b
A’b
B’
bP
bo
b cba b b
b
b
b
β
γ
α
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 14 / 23
Formalization in Coq
We use the concept of rank:
R1 ∀X ⊆E , 0≤ rk(X )≤|X | (nonnegative and subcardinal)
R2 ∀XY ⊆E ,X ⊆ Y ⇒ rk(X ) ≤ rk(Y ) (nondecreasing)
R3 ∀XY ⊆E , rk(X ∪ Y ) + rk(X ∩ Y ) ≤ rk(X ) + rk(Y )(submodular)
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 15 / 23
Example
rk{A,B} = 1 A = B
rk{A,B} = 2 A 6= B
rk{A,B ,C} = 2 A,B ,C are collinear
with at least two of them distinct
rk{A,B ,C} ≤ 2 A,B ,C are collinear
rk{A,B ,C} = 3 A,B ,C are not collinear
rk{A,B ,C ,D} = 3 A,B ,C ,D are co-planar,
not all collinear
rk{A,B ,C ,D} = 4 A,B ,C ,D are not co-planar
rk{A,B ,C ,D,E} ≤ 2 A,B ,C ,D,E are all collinear
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 16 / 23
Axiom system to capture projective at least 3-dimensional space
Rk-Singleton ∀P : Point, rk{P} ≥ 1
Rk-Couple ∀P Q : Point,P 6= Q ⇒ rk{P ,Q} ≥ 2
Rk-Pasch ∀A B C D, rk{A,B ,C ,D} ≤ 3 ⇒∃J, rk{A,B , J} = rk{C ,D, J} = 2
Rk-Three-Points∀A B ,∃C , rk{A,B ,C} = rk{B ,C} = rk{A,C} = 2
Rk-Lower-Dimension ∃A B C D, rk{A,B ,C ,D} ≥ 4
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 17 / 23
Outline of the proof
1 general lemmas (framework)
2 proof of the 3D statement
3 proof of the 2D statement by projection
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 18 / 23
Proof technique
Using axiom R3
∀XY , rk(X ∪ Y ) + rk(X ∩ Y ) ≤ rk(X ) + rk(Y )
⇓
rk{A,B ,C ,D, I} + rk{ I} ≤ rk{A,B , I} + rk{C ,D, I}
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 19 / 23
Proof technique
Using axiom R3
∀XY , rk(X ∪ Y ) + rk(X ∩ Y ) ≤ rk(X ) + rk(Y )
6⇓
rk{A,B ,C ,D, I} + rk{A, I} ≤ rk{A,B , I} + rk{C ,D, I}
This is false. If for instance A = C , {A,B , I} ∩ {C ,D, I} = {A, I}
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 19 / 23
Proof technique
Using axiom R3
∀XY , rk(X ∪ Y ) + rk(X ∩ Y ) ≤ rk(X ) + rk(Y )
6⇓
rk{A,B ,C ,D, I} + rk{A, I} ≤ rk{A,B , I} + rk{C ,D, I}
This is false. If for instance A = C , {A,B , I} ∩ {C ,D, I} = {A, I}
Lemma (R3-alt)
∀XYI , I ⊆ X ∩ Y ⇒ rk(X ∪ Y ) + rk(I ) ≤ rk(X ) + rk(Y )
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 19 / 23
Conclusion
A formalization of duality
Models
An axiom system to capture projective geometry based on ranks.
A way to express incidence relations thanks to ranks.
A case study: Desargues.
≥ 15k lines of Coq
Future work
Automatic proofs using hexamys.
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 20 / 23
Marc Bezem and Dimitri Hendriks.On the Mechanization of the Proof of Hessenberg’s Theorem inCoherent Logic.J. of Automated Reasoning, 40(1):61–85, 2008.
Jens Brandt and Klaus Schneider.Using three-valued logic to specify and verify algorithms ofcomputational geometry.In ICFEM, volume 3785 of LNCS, pages 405–420. Springer-Verlag,2005.
Christophe Dehlinger, Jean-Francois Dufourd, and Pascal Schreck.Higher-Order Intuitionistic Formalization and Proofs in Hilbert’sElementary Geometry.In ADG’00, volume 2061 of LNAI, pages 306–324. Springer-Verlag,2000.
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 21 / 23
Jean-Francois Dufourd.Design and Formal Proof of a New Optimal Image SegmentationProgram with Hypermaps.Pattern Recognition, 40(11):2974–2993, 2007.
Frederique Guilhot.Formalisation en Coq et visualisation d’un cours de geometrie pour lelycee.TSI, 24:1113–1138, 2005.In french.
Laura Meikle and Jacques Fleuriot.Formalizing Hilbert’s Grundlagen in Isabelle/Isar.In Theorem Proving in Higher Order Logics, pages 319–334, 2003.
Laura Meikle and Jacques Fleuriot.Mechanical theorem proving in computation geometry.In Hoon Hong and Dongming Wang, editors, ADG’04, volume 3763 ofLNAI, pages 1–18. Springer-Verlag, 2005.
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 22 / 23
Dominique Michelucci and Pascal Schreck.Incidence Constraints: a Combinatorial Approach.International J. of Computational Geometry and Application,16(5-6):443–460, 2006.
Julien Narboux.Mechanical theorem proving in Tarski’s geometry.In ADG’06, volume 4869 of LNAI, pages 139–156. Springer-Verlag,2007.
David Pichardie and Yves Bertot.Formalizing convex hulls algorithms.In TPHOLs’2001, volume 2152 of LNCS, pages 346–361.Springer-Verlag, 2001.
Magaud Schreck Narboux (UdS) Formalizing projective geometry GDR LTP 23 / 23