Difference between revisions of "Free variables and bound variables"
Jump to navigation
Jump to search
(Created page with "See Free variables and bound variables") |
|||
Line 1: | Line 1: | ||
The following excerpts are copied from Wikipedia: [[wikipedia:Free variables and bound variables|Free variables and bound variables]] | |||
=Free Variable= | |||
In [[computer programming]], the term '''free variable''' refers to [[variable (programming)|variables]] used in a [[function (computer science)|function]] that are neither [[local variable]]s nor [[parameter (computer programming)|parameter]]s of that function. The term [[non-local variable]] is often a synonym in this context. | |||
=Bound Variable= | |||
A '''bound variable''', in contrast, is a variable that has been ''bound'' to a specific value or range of values in the [[domain of discourse]] or [[universe (mathematics)|universe]]. This may be achieved through the use of logical quantifiers, variable-binding operators, or an explicit statement of allowed values for the variable (such as, "…where <math>n</math> is a positive integer".) Examples are given in the next section. However it is done, the variable ceases to be an independent variable on which the value of the expression depends, whether that value be a truth value or the numerical result of a calculation, or, more generally, an element of an image set of a function. Note that while the domain of discourse in many contexts is understood, when an explicit range of values for the bound variable has not been given, it may be necessary to specify the domain in order to properly evaluate the expression. For example, consider the following expression in which both variables are bound by logical quantifiers: | |||
<math display=block>\forall y\,\exists x\,\left(x=\sqrt{y}\right).</math> |
Revision as of 11:35, 13 May 2022
The following excerpts are copied from Wikipedia: Free variables and bound variables
Free Variable
In computer programming, the term free variable refers to variables used in a function that are neither local variables nor parameters of that function. The term non-local variable is often a synonym in this context.
Bound Variable
A bound variable, in contrast, is a variable that has been bound to a specific value or range of values in the domain of discourse or universe. This may be achieved through the use of logical quantifiers, variable-binding operators, or an explicit statement of allowed values for the variable (such as, "…where is a positive integer".) Examples are given in the next section. However it is done, the variable ceases to be an independent variable on which the value of the expression depends, whether that value be a truth value or the numerical result of a calculation, or, more generally, an element of an image set of a function. Note that while the domain of discourse in many contexts is understood, when an explicit range of values for the bound variable has not been given, it may be necessary to specify the domain in order to properly evaluate the expression. For example, consider the following expression in which both variables are bound by logical quantifiers: