FO[Sugar]¶
Goal¶
The goal of FO[Sugar] is to add convenient notations: binary and direct quantifications, variable declaration, and the “in” operator.
It also supports reasoning with partial interpretation of symbols.
Binary Quantification and Variable Declaration¶
Syntax
FO[Sugar] adds these production rules:
Declaration ← VARIABLE IN ( Type | Symbol );
Quantee ← VARIABLE {',' VARIABLE} [ IN Symbol ];
Quantee ← VarTuple {',' VarTuple} IN Symbol;
VarTuple ← '(' VARIABLE { ',' VARIABLE } ')';
Well-formedness
Typemust be a declared type.Symbolmust be a declared predicate.Symbolmust be a unary predicate when quantifying aVARIABLE, and an n-ary predicate when quantifying aVarTuple.When the variable has been declared in the vocabulary, the
IN Symbolcan be omitted.When quantifying a
VarTuple, the number ofVARIABLEinVarTuplemust match the arity ofSymbol.
Semantics
Let’s assume that the type signature of P is T1 ⨯ ... ⨯ Tn → 𝔹.
∃ x1 ∈ P: φ
reduces to ∃ x1 ∈ T1: P(x1) ∧ φ (where P is unary).
When the vocabulary has the declaration var x in T1,
the formula can also be written ∃ x1: φ.
∃ (x1, ..., xn) ∈ P: φ
reduces to ∃ x1 ∈ T1, .., xn ∈ Tn: P(x1, .., xn) ∧ φ.
Similarly,∀ x1 ∈ P: φ
reduces to ∀ x1 ∈ T1: P(x1) ⇒ φ (where P is unary).
When the vocabulary has the declaration var x in T1,
the formula can also be written ∀ x1: φ.
∀ (x1, ..., xn) ∈ P: φ
reduces to ∀ x1 ∈ T1, .., xn ∈ Tn: P(x1, .., xn) ⇒ φ.
Example
Assuming that the type signature of man is Person → 𝔹,
∀ x in man: mortal(x). is equivalent to ∀ x in Person: man(x) ⇒ mortal(x).
Direct quantification¶
Syntax
FO[Sugar] adds these production rules:
Quantee ← VARIABLE {',' VARIABLE} IN '{' Value { ',' Value } '}';
Quantee ← VarTuple {',' VarTuple} IN '{' TupleValue { ',' TupleValue } '}';
Well-formedness
The
Values must have the same type; this type is the type of theVARIABLEs.The
TupleValuemust be of the same type; they must not have aTOValue. TheVarTupletype is the type of theTupleValues.
Semantics
∃ x ∈ {1,2,3}: φ(x)
reduces to φ(1) ∨ φ(2) ∨ φ(3).
∃ (x,y) ∈ {(a,1),(b,2)}: φ(x,y)
reduces to φ(a,1) ∨ φ(b,2).
∀ x ∈ {1,2,3}: φ(x)
reduces to φ(1) ∨ φ(2) ∨ φ(3).
∀ (x,y) ∈ {(a,1),(b,2)}: φ(x,y)
reduces to φ(a,1) ∧ φ(b,2).
“in” operator¶
Syntax
FO[Sugar] adds these production rules:
Unary ← { UNARY } Enum;
Enum ← Base IN '{' Value { ',' Value } '}';
Notice that this extension redefines the syntax of Unary in FO[Core].
Well-formedness
The type of Base must be the same as the type of Value.
Semantics
Base IN { Value1, ..., Valuen } is the same as Base=Value1 ∨ .. ∨ Base=Valuen.
Partial interpretation of symbols¶
The goal is to support reasoning with partial interpretations of functions and predicates.
Lexicon
Token |
Pattern |
Example |
|---|---|---|
INCLUDE |
|
Syntax
FO[Sugar] adds these production rules:
Enum ← NAME_S '(' Expression {',' Expression } ')' 'is' 'enumerated' ;
Interpretation ← NAME_S INCLUDE SymbolInterpretation '.';
Well-formedness
NAME_Smust be declared in the vocabulary and must be given anInterpretation.The number and types of arguments of
NAME_SinEnummust match its type signature.The number and type of values
Interpretationmust match the type signature of theNAME_Sbeing interpreted.An
InterpretationusingINCLUDEmust use aTOelement after every tuple of values in itsSymbolInterpretation. TheSymbolInterpretationdoes not have to be total over its domain.
Semantics
A symbol interpretation given using
INCLUDEis a partial interpretation of the symbol: the interpretation of the symbol is left unspecified for the tuples that are not interpreted.NAME_S(e1, .. , en) is enumeratedistruewhen theInterpretationofNAME_Sis total or when the interpretation of the tuple(e1, .. , en)is specified in theInterpretationofNAME_S. It isfalseotherwise.
Example
The following theory requires that material() has a known maximum temperature.
Material := {A, B, C}.
maxTemp :⊇ {A→100}. // maxTemp: Material -> Int
maxTemp(material()) is enumerated. // material: () -> Material
material() is thus A in every model.