Existential quantifier elimination for the variables in {@code var}.
@param r   the BDD root node
@param var the variables to eliminate
@return the BDD with the eliminated variables
507153
public int exists(final int r, final int var) {
    final int res;
    if (var < 2)
      return r;
    varset2vartable(var);
    initRef();
    res = quantRec(r, Operand.OR, var << 3);
    return res;
  }
988971
def get_source_var_declaration(self, var):
        
        return next((x.source_mapping for x in self.variables if x.name == var))
1348434
private static void makeDeclarationVar(Var coalescedName) {
    if (coalescedName.isLet() || coalescedName.isConst()) {
      Node declNode =
          NodeUtil.getEnclosingNode(coalescedName.getParentNode(), NodeUtil::isNameDeclaration);
      declNode.setToken(Token.VAR);
    }
  }
613742
private boolean weHaveVar( String name )
    {
        // super.variables.containsKey( name ) not any faster, I checked
        try {
            return super.getVariableImpl( name, false ) != null;
        } catch ( UtilEvalError e ) { return false; }
    }
505402
private IntVar getEarlyVar() {
        IntVar earlyVar = null;
        for (int i = stays.nextSetBit(0); i >= 0; i = stays.nextSetBit(i + 1)) {
            if (starts[i] != null && !starts[i].isInstantiated()) {
                if (earlyVar == null) {
                    earlyVar = starts[i];
                } else {
                    if (earlyVar.getLB() > starts[i].getLB()) {
                        earlyVar = starts[i];
                    }
                }
            }
        }
        return earlyVar;
    }
693700
public static <T,U> TemporalExprViewItem<T> expr( String exprId, Variable<T> var1, Variable<U> var2, TemporalPredicate temporalPredicate ) {
        return new VariableTemporalExprViewItem<>( exprId, var1, null, var2, null, temporalPredicate);
    }
518089
private VariableStatementTree parseVariableStatement() {
    SourcePosition start = getTreeStartLocation();
    VariableDeclarationListTree declarations = parseVariableDeclarationList();
    eatPossibleImplicitSemiColon();
    return new VariableStatementTree(getTreeLocation(start), declarations);
  }
694377
public <T extends Variable> T lookupVariable(String token) {
        Variable result = variables.get(token);
        return (T)result;
    }
579788
public function resolveVariableToNode($var)
    {
        $n = $var;
        // When a use is passed, start outside the closure to not return immediately
        // Use variable vs variable parsing?
        if ($var instanceof Node\UseVariableName) {
            $n = $var->getFirstAncestor(Node\Expression\AnonymousFunctionCreationExpression::class)->parent;
            $name = $var->getName();
        } else if ($var instanceof Node\Expression\Variable || $var instanceof Node\Parameter) {
            $name = $var->getName();
        } else {
            throw new \InvalidArgumentException('$var must be Variable, Param or ClosureUse, not ' . get_class($var));
        }
        if (empty($name)) {
            return null;
        }

        $shouldDescend = function ($nodeToDescand) {
            // Make sure not to decend into functions or classes (they represent a scope boundary)
            return !($nodeToDescand instanceof PhpParser\FunctionLike || $nodeToDescand instanceof PhpParser\ClassLike);
        };

        // Traverse the AST up
        do {
            // If a function is met, check the parameters and use statements
            if ($n instanceof PhpParser\FunctionLike) {
                if ($n->parameters !== null) {
                    foreach ($n->parameters->getElements() as $param) {
                        if ($param->getName() === $name) {
                            return $param;
                        }
                    }
                }
                // If it is a closure, also check use statements
                if ($n instanceof Node\Expression\AnonymousFunctionCreationExpression &&
                    $n->anonymousFunctionUseClause !== null &&
                    $n->anonymousFunctionUseClause->useVariableNameList !== null) {
                    foreach ($n->anonymousFunctionUseClause->useVariableNameList->getElements() as $use) {
                        if ($use->getName() === $name) {
                            return $use;
                        }
                    }
                }
                break;
            }

            // Check each previous sibling node and their descendents for a variable assignment to that variable
            // Each previous sibling could contain a declaration of the variable
            while (($prevSibling = $n->getPreviousSibling()) !== null && $n = $prevSibling) {

                // Check the sibling itself
                if (self::isVariableDeclaration($n, $name)) {
                    return $n;
                }

                // Check descendant of this sibling (e.g. the children of a previous if block)
                foreach ($n->getDescendantNodes($shouldDescend) as $descendant) {
                    if (self::isVariableDeclaration($descendant, $name)) {
                        return $descendant;
                    }
                }
            }
        } while (isset($n) && $n = $n->parent);
        // Return null if nothing was found
        return null;
    }
