Upload
ngodung
View
218
Download
0
Embed Size (px)
Citation preview
Verifying an algorithm computing Discrete VectorFields for digital imaging∗
J. Heras, M. Poza, and J. Rubio
Department of Mathematics and Computer Science, University of La Rioja
Calculemus 2012
∗Partially supported by Ministerio de Educacion y Ciencia, project MTM2009-13842-C02-01, and by European
Commission FP7, STREP project ForMath, n. 243847
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 1/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
ReducedChain complex
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex Chain complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
ReducedChain Complex
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex Chain complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
ReducedChain Complex
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex Chain complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
ReducedChain Complex
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Algebraic Topology and Digital Images
Digital Image
Simplicial complex Chain complex
Homology groups
C0 = Z2[vertices]C1 = Z2[edges]C2 = Z2[triangles]
H1 = Z2 ⊕ Z2 ⊕ Z2
H0 = Z2 ⊕ Z2
ReducedChain Complex
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 2/31
Motivation
Goal
Application:
Analysis of biomedical images
Requirements:
EfficiencyReliability
Goal
A formally verified efficient method to compute homology fromdigital images
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 3/31
Motivation
Goal
Application:
Analysis of biomedical images
Requirements:
EfficiencyReliability
Goal
A formally verified efficient method to compute homology fromdigital images
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 3/31
Motivation
Goal
Application:
Analysis of biomedical images
Requirements:
EfficiencyReliability
Goal
A formally verified efficient method to compute homology fromdigital images
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 3/31
Motivation
Goal
Digital Image
Simplicial Complex
Chain Complex
Homology
triangulation
graded structure
computing
properties
reduction
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 4/31
Motivation
Goal
Digital Image
Simplicial Complex
Chain Complex
Homology
triangulation
graded structure
computing
properties
reduction
J. Heras, M. Denes, G. Mata, A. Mortberg, M. Poza, and V. Siles. Towards acertified computation of homology groups. In proceedings 4th InternationalWorkshop on Computational Topology in Image Context. Lecture Notes inComputer Science, 7309, pages 49–57, 2012.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 4/31
Motivation
Goal
Digital Image
Simplicial Complex
Chain Complex
Homology
triangulation
graded structure
computing
properties
reduction
Bottleneck
Compute Homology from Chain Complexes
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 4/31
Motivation
Goal
Digital Image
Simplicial Complex
Chain Complex
Homology
triangulation
graded structure
computing
properties
reduction
Goal of this work
Formalization in Coq/SSReflect of a procedure to reduce the sizeof Chain Complexes but preserving homology
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 4/31
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 5/31
Mathematical background
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 6/31
Mathematical background
Chain Complexes
Definition
A chain complex C∗ is a pair of sequences C∗ = (Cq , dq)q∈Z where:
For every q ∈ Z, the component Cq is a Z2-module, the chain group of degree q
For every q ∈ Z, the component dq is a module morphism dq : Cq → Cq−1, thedifferential map
For every q ∈ Z, the composition dqdq+1 is null: dqdq+1 = 0
Definition
If C∗ = (Cq , dq)q∈Z is a chain complex:
The image Bq = im dq+1 ⊆ Cq is the (sub)module of q-boundaries
The kernel Zq = ker dq ⊆ Cq is the (sub)module of q-cycles
Definition
Let C∗ = (Cq , dq)q∈Z be a chain complex. For each degree n ∈ Z, the n-homologymodule of C∗ is defined as the quotient module
Hn(C∗) =Zn
Bn
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 7/31
Mathematical background
Chain Complexes
Definition
A chain complex C∗ is a pair of sequences C∗ = (Cq , dq)q∈Z where:
For every q ∈ Z, the component Cq is a Z2-module, the chain group of degree q
For every q ∈ Z, the component dq is a module morphism dq : Cq → Cq−1, thedifferential map
For every q ∈ Z, the composition dqdq+1 is null: dqdq+1 = 0
Definition
If C∗ = (Cq , dq)q∈Z is a chain complex:
The image Bq = im dq+1 ⊆ Cq is the (sub)module of q-boundaries
The kernel Zq = ker dq ⊆ Cq is the (sub)module of q-cycles
Definition
Let C∗ = (Cq , dq)q∈Z be a chain complex. For each degree n ∈ Z, the n-homologymodule of C∗ is defined as the quotient module
Hn(C∗) =Zn
Bn
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 7/31
Mathematical background
Chain Complexes
Definition
A chain complex C∗ is a pair of sequences C∗ = (Cq , dq)q∈Z where:
For every q ∈ Z, the component Cq is a Z2-module, the chain group of degree q
For every q ∈ Z, the component dq is a module morphism dq : Cq → Cq−1, thedifferential map
For every q ∈ Z, the composition dqdq+1 is null: dqdq+1 = 0
Definition
If C∗ = (Cq , dq)q∈Z is a chain complex:
The image Bq = im dq+1 ⊆ Cq is the (sub)module of q-boundaries
The kernel Zq = ker dq ⊆ Cq is the (sub)module of q-cycles
Definition
Let C∗ = (Cq , dq)q∈Z be a chain complex. For each degree n ∈ Z, the n-homologymodule of C∗ is defined as the quotient module
Hn(C∗) =Zn
Bn
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 7/31
Mathematical background Effective Homology Theory
Reduction
Definition
A reduction ρ between two chain complexes C∗ y D∗ (denoted by ρ : C∗⇒⇒D∗) is atern ρ = (f , g , h)
C∗
h
�� f++D∗
g
kk
satisfying the following relations:
1) fg = idD∗ ;
2) dC h + hdC = idC∗ − gf ;
3) fh = 0; hg = 0; hh = 0.
Theorem
If C∗⇒⇒D∗, then C∗ ∼= D∗ ⊕ A∗, with A∗ acyclic, what implies thatHn(C∗) ∼= Hn(D∗) for all n.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 8/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Morse Theory
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Given a chain complex C∗ and a dvf , V over C∗
C∗⇒⇒C c∗
generators of C c∗ are critical cells of C∗
0← Z162
d1←− Z322
d2←− Z162 ← 0
↓
0← Z2d1←− Z2
d2←− 0← 0
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 9/31
Mathematical background Discrete Morse Theory
Discrete Vector Fields
Definition
Let C∗ = (Cp , dp)p∈Z a free chain complex with distinguished Z2-basis βp ⊂ Cp . A
discrete vector field V on C∗ is a collection of pairs V = {(σi ; τi )}i∈I satisfying the
conditions:
Every σi is some element of βp , in which case τi ∈ βp+1. The degree p dependson i and in general is not constant.
Every component σi is a regular face of the corresponding τi .
Each generator (cell) of C∗ appears at most once in V .
Definition
A V -path of degree p and length m is a sequence π = ((σik , τik ))0≤k<m satisfying:
Every pair (σik , τik ) is a component of V and τik is a p-cell.
For every 0 < k < m, the component σik is a face of τik−1, non necessarily
regular, but different from σik−1.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 10/31
Mathematical background Discrete Morse Theory
Discrete Vector Fields
Definition
Let C∗ = (Cp , dp)p∈Z a free chain complex with distinguished Z2-basis βp ⊂ Cp . A
discrete vector field V on C∗ is a collection of pairs V = {(σi ; τi )}i∈I satisfying the
conditions:
Every σi is some element of βp , in which case τi ∈ βp+1. The degree p dependson i and in general is not constant.
Every component σi is a regular face of the corresponding τi .
Each generator (cell) of C∗ appears at most once in V .
Definition
A V -path of degree p and length m is a sequence π = ((σik , τik ))0≤k<m satisfying:
Every pair (σik , τik ) is a component of V and τik is a p-cell.
For every 0 < k < m, the component σik is a face of τik−1, non necessarily
regular, but different from σik−1.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 10/31
Mathematical background Discrete Morse Theory
Discrete Vector Fields
Definition
A discrete vector field V is admissible if for every p ∈ Z, a function λp : βp → N isprovided satisfying the following property: every V -path starting from σ ∈ βp has alength bounded by λp(σ).
Definition
A cell σ which does not appear in a discrete vector field V is called a critical cell.
Theorem
Let C∗ = (Cp , dp)p∈Z be a free chain complex and V = {(σi ; τi )}i∈I be an admissiblediscrete vector field on C∗. Then the vector field V defines a canonical reductionρ = (f , g , h) : (Cp , dp)⇒⇒ (C c
p , d′p) where C c
p = Z2[βcp ] is the free Z2-module generated
by the critical p-cells.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 11/31
Mathematical background Discrete Morse Theory
Discrete Vector Fields
Definition
A discrete vector field V is admissible if for every p ∈ Z, a function λp : βp → N isprovided satisfying the following property: every V -path starting from σ ∈ βp has alength bounded by λp(σ).
Definition
A cell σ which does not appear in a discrete vector field V is called a critical cell.
Theorem
Let C∗ = (Cp , dp)p∈Z be a free chain complex and V = {(σi ; τi )}i∈I be an admissiblediscrete vector field on C∗. Then the vector field V defines a canonical reductionρ = (f , g , h) : (Cp , dp)⇒⇒ (C c
p , d′p) where C c
p = Z2[βcp ] is the free Z2-module generated
by the critical p-cells.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 11/31
Mathematical background Discrete Morse Theory
Discrete Vector Fields
Definition
A discrete vector field V is admissible if for every p ∈ Z, a function λp : βp → N isprovided satisfying the following property: every V -path starting from σ ∈ βp has alength bounded by λp(σ).
Definition
A cell σ which does not appear in a discrete vector field V is called a critical cell.
Theorem
Let C∗ = (Cp , dp)p∈Z be a free chain complex and V = {(σi ; τi )}i∈I be an admissiblediscrete vector field on C∗. Then the vector field V defines a canonical reductionρ = (f , g , h) : (Cp , dp)⇒⇒ (C c
p , d′p) where C c
p = Z2[βcp ] is the free Z2-module generated
by the critical p-cells.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 11/31
Mathematical background Discrete Morse Theory
Example: an admissible discrete vector field
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 12/31
Mathematical background Discrete Morse Theory
Example: an admissible discrete vector field
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 12/31
Mathematical background Discrete Morse Theory
Example: an admissible discrete vector field
Dvf x
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 12/31
Mathematical background Discrete Morse Theory
Example: an admissible discrete vector field
Dvf x Dvf X
Admissible x
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 12/31
Mathematical background Discrete Morse Theory
Example: an admissible discrete vector field
Dvf x Dvf X
Admissible x
Dvf X
Admissible X
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 12/31
Mathematical background Discrete Morse Theory
Vector fields and integer matrices
Differential maps of a Chain Complex can be represented as matrices
. . .← Zm2
M←− Zn2 ← . . .
Definition
An admissible vector field V for M is nothing but a set of integer pairs {(ai , bi )}satisfying these conditions:
1 1 ≤ ai ≤ m and 1 ≤ bi ≤ n
2 The entry M[ai , bi ] of the matrix is 1
3 The indices ai (resp. bi ) are pairwise different
4 Non existence of loops
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 13/31
Mathematical background Discrete Morse Theory
Vector fields and integer matrices
Differential maps of a Chain Complex can be represented as matrices
. . .← Zm2
M←− Zn2 ← . . .
Definition
An admissible vector field V for M is nothing but a set of integer pairs {(ai , bi )}satisfying these conditions:
1 1 ≤ ai ≤ m and 1 ≤ bi ≤ n
2 The entry M[ai , bi ] of the matrix is 1
3 The indices ai (resp. bi ) are pairwise different
4 Non existence of loops
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 13/31
Mathematical background Discrete Morse Theory
Vector fields and integer matrices
Differential maps of a Chain Complex can be represented as matrices
. . .← Zm2
M←− Zn2 ← . . .
Definition
An admissible vector field V for M is nothing but a set of integer pairs {(ai , bi )}satisfying these conditions:
1 1 ≤ ai ≤ m and 1 ≤ bi ≤ n
2 The entry M[ai , bi ] of the matrix is 1
3 The indices ai (resp. bi ) are pairwise different
4 Non existence of loops
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 13/31
Mathematical background Discrete Morse Theory
Vector fields and integer matrices
Differential maps of a Chain Complex can be represented as matrices
. . .← Zm2
M←− Zn2 ← . . .
Definition
An admissible vector field V for M is nothing but a set of integer pairs {(ai , bi )}satisfying these conditions:
1 1 ≤ ai ≤ m and 1 ≤ bi ≤ n
2 The entry M[ai , bi ] of the matrix is 1
3 The indices ai (resp. bi ) are pairwise different
4 Non existence of loops
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 13/31
An abstract method
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 14/31
An abstract method
Coq/SSReflect
Coq:
An Interactive Proof AssistantBased on Calculus of Inductive ConstructionsInteresting feature: program extraction from a constructiveproof
SSReflect:
Extension of CoqDeveloped while formalizing the Four Color Theorem by G.GonthierCurrently, it is used in the formalization of Feit-ThompsonTheorem
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 15/31
An abstract method
Coq/SSReflect
Coq:
An Interactive Proof AssistantBased on Calculus of Inductive ConstructionsInteresting feature: program extraction from a constructiveproof
SSReflect:
Extension of CoqDeveloped while formalizing the Four Color Theorem by G.GonthierCurrently, it is used in the formalization of Feit-ThompsonTheorem
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 15/31
An abstract method
Admissible discrete vector fields in SSReflect
Definition
An admissible discrete vector field V for M is nothing but a set of integer pairs{(ai , bi )} satisfying these conditions:
1 1 ≤ ai ≤ m and 1 ≤ bi ≤ n
2 The entry M[ai , bi ] of the matrix is 1
3 The indices ai (resp. bi ) are pairwise different
4 Non existence of loops
Definition admissible_dvf (M: ’M[Z2]_(m,n))
(V: seq (’I_m * ’I_n)) (ords : simpl_rel ’I_m) :=
all [pred p | M p.1 p.2 == 1] V &&
uniq (map (@fst _ _) V) && uniq (map (@snd _ _) V) &&
all [pred i | ~~ (connect ords i i)] (map (@fst _ _) V).
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 16/31
An abstract method
The abstract algorithm
Fixpoint genDvfOrders M V (ords : simpl_rel _) k :=
if k is l.+1 then
let P := [pred ij | admissible (ij::V) M
(relU ords (gen_orders M ij.1 ij.2))] in
if pick P is Some (i,j)
then genDvfOrders M ((i,j)::V)
(relU ords (gen_orders M i j)) l
else (V, ords)
else (V, ords).
Definition gen_adm_dvf M :=
genDvfOrders M [::] [rel x y | false] (minn m n).
Lemma admissible_gen_adm_dvf m n (M : ’M[Z2]_(m,n)) :
let (vf,ords) := gen_adm_dvf M in admissible vf M ords.
Problem
It is not an executable algorithm
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 17/31
An abstract method
The abstract algorithm
Fixpoint genDvfOrders M V (ords : simpl_rel _) k :=
if k is l.+1 then
let P := [pred ij | admissible (ij::V) M
(relU ords (gen_orders M ij.1 ij.2))] in
if pick P is Some (i,j)
then genDvfOrders M ((i,j)::V)
(relU ords (gen_orders M i j)) l
else (V, ords)
else (V, ords).
Definition gen_adm_dvf M :=
genDvfOrders M [::] [rel x y | false] (minn m n).
Lemma admissible_gen_adm_dvf m n (M : ’M[Z2]_(m,n)) :
let (vf,ords) := gen_adm_dvf M in admissible vf M ords.
Problem
It is not an executable algorithm
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 17/31
An effective method
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 18/31
An effective method Methodology
Romero-Sergeraert’s Algorithm
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Algorithm
Input: A matrix MOutput: An admissible discrete vector field for M
Algorithm
Input: A chain complex C∗ and an admissible discrete vector field of C∗Output: A reduced chain complex C∗
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 19/31
An effective method Methodology
Romero-Sergeraert’s Algorithm
A. Romero and F. Sergeraert. Discrete Vector Fields and Fundamental AlgebraicTopology, 2010. http://arxiv.org/abs/1005.5685v1.
Algorithm
Input: A matrix MOutput: An admissible discrete vector field for M
Algorithm
Input: A chain complex C∗ and an admissible discrete vector field of C∗Output: A reduced chain complex C∗
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 19/31
An effective method Methodology
From computation to verification through testing
Haskell as programming language
QuickCheck to test the programs
Coq/SSReflect to verify the correctness of the programs
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 20/31
An effective method Methodology
Haskell
Algorithm (gen adm dvf )
Input: A matrix MOutput: An admissible discrete vector field for M
Algorithm (reduced cc)
Input: A chain complex C∗Output: A reduced chain complex C∗
> gen_adm_dvf [[1,0,1,1],[0,0,1,0],[1,1,0,1]]
[(0,0),(1,2),(2,1)]
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 21/31
An effective method Methodology
QuickCheck
A specification of the properties which our program must verify
Testing them
Towards verificationDetect bugs
> quickCheck M -> admissible (gen_adm_dvf M)
+ + + OK, passed 100 tests
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 22/31
An effective method Methodology
Coq/SSReflect
SSReflect Theorem:
Theorem gen_adm_dvf_is_admissible (M : seq (seq Z2)) :
admissible (gen_adm_dvf M).
SSReflect Theorem:
Theorem is_reduction (C : chaincomplex) : reduction C (reduced_cc C).
SSReflect Theorem:
Theorem reduction_preserves_betti (C D : chaincomplex)
(rho : reduction C D) : Betti C = Betti D.
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 23/31
An effective method Experimental results
Experimental results
500 randomly generated matrices
Initial size of the matrices: 100× 300
Time: 12 seconds
After reduction: 5× 50
Time: milliseconds
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 24/31
An effective method Experimental results
Experimental results
500 randomly generated matrices
Initial size of the matrices: 100× 300
Time: 12 seconds
After reduction: 5× 50
Time: milliseconds
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 24/31
Application Counting synapses
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 25/31
Application Counting synapses
Counting Synapses
Synapses are the points of connection between neurons
Relevance: Computational capabilities of the brain
Procedures to modify the synaptic density may be animportant asset in the treatment of neurological diseases
An automated and reliable method is necessary
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 26/31
Application Counting synapses
Counting Synapses
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 27/31
Application Counting synapses
Counting Synapses
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 27/31
Application Counting synapses
Counting Synapses
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 27/31
Application Counting synapses
Results with biomedical images
Without reduction procedure:
Coq is not able to compute homology of this kind of images
After reduction procedure:
Coq computes in just 25 seconds
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 28/31
Application Counting synapses
Results with biomedical images
Without reduction procedure:
Coq is not able to compute homology of this kind of images
After reduction procedure:
Coq computes in just 25 seconds
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 28/31
Conclusions and Further work
Table of Contents
1 Mathematical background
2 An abstract method
3 An effective method
4 Application
5 Conclusions and Further work
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 29/31
Conclusions and Further work
Conclusions and Further work
Conclusions:
Method to reduce big images preserving homologyFormalization of admissible discrete vector fields on CoqRemarkable reductions in different benchmarks
Further work:
Matrices with coefficients over ZIntegration between Coq and ACL2Application of homological methods to biomedical problems
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 30/31
Conclusions and Further work
Conclusions and Further work
Conclusions:
Method to reduce big images preserving homologyFormalization of admissible discrete vector fields on CoqRemarkable reductions in different benchmarks
Further work:
Matrices with coefficients over ZIntegration between Coq and ACL2Application of homological methods to biomedical problems
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 30/31
Thank you for your attention Questions?
Verifying an algorithm computing Discrete VectorFields for digital imaging
J. Heras, M. Poza, and J. Rubio
Department of Mathematics and Computer Science, University of La Rioja
Calculemus 2012
J. Heras, M. Poza, and J. Rubio Verifying an algorithm computing Discrete Vector Fields for digital imaging 31/31