Canonical Big Operators

Slides:



Advertisements
Similar presentations
Precalculus Lesson 7.2 Matrix Algebra 4/6/2017 8:43 PM
Advertisements

Math 3121 Abstract Algebra I Lecture 8 Sections 9 and 10.
Lecture 24 MAS 714 Hartmut Klauck
Formalising the structure of extremal p-groups Georges Gonthier.
Proofs and Programs Wei Hu 11/01/2007. Outline  Motivation  Theory  Lambda calculus  Curry-Howard Isomorphism  Dependent types  Practice  Coq Wei.
Factoring and Expanding Linear Expressions .
3.2 Determinants; Mtx Inverses
Lecture 15 Recursive and Iterative Formula for Determinants Shang-Hua Teng.
4.I. Definition 4.II. Geometry of Determinants 4.III. Other Formulas Topics: Cramer’s Rule Speed of Calculating Determinants Projective Geometry Chapter.
1 02/09/05CS267 Lecture 7 CS 267 Tricks with Trees James Demmel
III. Reduced Echelon Form
Properties of Matrix Operations King Saud University.
1.3 – AXIOMS FOR THE REAL NUMBERS. Goals  SWBAT apply basic properties of real numbers  SWBAT simplify algebraic expressions.
Linear Algebra With Applications by Otto Bretscher. Page The Determinant of any diagonal nxn matrix is the product of its diagonal entries. True.
3.5 Solution by Determinants. The Determinant of a Matrix The determinant of a matrix A is denoted by |A|. Determinants exist only for square matrices.
GROUPS & THEIR REPRESENTATIONS: a card shuffling approach Wayne Lawton Department of Mathematics National University of Singapore S ,
Georges Gonthier Reflection, of all shapes and sizes.
Systems of Linear Equation and Matrices
Matrix Algebra. Quick Review Quick Review Solutions.
1.4 Inverses; Rules of Matrix Arithmetic. Properties of Matrix Operations For real numbers a and b,we always have ab=ba, which is called the commutative.
1 Theorem Proving and Model Checking in PVS A PVS – An Introduction Edmund Clarke Daniel Kroening Carnegie Mellon University.
2 2.1 © 2016 Pearson Education, Inc. Matrix Algebra MATRIX OPERATIONS.
Copyright © 2011 Pearson, Inc. 7.2 Matrix Algebra.
Matrices CHAPTER 8.1 ~ 8.8. Ch _2 Contents  8.1 Matrix Algebra 8.1 Matrix Algebra  8.2 Systems of Linear Algebra Equations 8.2 Systems of Linear.
1 Put your name if you want your attendance credit. Please put your as well. CSC 320 is done at 11:30 so I did NOT fill in the box for 11:30 for.
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
CSE-490 Logic in Computer Science The Coq Proof Assistant POSTECH Dec 15, 2006 박성우.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
For real numbers a and b,we always have ab = ba, which is called the commutative law for multiplication. For matrices, however, AB and BA need not be equal.
2 2.1 © 2012 Pearson Education, Inc. Matrix Algebra MATRIX OPERATIONS.
Section 3.4 Boolean Algebra. A link between:  Section 1.3: Logic Systems  Section 3.3: Set Systems Application:  Section 3.5: Logic Circuits in Computer.
Chapter 2 … part1 Matrices Linear Algebra S 1. Ch2_2 2.1 Addition, Scalar Multiplication, and Multiplication of Matrices Definition A matrix is a rectangular.
1.7 The Distributive Property. You can use the distributive property to simplify algebraic expressions We can use the distributive property to re-write.
Lecture 1 Overview Topics 1. Proof techniques: induction, contradiction Proof techniques June 1, 2015 CSCE 355 Foundations of Computation.
The rule gives a neat formula for solving a linear system A bit of notation first. We denote by the square matrix obtained by replacing the i-th column.
4-3 Equivalent Expressions Learn factor numerical and algebraic expressions and write equivalent numerical and algebraic expression.
Copyright © Cengage Learning. All rights reserved. 7 Matrices and Determinants.
Slide INTRODUCTION TO DETERMINANTS Determinants 3.1.
1 Interactive Computer Theorem Proving CS294-9 October 19, 2006 Adam Chlipala UC Berkeley Lecture 9: Beyond Primitive Recursion.
Linear Algebra With Applications by Otto Bretscher.
Matrices Introduction.
Factoring and Expanding Linear Expressions .
CSCE 355 Foundations of Computation
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Matrix Algebra MATRIX OPERATIONS.
Group.
Formal Methods in software development
Rules of Matrix Arithmetic
Read Once Branching Programs: a model of computation used in CAD.
Gauss-Siedel Method.
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Applied Discrete Mathematics Week 4: Number Theory
CSCE 355 Foundations of Computation
Infinite Geometric Series
Propositional Calculus: Boolean Algebra and Simplification
GROUPS & THEIR REPRESENTATIONS: a card shuffling approach
1-7: The Distributive Property
Finite Automata and Formal Languages
Finite Model Theory Lecture 15
Matrices.
§2-2 Controllability of Linear Dynamical Equations
Formal Methods in software development
Chapter 3 Canonical Form and Irreducible Realization of Linear Time-invariant Systems.
Chapter 7: Matrices and Systems of Equations and Inequalities
1.3 – AXIOMS FOR THE REAL NUMBERS
Equivalent Expressions
DETERMINANT MATH 80 - Linear Algebra.
Data Parallel Pattern 6c.1
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Inverse Matrices From: D.A. Harville, Matrix Algebra from a Statistician’s Perspective, Springer. Chapter 8.
Presentation transcript:

