Skip to content

Commit d6920e2

Browse files
committed
Add missing Fraud+ semantics.
1 parent a587d3e commit d6920e2

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

www/notes/fraud-plus/semantics.rkt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#lang racket
2+
(provide F 𝑭-𝒆𝒏𝒗)
3+
4+
(require redex/reduction-semantics
5+
(rename-in (only-in "../fraud/semantics.rkt" F 𝑭-𝒆𝒏𝒗) [F F-] [𝑭-𝒆𝒏𝒗 𝑭--𝒆𝒏𝒗]))
6+
7+
; for use in presentations (informally noting x can't be let, etc.)
8+
(define-extended-language F F-
9+
(e ::= .... (cond [e_p0 e_a0] ... [else e_an])))
10+
11+
12+
(define-extended-judgment-form F 𝑭--𝒆𝒏𝒗
13+
#:contract (𝑭-𝒆𝒏𝒗 e r a)
14+
#:mode (𝑭-𝒆𝒏𝒗 I I O)
15+
16+
[(𝑭-𝒆𝒏𝒗 e_p0 r v_p0) ... (is-false v_p0) ... (𝑭-𝒆𝒏𝒗 e_pk r v) (is-true v) (𝑭-𝒆𝒏𝒗 e_ak r a)
17+
--------
18+
(𝑭-𝒆𝒏𝒗 (cond [e_p0 e_a0] ... [e_pk e_ak] [e_pk+1 e_ak+1] ... [else e_an]) r a)]
19+
20+
[(𝑭-𝒆𝒏𝒗 e_p0 r v_p0) ... (is-false v_p0) ... (𝑭-𝒆𝒏𝒗 e_an r a)
21+
--------
22+
(𝑭-𝒆𝒏𝒗 (cond [e_p0 e_a0] ... [else e_an]) r a)]
23+
24+
[(𝑭-𝒆𝒏𝒗 e_p0 r v_p0) ... (is-false v_p0) ... (𝑭-𝒆𝒏𝒗 e_pk r err)
25+
--------
26+
(𝑭-𝒆𝒏𝒗 (cond [e_p0 e_a0] ... [e_pk e_ak] [e_pk+1 e_ak+1] ... [else e_an]) r err)]
27+
28+
#|
29+
30+
[(𝑭-𝒆𝒏𝒗 e_0 r v_0) (𝑭-𝒆𝒏𝒗 e_1 (ext r x v_0) a)
31+
----- "let"
32+
(𝑭-𝒆𝒏𝒗 (let ((x e_0)) e_1) r a)]
33+
34+
[(𝑭-𝒆𝒏𝒗 e_0 r err)
35+
----------- "let-err"
36+
(𝑭-𝒆𝒏𝒗 (let ((x e_0)) e_1) r err)]
37+
38+
;; Primitive application
39+
[(𝑭-𝒆𝒏𝒗 e_0 r a_0)
40+
----------- "prim"
41+
(𝑭-𝒆𝒏𝒗 (p e_0) r (𝑭-𝒑𝒓𝒊𝒎 (p a_0)))])
42+
|#
43+
)
44+
45+
(define-judgment-form F
46+
#:mode (is-true I)
47+
#:contract (is-true v)
48+
[----
49+
(is-true #t)]
50+
[-----
51+
(is-true i)])
52+
53+
(define-judgment-form F
54+
#:mode (is-false I)
55+
#:contract (is-false v)
56+
[----
57+
(is-false #f)])

0 commit comments

Comments
 (0)