CS 641 Lecture -*- Outline -*- * Boolean Lattices (6.1) This section starts a discussion of reasoning about logical formulas. Recall that the truth values form a complete Boolean lattice, so the inference rules for the Boolean's are special case of those for Boolean lattices. The following is from Appendix A ------------------------------------------ ASCII NOTATION In the following, we write ``.'' for function application, ``!'' for complement, ``;'' for forward composition, ``o'' for backward composition, _ ``\meet'' for meet (| |), ``\intersect'' for intersection, ``\join'' for join (|_|), ``\union'' for union, ``<='' for the ordering (\sqsubseteq), ``>='' for the inverse ordering, ``<'' for strict ordering (\sqsubset), ``>'' for strict inverse ordering ``\subseteq'' for non-strict subset, ``\supseteq'' for nonstrict superset, ``\subset'' for strict subset, ``\supset'' for strict superset, ``=='' for equality, ``!='' for inequality, ``/\'' for conjunction (and), ``\/'' for disjunction (or) ``==>'' for implication ``<=='' for consequence ``<==>'' for logical equivalence, ``<=!=>'' for logical inequivalence This table is also arranged in precedence order, with "not" having the highest precedence (binding most tightly). ------------------------------------------ Although Back and von Wright distinguish precedence levels for \meet and \intersect vs. \join and \union, and between conjunction and disjunction, I won't do that. ** inference rules for Boolean Lattices (6.1) Regard the \sqsubseteq relation as a boolean-valued function, written infix. ------------------------------------------ INFERENCE RULES FOR BOOLEAN LATTICES (Table 6.1) Phi |- t <= t' Phi' |- t' <= t'' ____________________________(transitive) Phi \union Phi' |- t <= t'' ... ------------------------------------------ writing this avoids having to use implication directly in proofs ** Truth Values (6.2) Lattice theory provides a nice of characterizing properties of truth values that are useful in reasoning. *** operators T, F, not, ==>, <==, /\, \/ Notes: use <==> for == with lower precedence t <== t' means t' ==> t but is often more convenient in proofs *** inference rules specialize the rules for Boolean lattices Q: what's the correspondence between the Boolean operators and the lattice operators? ------------------------------------------ Two special properties: 1. it's totally ordered: ___________________________(==> linear) |- (t ==> t') \/ (t' ==> t) 2. we identify truth with theorem-hood: ____ (truth) |- T ------------------------------------------ *** Derivations with Logical Connectives (6.3) We want to use our proof format for the Booleans. Q: The inference rules only talk about relations, how can we use them to prove a conjunction or disjunction? ------------------------------------------ DERIVATIONS WITH LOGICAL CONNECTIVES (6.3) _____________________ (T rule) |- t <==> (t <==> T) So we can prove a theorem Phi |- t by an outline of the form Phi |- t <==> {reason} T Justification for this: _________________{T rule} Phi |- t <==> T |- t <==> (t <==> T) ____________________________{substitution} Phi |- t We can also do a proof by contradiction using: ________________________ (F rule) |- !t <==> (t <==> F) ------------------------------------------ Q: If we can show (T ==> e) does that prove e? (yes, by T ==> rule) Q: If we can show e ==> F does that prove !e? (yes, by the ==> F rule) Q: If we can show (e ==> T) does that prove e? no, everything implies T Q: If we can show (F ==> e) does that prove e? no, everything is implied by F Q: How would you prove !t? can prove t <==> F or t ==> F (proof by contradiction) **** properties of truth and falsity ------------------------------------------ PROPERTIES OF TRUTH AND FALSITY WITH CONJUNCTION AND DISJUNCTION _________________ (T /\ rule) |- T /\ t <==> t _________________ (T \/ rule) |- T \/ t <==> T _________________ (F /\ rule) |- F /\ t <==> F _________________ (F \/ rule) |- F \/ t <==> t ------------------------------------------ Q: how would you prove the T \/ rule? |- T <==> { ==> antisymmetric } * T ==> { \/ introduction } T \/ t * T \/ t ==> { \/ elimination } * t ==> { T greatest } T * T ==> { ==> reflexive } T . T . T \/ t **** Two Valued Logic ___________________________ (Boolean cases) |- (t <==> T) \/ (t <==> F) Proof: |- (t <==> T) \/ ("t <==> F") <==> { <==> F rule } (t <==> T) \/ !t <==> { <==> T rule } (t <==> T) \/ !(t <==> T) <==> { exhaustiveness } T **** Modus Ponens Phi |- t Phi' |- t ==> t' ____________________________ (Modus Ponens) Phi \union Phi' |- t' Proof: assume Phi |- t and Phi' |- t ==> t'. Phi \union Phi' |- T ==> { first hypothesis } t ==> { second hypothesis } t' Q: What does this prove? Phi \union Phi' |- T ==> t' from which the result follows by the T ==> rule. So this is valid kind of proof. Note use of hypotheses. **** Practice See the file cohen.txt for a slower take on this... Q: Can you prove that \/ is idempotent? Q: Can you prove that \/ distributes over equivalence |- P \/ (Q <==> R) <==> P \/ Q <==> P \/ R ? Q: Can you prove the "golden rule": |- t /\ t' <==> t <==> t' <==> t \/ t' ? Q: Can you prove the following absorption laws (i) |- X \/ (X \/ Y) <==> X (ii) |- X /\ (X /\ Y) <==> X ? Q: Can you prove that |- P ==> Q <==> P \/ Q <==> Q ? Q: Can you prove that |- X ==> Y <==> X /\ Y <==> X ? *** Quantifiers (6.4) Quantifiers are introduced as higher-order predicates! **** notation ------------------------------------------ ASCII NOTATION ``(\forall v :: t)'' means (\forall v * t) ``(\exists v :: t)'' means (\exists v * t) Note: always use parentheses around quantified expressions. ------------------------------------------ The ``::'' looks better than *. This notation is from Dijkstra, Cohen also uses it. ------------------------------------------ QUANTIFIERS (6.4) \forall: (\Sigma -> Bool) -> Bool \exists: (\Sigma -> Bool) -> Bool Notation: (\forall v :: t) = \forall (\ v . t) (\exists v :: t) = \exists (\ v . t) Bounded quantifiers: (\forall v : b : t) = (\forall v :: b ==> t) (\exists v : b : t) = (\exists v : b /\ t) Exists unique ^ (\exists! v :: t ) = (\exists v :: t /\ (\forall v' : t[v := v'] : v' = v)) ------------------------------------------ e.g., (\forall x : x > 0 : x/x = 1) **** semantics Q: What's \forall like in a lattice? \exists? meet and join (\forall x:T :: A.x) = /\ {A.x | x:T } ------------------------------------------ UNIVERSAL QUANTIFICATION RULES Introduction/Generalization: Phi |- s ==> t __________________ (\forall introduction) Phi |- s ==> (\forall v :: t) * v is not free in s or Phi Elimination/Specialization/Instantiation: ___________________ (\forall elimination) Phi |- (\forall v :: t) ==> t[v := t'] * t' is free for v in t ------------------------------------------ The side condition for \forall introduction is often phrased as "v is fresh" Q: What do these mean intuitively? Q: Is this rule valid: Phi |- (\forall v :: t) _______________________ (universal instantiation) Phi |- t[v := t'] * t' is free for v in t ? Yes, can prove it using modus ponens Q: What does the side condition mean? That there won't be any capture of free variables in t' Q: What happens if t' is not free for v in t? e.g., consider z == 7 |- (\forall x :: x > 3) ==> { improper use of universal instantiation } // wrong! (x > 3)[x := z] <==> { def. of substitution } "z" > 3 <==> { by assumption, z == 7 } 7 > 3 <==> { arithmetic } T ------------------------------------------ EXISTENTIAL QUANTIFICATION Introduction: __________________ (\exists introduction) Phi |- t[v := t'] ==> (\exists v :: t) * t' is free for v in t Elimination: Phi |- t ==> s ___________________ (\exists elimination) Phi |- (\exists v :: t) ==> s * v is not free in s or Phi ------------------------------------------ Q: What do these mean intuitively? Q: What happens if the side conditions don't hold? Can get a contradiction z == 7 |- T ==> { == is reflexive } 3 == 3 <==> { definition of substitution } (v == 3)[v := 3] ==> { \exists introduction, 3 is free for v in v == 3 } (\exists v :: v == 3) ==> { improper use of \exists elimination } // wrong! * z == 3 ==> { ==> reflexive } z == 3 . "z" ==3 <==> { by assumption, z == 7 } 7 == 3 <==> { arithmetic } F so we have "proved" that T ==> F, using a bad version of \exists elimination **** derived rules (table 6.3) Q: Can you prove DeMorgan's laws (in table 6.3)? See also the file cohen-quantifiers.txt in this directory, especially for rules regarding bounded quantifiers.