コード例 #1
0
 def yicesCheck(self, sessionIn, sessionOut, result):
     ''' Check consistency of the context.  This method performs a
     satisfiability check.  It returns the result as a string.'''
     print('yicesCheck: entry')
     sid = self.session_id(sessionIn)
     s_entry = self.session(sid)
     mgr = s_entry['manager']
     out = mgr.yices_check()
     newSession = self.tick(sessionIn)
     return [{sessionOut: mk_term(newSession), result: mk_term(out)}]
コード例 #2
0
 def yicesAssert(self, sessionIn, formula, sessionOut):
     ''' Assert formula into a logical context.  Input has to be in
     yices format.  '''
     print('yicesAssert: entry')
     command = '(assert %s)' % formula
     result = self.yices_command(sessionIn, command)
     return Substitutions(self, [{sessionOut: mk_term(result)}])
コード例 #3
0
 def yicesInconsistent(self, sessionIn, result):
     ''' Passively checks consistency of the context.  Only makes sense
     when preceded by a call to yicesCheck.  It returns the result as a string.'''
     print('yicesInconsistent: entry')
     sid = self.session_id(sessionIn)
     s_entry = self.session(sid)
     mgr = s_entry['manager']
     out = mgr.yices_inconsistent()
     return Substitutions(self, [{result: mk_term(out)}])
コード例 #4
0
 def yicesAssertNegation(self, sessionIn, formula, sessionOut):
     ''' Assert formula into a logical context.  Input has to be in
     yices format.  '''
     print('yicesAssertNegation: entry')
     command = '(assert (not %s))' % formula
     print('command: %s' % command)
     result = self.yices_command(sessionIn, command)
     print('after yices_command')
     return [{sessionOut: mk_term(result)}]
コード例 #5
0
 def yicesAssertPlus(self, sessionIn, formula, sessionOut):
     print('yicesAssertPlus: entry')
     sid = self.session_id(sessionIn)
     s_entry = self.session(sid)
     mgr = s_entry['manager']
     yid = mgr.yices_assert_plus(formula)
     if yid != 0:
         session_out = self.tick(sessionIn)
         return [{sessionOut: mk_term(session_out)}]
     else:
         self.fail(mgr.yices_get_last_error_msg())
コード例 #6
0
 def yicesReset(self, sessionIn, sessionOut):
     ''' Reset the logical context.'''
     print('yicesReset: entry')
     sid = self.session_id(sessionIn)
     s_entry = self.session(sid)
     mgr = s_entry['manager']
     result = mgr.yices_reset()
     if result == 0:
         self.fail(mgr.yices_get_last_error_msg())
     else:
         session_out = self.tick(sessionIn)
         return Substitutions(self, [{sessionOut: mk_term(session_out)}])
コード例 #7
0
 def yicesStart(self, session):
     """
     Creates a fresh Yices session with session_info initialized so that
     decls is the current list of declarations, unsatcore is the unsatisfiable
     core, assignment is the model, and stack is the length of the decls
     at the point of the more recently scoped push.  
     """
     print('yicesStart: entry')
     sessionOut = self.add_session('yices', {
         'manager': YicesContextManager(),
         'timestamp': 0
     })
     return Substitutions(self, [{session: mk_term(sessionOut)}])
コード例 #8
0
 def yicesModel(self, sessionIn, model):
     print('yicesModel: entry')
     sid = self.session_id(sessionIn)
     s_entry = self.session(sid)
     mgr = s_entry['manager']
     assignment = mgr.yices_assignment()
     print('assignment: %s' % assignment)
     vars = [var for var in assignment]
     out = ''
     for var in vars:
         out += '(= %s %s)' % (var, assignment[var])
     out = '(and %s)' % out
     print('model %s' % out)
     return Substitutions(self, [{model: mk_term(out)}])
コード例 #9
0
 def yicesIncludeFile(self, sessionIn, file, sessionOut):
     print('yicesIncludeFile: entry')
     sid = self.session_id(sessionIn)
     print('sid: %s' % sid)
     s_entry = self.session(sid)
     print('s_entry: %s' % s_entry)
     mgr = s_entry['manager']
     print('mgr: %s' % mgr)
     print('file: %s' % file)
     print('filename: %s' % file['file'])
     yid = mgr.yices_include(file['file'])
     print('yid: %s' % yid)
     if yid != 0:
         session_out = self.tick(sessionIn)
         return Substitutions(self, [{sessionOut: mk_term(session_out)}])
     else:
         self.fail(mgr.yices_get_last_error_msg())
コード例 #10
0
 def yicesPop(sessionIn, sessionOut):
     ''' Remove the top level from the assertion stack.'''
     print('yicesPop: entry')
     result = self.yices_pop(sessionIn)
     return Substitutions(self, [{sessionOut: mk_term(result)}])
コード例 #11
0
 def yicesPush(self, sessionIn, sessionOut):
     ''' Create a new level on the assertion stack.'''
     print('yicesPush: entry')
     result = self.yices_push(sessionIn)
     return Substitutions(self, [{sessionOut: mk_term(result)}])
コード例 #12
0
ファイル: yices_wrapper.py プロジェクト: marciopocebon/ETB
 def nil(self, v):
     if v.is_var():
         return Substitutions(self, [self.bindResult(v, mk_term([]))])
     else:
         return Errors(self, ["nil passed a non variable: %s" % v])
コード例 #13
0
 def yicesDeclare(self, sessionIn, var, type, sessionOut):
     ''' Define a variable.  If "body is not "None" the variable
     will become a yices macro.  "var", "type" have to be in yices syntax.'''
     print('yicesDeclare: entry')
     result = self.yices_define(sessionIn, var, type)
     return Substitutions(self, [{sessionOut: mk_term(result)}])
コード例 #14
0
 def yicesVersion(self, version):
     print('finding version')
     result = libyices.yices_version()
     print('found version')
     return Substitutions(self, [{version: mk_term(result)}])
コード例 #15
0
ファイル: list_wrapper.py プロジェクト: marciopocebon/ETB
 def nil(self, v):
     if v.is_var():
         return Substitutions(self, [{v: mk_term([])}])
     else:
         return Errors(self, ["checking not supported"])
コード例 #16
0
 def yicesDefine(self, sessionIn, var, type, body, sessionOut):
     ''' Define a variable.  "var", "type", and 
     "body" have to be in yices syntax.'''
     print('yicesDefine: entry')
     result = self.yices_define(sessionIn, var, type, body)
     return Substitutions(self, [{sessionOut: mk_term(result)}])
コード例 #17
0
 def nil(self, v):
     """Bind v to the empty list"""
     if v.is_var():
         return Substitutions(self, [ self.bindResult(v, terms.mk_term([])) ])
     else:
         return Errors(self,  [ "nil passed a non variable: %s" % v ])