Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Forbid uppercased propositions in LDLf #28

Open
marcofavorito opened this issue Mar 24, 2020 · 1 comment
Open

Forbid uppercased propositions in LDLf #28

marcofavorito opened this issue Mar 24, 2020 · 1 comment

Comments

@marcofavorito
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, it is still legal to create an LDLf formula whose atoms have upper-cased characters, differently from LTLf.

from flloat.parser.ltlf import LTLfParser
LTLfParser()("F(a)") # this is OK
LTLfParser()("F(A)") # this raises error
from flloat.parser.ldlf import LDLfParser
LTLfParser()("a") # this is OK
LTLfParser()("A") # this is OK although should raise exception

Describe the solution you'd like
Update LDLf module to forbid uppercased propositions.

Describe alternatives you've considered

Additional context

@marcofavorito marcofavorito changed the title Forbid uppercased in LDLf Forbid uppercased proposition in LDLf Mar 24, 2020
@marcofavorito marcofavorito changed the title Forbid uppercased proposition in LDLf Forbid uppercased propositions in LDLf Mar 24, 2020
@cipollone
Copy link
Collaborator

cipollone commented Mar 24, 2020

Yes, this was the intended behaviour.
The naming convention for all atomics is:

flloat/flloat/base.py

Lines 33 to 41 in 75e8ec9

class AtomicFormula(Formula, ABC):
"""An abstract atomic formula.
Both formulae and names can be used as atomic symbols.
A name must be a string made of letters, numbers, underscores, or it must
be a quoted string.
"""
name_regex = re.compile(r'(\w+)|(".*")')

This is inherited by PLAtomic and LDLfPropositionalAtom. Instead, LTLfAtomic overrides the regex to forbid uppercase letters (to solve the ambiguity with with temporal operators).

Maybe we prefer a more uniform behaviour, among logics. In this case, we can simply move the regex from LTLfAtomic to AtomicFormula, to apply it to all of them.

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

No branches or pull requests

2 participants