Adjust fixed mode and add new stlc counterexamples

This commit is contained in:
Burke Fetscher 2014-03-18 14:39:42 -05:00
parent 2f18cd202f
commit 28e99cf9eb
20 changed files with 164 additions and 171 deletions

View File

@ -2,17 +2,9 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "app rule the range of the function is matched to the argument") > (define the-error "app rule the range of the function is matched to the argument")
8d7
< racket/contract
9a9
> racket/contract
58c58 58c58
< (typeof Γ M_2 σ) < (typeof Γ M_2 σ)
--- ---
> (typeof Γ M_2 σ_2) > (typeof Γ M_2 σ_2)
232d231 232d231
< <
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -7,7 +7,3 @@
< ((cons v) v)) < ((cons v) v))
--- ---
> (cons v)) > (cons v))
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,15 +2,7 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "the order of the types in the function position of application has been swapped") > (define the-error "the order of the types in the function position of application has been swapped")
8d7
< racket/contract
9a9
> racket/contract
57c57 57c57
< [(typeof Γ M (σσ_2)) < [(typeof Γ M (σσ_2))
--- ---
> [(typeof Γ M (σ_2 → σ)) > [(typeof Γ M (σ_2 → σ))
249c249
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,15 +2,7 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "the type of cons is incorrect") > (define the-error "the type of cons is incorrect")
8d7
< racket/contract
9a9
> racket/contract
67c67 67c67
< (int → ((list int) → (list int)))] < (int → ((list int) → (list int)))]
--- ---
> (int → ((list int) → int))] > (int → ((list int) → int))]
249c249
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,17 +2,9 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "the tail reduction returns the wrong value") > (define the-error "the tail reduction returns the wrong value")
8d7
< racket/contract
9a9
> racket/contract
92c92 92c92
< (in-hole E v_2) < (in-hole E v_2)
--- ---
> (in-hole E v_1) > (in-hole E v_1)
232d231 232d231
< <
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,17 +2,9 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "hd reduction acts on partially applied cons") > (define the-error "hd reduction acts on partially applied cons")
8d7
< racket/contract
9a9
> racket/contract
88c88 88c88
< (--> (in-hole E (hd ((cons v_1) v_2))) < (--> (in-hole E (hd ((cons v_1) v_2)))
--- ---
> (--> (in-hole E (hd (cons v_1))) > (--> (in-hole E (hd (cons v_1)))
232d231 232d231
< <
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,10 +2,6 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "evaluation isn't allowed on the rhs of applications") > (define the-error "evaluation isn't allowed on the rhs of applications")
8d7
< racket/contract
9a9
> racket/contract
36,37c36 36,37c36
< (E M) < (E M)
< (v E))) < (v E)))
@ -13,7 +9,3 @@
> (E M))) > (E M)))
232d230 232d230
< <
249c247
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,17 +2,9 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "lookup always returns int") > (define the-error "lookup always returns int")
8d7
< racket/contract
9a9
> racket/contract
76c76 76c76
< σ] < σ]
--- ---
> int] > int]
232d231 232d231
< <
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -2,17 +2,9 @@
< (define the-error "no error") < (define the-error "no error")
--- ---
> (define the-error "variables aren't required to match in lookup") > (define the-error "variables aren't required to match in lookup")
8d7
< racket/contract
9a9
> racket/contract
75c75 75c75
< [(lookup (x σ Γ) x) < [(lookup (x σ Γ) x)
--- ---
> [(lookup (x σ Γ) x_2) > [(lookup (x σ Γ) x_2)
232d231 232d231
< <
249c248
< (= (length red-res) 1)
---
> (= (length red-res) 1)

View File

@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -5,8 +5,8 @@
(require redex/reduction-semantics (require redex/reduction-semantics
(only-in redex/private/generate-term pick-an-index) (only-in redex/private/generate-term pick-an-index)
racket/list racket/list
racket/contract
racket/match racket/match
racket/contract
"tut-subst.rkt") "tut-subst.rkt")
(provide (all-defined-out)) (provide (all-defined-out))
@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -265,15 +265,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -265,15 +265,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -263,15 +263,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -264,15 +264,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -5,8 +5,8 @@
(require redex/reduction-semantics (require redex/reduction-semantics
(only-in redex/private/generate-term pick-an-index) (only-in redex/private/generate-term pick-an-index)
racket/list racket/list
racket/contract
racket/match racket/match
racket/contract
"tut-subst.rkt") "tut-subst.rkt")
(provide (all-defined-out)) (provide (all-defined-out))
@ -265,15 +265,21 @@
(define fixed (define fixed
(term (term
(;; 2 (;; 2
((cons 1) 2) ((cons 1) nil)
;; 3 ;; 3
((λ (x int) (hd x)) ((λ (x (list int)) 1)
7) 7)
;; 4 (if we hadn't changed number->v in cons)
(cons ((cons 0) nil))
;; 5
(tl ((cons 1) nil))
;; 6
(hd ((cons 1) nil))
;; 7
((λ (x int) x) (hd ((cons 1) nil)))
;; 8
((λ (x (list int)) (cons x)) nil)
;; 9
((λ (x int) (λ (y (list int)) x)) 1)
;; 10 ;; 10
((λ (x (list int)) (hd x)) (hd 0))))
7)
;; 5, 6, 7, 8, 9
((λ (x int) (hd x))
((cons 1) nil))
;; 4
(hd ((cons ((cons 1) nil)) nil)))))

View File

@ -189,7 +189,7 @@
[(equal? gen-type 'fixed) [(equal? gen-type 'fixed)
(define some-failed? (define some-failed?
(for/or ([t (in-list fixed)]) (for/or ([t (in-list fixed)])
(define ok? (check t)) (define ok? (check (and (tc t) t)))
(not ok?))) (not ok?)))
(unless some-failed? (unless some-failed?
(error 'fixed "Expected some term to fail, but didn't find one in ~a" fixed))] (error 'fixed "Expected some term to fail, but didn't find one in ~a" fixed))]
@ -240,13 +240,14 @@
(for ([gen-type (in-list types)]) (for ([gen-type (in-list types)])
(test-file filename verbose #f gen-type (* minutes 60)))) (test-file filename verbose #f gen-type (* minutes 60))))
(call-with-output-file output-file (unless (member 'fixed types)
(λ (out) (call-with-output-file output-file
(write (λ (out)
(apply append (write
(for/list ([(type times) (in-hash results)]) (apply append
(apply append (for/list ([(type times) (in-hash results)])
(for/list ([t times]) (apply append
(list filename type t))))) (for/list ([t times])
(list filename type t)))))
out)) out))
#:exists 'replace) #:exists 'replace))