USE BOOK TYPES AND PROGRAMMING LANGUAGES AS REFERENCE What is the role of termSubstTop operation (Section 7.2) in the mu

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

USE BOOK TYPES AND PROGRAMMING LANGUAGES AS REFERENCE What is the role of termSubstTop operation (Section 7.2) in the mu

Post by answerhappygod »

USE BOOK TYPES AND PROGRAMMING LANGUAGES AS REFERENCE
What is the role of termSubstTop operation (Section 7.2) in the
multi-step evaluation function eval?
Use Book Types And Programming Languages As Reference What Is The Role Of Termsubsttop Operation Section 7 2 In The Mu 1
Use Book Types And Programming Languages As Reference What Is The Role Of Termsubsttop Operation Section 7 2 In The Mu 1 (242.33 KiB) Viewed 81 times
7.3 Evaluation As in Chapter 3, the evaluation function depends on an auxiliary predicate isval: let rec isval ctx t = match t with TmAbs (-,-,-) true |- false The single-step evaluation function is a direct transcription of the evaluation rules, except that we pass a context ctx along with the term. This argument is not used in the present evall function, but it is needed by some of the more complex evaluators later on. let rec evall ctx t = match t with TmApp(fi, TmAbs (-,x, t12), v2) when isval ctx v2 – termSubstTop v2 t12 | TmApp(fi,v1, t2) when isval ctx v1 - let t2' = evall ctx t2 in TmApp (fi, vi, t2') | TmApp (fi, t1, t2) let ti' = evall ctx tl in TmApp(fi, ti', t2) 1- raise NoRuleApplies The multi-step evaluation function is the same as before, except for the ctx argument: = let rec eval ctx t = try let t' = evall ctx t in eval ctx t' with NoRuleApplies → t
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply