Our contribution (2) Implementation The development is gathered in the library Coq-Polyhedra: github.com/nhojem/Coq-Polyhedra It is based on the Mathematical Components Library [Gonthier et al., 2016]: • we extensively use its Boolean reflection methodology predicates over polyhedra bool usual statements Prop reflect • we exploit some of its components (mainly linear algebra) to formalize the simplex method. 4/33 ” logical formula ” Coq programs
Related work Existing formalizations of polyhedra HOL-Light very complete formalization of convex polyhedra, including several important results [Harrison, 2013] Isabelle implementation of a simplex-based satisfiability procedure [Spasić and Marić, 2012] Goal : obtain a practical and executable code for SMT solving Coq implementation of Fourier–Motzkin elimination on linear inequalities [Sakaguchi, 2016] In comparison, • our approach is effective, based on certificates • we use the simplex method as a mathematical tool Remark Polyhedra are also used in formal proving as “informal backend”. 5/33
A quick overview at Coq and Mathematical Components
The proof assistant Coq Main features • written in OCaml • relies on the Calculus of Inductive Constructions (CIC) • GUIs: CoqIDE, Emacs/Proof General, etc CIC very rich typed functional programming language, well-suited for implementing mathematical objects and statements CIC is an intuitionistic (constructive) logic • no excluded middle law P P • no double negation elimination P P , no reductio ad absurdum • to show x P x , you need to construct an x such that P x holds. 6/33 • developed since „ 30 years, first implementation by Coquand and Huet
The proof assistant Coq Main features • written in OCaml • relies on the Calculus of Inductive Constructions (CIC) • GUIs: CoqIDE, Emacs/Proof General, etc well-suited for implementing mathematical objects and statements CIC is an intuitionistic (constructive) logic • no excluded middle law P P • no double negation elimination P P , no reductio ad absurdum • to show x P x , you need to construct an x such that P x holds. 6/33 • developed since „ 30 years, first implementation by Coquand and Huet CIC “ very rich typed functional programming language,
The proof assistant Coq Main features • written in OCaml • relies on the Calculus of Inductive Constructions (CIC) • GUIs: CoqIDE, Emacs/Proof General, etc well-suited for implementing mathematical objects and statements CIC is an intuitionistic (constructive) logic 6/33 • developed since „ 30 years, first implementation by Coquand and Huet CIC “ very rich typed functional programming language, • no excluded middle law P _ ␣ P • no double negation elimination P ô ␣␣ P , no reductio ad absurdum • to show D x . P p x q , you need to construct an x such that P p x q holds.
• fun x => t is the function which maps x to t ; • curryfied form: fun x => fun y => t , compared with fun (x,y) => t • nat , bool Digression on functional languages and types Functional = functions are terms like any other (constants, variables, etc) Notation • f x stands for the application of f to x (compared with f(x) in most imperative languages); Example • if f and g are two functions, f g stands for their composition. • lots of pattern matching , loops implemented via recursion , etc Types Every term comes with a type, for instance: • A -> B : functions from A to B 7/33
• nat , bool Digression on functional languages and types Functional = functions are terms like any other (constants, variables, etc) Notation • f x stands for the application of f to x (compared with f(x) in most imperative languages); Example • if f and g are two functions, f g stands for their composition. • lots of pattern matching , loops implemented via recursion , etc Types Every term comes with a type, for instance: • A -> B : functions from A to B 7/33 • fun x => t is the function which maps x to t ; • curryfied form: fun x => fun y => t , compared with fun (x,y) => t
• nat , bool Digression on functional languages and types Functional = functions are terms like any other (constants, variables, etc) Notation • f x stands for the application of f to x (compared with f(x) in most imperative languages); Example • if f and g are two functions, f g stands for their composition. • lots of pattern matching , loops implemented via recursion , etc Types Every term comes with a type, for instance: • A -> B : functions from A to B 7/33 • fun x => t is the function which maps x to t ; • curryfied form: fun x => fun y => t , compared with fun (x,y) => t
Digression on functional languages and types Functional = functions are terms like any other (constants, variables, etc) Notation • f x stands for the application of f to x (compared with f(x) in most imperative languages); Example • if f and g are two functions, f g stands for their composition. • lots of pattern matching , loops implemented via recursion , etc Types Every term comes with a type, for instance: • nat , bool • A -> B : functions from A to B 7/33 • fun x => t is the function which maps x to t ; • curryfied form: fun x => fun y => t , compared with fun (x,y) => t
Checking proof: Curry–Howard isomorphism A -> B B and A hold, then B holds if A f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! False False xA(x) x A x B General correspondence principle between logical formulas and types A A + B B A A * B B A x:A proof x of A the type A lives in the sort Prop A A Type Formula 8/33
Checking proof: Curry–Howard isomorphism B B and A hold, then B holds if A f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! False False xA(x) x A x A -> B A General correspondence principle between logical formulas and types A + B B A A * B B A the term x has type A x:A proof x of A the type A lives in the sort Prop A A Type Formula 8/33
Checking proof: Curry–Howard isomorphism B B and A hold, then B holds if A f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! False False xA(x) x A x A -> B A General correspondence principle between logical formulas and types A + B B A the type of pairs (a,b) , where a:A , b:B A * B the term x has type A x:A proof x of A the type A lives in the sort Prop A A Type Formula 8/33 A ^ B
Checking proof: Curry–Howard isomorphism B B and A hold, then B holds if A f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! False False xA(x) x A x A -> B A General correspondence principle between logical formulas and types “sum type”, either a:A or b:B A + B the type of pairs (a,b) , where a:A , b:B A * B the term x has type A x:A proof x of A the type A lives in the sort Prop A A Type Formula 8/33 A ^ B A _ B
Checking proof: Curry–Howard isomorphism The kernel of Coq checks that the type of terms is correct w.r.t. a set of from a proof of A x A x xA(x) False False Coq is a typechecker! inference rules. A -> B Example f : A -> B a : A f a : B if A B and A hold, then B holds function which returns a proof of B 8/33 General correspondence principle between logical formulas and types x:A Formula Type A A the type A lives in the sort Prop proof x of A the term x has type A A * B the type of pairs (a,b) , where a:A , b:B A + B “sum type”, either a:A or b:B A ^ B A _ B A ù ñ B
Checking proof: Curry–Howard isomorphism General correspondence principle between logical formulas and types B and A hold, then B holds if A f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! False False dependent product from a proof of A function which returns a proof of B A -> B 8/33 the type A lives in the sort Prop “sum type”, either a:A or b:B A + B Formula Type A the type of pairs (a,b) , where a:A , b:B A * B A the term x has type A x:A proof x of A A ^ B A _ B A ù ñ B @ x . A p x q Π xA(x)
Checking proof: Curry–Howard isomorphism The kernel of Coq checks that the type of terms is correct w.r.t. a set of from a proof of A dependent product False False empty type Coq is a typechecker! inference rules. General correspondence principle between logical formulas and types Example f : A -> B a : A f a : B if A B and A hold, then B holds function which returns a proof of B A -> B 8/33 the type A lives in the sort Prop “sum type”, either a:A or b:B Formula Type A + B A the type of pairs (a,b) , where a:A , b:B A * B A the term x has type A x:A proof x of A A ^ B A _ B A ù ñ B @ x . A p x q Π xA(x)
Checking proof: Curry–Howard isomorphism The kernel of Coq checks that the type of terms is correct w.r.t. a set of from a proof of A dependent product False False empty type Coq is a typechecker! inference rules. General correspondence principle between logical formulas and types Example f : A -> B a : A f a : B if A B and A hold, then B holds function which returns a proof of B A -> B 8/33 the type A lives in the sort Prop “sum type”, either a:A or b:B Formula Type A + B A the type of pairs (a,b) , where a:A , b:B A * B A the term x has type A x:A proof x of A A ^ B A _ B A ù ñ B @ x . A p x q Π xA(x)
Checking proof: Curry–Howard isomorphism General correspondence principle between logical formulas and types f a : B a : A f : A -> B Example inference rules. The kernel of Coq checks that the type of terms is correct w.r.t. a set of Coq is a typechecker! empty type False False dependent product from a proof of A function which returns a proof of B A -> B 8/33 x:A Formula Type A A the type A lives in the sort Prop proof x of A the term x has type A A * B the type of pairs (a,b) , where a:A , b:B A + B “sum type”, either a:A or b:B A ^ B A _ B A ù ñ B @ x . A p x q Π xA(x) ” if A ù ñ B and A hold, then B holds
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
The Mathematical Components library Called MathComp for short. • developed by Gonthier et al. for the formal proof of the Four Color Theorem and Feit–Thompson Theorem • relies on small scale reflection principle: proof by computation rather than by logical derivation • large hierarchy of mathematical objects: linear algebra, finite groups, algebraic numbers, representation theory, etc • powerful set of tactics • freely distributed, available at https://github.com/math-comp/math-comp • a book (Mahboubi and Tassi), under development https://math-comp.github.io/mcb/ Examples! 9/33
A /\ B A \/ B ~ A allows case analysis, reductio ad absurdum, etc overcome the intuitionistic restriction of CIC bool behaves like the classical logic ! Pros of bool [forall i, p i] forall x, P x ~~ a Boolean reflection a || b Two different worlds: a && b true, false True, False bool Prop • Boolean algebra, i.e., the type bool := true | false . 10/33 • logical formulas of CIC, which live in the sort Prop
Boolean reflection a || b allows case analysis, reductio ad absurdum, etc overcome the intuitionistic restriction of CIC bool behaves like the classical logic ! Pros of bool [forall i, p i] forall x, P x ~~ a ~ A 10/33 Two different worlds: a && b true, false True, False bool Prop • Boolean algebra, i.e., the type bool := true | false . • logical formulas of CIC, which live in the sort Prop A /\ B A \/ B
Boolean reflection Two different worlds: allows case analysis, reductio ad absurdum, etc bool behaves like the classical logic ! Pros of bool [forall i, p i] forall x, P x ~~ a ~ A a || b a && b true, false True, False bool Prop • Boolean algebra, i.e., the type bool := true | false . 10/33 • logical formulas of CIC, which live in the sort Prop A /\ B A \/ B ù ñ overcome the intuitionistic restriction of CIC
• either P holds and b = true , • or ~ P holds and b = false . Boolean reflection (2) But using of bool • requires to implement a decision procedure in the CIC: Booleans are computed by Coq functions • is less convenient to manipulate the logical part of formulas. MathComp combines the best of the two worlds Prop and bool , via the Boolean reflection methodology : Reflection predicate reflect P b essentially means that P:Prop and b:bool are equivalent: MathComp provides reflection views to pass from bool to Prop , and vice versa. Examples! 11/33
• either P holds and b = true , • or ~ P holds and b = false . Boolean reflection (2) • is less convenient to manipulate the logical part of formulas. Examples! and vice versa. MathComp provides reflection views to pass from bool to Prop , essentially means that P:Prop and b:bool are equivalent: reflect P b Reflection predicate via the Boolean reflection methodology : MathComp combines the best of the two worlds Prop and bool , eqn : nat -> nat -> bool But using of bool About eqn. end. | m'.+1, n'.+1 => eqn m' n' | 0, 0 => true match m, n with Fixpoint eqn m n {struct m} := Decidable equality over naturals (type nat ) Example Booleans are computed by Coq functions • requires to implement a decision procedure in the CIC: 11/33 | _, _ => false
• either P holds and b = true , • or ~ P holds and b = false . Boolean reflection (2) But using of bool • requires to implement a decision procedure in the CIC: Booleans are computed by Coq functions • is less convenient to manipulate the logical part of formulas. MathComp combines the best of the two worlds Prop and bool , via the Boolean reflection methodology : Reflection predicate reflect P b essentially means that P:Prop and b:bool are equivalent: MathComp provides reflection views to pass from bool to Prop , and vice versa. Examples! 11/33
• either P holds and b = true , • or ~ P holds and b = false . Boolean reflection (2) reflect P b Examples! and vice versa. MathComp provides reflection views to pass from bool to Prop , essentially means that P:Prop and b:bool are equivalent: Reflection predicate But using of bool via the Boolean reflection methodology : • is less convenient to manipulate the logical part of formulas. Booleans are computed by Coq functions • requires to implement a decision procedure in the CIC: 11/33 ù ñ MathComp combines the best of the two worlds Prop and bool ,
Boolean reflection (2) But using of bool Examples! and vice versa. MathComp provides reflection views to pass from bool to Prop , essentially means that P:Prop and b:bool are equivalent: reflect P b Reflection predicate via the Boolean reflection methodology : • is less convenient to manipulate the logical part of formulas. Booleans are computed by Coq functions • requires to implement a decision procedure in the CIC: 11/33 ù ñ MathComp combines the best of the two worlds Prop and bool , • either P holds and b = true , • or ~ P holds and b = false .
Boolean reflection (2) But using of bool Examples! and vice versa. essentially means that P:Prop and b:bool are equivalent: reflect P b Reflection predicate via the Boolean reflection methodology : • is less convenient to manipulate the logical part of formulas. Booleans are computed by Coq functions • requires to implement a decision procedure in the CIC: 11/33 ù ñ MathComp combines the best of the two worlds Prop and bool , • either P holds and b = true , • or ~ P holds and b = false . ` MathComp provides reflection views to pass from bool to Prop ,
Formalizing the simplex method
The purpose of the simplex method Example subject to minimize Linear programming x 1 x 2 minimize subject to 12/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . 3 x 1 ` x 2 x 1 ` x 2 ě 4 ´ x 1 ´ 3 x 2 ě ´ 23 4 x 1 ´ x 2 ě 1 ´ 2 x 1 ` x 2 ě ´ 11 x 2 ě 1
The purpose of the simplex method Linear programming c x 2 x 1 c x 2 x 1 x 2 x 1 the LP is infeasible (empty feasible set) • equal to the LP is unbounded (no lower bound) • equal to • finite (optimal point) The value of the linear program can be subject to minimize 13/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . ´ c
The purpose of the simplex method Linear programming c x 2 x 1 x 2 x 1 c x 2 x 1 the LP is infeasible (empty feasible set) • equal to • finite (optimal point) The value of the linear program can be subject to minimize 13/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . • equal to ´8 (no lower bound) ù ñ the LP is unbounded ´ c
The purpose of the simplex method Linear programming x 2 x 1 c x 2 x 1 c x 2 x 1 13/33 The value of the linear program can be • finite (optimal point) subject to minimize x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . • equal to ´8 (no lower bound) ù ñ the LP is unbounded • equal to `8 (empty feasible set) ù ñ the LP is infeasible ´ c
n Ax A T u b is empty if and only if the value of the following LP is : maximize b u subject to The purpose of the simplex method (2) The polyhedron x u 0 u m Fit the Boolean reflection framework Emptiness of polyhedra can be defined as a Boolean predicate , relying on the simplex method. 0 Corollary (Farkas Lemma) The simplex method can be thought of as a decision procedure . and a dual feasible point u . A linear program minimize subject to The dual LP maximize 14/33 subject to Theorem (Strong duality) If one of the two LPs is feasible, then they have the same optimal value . (…) In addition, when both are feasible, the optimal value is simultaneously attained by a primal feasible point x x b , u y x c , x y A T u “ c , u ě 0 , u P R m Ax ě b , x P R n
n Ax The purpose of the simplex method (2) following LP is : maximize b u subject to A T u u 0 0 u m Fit the Boolean reflection framework Emptiness of polyhedra can be defined as a Boolean predicate , relying on the simplex method. b is empty if and only if the value of the The polyhedron x The simplex method can be thought of as a decision procedure . Corollary (Farkas Lemma) A linear program minimize subject to The dual LP maximize 14/33 subject to Theorem (Strong duality) If one of the two LPs is feasible, then they have the same optimal value . (…) In addition, when both are feasible, the optimal value is simultaneously x b , u y x c , x y A T u “ c , u ě 0 , u P R m Ax ě b , x P R n attained by a primal feasible point x ˚ and a dual feasible point u ˚ .
The purpose of the simplex method (2) The simplex method can be thought of as a decision procedure . the simplex method. Emptiness of polyhedra can be defined as a Boolean predicate , relying on Fit the Boolean reflection framework subject to maximize Corollary (Farkas Lemma) If one of the two LPs is feasible, then they have the same optimal value . (…) Theorem (Strong duality) subject to maximize The dual LP subject to minimize A linear program 14/33 x b , u y x c , x y A T u “ c , u ě 0 , u P R m Ax ě b , x P R n The polyhedron t x P R n : Ax ě b u is empty if and only if the value of the following LP is `8 : x b , u y A T u “ 0 , u ě 0 , u P R m
The purpose of the simplex method (2) The simplex method can be thought of as a decision procedure . the simplex method. Emptiness of polyhedra can be defined as a Boolean predicate , relying on Fit the Boolean reflection framework subject to maximize Corollary (Farkas Lemma) If one of the two LPs is feasible, then they have the same optimal value . (…) Theorem (Strong duality) subject to maximize The dual LP subject to minimize A linear program 14/33 x b , u y x c , x y A T u “ c , u ě 0 , u P R m Ax ě b , x P R n The polyhedron t x P R n : Ax ě b u is empty if and only if the value of the following LP is `8 : x b , u y A T u “ 0 , u ě 0 , u P R m
• y >=m z is a notation for [forall i, y i 0 >= z i 0] The purpose of the simplex method (3) Variable c: 'cV_n. (* col. vector of size n *) '[c,x] , notation for \sum_(i < n) c_i * x_i . Objective function x \in polyhedron A b reduces to A *m x >=m b . • *m is the matrix product Definition polyhedron A b := [pred x:'cV_n | (A *m x) >=m b]. The feasible set is formalized via a Boolean predicate Variable b: 'cV_m. (* col. vector of size m *) Linear programming Variable A: 'M_(m,n). (* matrix of size m*n *) Global variables: subject to minimize 15/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i .
The purpose of the simplex method (3) Linear programming '[c,x] , notation for \sum_(i < n) c_i * x_i . Objective function • y >=m z is a notation for [forall i, y i 0 >= z i 0] • *m is the matrix product Definition polyhedron A b := [pred x:'cV_n | (A *m x) >=m b]. The feasible set is formalized via a Boolean predicate Variable c: 'cV_n. (* col. vector of size n *) Variable b: 'cV_m. (* col. vector of size m *) Variable A: 'M_(m,n). (* matrix of size m*n *) Global variables: subject to minimize 15/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . ù ñ x \in polyhedron A b reduces to A *m x >=m b .
The purpose of the simplex method (3) Variable A: 'M_(m,n). (* matrix of size m*n *) • y >=m z is a notation for [forall i, y i 0 >= z i 0] • *m is the matrix product Definition polyhedron A b := [pred x:'cV_n | (A *m x) >=m b]. The feasible set is formalized via a Boolean predicate Variable c: 'cV_n. (* col. vector of size n *) Linear programming Variable b: 'cV_m. (* col. vector of size m *) Global variables: subject to minimize 15/33 x c , x y Ax ě b , x P R n where A P R m ˆ n , b P R n , c P R n , and x c , x y : “ ř n i “ 1 c i x i . ù ñ x \in polyhedron A b reduces to A *m x >=m b . Objective function ” '[c,x] , notation for \sum_(i < n) c_i * x_i .
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33 3. up to finding an optimal vertex
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33 • bases encode vertices
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33 • reduced costs determine optimality
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33 • pivoting switches from a vertex to
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Geometric interpretation of the simplex method 1. starting from an initial vertex 2. iterate over the vertex-edge graph while decreasing the objective function 3. up to finding an optimal vertex Three ingredients : • bases encode vertices • reduced costs determine optimality • pivoting switches from a vertex to another or determines if the LP is unbounded x 1 x 2 x 1 x 2 16/33
Bases 1 (qinvmx [...] (row_submx A I)) *m (row_submx b I). Definition point_of_basis (I:basis) := where we have defined: FeasibleBasis (I:basis) of point_of_basis I \in polyhedron A b Inductive feasible_basis := Basis (I:prebasis) of row_free (row_submx A I). Inductive basis := Inductive prebasis := Prebasis (I: {set 'I_m}) of (#|I| == n). Bases are formalized via three layers of types: 5 4 3 2 17/33 Definition subject to minimize x 2 x 1 The basis is feasible when the basic point belongs to the polyhedron. has a unique solution, called the basic point . A basis is a subset I Ă t 1 , . . . , m u of cardinality n such that the system A i x “ b i , i P I 3 x 1 ` x 2 x 1 ` x 2 ě 4 ´ x 1 ´ 3 x 2 ě ´ 23 4 x 1 ´ x 2 ě 1 ´ 2 x 1 ` x 2 ě ´ 11 x 2 ě 1 t 4 , 5 u
Bases Inductive basis := (qinvmx [...] (row_submx A I)) *m (row_submx b I). Definition point_of_basis (I:basis) := where we have defined: FeasibleBasis (I:basis) of point_of_basis I \in polyhedron A b Inductive feasible_basis := Basis (I:prebasis) of row_free (row_submx A I). Inductive prebasis := Prebasis (I: {set 'I_m}) of (#|I| == n). Definition Bases are formalized via three layers of types: The basis is feasible when the basic point belongs to the polyhedron. has a unique solution, called the basic point . 17/33 A basis is a subset I Ă t 1 , . . . , m u of cardinality n such that the system A i x “ b i , i P I
Bases Inductive basis := (qinvmx [...] (row_submx A I)) *m (row_submx b I). Definition point_of_basis (I:basis) := where we have defined: FeasibleBasis (I:basis) of point_of_basis I \in polyhedron A b Inductive feasible_basis := Basis (I:prebasis) of row_free (row_submx A I). Inductive prebasis := Prebasis (I: {set 'I_m}) of (#|I| == n). Definition Bases are formalized via three layers of types: The basis is feasible when the basic point belongs to the polyhedron. has a unique solution, called the basic point . 17/33 A basis is a subset I Ă t 1 , . . . , m u of cardinality n such that the system A i x “ b i , i P I
Bases Definition (qinvmx [...] (row_submx A I)) *m (row_submx b I). Definition point_of_basis (I:basis) := where we have defined: FeasibleBasis (I:basis) of point_of_basis I \in polyhedron A b Inductive feasible_basis := Basis (I:prebasis) of row_free (row_submx A I). Inductive basis := Inductive prebasis := Prebasis (I: {set 'I_m}) of (#|I| == n). Bases are formalized via three layers of types: The basis is feasible when the basic point belongs to the polyhedron. has a unique solution, called the basic point . 17/33 A basis is a subset I Ă t 1 , . . . , m u of cardinality n such that the system A i x “ b i , i P I = submatrix A I
Bases Inductive basis := (qinvmx [...] (row_submx A I)) *m (row_submx b I). Definition point_of_basis (I:basis) := where we have defined: FeasibleBasis (I:basis) of point_of_basis I \in polyhedron A b Inductive feasible_basis := Basis (I:prebasis) of row_free (row_submx A I). Inductive prebasis := Prebasis (I: {set 'I_m}) of (#|I| == n). Definition Bases are formalized via three layers of types: The basis is feasible when the basic point belongs to the polyhedron. has a unique solution, called the basic point . 17/33 A basis is a subset I Ă t 1 , . . . , m u of cardinality n such that the system A i x “ b i , i P I
Reduced costs: optimality certificate forall x, x \in polyhedron A b -> u b u b 0 b A x 0 u u A x c x Proof sketch '[c, point_of_basis I] <= '[c, x]. reduced_cost >=m 0 -> Variable I : feasible_basis. Lemma optimality_certificate : (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := In Coq, this simply writes as: c T u A of the system is defined as the unique solution u The reduced cost vector at basis Definition 18/33
Reduced costs: optimality certificate Proof sketch u b u b 0 b A x 0 u u A x c x '[c, point_of_basis I] <= '[c, x]. Variable I : feasible_basis. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> Lemma optimality_certificate : (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := In Coq, this simply writes as: of the system Definition 18/33 The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c .
Reduced costs: optimality certificate Proof sketch u b u b 0 b A x 0 u u A x c x '[c, point_of_basis I] <= '[c, x]. Variable I : feasible_basis. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> Lemma optimality_certificate : (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := In Coq, this simply writes as: of the system Definition 18/33 The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c .
Reduced costs: optimality certificate Proof sketch u b u b 0 b A x 0 u u A x c x '[c, point_of_basis I] <= '[c, x]. Variable I : feasible_basis. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> Lemma optimality_certificate : (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := In Coq, this simply writes as: of the system Definition 18/33 The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c .
Reduced costs: optimality certificate Proof sketch u b u b 0 b A x 0 u u A x c x '[c, point_of_basis I] <= '[c, x]. Variable I : feasible_basis. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> Lemma optimality_certificate : (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := In Coq, this simply writes as: of the system Definition 18/33 The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c .
Reduced costs: optimality certificate Lemma optimality_certificate : u b u Variable I : feasible_basis. '[c, point_of_basis I] <= '[c, x]. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> Proof sketch (qinvmx [...] (row_submx A I))^T *m c. Definition reduced_cost := Definition 18/33 of the system In Coq, this simply writes as: The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c . x c , x y “ x u , A I x y “ x , A I x ´ b I y ` x u , b I y lo omo on loooomoooon ě 0 ď 0
Reduced costs: optimality certificate Lemma optimality_certificate : u Proof sketch Variable I : feasible_basis. forall x, x \in polyhedron A b -> reduced_cost >=m 0 -> '[c, point_of_basis I] <= '[c, x]. (qinvmx [...] (row_submx A I))^T *m c. Definition Definition reduced_cost := 18/33 of the system In Coq, this simply writes as: The reduced cost vector at basis I is defined as the unique solution u P R I p A I q T u “ c . x c , x y “ x u , A I x y “ x , A I x ´ b I y ` x u , b I y ď x u , b I y lo omo on loooomoooon ě 0 ď 0
Pivoting x 1 '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace c x 2 19/33 If the reduced cost vector has some negative entries: x 2 x 1 the LP is unbounded • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. ´ c
Pivoting x 1 '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace c x 2 19/33 If the reduced cost vector has some negative entries: x 2 x 1 the LP is unbounded • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. ´ c
Pivoting x 1 '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace c x 2 19/33 If the reduced cost vector has some negative entries: x 2 x 1 the LP is unbounded • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. ´ c
Pivoting x 1 '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace c x 2 x 1 x 2 the LP is unbounded If the reduced cost vector has some negative entries: • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: '[c, direction] < 0. Lemma direction_improvement : (qinvmx [...] (row_submx A I)) *m ei. let: ei := (delta_mx i 0) in Definition direction := • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. 19/33 ´ c
Pivoting x 1 '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace c x 2 c If the reduced cost vector has some negative entries: x 2 x 1 the LP is unbounded • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. 19/33
Pivoting If the reduced cost vector has some negative entries: '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace x 2 x 1 c x 2 x 1 i.e., the halfline is contained in the polyhedron • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. 19/33 ´ c ù ñ the LP is unbounded
Pivoting If the reduced cost vector has some negative entries: '[c, point_of_basis next_I] <= '[c, point_of_basis I]. Fact [...]: new_halfspace |: (I :\ (enum_val [...] i)). Definition next_I := the index new_halfspace is used to build the next basis: Definition new_halfspace := [...] • or, the halfline hits the boundary of a new halfspace forall M, exists x, (x \in polyhedron A b) /\ ('[c,x] < M) Lemma unbounded_certificate : (A *m direction) >=m 0 -> x 2 x 1 c x 2 x 1 i.e., the halfline is contained in the polyhedron • the direction is feasible : (A *m direction) >=m 0 At this stage, two possibilities: • decreases the objective function • follows an incident edge we can build a direction vector which Hypothesis [...] : reduced_cost i 0 < 0. Variable i : 'I_#|I|. 19/33 ´ c ù ñ the LP is unbounded
Recommend
More recommend