CS 641 Lecture -*- Outline -*- * predicates and sets (7.1) The goal is to formalize predicates in HOL. Sets are identified with predicates, so this also formalizes set theory in HOL. Inference rules are special cases of the inference rules for complete Boolean lattices; hence have rules for general meets and joins. ------------------------------------------ ASCII NOTATION In the following, we write ``S'' for a type (\Sigma) ``s'' for an element of S (\sigma) ``P(S)'' for predicate space over S ``\in'' for set membership _ ``\meet'' for meet (| |), ``\intersect'' for intersection, ``\join'' for join (|_|), ``\union'' for union, ``\subseteq'' for non-strict subset (predicate implication), ``\supseteq'' for nonstrict superset (predicate consequence) ``\bot'' for bottom element of lattice, ``\top'' for top element of lattice, ------------------------------------------ ** predicates and sets (7.1) ------------------------------------------ PREDICATES Def: Let S be a type. Then ^ P(S) = S -> Bool is the space of *predicates* over S. PREDICATE-SET ISOMORPHISM Def: Let p: P(S) be a predicate. Then the *subset of S determined by p* is ^ A_p = { s \in S | p.s <==> T }. Def: let A \subset S be a set. Then the *characteristic predicate* for A is ------------------------------------------ ... p_A : S -> Bool such that p_A.s <==> s \in A Q: How should P(S) be ordered? point-wise, of course! *** ordering and operations on predicates ------------------------------------------ PREDICATE ORDERING Def: Let p, q: P(S). Then ^ p \subseteq Q = Corollary 7.1. (P(S),\subseteq) is a complete Boolean and atomic lattice. ------------------------------------------ ... (\forall s : s \in S : p.s ==> q.s) Q: Why does this corollary hold? because Boolean is a complete Boolean and atomic lattice. ------------------------------------------ OPERATIONS ON PREDICATES For all s: S, p, q: P(S), define false.s == F (\bot of predicates) true.s == T (\top of predicates) (p \intersect q).s (\meet of predicates) == p.s /\ q.s (p \union q).s (\join of predicates) == p.s \/ q.s (!p).s == !(p.s) (! of predicates) (p ==> q).s (==> of predicates) == p.s ==> q.s (p <==> q).s (<==> of predicates) == (p.s <==> q.s) ------------------------------------------ Q: What's the relation between \subseteq and ==> on predicates? p \subseteq q <==> (\forall s :: (p ==> s).s) Q: What's the lattice ordering on predicates? \subseteq Q: What's the relation between == and <==> on predicates? p == q <==> (\forall s :: (p <==> s).s) *** sets as predicates ------------------------------------------ CORRESPONDENCE characteristic | corresponding predicates | sets =====================|=================== p_A \subseteq p_A | A \subset B | {} true | p_A \intersect p_B | | A \union B !(p_A) | | { s: S | t } | s \in A ------------------------------------------ fill this in *** properties of predicates Get all the properties of complete, atomic Boolean lattices for both predicates and sets. I.e., have the translation of Figure 6.1. ** images and indexed sets *** images and preimages ------------------------------------------ IMAGES AND PREIMAGES Def. Let f: S -> G. Let A \subseteq S. Then the *image of A under f* is ^ im.f.A = (image) {y: G | (\exists x : x \in A : y = f.x)} Overloaded notation: write f.A for im.f.A. Def. Let f: S -> G. Then the *range of f* is ^ ran.f = f.S (range) Def. Let f: S -> G. Let B \subseteq G. Then the *preimage of f* is ^ preim.f.B = { x | f.x \in B } (preimage) -1 Notation: write f .B for preim.f.B ------------------------------------------ Q: Is im.f : P(S) -> P(G) monotonic? strict? a join homomorphism? yes Q: Is preim.f : P(G) -> P(S) monotonic? strict? a join homomorphism? yes, and more, it's also a meet-homomorphism, and a negation homomorphism. See table 7.1 *** indexed sets ------------------------------------------ INDEXED SETS Def. Let a: S -> G and I \subset S, and let t be a term of type G. Then ^ { t | i \in I } = im.(\i . t).I Example, Let a.0 = Nat a.i = Nat -> a.(i-1) for i > 0 Then { a.i | i \in Nat } == im.a.Nat ------------------------------------------ ... == { Nat, Nat -> Nat, Nat -> Nat -> Nat, ... }