Basic stuff for first order logic: datatype, parsing and printing, semantics, syntax operations and substitution.
Function or value | Description | ||
It is just a shortcut to call Fol.parset.
Example
Evaluates to
Example
Throws System.Exception: Closing bracket expected .
|
|||
Full Usage:
parse_atomic_term vs inp
Parameters:
string list
inp : string list
Returns: term * string list
|
|||
Full Usage:
parse_term vs inp
Parameters:
string list
inp : string list
Returns: term * string list
|
![]() ![]() ![]() ![]() ![]() ![]() Recursive descent parser of terms built up from an atomic term parser by cascading instances of parse infix in order of precedence, following the conventions with '^' coming highest and '::' lowest. It takes a list of string tokens `inp` and returns a pair consisting of the parsed term tree together with any unparsed input. In order to check whether a name is within the scope of a quantifier, it takes an additional argument `vs` which is the set of bound variables in the current scope.
|
||
Example
Evaluates to
Example
Throws System.Exception: Closing bracket expected .
|
Function or value | Description | ||
It is just a shortcut to call Fol.parse.
Example
Evaluates to Atom (R ("<", [Fn ("+", [Var "x"; Var "y"]); Var "z"])) .
Example
Throws System.Exception: Unparsed input: 2 tokens remaining in buffer.
|
|||
Example
Evaluates to [Atom (R ("P", Var "x"); Atom (R ("Q", Var "x")])) .
|
|||
Example
Evaluates to Atom (R ("<", [Fn ("+", [Var "x"; Var "y"]); Var "z"])) .
Example
Throws System.Exception: Unparsed input: 2 tokens remaining in buffer.
|
|||
|
|||
|
Function or value | Description |
|
|
Full Usage:
fprint_infix_term tw isleft oldprec newprec sym p q
Parameters:
TextWriter
isleft : bool
oldprec : int
newprec : int
sym : string
p : term
q : term
|
|
|
|
|
|
|
Example
After evaluation the text ``sqrt(1 - power(cos(x + y,2)))`` is
printed to the stdout .
|
Full Usage:
sprint_term t
Parameters:
term
-
The input term.
Returns: string
The terms's concrete syntax representation.
Modifiers: inline |
Use the interactive option
to automatically return the concrete syntax representation of terms
when working in an F# interactive session.
Note
The opening and closing quotation symbols Example
Evaluates to "``sqrt(1 - power(cos(x + y,2)))``" .
|
|
NoteThis function is not part of che book code and is added here for convenience. |
|
NoteThis function is not part of che book code and is added here for convenience. |
Function or value | Description |
|
|
|
|
|
|
Full Usage:
print_atom prec arg
Parameters:
'a
arg : fol
Modifiers: inline Type parameters: 'a |
|
|
Example
After evaluation the text
`forall x y. exists z. x < z /\ y < z` is
printed to the stdout .
|
|
|
Full Usage:
sprint_atom prec arg
Parameters:
'a
arg : fol
Returns: string
Modifiers: inline Type parameters: 'a |
|
|
Use the interactive option
to automatically return the concrete syntax representation of fol
formulas when working in an F# interactive session.
Note
The opening and closing quotation symbols Example
Evaluates to "`forall x y. exists z. x < z /\ y < z`" .
|
|
Function or value | Description |
Full Usage:
holds (domain, func, pred) v fm
Parameters:
'a list
-
The domain of the interpretation: the non-empty set \(D\) in which the value of each term lies.
func : string -> 'a list -> 'a
-
The mapping of each \(n\)-ary function symbol to a function \(f_M : D^n \rightarrow D\).
pred : string -> 'a list -> bool
-
The mapping of each \(n\)-ary predicate symbol to a boolean function \(P_M : D^n \rightarrow \{falso,vero\}\).
v : func<string, 'a>
-
The valuation of the variables: an fpf that maps each variable to an element of the domain.
fm : formula<fol>
-
The input formula.
Returns: bool
The truth-value of the formula in the given interpretation and
valuation.
|
Example
val fm: obj
|
Full Usage:
termval (domain, func, pred) v tm
Parameters:
'a
-
The domain of the interpretation: the non-empty set \(D\) in which the value of each term lies.
func : string -> 'b list -> 'b
-
The mapping of each \(n\)-ary function symbol to a function \(f_M : D^n \rightarrow D\).
pred : 'c
-
The mapping of each \(n\)-ary predicate symbol to a boolean function \(P_M : D^n \rightarrow \{falso,vero\}\).
v : func<string, 'b>
-
The valuation of the variables: an fpf that maps each variable to an element of the domain.
tm : term
-
The input term.
Returns: 'b
The element of the domain that corresponds to the term value in the
given interpretation and valuation.
|
Example
|
Function or value | Description |
Full Usage:
bool_interp
Returns: bool list * (string -> bool list -> bool) * (string -> 'a list -> bool)
|
|
Full Usage:
mod_interp n
Parameters:
int
-
The input modulo.
Returns: int list * (string -> int list -> int) * (string -> 'a list -> bool)
|
Example
|
Function or value | Description |
Example
Evaluates to ["x"; "y"; "z"] .
|
|
Function or value | Description |
Bound variables will be renamed if necessary to avoid capture.
Example
Evaluates to `forall x'. x' = x` .
Example
Evaluates to `forall x' x''. x' = x ==> x' = x''` .
|
|
Full Usage:
substq subfn quant x p
Parameters:
func<string, term>
-
The fpf that contains the mapping for the variables to replace.
quant : string -> formula<fol> -> formula<fol>
-
The quantification constructor to apply when reconstructing a quantified formula.
x : string
-
The variable to check.
p : formula<fol>
-
The input formula.
Returns: formula<fol>
The reconstructed quantified formula with appropriate variables
variants if needed.
|
Checks whether there would be variable capture if the bound variable
Example
Evaluates to `forall x'. x' = x` .
|
|
Replaces every variable in
Example
Evaluates to ``1 + f(y,2)`` .
|
Full Usage:
variant x vars
Parameters:
string
-
The input variable name.
vars : string list
-
The list of names to avoid.
Returns: string
The x itself it if is not contained in vars ; otherwise,
the string obtained from x adding prime characters to it until
it is distinct from every element of vars .
|
Creates a 'variant' of a variable name by adding prime characters to it
until it is distinct from every element of
Example
|
Function or value | Description |
|
|
Full Usage:
is_const_name s
Parameters:
string
-
The input string.
Returns: bool
true, if the input is a constant term, otherwise false.
|
Only numerals and the empty list constant
Example
|
It is similar to Formulas.onatoms but specific for fol formulas. Example
Evaluates to `P(x_1,f(z)) ==> Q(x_1)` .
|