What are the rules of scope? What are the rules for scope in standard mathematics? I've mostly been working with informal/standard mathematics so the concepts of 'scope' are not familliar to me.
I understand that a variable can be defined in a specific context and scope, discussing when something is the 'same variable' perhaps is dependent on the scope, so let's say the symbol 'x' is the 'same variable' within the context of the scope. The definition of when something is 'the same variable' or 'in scope' is difficult. Is there a precise definition of this?
These are the rules I seem to understsand so far:

*

*A bound variable is in scope if it comes after a quantifier or bounding operator only in the expression after that operator


*A variable which is introduced using free occurences is in-scope in the same formula/expression, as long as it is free in the formula.
Are there any other rules that must be known? For example, if I am doing something and I introduce several formulas with free occurences of a symbol 'x' is the scope limited to each formula or is 'x' the same variable in each formula as they are part of the same 'scope'.When given two formulas with occurences of 'x', for each assignment, 'x' is in scope in both formulas if both yield a truth value?
Is it formally correct to introduce the same symbol in a formula twice (through binding) but in different scopes?
Can I use the same symbol for both free and bound variables in the same language?
 A: I'm not aware that anyone has written down formal rules, but as a matter of convention, it's confusing for readers to use the same variable names for both a free and a bound variable so I would avoid it. The most forgivable kinds of recycling are dummy variables such as the indices of summations, e.g. in expressions like
$$a_n = \sum_{k=0}^n b_k$$
the dummy / bound variable $k$ indexing the summation is tacitly understood to have local scope confined to the summation and nobody will be confused if you use the same index for a different summation, and similarly for dummy integration variables such as the variable $t$ in an expression like
$$g(x) = \int_0^x f(t) \, dt.$$
Other than that I would generally avoid recycling variable names but there are a few forgivable exceptions that you pick up from reading other people's mathematical writing, e.g. nobody will be confused if you write $f(x), g(x), h(x)$ with the tacit understanding that $f, g, h$ are three functions and $x$ is just a dummy variable describing some element of their domain, whatever that is. But if, for example, there is a quantity $n$ that you need to keep track of in the course of the argument, definitely do not reuse that symbol to refer to anything else in the argument, even dummy variables.
As you read mathematical writing you'll also pick up conventions for which symbols tend to be "reserved" for which purposes, e.g. it is common to reserve $i, j, k$ as dummy variables to index summations (although $i$ should be avoided if you need to write down complex numbers), and using these conventions improves readability so it's a good idea not to deviate from them too much.
Just try to write things that aren't confusing to read. You're trying to communicate something to another human, not a compiler. So ultimately the guiding question is: could a typical reader be confused by this notational choice, or not?
