Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG in new parenthesis code #36

Open
EasyArray opened this issue Mar 19, 2022 · 3 comments
Open

BUG in new parenthesis code #36

EasyArray opened this issue Mar 19, 2022 · 3 comments
Assignees

Comments

@EasyArray
Copy link
Owner

# The original rules: ",_a=_a" just passes along the assignment
rule TN  ⟦α⟧          = lex[α]        || α ∈ lex
rule NN  ⟦tree[_α β]⟧ = ⟦β,_a=_a⟧     || α != pro
rule FAR ⟦tree[γ β]⟧  = ⟦β,_a=_a⟧(⟦γ,_a=_a⟧) || isfun(⟦β,_a=_a⟧) and (⟦γ,_a=_a⟧∈dom(⟦β,_a=_a⟧))
rule FAL ⟦tree[β γ]⟧  = ⟦β,_a=_a⟧(⟦γ,_a=_a⟧) || isfun(⟦β,_a=_a⟧) and (⟦γ,_a=_a⟧∈dom(⟦β,_a=_a⟧))

# A revised PM rule: notice the new presupposition!
rule PM  ⟦tree[β γ]⟧  = [λx : ⟦β,_a=_a⟧(x) is not None and ⟦γ,_a=_a⟧(x) is not None . ⟦β,_a=_a⟧(x) ∧ ⟦γ,_a=_a⟧(x)] || τ(⟦γ,_a=_a⟧)==τ(⟦β,_a=_a⟧)==⟨e,t⟩

# New PA and TP rules
rule PA  ⟦tree[_CP β γ]⟧ = [λx : ⟦γ,_a=x⟧ is not None. ⟦γ,_a=x⟧]
rule TP  ⟦tree[_pro β]⟧  = _a

lex raining = 1
lex smokes = [λx . smokesʼ(x)]

⟦tree[_CP who [[_pro t] smokes]],True⟧

adds extra parens around the sentence in the output:

[λx∈e: ⟦(tree[tree[_pro t] smokes]),_a=x⟧ is not None. ⟦(tree[tree[_pro t] smokes]),_a=x⟧]
@EasyArray
Copy link
Owner Author

The above is not a huge deal, since (tree[...]) evaluates the same as just tree[...]. However, here is a worse problem:

lex no = [λp . [λq . ext(λy . p(y) & q(y)) == {}]]
⟦no⟧

evaluates to

[λp∈e.[λq∈e. ext[λy∈e. p(y) & q(y)] == {}]]

Notice the lack of parentheses after ext.

@EasyArray
Copy link
Owner Author

Actually, even that is not so bad, because I forgot the [] around the lambda function!

@havijw
Copy link
Collaborator

havijw commented Mar 21, 2022

Discussion from email

There are no major problems here, but there are some cases where parentheses are being added when they aren't needed.

  • At the level where this parenthesis logic is calculated, double brackets should count as delimiters, but they are not in Token.delims, so (among other issues) ⟦foo⟧ for instance would not count as a Span.
    • A hasDelims function that takes into account double brackets should be able to solve this.
  • Things that look like f(x) (also including tree[...]) should count as a single item.
    • Logic for detecting something like this already exists with peek in Span.update:
      if peek is not None:
      DEBUGGING and mylog(f"Next item: {peek}::{type(peek)}")
      if isinstance(peek, Span) and peek[0].string == "(":
  • Spaces are currently being put inside parentheses, when they should be outside. For instance, we get foo( bar) rather than foo (bar), and the latter is clearly preferable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants