Example #1
0
 def extractInitArgValue(argName, operators, operands):
     '''
     Given a name of one of the arguments of the __init__ method,
     return the corresponding value contained in the 'operands'
     composite expression (i.e., the operands of a constructed operation).
     '''
     if argName == 'indexOrIndices':
         argName = 'instanceVarOrVars'
     elif argName == 'summand':
         argName = 'instanceExpr'
     return OperationOverInstances.extractInitArgValue(
         argName, operators, operands)
Example #2
0
 def extractInitArgValue(argName, operators, operands):
     '''
     Given a name of one of the arguments of the __init__ method,
     return the corresponding value contained in the 'operands'
     composite expression (i.e., the operands of a constructed operation).
     '''
     from proveit.logic import InSet
     if argName=='instanceElement':
         return operands.body # instance mapping
     elif argName=='instanceVar':
         return operands.parameter
     elif argName=='domain':
         # the first condition must be the domain condition
         domainCondition = operands.conditions[0]
         assert isinstance(domainCondition, InSet), "Expecting the first condition of a SetOfAll object to be the domain condition of type InSet"
         assert domainCondition.element==operands.parameter, "Expecting the first condition of a SetOfAll object to be the domain condition with the proper element"
         return domainCondition.domain
     elif argName=='conditions':
         return ExprList(*operands.conditions[1:]) # all except the domain condition
     else:
         return OperationOverInstances.extractInitArgValue(argName, operators, operands)