Equivalence Classes

Equivalence Classes

Defining Functions on Equivalence Classes Lawrence C. Paulson, Computer Laboratory, University of Cambridge Outline of Talk 1. Review of equivalence relations and quotients 2. General lemmas for defining quotients formally 3. Detailed development of the integers 4. Brief treatment of a quotiented datatype 2 Quotient Constructions Identify values according to an equivalence relation • terms that differ only by bound variable names • numbers that leave the same residue modulo p numerous applications in algebra, topology, etc. • quotient constructions of the integers, rationals and non-standard reals; quotient groups and rings Where are the applications in automated proof? 3 Definitions • An equivalence relation ∼ on a set A is any relation that is reflexive (on A), symmetric and transitive. • An equivalence class [x]∼ contains all y where y ∼ x (for x ∈ A) • If ∼ is an equivalence relation on A, then the quotient space A/∼ is the set of all equivalence classes • The equivalence classes form a partition of A 4 Examples The integers: equivalence classes on ℕ×ℕ The integers can be defined• as equivalence classes on pairs of natural numbers related by The integers can be defined as equivalence classes on pairs of natural numbers related by (x, y) (x(u, ,yv) ) (u, v)x v xu vy u y ∼ ∼⇐⇒ ⇐+⇒= ++ = + ≠0 The rational numbers can beThedefined asrationals:equivalence classes equivalencon pairs of integerserelated clabysses on ℤ×ℤ The rational• numbers can be defined as equivalence classes on pairs of integers related by (x, y) (x(u, ,yv) ) (u, v)xv uyxv (uyy, v (0y), v 0) ∼ ∼⇐⇒ ⇐=⇒ = $= $= The integers can be defined using a signed magnitude representation. The rational numbers can be defined as fractions in reduced form. The integers• canλ-betdefinederms:using equivalenca signed magnitude representation.e classesThe onrational α-numbersequivalenccan be definedeas fractions in reduced form. The[x] hyisperreals:the equiv inalencefinitclasse sequency esy ofx reals • ∼ [x] is the equivalence class y y x ∼ { | ∼{ }| ∼ } The equivalence relation partitions(quotientthe set A. Theedquotient withset Arespect/ is defined to tbeothe anset ofultrageneratedfiltby er. ) The equivalence relation partitions the set A. The quotient∼ set A/ is defined to be the set of ∼generated by . Let us examine the construction of the integers. ∼ ∼ Let us examine the construction of the integers. 5 [(x, y)][(xrepresents, y)] representsthe integerthe intex gery x y − − 2 2 The integers can be defined as equivalence classes on pairs of natural numbers related by (x, y) (u, v) x v u y ∼ ⇐⇒ + = + The rational numbers can be defined as equivalence classes on pairs of integers related by (x, y) (u, v) xv uy (y, v 0) ∼ ⇐⇒ = $= The integers can be defined using a signed magnitude representation. The rational numbers can be defined as fractions in reduced form. [x] is the equivalence class y y x ∼ { | ∼ } The equivalence relation partitions the set A. The quotient set A/ is defined to be the set of generated by . ∼ ∼ Let us examine the constructionConstrof the integers.ucting the Integers [(x, y)] represents the integer x y − The integer operations on equivalence classes: 0 [(0, 0)] = [(x, y)] 2[(y, x)] − = [(x, y)] [(u, v)] [(x u, y v)] + = + + [(x, y)] [(u, v)] [(xu yv, xv vu)] × = + + Such definitions are only leFgitimateunctionif they are deindependentfinitionsof the particular mustelements preserchosen fromvethe theequiv alence classes. To prove equivalence relation. Then the choice ( z) z of representative− −does= not matter. write the integer z as [(x, y)]. ( [(x, y)]) [(y, x)] [(x, y)] − − = −6 = The proof that addition is associative appeals to the corresponding property for the natural numbers: [(x , y )] [(x , y )] [(x , y )] [(x x x , y y y ]) 1 1 + 2 2 + 3 3 = 1 + 2 + 3 1 + 2 + 3 [(x , y )] [(x , y )] [(x , y )] ! " = 1 1 + 2 2 + 3 3 3 ! " 0 [(0, 0)] = [(x, y)] [(y, x)] − = [(x, y)] [(u, v)] [(x u, y v)] + = + + [(x, y)] [(u, v)] [(xu yv, xv vu)] × = + + Such definitions are only legitimate if they are independent of the particular elements chosen from the equivalence classes. To prove Sample Proof: ( z) z 0 [(0, 0)] = − − = [(x, y)] [(y, x)] write the integer z as [(x, y)]. − = [(x, y)] [(u, v)] [(x u, y v)] + = + + [(x, y)] [(u, v)] [(xu yv, xv vu)] • Replace z× by an( arbitrar=[(x,y +equivalency)]) + e cla[(ssy, x)] [(x, y)] Such definitions are only legitimate if they are independent− −of the particular0 elements[(0,chosen0)]=from the−equivalence classes. = = Rewrite using [(x, y)] [(y, x)] To prove • − = [(x, y)] [((uz,)v)] z [(x u, y v)] The proof that addition is associative appeals+− −to =the=corresponding+ + property for the natural numbers: • Proof is trivial:[(x, y)] [(u, v)] [(xu yv, xv vu)] write the integer z as [(x, y)]. × = + + ( , Such definitions) are only(le(gitimate[,(xif,theyy))are]) independent[(yof,the(x)particular] ,[(elementsx, y))chosen] from the(equivalence classes. , ) [ x1 y1 ] [−x−2 y2 ]= − [ x3= y3 ] [ x1 x2 x3 y1 y2 y3] To prove + + = + + + + The proof that addition is associative appeals to the corresponding property( forzthe) naturalz numbers: [(x1, y1)] [(x2, y2)] [(x3, y3)] ! " − − = = + + [(x ,writey )the] integer[(xz as,[(yx, )y)]]. [(x , y )] [(x x x , y y y ]) 1 1 + 2 2 + 3 3 = 1 + 2 + 3 1 + 2 + 3 ( , ) ( , ) ( , ) ! " ( [(x, y)])[ x1 y[(1y], x)][ x2[(xy32, y])] [ x3 y3 ] ! " − − = 7= − + = + 3 ! " The proof that addition is associative appeals to the corresponding property for the natural numbers: [(x , y )] [(x , y )] [(x , y )] [(x x x , y y y ]) 1 1 + 2 2 + 3 3 = 1 + 2 + 3 1 + 2 + 3 [(x , y )] [(x , y )] [(x , y )] ! " = 1 1 + 2 2 + 3 3 3 ! " 0 [(0, 0)] = [(x, y)] [(y, x)] − = [(x, y)] [(u, v)] [(x u, y v)] + = + + [(x, y)] [(u, v)] [(xu yv, xv vu)] Proof that× += is Associative+ + Such definitions are only legitimate if they are independent of the particular elements chosen from the equivalence classes. To prove ( z) z Replace each integer −by− a pair= of natural numbers. write the integer z as [(x, y)]. ( [(x, y)]) [(y, x)] [(x, y)] Prove by associativity− − =of− + on the= naturals The proof that addition is associative appeals to the corresponding property for the natural numbers: [(x , y )] [(x , y )] [(x , y )] [(x x x , y y y ]) 1 1 + 2 2 + 3 3 = 1 + 2 + 3 1 + 2 + 3 [(x , y )] [(x , y )] [(x , y )] ! " = 1 1 + 2 2 + 3 3 3 ! " 8 Alternatives to Quotients • λ-terms? Use de Bruijn’s treatment of variables ✓ • Integers as signed natural numbers? Ugly, with massive case analyses ✗ • Rationals as reduced fractions? Requires serious reasoning about greatest common divisors ✗ • Hyperreals? Quotient groups? ✗✗✗ 9 A Formalization of Equivalence Classes R“ x denotes y (x, y) R : the equivalence class [x] { } { | ∈ } R theorem eq equiv class iff: "[[equiv A r; x A; y A]] (r‘‘{x} = r‘‘{y})∈ =∈((x,y) r)" "⇒ ∈ The quotient set is definedFtoormalizingbe the set of equivalence classes. Quotients "A//r x A. {r‘‘{x}}" ≡ ∈ set comprehensions as unions and singleton sets Set comprehensionsA!Formalization of asEqui nestvalenceed unionsClass esof singletons R“ x denotes y (x, y) R : the equivalence class [x]R f (x , . , x ){ }x A , . {. ,|x A ∈ } . f (x , . , x ) { 1 n | 1 ∈ 1 n ∈ n} = { 1 n } theorem eq equiv classx1iff:A1 xn An "∈ "∈ " equiv A r; x A; y A Congruence-preserving property:[[ ]] (r‘‘{x} = r‘‘{y})∈ =∈((x,y) r)" congruentExampler : fthis"⇒ deyfinitionz. (y,z) of a quotientr spacf ye= f z∈ The quotient≡set∀is defined to be the set of equi∈valence classes.−→ "A//r x 4 A. {r‘‘{x}}" ≡ ∈ set comprehensions as unions and singleton sets ! The equivalencf (x , . , xe cla) xss [x]A , . , x A . f (x , . , x ) { 1 n | 1 ∈ 1 n ∈ n} = { 1 n } x A x A 1∈ 1 n∈ n 10 " " Congruence-preserving property: congruent r f y z. (y,z) r f y = f z ≡ ∀ ∈ −→ 4 Typical theorem: [x] = [y] A Formalizationif andof Equionlvalencey ifClass x es∼ y R“ x denotes y (x, y) R : the equivalence class [x] { } { | ∈ } R theorem eq equiv class iff: "[[equiv A r; x A; y A]] (r‘‘{x} = r‘‘{y})∈ =∈((x,y) r)" "⇒ ∈ The quotient set is defined to be the set of equivalence classes. "A//r x A. {r‘‘{x}}" ≡ ∈ r is anset equivalenccomprehensions as unionse and singleton sets The equivalence classes relation on A ! [x] and [y] f (x , . , x ) x A , . , x A . f (x , . , x ) { 1 n | 1 ∈ 1 n ∈ n} = { 1 n } x A x A "1∈ 1 "n∈ n Congruence-preserving property: congruent r f 11y z. (y,z) r f y = f z ≡ ∀ ∈ −→ 4 Defining Functions on Equivalence Classes • Form a set bylemma appleliminatesyinga uniontheo vceroncretthe elementseof functionan equivalence class topro vided the function is Congruence-preserving. all representativeslemma UN equiv class: "[[equiv A r; congruent r f; a A]] • If the function preserves the( equivalencx r‘‘{a}.e relation,f x) = f a"∈ "⇒ ∈ this set will beother a stufsingletf for two-aron.gument Thenfunctions get its element: ! contents x = x { } Example: Defining the Integers Formally (ComprehensionsWe begin by defining arethe equi unions,valence relation. so we collapse c"intrelonstant unions{((x,y),(u,v))) | x y u v. x+v = u+y}" ≡ Next, we introduce the type int. 12 typedef (Integ) int = "UNIV//intrel" by (auto simp add: quotient def) Now we can define the integer constants 0 and 1. "0 Abs Integ(intrel ‘‘ {(0,0)})" "1 ≡ Abs Integ(intrel ‘‘ {(1,0)})" ≡ 5 A Formalization of Equivalence Classes R“ x denotes y (x, y) R : the equivalence class [x] { } { | ∈ } R theorem eq equiv class iff: "[[equiv A r; x A; y A]] (r‘‘{x} = r‘‘{y})∈ =∈((x,y) r)" "⇒ ∈ The quotient set is defined to be the set of equivalence classes.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    26 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us