#NEWLINE# def fol( self ) : #NEWLINE# #INDENT# if self . consequent : #NEWLINE# #INDENT# accum = None #NEWLINE# if self . conds : #NEWLINE# #INDENT# accum = reduce ( AndExpression , [ c . fol ( ) for c in self . conds ] ) #NEWLINE# #UNINDENT# if accum : #NEWLINE# #INDENT# accum = ImpExpression ( accum , self . consequent . fol ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# accum = self . consequent . fol ( ) #NEWLINE# #UNINDENT# for ref in self . refs [ : : ( - 1 ) ] : #NEWLINE# #INDENT# accum = AllExpression ( ref , accum ) #NEWLINE# #UNINDENT# return accum #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . conds ) : #NEWLINE# #INDENT# raise Exception ( 'Cannot convert DRS with no conditions to FOL.' ) #NEWLINE# #UNINDENT# accum = reduce ( AndExpression , [ c . fol ( ) for c in self . conds ] ) #NEWLINE# for ref in map ( Variable , self . _order_ref_strings ( self . refs ) [ : : ( - 1 ) ] ) : #NEWLINE# #INDENT# accum = ExistsExpression ( ref , accum ) #NEWLINE# #UNINDENT# return accum