Generate a shallowly embedded ACL2 quoted symbol.
(atj-gen-shallow-symbol symbol pkg-class-names curr-pkg guards$) → expr
If guards are assumed and the symbol is an ACL2 boolean, we generate the corresponding Java boolean literal.
In all other cases, the generated expression depends on the current package, i.e. the package of the function where the quoted symbol occurs. If the current package is the same as the symbol's package, or if the current package imports the symbol, then we just generate the simple name of the field, because the field will be declared in the class for the current package. Otherwise, we generate a qualified name, preceded by the name of the class for the symbol's package. This mirrors the rules for symbol references in ACL2.
Function:
(defun atj-gen-shallow-symbol (symbol pkg-class-names curr-pkg guards$) (declare (xargs :guard (and (symbolp symbol) (string-string-alistp pkg-class-names) (stringp curr-pkg) (booleanp guards$)))) (let ((__function__ 'atj-gen-shallow-symbol)) (declare (ignorable __function__)) (b* (((when (and guards$ (booleanp symbol))) (if symbol (jexpr-literal-true) (jexpr-literal-false))) (sym-pkg (symbol-package-name symbol)) (simple-name (atj-gen-shallow-symbol-field-name symbol)) ((when (or (equal sym-pkg curr-pkg) (member-eq symbol (pkg-imports curr-pkg)))) (jexpr-name simple-name)) (class-name (atj-get-pkg-class-name sym-pkg pkg-class-names))) (jexpr-name (str::cat class-name "." simple-name)))))
Theorem:
(defthm jexprp-of-atj-gen-shallow-symbol (b* ((expr (atj-gen-shallow-symbol symbol pkg-class-names curr-pkg guards$))) (jexprp expr)) :rule-classes :rewrite)