Skip to content

Using metafunctions inside modeless judgment premises causes judgment not to hold #219

@atgeller

Description

@atgeller

If, in the premise of a modeless judgment rule, there is a recursive call to the modeless judgment where a metafunction is used, the judgment fails to hold on valid derivations. This does not seem to be the case for judgments with modes.

Below is a small test case demonstrating the issue.

#lang racket

(require redex)

(define-language testL
  (e ::= a (box e)))

(define-metafunction testL
  unbox : e -> e
  [(unbox (box e)) e])

(define-judgment-form testL
  #:contract (test1 e e)
  #:mode (test1 I I)

  [---------- "r1"
  (test1 e e)]

  [(where (box _) e_1)
   (test1 (unbox e_1) e_2)
   --------------- "r2"
   (test1 e_1 e_2)])

(test-judgment-holds (test1 (box a) a)) ;; should be #t
;(build-derivations (test1 (box a) a))
;; should output (derivation '(test1 (box a) a) "r2" (list (derivation '(test1 a a) "r1" '())))

(define-judgment-form testL
  #:contract (test2 e e)

  [---------- "r1"
  (test2 e e)]

  [(where (box _) e_1)
   (test2 (unbox e_1) e_2)
   --------------- "r2"
   (test2 e_1 e_2)])

(test-judgment-holds test2 (derivation '(test2 (box a) a) "r2" (list (derivation '(test2 a a) "r1" '())))) ;; should be #t, is #f

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions