# October 10th # boolean functions - return False or True ## is it a forall-relation, or a there-exists relation ## forall - and , there-exists - or # is there a negative number in the array def findneg(A): ax = False # default value for a there-exists relation i = 0 while i<=len(A)-1 and not(ax): #ax==False: if (A[i] < 0): ax = True i += 1 # while return ax # forall :checks if an array of integers is sorted [2,4,7,9]->True # [2,4,7,5,9] -> False : if not(A[i] <= A[i+1]) def sorted(A): ax = True # for-all relation default i = 0 while i<= len(A)-2 and ax: if (A[i] > A[i+1]): ax = False i += 1 # while return ax def myin(x,A): # True if x is in array A ax = False i =0 while i False def disjoint(A,B): i = 0 ax = True # ax,bx,cx,dx eax ebx ecx rax rbx rcx while i