Lecture 12(Friday)

# Lecture 12(Friday) - def inner_forall(L P y for x in L if...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: def inner_forall(L, P, y) : for x in L : if not P(x,y) : return False # there’s a counterexample else : pass return True # no counterexamples def outer_forall(L1, P, L2, Q) : for x in L1 : if not Q(L2, P, x) : return False # there’s a counterexample else : pass return True # no counterexamples def inner_exists(L, P, x) : for y in L: if P(x,y) : return True # there’s an example else: pass return False # there’s no example def outer_exists(L1, P, L2, Q) : for y in L1: if Q(L2, P, y) : return True # there’s an example else: pass return False # there’s no example def P(x,y) : return x + y == 5 L1 = [1, 2, 3, 4] L2 = [1, 2, 3, 4] slide 13 dangerous switching Can you switch 8 " 2 R + with 9 2 R + without altering the truthfulness of the statement? 8 x 2 R ; 8 " 2 R + ; 9 2 R + ; j x : 6 j < ) j x 2 : 36 j < " (you can!). How about: 8 " 2 R + ; 9 2 R + ; 8 x 2 R ; j x : 6 j < ) j x 2 : 36 j < " This latter is often written in a di erent form: lim x ! : 6 x 2 = 0 : 36 First specify how close to 0.36First specify how close to 0....
View Full Document

## This note was uploaded on 10/13/2011 for the course COMPUTER S CSC 165 taught by Professor Dannyheap during the Fall '10 term at University of Toronto.

### Page1 / 6

Lecture 12(Friday) - def inner_forall(L P y for x in L if...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online