Английская Википедия:Fresh variable

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Multiple issues

In formal reasoning, in particular in mathematical logic, computer algebra, and automated theorem proving, a fresh variable is a variable that did not occur in the context considered so far.[1]Шаблон:Cn The concept is often used without explanation.[2]Шаблон:Cn

Fresh variables may be used to replace other variables, to eliminate variable shadowing or capture. For instance, in alpha-conversion, the processing of terms in the lambda calculus into equivalent terms with renamed variables, replacing variables with fresh variables can be helpful as a way to avoid accidentally capturing variables that should be free.[3] Another use for fresh variables involves the development of loop invariants in formal program verification, where it is sometimes useful to replace constants by newly introduced fresh variables.[4]

Example

For example, in term rewriting, before applying a rule <math>l \to r</math> to a given term <math>t</math>, each variable in <math>l \to r</math> should be replaced by a fresh one to avoid clashes with variables occurring in <math>t</math>.Шаблон:Cn Given the rule

<math>append(cons(x,y),z) \to cons(x,append(y,z))</math>

and the term

<math>append(cons(x,cons(y,nil)),cons(3,nil))</math>,

attempting to find a matching substitution of the rule's left-hand side, <math>append(cons(x,y),z)</math>, within <math>append(cons(x,cons(y,nil)),cons(3,nil))</math> will fail, since <math>y</math> cannot match <math>cons(y,nil)</math>. However, if the rule is replaced by a fresh copyШаблон:Efn

<math>append(cons(v_1,v_2),v_3) \to cons(v_1,append(v_2,v_3))</math>

before, matching will succeed with the answer substitution <math>\{ v_2 \mapsto x, \; v_2 \mapsto cons(y,nil), \; v_3 \mapsto cons(3,nil) \}</math>.

Notes

Шаблон:Notelist

References

Шаблон:Reflist

Шаблон:Logic-stub