79656
function parseVariableIdentifier() {
        var token, node = new Node();

        token = lex();

        if (token.type !== Token.Identifier) {
            if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {
                tolerateUnexpectedToken(token, Messages.StrictReservedWord);
            } else {
                throwUnexpectedToken(token);
            }
        }

        return node.finishIdentifier(token.value);
    }
609516
public static boolean isVariableSet(QuerySolution resultRow, String variableName) {

        if (resultRow != null) {
            return resultRow.contains(variableName);
        }

        return false;
    }
1242770
public String getVariableShortName(VariableElement var) {
    String baseName = getVariableBaseName(var);
    if (var.getKind().isField() && !ElementUtil.isGlobalVar(var)) {
      return baseName + '_';
    }
    return baseName;
  }
978225
public void freeVariables(SyntacticItem e, Set<WyalFile.VariableDeclaration> freeVars) {
		if (e instanceof Expr.VariableAccess) {
			Expr.VariableAccess va = (Expr.VariableAccess) e;
			freeVars.add(va.getVariableDeclaration());
		} else if (e instanceof Expr.Quantifier) {
			Expr.Quantifier q = (Expr.Quantifier) e;
			freeVariables(q.getBody(), freeVars);
			// Remove any bound variables
			for (WyalFile.VariableDeclaration vd : q.getParameters()) {
				freeVars.remove(vd);
			}
		} else {
			for (int i = 0; i != e.size(); ++i) {
				SyntacticItem item = e.get(i);
				if (item != null) {
					freeVariables(item, freeVars);
				}
			}
		}
	}
1131778
public SDVariable var(@NonNull String name, @NonNull VariableType variableType, WeightInitScheme weightInitScheme,
                             org.nd4j.linalg.api.buffer.DataType dataType, long... shape) {
        if (variables.containsKey(name) && variables.get(name).getVariable().getArr() != null)
            throw new IllegalArgumentException("Another variable with the name " + name + " already exists.");

        if (name == null || name.length() < 1)
            name = getNewVarName();


        SDVariable ret = new SDVariable(name, variableType, this, shape, dataType, weightInitScheme);
        addVariable(ret);

        if(variableType == VariableType.PLACEHOLDER){
            setOriginalPlaceHolderShape(name, shape);
            putShapeForVarName(name, shape);
        }
        return ret;
    }
51395
@Override
    public R visitVariable(VariableTree node, P p) {
        R r = scan(node.getModifiers(), p);
        r = scanAndReduce(node.getType(), p, r);
        r = scanAndReduce(node.getNameExpression(), p, r);
        r = scanAndReduce(node.getInitializer(), p, r);
        return r;
    }
420033
protected static Variable findTargetVariable(VariableExpression ve) {
        final Variable accessedVariable = ve.getAccessedVariable() != null ? ve.getAccessedVariable() : ve;
        if (accessedVariable != ve) {
            if (accessedVariable instanceof VariableExpression)
                return findTargetVariable((VariableExpression) accessedVariable);
        }
        return accessedVariable;
    }
726741
public final Variable getVariable(int variableNum) {
    int index = getVariableIndex(variableNum);
    if (index >= 0) {
      return vars[index];
    } else {
      return null;
    }
  }