Canonical Big Operators Yves Bertot, Georges Gonthier, Sidi Ould Biha, Ioana Paşca

Canonical Big Operators ∑Φ(n/d) md d | n ∑ai Xi i < n ⋀GCD Qi(X)‏ i = 1 n ∑ (-1)σ ∏i Ai,iσ σSn  Vi Vi ≈ W ∩ H H < G H maximal \bigcap_{H < G \atop H {\rm\ maximal}} H ∑ Xi + Yi = ∑Xi + ∑Yi i i i 25 December, 2018 Canonical Big Operators

Motivation Big operators for proof systems General description Reusable code Easy manipulation Existing libraries are less general

Example: determinants Leibnitz formula : Cauchy theorem : |AB| = |A| |B| |A| = ∑ (-1)σ ∏i Ai,iσ σSn |AB| = ∑ (-1)σ ∏i σSn (AB)i,iσ (∑j Ai,j Bj,iσ) = ∑ (-1)σ ∑ ∏i Ai,iρ σSn ρ ∏i Biρ,iσ Biρ,iσ = ∑ ∏i Ai,iρ ∑ (-1)σ ∏i Biρ,iσ σSn = ∑ ∏i Ai,iρ ∑ (-1)σ ∏j Bj,jρ-1σ i = jρ-1 ρSn ρSn ρ σSn =(∑ (-1)ρ ∏i Ai,iρ) ( ∑ (-1)τ ∏j Bj,jτ ) ρSn τSn σ = ρτ = ∑ (-1)ρ ∏i Ai,iρ ∑ (-1)τ ∏j Bj,jτ τSn ρSn = ∑ (-1)ρ ∏i Ai,iρ ∑ (-1)ρ-1σ ∏j Bj,jρ-1σ σSn ρSn ρSn + ∑ ∏i Ai,iρ |(Biρ,j)| ρSn + ∑ ∏i Ai,iρ ∑ (-1)σ ∏i Biρ,iσ σSn = |A| |B| 25 December, 2018 Canonical Big Operators

