Split wf and validity checking
Previously, wf was serving double-duty checking that Γ was well-formed w.r.t. Δ, and then checking that Δ was valid (i.e. satisfied positivity conditions and such). Now these are different judgments.
This commit is contained in:
parent
0b0a2eed40
commit
8b58736101
|
@ -454,30 +454,39 @@
|
||||||
,(and (term (positive D (in-hole Ξ (Unv 0)))) (term (positive* D (t_rest ...))))
|
,(and (term (positive D (in-hole Ξ (Unv 0)))) (term (positive* D (t_rest ...))))
|
||||||
(where (in-hole Ξ (in-hole Θ D)) t_c)])
|
(where (in-hole Ξ (in-hole Θ D)) t_c)])
|
||||||
|
|
||||||
;; Holds when the signature Δ and typing context Γ are well-formed.
|
;; Holds when the signature Δ is valid
|
||||||
(define-judgment-form tt-typingL
|
(define-judgment-form tt-typingL
|
||||||
#:mode (wf I I)
|
#:mode (valid I)
|
||||||
#:contract (wf Δ Γ)
|
#:contract (valid Δ)
|
||||||
|
|
||||||
[----------------- "WF-Empty"
|
[-------- "Valid-Empty"
|
||||||
(wf ∅ ∅)]
|
(valid ∅)]
|
||||||
|
|
||||||
[(type-infer Δ Γ t t_0)
|
[(valid Δ)
|
||||||
(wf Δ Γ)
|
|
||||||
----------------- "WF-Var"
|
|
||||||
(wf Δ (Γ x : t))]
|
|
||||||
|
|
||||||
[(wf Δ ∅)
|
|
||||||
(type-infer Δ ∅ t_D U_D)
|
(type-infer Δ ∅ t_D U_D)
|
||||||
(type-infer Δ (∅ D : t_D) t_c U_c) ...
|
(type-infer Δ (∅ D : t_D) t_c U_c) ...
|
||||||
;; NB: Ugh this should be possible with pattern matching alone ....
|
;; NB: Ugh this should be possible with pattern matching alone ....
|
||||||
(side-condition ,(andmap (curry equal? (term D)) (term (D_0 ...))))
|
(side-condition ,(andmap (curry equal? (term D)) (term (D_0 ...))))
|
||||||
(side-condition (positive* D (t_c ...)))
|
(side-condition (positive* D (t_c ...)))
|
||||||
----------------- "WF-Inductive"
|
----------------- "Valid-Inductive"
|
||||||
(wf (Δ (D : t_D
|
(valid (Δ (D : t_D
|
||||||
;; Checks that a constructor for x actually produces an x, i.e., that
|
;; Checks that a constructor for x actually produces an x, i.e., that
|
||||||
;; the constructor is well-formed.
|
;; the constructor is well-formed.
|
||||||
((c : (name t_c (in-hole Ξ (in-hole Θ D_0)))) ...))) ∅)])
|
((c : (name t_c (in-hole Ξ (in-hole Θ D_0)))) ...))))])
|
||||||
|
|
||||||
|
;; Holds when the signature Δ and typing context Γ are well-formed.
|
||||||
|
(define-judgment-form tt-typingL
|
||||||
|
#:mode (wf I I)
|
||||||
|
#:contract (wf Δ Γ)
|
||||||
|
|
||||||
|
[(valid Δ)
|
||||||
|
----------------- "WF-Empty"
|
||||||
|
(wf Δ ∅)]
|
||||||
|
|
||||||
|
[(type-infer Δ Γ t t_0)
|
||||||
|
(wf Δ Γ)
|
||||||
|
----------------- "WF-Var"
|
||||||
|
(wf Δ (Γ x : t))])
|
||||||
|
|
||||||
;; TODO: Bi-directional and inference?
|
;; TODO: Bi-directional and inference?
|
||||||
;; TODO: http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/stephanie.pdf
|
;; TODO: http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/stephanie.pdf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user