fbpx
Wikipedia

Fresh variable

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][citation needed] The concept is often used without explanation.[2][citation needed]

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 edit

For example, in term rewriting, before applying a rule   to a given term  , each variable in   should be replaced by a fresh one to avoid clashes with variables occurring in  .[citation needed] Given the rule

 

and the term

 ,

attempting to find a matching substitution of the rule's left-hand side,  , within   will fail, since   cannot match  . However, if the rule is replaced by a fresh copy[a]

 

before, matching will succeed with the answer substitution  .

Notes edit

  1. ^ that is, a copy with each variable consistently replaced by a fresh variable

References edit

  1. ^ Carmen Bruni (2018). Predicate Logic: Natural Deduction (PDF) (Lecture Slides). Univ. of Waterloo. Here: slide 13/26.
  2. ^ Michael Färber (Feb 2023). Denotational Semantics and a Fast Interpreter for jq (Technical Report). Univ. of Innsbruck. arXiv:2302.10576. Here: p.4.
  3. ^ Gordon, Andrew D.; Melham, Thomas F. (1996). "Five axioms of alpha-conversion". In von Wright, Joakim; Grundy, Jim; Harrison, John (eds.). Theorem Proving in Higher Order Logics, 9th International Conference, TPHOLs'96, Turku, Finland, August 26-30, 1996, Proceedings. Lecture Notes in Computer Science. Vol. 1125. Springer. pp. 173–190. doi:10.1007/BFB0105404.
  4. ^ Cohen, Edward (1990). "Loops B — On replacing constants by fresh variables". Programming in the 1990s. Monographs in Computer Science. New York: Springer. pp. 149–194. doi:10.1007/978-1-4613-9706-9. ISBN 9781461397069. S2CID 1509875.

fresh, variable, this, article, multiple, issues, please, help, improve, discuss, these, issues, talk, page, learn, when, remove, these, template, messages, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding. This article has multiple issues Please help improve it or discuss these issues on the talk page Learn how and when to remove these template messages This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Fresh variable news newspapers books scholar JSTOR September 2023 Learn how and when to remove this template message The topic of this article may not meet Wikipedia s general notability guideline Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention If notability cannot be shown the article is likely to be merged redirected or deleted Find sources Fresh variable news newspapers books scholar JSTOR September 2023 Learn how and when to remove this template message Learn how and when to remove this template message 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 citation needed The concept is often used without explanation 2 citation needed 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 editFor example in term rewriting before applying a rule l r displaystyle l to r nbsp to a given term t displaystyle t nbsp each variable in l r displaystyle l to r nbsp should be replaced by a fresh one to avoid clashes with variables occurring in t displaystyle t nbsp citation needed Given the rule a p p e n d c o n s x y z c o n s x a p p e n d y z displaystyle append cons x y z to cons x append y z nbsp and the term a p p e n d c o n s x c o n s y n i l c o n s 3 n i l displaystyle append cons x cons y nil cons 3 nil nbsp attempting to find a matching substitution of the rule s left hand side a p p e n d c o n s x y z displaystyle append cons x y z nbsp within a p p e n d c o n s x c o n s y n i l c o n s 3 n i l displaystyle append cons x cons y nil cons 3 nil nbsp will fail since y displaystyle y nbsp cannot match c o n s y n i l displaystyle cons y nil nbsp However if the rule is replaced by a fresh copy a a p p e n d c o n s v 1 v 2 v 3 c o n s v 1 a p p e n d v 2 v 3 displaystyle append cons v 1 v 2 v 3 to cons v 1 append v 2 v 3 nbsp before matching will succeed with the answer substitution v 2 x v 2 c o n s y n i l v 3 c o n s 3 n i l displaystyle v 2 mapsto x v 2 mapsto cons y nil v 3 mapsto cons 3 nil nbsp Notes edit that is a copy with each variable consistently replaced by a fresh variableReferences edit Carmen Bruni 2018 Predicate Logic Natural Deduction PDF Lecture Slides Univ of Waterloo Here slide 13 26 Michael Farber Feb 2023 Denotational Semantics and a Fast Interpreter for jq Technical Report Univ of Innsbruck arXiv 2302 10576 Here p 4 Gordon Andrew D Melham Thomas F 1996 Five axioms of alpha conversion In von Wright Joakim Grundy Jim Harrison John eds Theorem Proving in Higher Order Logics 9th International Conference TPHOLs 96 Turku Finland August 26 30 1996 Proceedings Lecture Notes in Computer Science Vol 1125 Springer pp 173 190 doi 10 1007 BFB0105404 Cohen Edward 1990 Loops B On replacing constants by fresh variables Programming in the 1990s Monographs in Computer Science New York Springer pp 149 194 doi 10 1007 978 1 4613 9706 9 ISBN 9781461397069 S2CID 1509875 nbsp This logic related article is a stub You can help Wikipedia by expanding it vte Retrieved from https en wikipedia org w index php title Fresh variable amp oldid 1203539321, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.