Canonical Big Operators Notation Present the options Hide or fill the options Generic filling Definition reducebig R I op nil r P (F : I -> R) : R := foldr (fun i x => if P i then op (F i) x else x) nil r. Notation "\big[ op / nil ]_ ( i <- r | P ) F" := (reducebig op nil r (fun i => P) (fun i => F)). Notation "\big[ op / nil ]_( i <- r ) F" := (\big[op/nil]_(i <- r | true) F). Notation "\sum_ ( i <- r ) F" := (\big[addn/0%nat]_(i <- r) F) : nat_scope. Notation "\big[ op / nil ]_ i F" := (\big[op/nil]_(i <- fintype.enum _) F). 25 December, 2018 Canonical Big Operators

@reducebig nat _ addn 0 (enum _) .. (fun i : _ => F i) Inferred Notation Polymorphism with dependent records Structure finType : Type := FinType { sort :> Type; enum : list sort; ... }. :> Variable I : finType. Variable F : I -> nat. sort I -> nat. Lemma null_sum : \sum_i F i = 0 -> forall i, F i = 0. @reducebig nat _ addn 0 (enum _) .. (fun i : _ => F i) I I I list (sort _) = list (sort I) 25 December, 2018 Canonical Big Operators

@reducebig nat _ addn 0 (enum _) .. (fun i : _ => V i * V i) Canonical Structures Dependent records for ad hoc polymorphism Inductive ordinal n : Type := Ordinal i of i < n. Notation “''I_' n" := (ordinal n). Definition ord_enum n : list 'I_n := … Canonical Structure ordinal_finType n := FinType 'I_n (ord_enum n) … Variable V : 'I_10 -> nat. Hypothesis normV : \sum_i V i * V i <= 3. ordinal_finType _ 10 @reducebig nat _ addn 0 (enum _) .. (fun i : _ => V i * V i) list 'I_(_) list (sort _) = list 'I_10 25 December, 2018 Canonical Big Operators

Canonical Big Operators Generic Lemmas Pull, split, reindex, exchange … Lemma big_split : forall I (r : list I) P F G, \big[*%M/1]_(i <- r | P i) (F i * G i) = \big[*%M/1]_(i <- r | P i) F i * \big[*%M/1]_(i <- r | P i) G i. ∏ (Fi *Gi ) = (∏ Fi ) * (∏ Gi ) ir, P(i) Variables F G : 'I_10 -> nat. Lemma sumnK : \sum_i (F i + G i) - \sum_i G i = \sum_i F i. Proof. by rewrite big_split addnK. Qed. 25 December, 2018 Canonical Big Operators

Canonical Big Operators Operator structures Polymorphism for values! Structure law : Type := Law { operator : T -> T -> T; _ : associative operator; _ : left_unit unit operator; _ : right_unit unit operator }. Structure abelian_law : Type := AbelianLaw { abelaw :> law; _ : commutative (operator abelaw) }. Canonical Structure addn_monoid := Law addnA add0n addn0. Canonical Structure addn_abeloid := AbelianLaw addnC. … 25 December, 2018 Canonical Big Operators

