Exemplo n.º 1
0
from src import filemgt
from tasks import *
import os, sys
from src.ClifModuleSet import ClifModuleSet
from tasks import clif_to_tptp

#global variables
filemgt.start_logging()
tempfolder = filemgt.read_config('converters', 'tempfolder')
ignores = [tempfolder]
ending = filemgt.read_config('cl','ending')
licence.print_terms()

if __name__ == '__main__':
    options = sys.argv
    options.reverse()
    options.pop()
    folder = options.pop()
    tptp_all(folder, options)


#    for directory, subdirs, files in os.walk(folder):
#        if any(ignore in directory for ignore in ignores):
#            pass
#        else:
#            for single_file in files:
#                if single_file.endswith(ending):
#                    filename = os.path.join(directory.replace('qs\\',''), single_file)
#                    print filename
#                    m = ClifModuleSet(filename)
#                    clif_to_ladr.ladr(filename, m, options)
Exemplo n.º 2
0
from src import filemgt
from tasks import *
import os, sys
from src.ClifModuleSet import ClifModuleSet
from tasks import clif_to_tptp

#global variables
filemgt.start_logging()
tempfolder = filemgt.read_config('converters', 'tempfolder')
ignores = [tempfolder]
ending = filemgt.read_config('cl','ending')
licence.print_terms()

if __name__ == '__main__':
    options = sys.argv
    options.reverse()
    options.pop()
    folder = options.pop()
    ladr_all(folder, options)


#    for directory, subdirs, files in os.walk(folder):
#        if any(ignore in directory for ignore in ignores):
#            pass
#        else:
#            for single_file in files:
#                if single_file.endswith(ending):
#                    filename = os.path.join(directory.replace('qs\\',''), single_file)
#                    print filename
#                    m = ClifModuleSet(filename)
#                    clif_to_ladr.ladr(filename, m, options)
Exemplo n.º 3
0
    def __init__(self, name):
        
        filemgt.start_logging()

        name = filemgt.get_canonical_relative_path(name)
        
        # keep track of when all imports have been processed; necessary for detecting nonlogical symbols in the import structure
        self.completely_processed = False
                
        logging.getLogger(__name__).info("Creating ClifModuleSet " + name)

        self.module_name = ''
    
        # list of ClifModules that are imported and have been processed already   
        self.imports = set([])
        
        # keeps track of the lemma that needs to be proved; this is None if no lemma needs to be proved 
        self.lemma_module = None
        
        # list of imports that still require processing
        self.unprocessed_imports = set([])
    
        # list of nonlogical symbols that occur in any imported files
        # it is a tuple [symbol, count, d_min, d_max] where
        # symbol: name of the symbol
        # count: total number of Occurrences
        # d_min: minimal depth in the CL-import tree where it occurs
        # d_max: maximal depth in the CL-import tree where it occurs
        self.nonlogical_symbols = set([])
        
        self.defined_nonlogical_symbols = set([])
        
        # the primitive and potentially some defined predicates occurring in any imported files
        self.primitive_predicates = set([])
    
        # a list of predicates that are definitively defined predicates occurring in any imported files
        self.defined_predicates = set([])
        
        # the functions occurring in any imported files
        self.nonskolem_functions = set([])
        
        self.p9_file_name = ''
        self.tptp_file_name = ''

        m = ClifModule(name,depth=0)
        m.module_set = self
        self.imports.add(m)
        self.module_name=m.module_name

        self.unprocessed_imports = self.unprocessed_imports.union(m.get_imports())

        while len(self.unprocessed_imports)>0:
            # Process the next import that has not yet been processed
            m = ClifModule(self.unprocessed_imports.pop())
            m.module_set = self
#             # Link the module to all its parents: DOES NOT WORK CORRECTLY; we need to do this at the very end!
#             for cm in self.imports: # look through the complete set of imported modules
#                 if m.module_name in cm.get_imports(): # each module cm that imports the currently processed module m will be added as parent to m
#                     m.add_parent(cm.module_name,cm.get_depth()) # add as parent to the module

            self.imports.add(m)

            # add all the names of imported modules that have not yet been processed
            new_imports = set(m.get_imports()) - set([i.module_name for i in self.imports]) - set(self.unprocessed_imports)
            for i in new_imports:
                logging.getLogger(__name__).info('|-- imports: ' + i + ' (depth ' + str(m.get_depth()+1) + ')')
                            
            self.unprocessed_imports = self.unprocessed_imports.union(new_imports)
        
        self.completely_processed = True
        self.pretty_print()
Exemplo n.º 4
0
    def __init__(self, name):

        filemgt.start_logging()

        name = filemgt.get_canonical_relative_path(name)

        # keep track of when all imports have been processed; necessary for detecting nonlogical symbols in the import structure
        self.completely_processed = False

        logging.getLogger(__name__).info("Creating ClifModuleSet " + name)

        self.module_name = ''

        # list of ClifModules that are imported and have been processed already
        self.imports = set([])

        # keeps track of the lemma that needs to be proved; this is None if no lemma needs to be proved
        self.lemma_module = None

        # list of imports that still require processing
        self.unprocessed_imports = set([])

        # list of nonlogical symbols that occur in any imported files
        # it is a tuple [symbol, count, d_min, d_max] where
        # symbol: name of the symbol
        # count: total number of Occurrences
        # d_min: minimal depth in the CL-import tree where it occurs
        # d_max: maximal depth in the CL-import tree where it occurs
        self.nonlogical_symbols = set([])

        self.defined_nonlogical_symbols = set([])

        # the primitive and potentially some defined predicates occurring in any imported files
        self.primitive_predicates = set([])

        # a list of predicates that are definitively defined predicates occurring in any imported files
        self.defined_predicates = set([])

        # the functions occurring in any imported files
        self.nonskolem_functions = set([])

        self.p9_file_name = ''
        self.tptp_file_name = ''

        m = ClifModule(name, depth=0)
        m.module_set = self
        self.imports.add(m)
        self.module_name = m.module_name

        self.unprocessed_imports = self.unprocessed_imports.union(
            m.get_imports())

        while len(self.unprocessed_imports) > 0:
            # Process the next import that has not yet been processed
            m = ClifModule(self.unprocessed_imports.pop())
            m.module_set = self
            #             # Link the module to all its parents: DOES NOT WORK CORRECTLY; we need to do this at the very end!
            #             for cm in self.imports: # look through the complete set of imported modules
            #                 if m.module_name in cm.get_imports(): # each module cm that imports the currently processed module m will be added as parent to m
            #                     m.add_parent(cm.module_name,cm.get_depth()) # add as parent to the module

            self.imports.add(m)

            # add all the names of imported modules that have not yet been processed
            new_imports = set(m.get_imports()) - set(
                [i.module_name
                 for i in self.imports]) - set(self.unprocessed_imports)
            for i in new_imports:
                logging.getLogger(__name__).info('|-- imports: ' + i +
                                                 ' (depth ' +
                                                 str(m.get_depth() + 1) + ')')

            self.unprocessed_imports = self.unprocessed_imports.union(
                new_imports)

        self.completely_processed = True
        self.pretty_print()