Guest User

Untitled

a guest
Jan 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.40 KB | None | 0 0
  1. |- let rec apply = fun l -> fun x ->
  2. match l with [] -> x | f :: l -> f (apply l x) in
  3. apply ((fun x -> x * x) :: (fun y -> y + 3) :: []) 4
  4. evalto 49
  5. by E-LetRec {
  6. apply = ()[rec apply = fun l -> fun x ->
  7. match l with [] -> x | f :: l -> f (apply l x)] |-
  8. (apply ((fun x -> x * x) :: (fun y -> y + 3) :: [])) 4
  9. evalto 49
  10. by E-App {
  11.  
  12.  
  13. apply = ()[rec apply = fun l -> fun x ->
  14. match l with [] -> x | f :: l -> f (apply l x)] |-
  15. apply ((fun x -> x * x) :: (fun y -> y + 3) :: [])
  16. evalto (apply = ()[rec apply = fun l -> fun x ->
  17. match l with [] -> x | f :: l -> f (apply l x)],
  18. l = (apply = ()[rec apply = fun l -> fun x ->
  19. match l with [] -> x | f :: l -> f (apply l x)])[
  20. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  21. match l with [] -> x | f :: l -> f (apply l x)])[
  22. fun y -> y + 3] :: [])[
  23. fun x ->
  24. match l with [] -> x | f :: l -> f (apply l x)]
  25. by E-AppRec {
  26. apply = ()[rec apply = fun l -> fun x ->
  27. match l with [] -> x | f :: l -> f (apply l x)] |-
  28. apply evalto ()[rec apply = fun l -> fun x ->
  29. match l with [] -> x | f :: l -> f (apply l x)]
  30. by E-Var {};
  31.  
  32.  
  33. apply = ()[rec apply = fun l -> fun x ->
  34. match l with [] -> x | f :: l -> f (apply l x)] |-
  35. (fun x -> x * x) :: ((fun y -> y + 3) :: [])
  36. evalto (apply = ()[rec apply = fun l -> fun x ->
  37. match l with [] -> x | f :: l -> f (apply l x)])[
  38. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  39. match l with [] -> x | f :: l -> f (apply l x)])[
  40. fun y -> y + 3] :: []
  41. by E-Cons {
  42. apply = ()[rec apply = fun l -> fun x ->
  43. match l with [] -> x | f :: l -> f (apply l x)] |-
  44. (fun x -> x * x)
  45. evalto (apply = ()[rec apply = fun l -> fun x ->
  46. match l with [] -> x | f :: l -> f (apply l x)])[
  47. fun x -> x * x]
  48. by E-Fun {};
  49.  
  50. apply = ()[rec apply = fun l -> fun x ->
  51. match l with [] -> x | f :: l -> f (apply l x)] |-
  52. (fun y -> y + 3) :: []
  53. evalto (apply = ()[rec apply = fun l -> fun x ->
  54. match l with [] -> x | f :: l -> f (apply l x)])[
  55. fun y -> y + 3] :: []
  56. by E-Cons {
  57. apply = ()[rec apply = fun l -> fun x ->
  58. match l with [] -> x | f :: l -> f (apply l x)] |-
  59. (fun y -> y + 3)
  60. evalto (apply = ()[rec apply = fun l -> fun x ->
  61. match l with [] -> x | f :: l -> f (apply l x)])[
  62. fun y -> y + 3]
  63. by E-Fun {};
  64.  
  65. apply = ()[rec apply = fun l -> fun x ->
  66. match l with [] -> x | f :: l -> f (apply l x)] |-
  67. [] evalto [] by E-Nil {}
  68. }
  69. };
  70.  
  71. apply = ()[rec apply = fun l -> fun x ->
  72. match l with [] -> x | f :: l -> f (apply l x)],
  73. l = (apply = ()[rec apply = fun l -> fun x ->
  74. match l with [] -> x | f :: l -> f (apply l x)])[
  75. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  76. match l with [] -> x | f :: l -> f (apply l x)])[
  77. fun y -> y + 3] :: [] |-
  78. fun x ->
  79. match l with [] -> x | f :: l -> f (apply l x)
  80. evalto (apply = ()[rec apply = fun l -> fun x ->
  81. match l with [] -> x | f :: l -> f (apply l x)],
  82. l = (apply = ()[rec apply = fun l -> fun x ->
  83. match l with [] -> x | f :: l -> f (apply l x)])[
  84. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  85. match l with [] -> x | f :: l -> f (apply l x)])[
  86. fun y -> y + 3] :: [])[
  87. fun x ->
  88. match l with [] -> x | f :: l -> f (apply l x)]
  89. by E-Fun {}
  90.  
  91. };
  92.  
  93. apply = ()[rec apply = fun l -> fun x ->
  94. match l with [] -> x | f :: l -> f (apply l x)] |-
  95. 4 evalto 4 by E-Int {};
  96.  
  97. apply = ()[rec apply = fun l -> fun x ->
  98. match l with [] -> x | f :: l -> f (apply l x)],
  99. l = (apply = ()[rec apply = fun l -> fun x ->
  100. match l with [] -> x | f :: l -> f (apply l x)])[
  101. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  102. match l with [] -> x | f :: l -> f (apply l x)])[
  103. fun y -> y + 3] :: [],
  104. x = 4 |-
  105. match l with [] -> x | f :: l -> f (apply l x)
  106. evalto 49
  107. by E-MatchCons {
  108.  
  109. apply = ()[rec apply = fun l -> fun x ->
  110. match l with [] -> x | f :: l -> f (apply l x)],
  111. l = (apply = ()[rec apply = fun l -> fun x ->
  112. match l with [] -> x | f :: l -> f (apply l x)])[
  113. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  114. match l with [] -> x | f :: l -> f (apply l x)])[
  115. fun y -> y + 3] :: [],
  116. x = 4 |-
  117. l evalto (apply = ()[rec apply = fun l -> fun x ->
  118. match l with [] -> x | f :: l -> f (apply l x)])[
  119. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  120. match l with [] -> x | f :: l -> f (apply l x)])[
  121. fun y -> y + 3] :: []
  122. by E-Var {};
  123.  
  124. apply = ()[rec apply = fun l -> fun x ->
  125. match l with [] -> x | f :: l -> f (apply l x)],
  126. l = (apply = ()[rec apply = fun l -> fun x ->
  127. match l with [] -> x | f :: l -> f (apply l x)])[
  128. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  129. match l with [] -> x | f :: l -> f (apply l x)])[
  130. fun y -> y + 3] :: [],
  131. x = 4,
  132. f = (apply = ()[rec apply = fun l -> fun x ->
  133. match l with [] -> x | f :: l -> f (apply l x)])[
  134. fun x -> x * x],
  135. l = (apply = ()[rec apply = fun l -> fun x ->
  136. match l with [] -> x | f :: l -> f (apply l x)])[
  137. fun y -> y + 3] :: [] |-
  138. f (apply l x)
  139. evalto 49
  140. by E-App {
  141.  
  142. apply = ()[rec apply = fun l -> fun x ->
  143. match l with [] -> x | f :: l -> f (apply l x)],
  144. l = (apply = ()[rec apply = fun l -> fun x ->
  145. match l with [] -> x | f :: l -> f (apply l x)])[
  146. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  147. match l with [] -> x | f :: l -> f (apply l x)])[
  148. fun y -> y + 3] :: [],
  149. x = 4,
  150. f = (apply = ()[rec apply = fun l -> fun x ->
  151. match l with [] -> x | f :: l -> f (apply l x)])[
  152. fun x -> x * x],
  153. l = (apply = ()[rec apply = fun l -> fun x ->
  154. match l with [] -> x | f :: l -> f (apply l x)])[
  155. fun y -> y + 3] :: [] |-
  156. f evalto (apply = ()[rec apply = fun l -> fun x ->
  157. match l with [] -> x | f :: l -> f (apply l x)])[
  158. fun x -> x * x]
  159. by E-Var {};
  160.  
  161.  
  162. apply = ()[rec apply = fun l -> fun x ->
  163. match l with [] -> x | f :: l -> f (apply l x)],
  164. l = (apply = ()[rec apply = fun l -> fun x ->
  165. match l with [] -> x | f :: l -> f (apply l x)])[
  166. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  167. match l with [] -> x | f :: l -> f (apply l x)])[
  168. fun y -> y + 3] :: [],
  169. x = 4,
  170. f = (apply = ()[rec apply = fun l -> fun x ->
  171. match l with [] -> x | f :: l -> f (apply l x)])[
  172. fun x -> x * x],
  173. l = (apply = ()[rec apply = fun l -> fun x ->
  174. match l with [] -> x | f :: l -> f (apply l x)])[
  175. fun y -> y + 3] :: [] |-
  176. ((apply l) x)
  177. evalto 7
  178. by E-App {
  179.  
  180. apply = ()[rec apply = fun l -> fun x ->
  181. match l with [] -> x | f :: l -> f (apply l x)],
  182. l = (apply = ()[rec apply = fun l -> fun x ->
  183. match l with [] -> x | f :: l -> f (apply l x)])[
  184. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  185. match l with [] -> x | f :: l -> f (apply l x)])[
  186. fun y -> y + 3] :: [],
  187. x = 4,
  188. f = (apply = ()[rec apply = fun l -> fun x ->
  189. match l with [] -> x | f :: l -> f (apply l x)])[
  190. fun x -> x * x],
  191. l = (apply = ()[rec apply = fun l -> fun x ->
  192. match l with [] -> x | f :: l -> f (apply l x)])[
  193. fun y -> y + 3] :: [] |-
  194. (apply l) evalto (apply = ()[rec apply = fun l -> fun x ->
  195. match l with [] -> x | f :: l -> f (apply l x)],
  196. l = (apply = ()[rec apply = fun l -> fun x ->
  197. match l with [] -> x | f :: l -> f (apply l x)])[
  198. fun y -> y + 3] :: [])[
  199. fun x ->
  200. match l with [] -> x | f :: l -> f (apply l x)]
  201. by E-AppRec {
  202. apply = ()[rec apply = fun l -> fun x ->
  203. match l with [] -> x | f :: l -> f (apply l x)],
  204. l = (apply = ()[rec apply = fun l -> fun x ->
  205. match l with [] -> x | f :: l -> f (apply l x)])[
  206. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  207. match l with [] -> x | f :: l -> f (apply l x)])[
  208. fun y -> y + 3] :: [],
  209. x = 4,
  210. f = (apply = ()[rec apply = fun l -> fun x ->
  211. match l with [] -> x | f :: l -> f (apply l x)])[
  212. fun x -> x * x],
  213. l = (apply = ()[rec apply = fun l -> fun x ->
  214. match l with [] -> x | f :: l -> f (apply l x)])[
  215. fun y -> y + 3] :: [] |-
  216. apply evalto ()[rec apply = fun l -> fun x ->
  217. match l with [] -> x | f :: l -> f (apply l x)]
  218. by E-Var {};
  219.  
  220. apply = ()[rec apply = fun l -> fun x ->
  221. match l with [] -> x | f :: l -> f (apply l x)],
  222. l = (apply = ()[rec apply = fun l -> fun x ->
  223. match l with [] -> x | f :: l -> f (apply l x)])[
  224. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  225. match l with [] -> x | f :: l -> f (apply l x)])[
  226. fun y -> y + 3] :: [],
  227. x = 4,
  228. f = (apply = ()[rec apply = fun l -> fun x ->
  229. match l with [] -> x | f :: l -> f (apply l x)])[
  230. fun x -> x * x],
  231. l = (apply = ()[rec apply = fun l -> fun x ->
  232. match l with [] -> x | f :: l -> f (apply l x)])[
  233. fun y -> y + 3] :: [] |-
  234. l evalto (apply = ()[rec apply = fun l -> fun x ->
  235. match l with [] -> x | f :: l -> f (apply l x)])[
  236. fun y -> y + 3] :: []
  237. by E-Var {};
  238.  
  239. apply = ()[rec apply = fun l -> fun x ->
  240. match l with [] -> x | f :: l -> f (apply l x)],
  241. l = (apply = ()[rec apply = fun l -> fun x ->
  242. match l with [] -> x | f :: l -> f (apply l x)])[
  243. fun y -> y + 3] :: [] |-
  244. fun x ->
  245. match l with [] -> x | f :: l -> f (apply l x)
  246. evalto (apply = ()[rec apply = fun l -> fun x ->
  247. match l with [] -> x | f :: l -> f (apply l x)],
  248. l = (apply = ()[rec apply = fun l -> fun x ->
  249. match l with [] -> x | f :: l -> f (apply l x)])[
  250. fun y -> y + 3] :: [] )[
  251. fun x ->
  252. match l with [] -> x | f :: l -> f (apply l x)]
  253. by E-Fun {}
  254. };
  255.  
  256.  
  257. apply = ()[rec apply = fun l -> fun x ->
  258. match l with [] -> x | f :: l -> f (apply l x)],
  259. l = (apply = ()[rec apply = fun l -> fun x ->
  260. match l with [] -> x | f :: l -> f (apply l x)])[
  261. fun x -> x * x] :: (apply = ()[rec apply = fun l -> fun x ->
  262. match l with [] -> x | f :: l -> f (apply l x)])[
  263. fun y -> y + 3] :: [],
  264. x = 4,
  265. f = (apply = ()[rec apply = fun l -> fun x ->
  266. match l with [] -> x | f :: l -> f (apply l x)])[
  267. fun x -> x * x],
  268. l = (apply = ()[rec apply = fun l -> fun x ->
  269. match l with [] -> x | f :: l -> f (apply l x)])[
  270. fun y -> y + 3] :: [] |-
  271. x evalto 4 by E-Var {};
  272.  
  273.  
  274. apply = ()[rec apply = fun l -> fun x ->
  275. match l with [] -> x | f :: l -> f (apply l x)],
  276. l = (apply = ()[rec apply = fun l -> fun x ->
  277. match l with [] -> x | f :: l -> f (apply l x)])[
  278. fun y -> y + 3] :: [],
  279. x = 4 |-
  280. match l with [] -> x | f :: l -> f (apply l x)
  281. evalto 7
  282. by E-MatchCons {
  283. apply = ()[rec apply = fun l -> fun x ->
  284. match l with [] -> x | f :: l -> f (apply l x)],
  285. l = (apply = ()[rec apply = fun l -> fun x ->
  286. match l with [] -> x | f :: l -> f (apply l x)])[
  287. fun y -> y + 3] :: [],
  288. x = 4 |-
  289. l evalto (apply = ()[rec apply = fun l -> fun x ->
  290. match l with [] -> x | f :: l -> f (apply l x)])[
  291. fun y -> y + 3] :: []
  292. by E-Var {};
  293.  
  294.  
  295. apply = ()[rec apply = fun l -> fun x ->
  296. match l with [] -> x | f :: l -> f (apply l x)],
  297. l = (apply = ()[rec apply = fun l -> fun x ->
  298. match l with [] -> x | f :: l -> f (apply l x)])[
  299. fun y -> y + 3] :: [],
  300. x = 4,
  301. f = (apply = ()[rec apply = fun l -> fun x ->
  302. match l with [] -> x | f :: l -> f (apply l x)])[
  303. fun y -> y + 3],
  304. l = [] |-
  305. f (apply l x)
  306. evalto 7
  307. by E-App {
  308. apply = ()[rec apply = fun l -> fun x ->
  309. match l with [] -> x | f :: l -> f (apply l x)],
  310. l = (apply = ()[rec apply = fun l -> fun x ->
  311. match l with [] -> x | f :: l -> f (apply l x)])[
  312. fun y -> y + 3] :: [],
  313. x = 4,
  314. f = (apply = ()[rec apply = fun l -> fun x ->
  315. match l with [] -> x | f :: l -> f (apply l x)])[
  316. fun y -> y + 3],
  317. l = [] |-
  318. f evalto (apply = ()[rec apply = fun l -> fun x ->
  319. match l with [] -> x | f :: l -> f (apply l x)])[
  320. fun y -> y + 3]
  321. by E-Var {};
  322.  
  323.  
  324. apply = ()[rec apply = fun l -> fun x ->
  325. match l with [] -> x | f :: l -> f (apply l x)],
  326. l = (apply = ()[rec apply = fun l -> fun x ->
  327. match l with [] -> x | f :: l -> f (apply l x)])[
  328. fun y -> y + 3] :: [],
  329. x = 4,
  330. f = (apply = ()[rec apply = fun l -> fun x ->
  331. match l with [] -> x | f :: l -> f (apply l x)])[
  332. fun y -> y + 3],
  333. l = [] |-
  334. (apply l) x
  335. evalto 4
  336. by E-App {
  337.  
  338. apply = ()[rec apply = fun l -> fun x ->
  339. match l with [] -> x | f :: l -> f (apply l x)],
  340. l = (apply = ()[rec apply = fun l -> fun x ->
  341. match l with [] -> x | f :: l -> f (apply l x)])[
  342. fun y -> y + 3] :: [],
  343. x = 4,
  344. f = (apply = ()[rec apply = fun l -> fun x ->
  345. match l with [] -> x | f :: l -> f (apply l x)])[
  346. fun y -> y + 3],
  347. l = [] |-
  348. apply l
  349. evalto (apply = ()[rec apply = fun l -> fun x ->
  350. match l with [] -> x | f :: l -> f (apply l x)],
  351. l = [])[
  352. fun x ->
  353. match l with [] -> x | f :: l -> f (apply l x)]
  354. by E-AppRec {
  355. apply = ()[rec apply = fun l -> fun x ->
  356. match l with [] -> x | f :: l -> f (apply l x)],
  357. l = (apply = ()[rec apply = fun l -> fun x ->
  358. match l with [] -> x | f :: l -> f (apply l x)])[
  359. fun y -> y + 3] :: [],
  360. x = 4,
  361. f = (apply = ()[rec apply = fun l -> fun x ->
  362. match l with [] -> x | f :: l -> f (apply l x)])[
  363. fun y -> y + 3],
  364. l = [] |-
  365. apply
  366. evalto ()[rec apply = fun l -> fun x ->
  367. match l with [] -> x | f :: l -> f (apply l x)]
  368. by E-Var {};
  369.  
  370. apply = ()[rec apply = fun l -> fun x ->
  371. match l with [] -> x | f :: l -> f (apply l x)],
  372. l = (apply = ()[rec apply = fun l -> fun x ->
  373. match l with [] -> x | f :: l -> f (apply l x)])[
  374. fun y -> y + 3] :: [],
  375. x = 4,
  376. f = (apply = ()[rec apply = fun l -> fun x ->
  377. match l with [] -> x | f :: l -> f (apply l x)])[
  378. fun y -> y + 3],
  379. l = [] |-
  380. l evalto []
  381. by E-Var {};
  382.  
  383. apply = ()[rec apply = fun l -> fun x ->
  384. match l with [] -> x | f :: l -> f (apply l x)],
  385. l = [] |-
  386. fun x ->
  387. match l with [] -> x | f :: l -> f (apply l x)
  388. evalto (apply = ()[rec apply = fun l -> fun x ->
  389. match l with [] -> x | f :: l -> f (apply l x)],
  390. l = [])[
  391. fun x ->
  392. match l with [] -> x | f :: l -> f (apply l x)]
  393. by E-Fun {}
  394. };
  395.  
  396. apply = ()[rec apply = fun l -> fun x ->
  397. match l with [] -> x | f :: l -> f (apply l x)],
  398. l = (apply = ()[rec apply = fun l -> fun x ->
  399. match l with [] -> x | f :: l -> f (apply l x)])[
  400. fun y -> y + 3] :: [],
  401. x = 4,
  402. f = (apply = ()[rec apply = fun l -> fun x ->
  403. match l with [] -> x | f :: l -> f (apply l x)])[
  404. fun y -> y + 3],
  405. l = [] |-
  406. x evalto 4 by E-Var {};
  407.  
  408. apply = ()[rec apply = fun l -> fun x ->
  409. match l with [] -> x | f :: l -> f (apply l x)],
  410. l = [],
  411. x = 4 |-
  412. match l with [] -> x | f :: l -> f (apply l x)
  413. evalto 4 by E-MatchNil {
  414. apply = ()[rec apply = fun l -> fun x ->
  415. match l with [] -> x | f :: l -> f (apply l x)],
  416. l = [],
  417. x = 4 |-
  418. l evalto []
  419. by E-Var {};
  420.  
  421.  
  422. apply = ()[rec apply = fun l -> fun x ->
  423. match l with [] -> x | f :: l -> f (apply l x)],
  424. l = [],
  425. x = 4 |-
  426. x evalto 4 by E-Var {}
  427. }
  428. };
  429.  
  430. apply = ()[rec apply = fun l -> fun x ->
  431. match l with [] -> x | f :: l -> f (apply l x)],
  432. y = 4 |-
  433. y + 3 evalto 7
  434. by E-Plus {
  435. apply = ()[rec apply = fun l -> fun x ->
  436. match l with [] -> x | f :: l -> f (apply l x)],
  437. y = 4 |-
  438. y evalto 4 by E-Var {};
  439.  
  440. apply = ()[rec apply = fun l -> fun x ->
  441. match l with [] -> x | f :: l -> f (apply l x)],
  442. y = 4 |-
  443. 3 evalto 3 by E-Int {};
  444.  
  445. 4 plus 3 is 7 by B-Plus {}
  446. }
  447. }
  448. }
  449. };
  450.  
  451. apply = ()[rec apply = fun l -> fun x ->
  452. match l with [] -> x | f :: l -> f (apply l x)],
  453. x = 7 |-
  454. x * x evalto 49
  455. by E-Times {
  456. apply = ()[rec apply = fun l -> fun x ->
  457. match l with [] -> x | f :: l -> f (apply l x)],
  458. x = 7 |-
  459. x evalto 7
  460. by E-Var {};
  461.  
  462. apply = ()[rec apply = fun l -> fun x ->
  463. match l with [] -> x | f :: l -> f (apply l x)],
  464. x = 7 |-
  465. x evalto 7
  466. by E-Var {};
  467.  
  468. 7 times 7 is 49 by B-Times {}
  469. }
  470. }
  471.  
  472. }
  473. }
  474. }
Add Comment
Please, Sign In to add comment