Canonical Big Operators A proof Lemma determinantM : forall n (A B : M_(n)), \det (A *m B) = \det A * \det B. Proof. move=> n A B; rewrite big_distrl /=. pose AB (f : {ffun _}) (s : 'S_n) i := A i (f i) * B (f i) (s i). transitivity (\sum_f \sum_(s : 'S_n) (-1) ^+ s * \prod_i AB f s i). rewrite exchange_big; apply: eq_bigr => /= s _. rewrite -big_distrr /=; congr (_ * _). pose F i j := A i j * B j (s i); rewrite -(bigA_distr_bigA F) /=. by apply: eq_bigr => x _; rewrite mxK. rewrite (bigID (fun f : {ffun _} => injectiveb f)) /= addrC big1 ?simp => [|f Uf]. rewrite (reindex (fun s => pval s)); last first. have s0 : 'S_n := 1%g; pose uf (f : F_(n)) := uniq (val f). exists (insubd s0) => /= f Uf; first apply: val_inj; exact: insubdK. apply: eq_big => /= [s|s _]; rewrite ?(valP s) // big_distrr /=. rewrite (reindex (mulg s)); last first. by exists (mulg s^-1) => t _; rewrite ?mulKVg ?mulKg. apply: eq_bigr => t _; rewrite big_split /= mulrA mulrCA mulrA mulrCA mulrA. rewrite -signr_addb odd_permM !pvalE; congr (_ * _). rewrite (reindex s^-1); last first. by exists (s : _ -> _) => i _; rewrite ?permK ?permKV. by apply: eq_bigr => i _; rewrite permM permKV ?eqxx // -{3}[i](permKV s). transitivity (\det (\matrix_(i, j) B (f i) j) * \prod_i A i (f i)). rewrite mulrC big_distrr /=; apply: eq_bigr => s _. rewrite mulrCA big_split //=; congr (_ * (_ * _)). case/injectivePn: Uf => i1 [i2 Di12 Ef12]. by rewrite (alternate_determinant Di12) ?simp //= => j; rewrite !mxK Ef12. Qed. \begin{eqnarray*} \det AB & = & \sum_{\sigma \in S_n} (-1)^\sigma \prod_i \left(\sum_j A_{ij} B_{j\sigma(i)}\right)\\ & = & \sum_{\phi :\; [1, n] \rightarrow [1, n]} \sum_{\sigma \in S_n} (-1)^\sigma \prod_i A_{i\phi(i)} B_{\phi(i)\sigma(i)}\\ & = & \sum_{\phi \notin S_n} \sum_{\sigma \in S_n} (-1)^\sigma \prod_i A_{i\phi(i)} B_{\phi(i)\sigma(i)} + \sum_{\phi \in S_n} \sum_{\sigma \in S_n} & = & \sum_{\phi \notin S_n} \left(\prod_i A_{i\phi(i)}\right)‏ (-1)^\sigma \prod_i B_{\phi(i)\sigma(i)}\\ & & {} + \sum_{\phi \in S_n} (-1)^\phi \left(\prod_i A_{i\phi(i)}\right)‏ (-1)^{\phi^{-1}\sigma} \prod_k B_{k\sigma(\phi^{-1}(k))}\\ \det \left(B_{\phi(i)j}\right)_{ij} + (\det A)\sum_{\tau \in S_n}(-1)^\tau \prod_k B_{k\tau(k)}\\ & = & 0 + (\det A)(\det B)\\ \end{eqnarray*} The first step swaps the iterated product of the Leibnitz formula with the sum in the general term of the matrix product, generating a sum over all functions from indices to indices. This is split into a sum over non-injective functions and a sum over permutations. The former is rearranged into a weighted sum of determinants of matrices with repeated rows, while the latter is reindexed, using the group properties of permutations, to become the desired product of determinants. 25 December, 2018 Canonical Big Operators

Canonical Big Operators More proofs Polynomials Linear algebra The Cramer formula : adj A • A = |A| • Idn The Cayley-Hamilton Theorem : PA (A) = 0 Numerical Analysis Kantorovitch’s Theorem (convergence criterion for Newton’s root-finding method for functions of several variables). Group theory : The Gaschütz, Schur-Zassenhaus, Maeschke and Hall theorems Theorem Cayley_Hamilton : forall A, (Zpoly (char_poly A)).[A] = 0. Proof. move=> A; apply/eqP; apply/factor_theorem. rewrite -phi_Zpoly -mulmx_adjl phi_mul; move: (phi _) => q; exists q. by rewrite phi_add phi_opp phi_Zpoly phi_polyC ZpolyX. Qed. 25 December, 2018 Canonical Big Operators

Canonical Big Operators Some conclusions Role of the infrastructure in organizing a library Type theory provides a rich language for expressing the intended use of theories. The key advantage is Coq’s Canonical Structure construct. Also: polymorphism, dependent records, type inference, coercions, notation Investing in theory infrastructure is most productive. 25 December, 2018 Canonical Big Operators