Polymorphic type of formulas with parser and printer.
Type | Description |
Function or value | Description |
Full Usage:
parse_atomic_formula (ifn, afn) vs inp
Parameters:
string list -> string list -> formula<'a> * string list
-
A restricted parser for infix atoms.
afn : string list -> string list -> formula<'a> * string list
-
A general parser for arbitrary atoms.
vs : string list
-
The set of bound variables in the current scope.
inp : string list
-
The list of string tokens
Returns: formula<'a> * string list
A pair consisting of the parsed formula tree together with
any unparsed input.
|
It attempts to parse an atomic formula as a term followed by an infix predicate symbol and only if that fails proceed to considering other kinds of formulas.
|
Full Usage:
parse_formula (ifn, afn) vs inp
Parameters:
string list -> string list -> formula<'a> * string list
-
A restricted parser for infix atoms.
afn : string list -> string list -> formula<'a> * string list
-
A general parser for arbitrary atoms.
vs : string list
-
The set of bound variables in the current scope.
inp : string list
-
The list of string tokens
Returns: formula<'a> * string list
A pair consisting of the parsed formula tree together with
any unparsed input.
|
It takes a list of string tokens
|
Full Usage:
parse_quant (ifn, afn) vs qcon x inp
Parameters:
string list -> string list -> formula<'a> * string list
-
A restricted parser for infix atoms.
afn : string list -> string list -> formula<'a> * string list
-
A general parser for arbitrary atoms.
vs : string list
-
The set of bound variables in the current scope.
qcon : string * formula<'a> -> formula<'a>
x : string
inp : string list
-
The list of string tokens
Returns: formula<'a> * string list
A pair consisting of the parsed formula tree together with
any unparsed input.
|
|
Function or value | Description |
Full Usage:
fbracket tw p n f x y
Parameters:
TextWriter
p : bool
n : 'a
f : 'b -> 'c -> unit
x : 'b
y : 'c
|
|
Full Usage:
fprint_formula tw pfn
Parameters:
TextWriter
pfn : int -> 'a -> unit
Returns: formula<'a> -> unit
|
|
Full Usage:
fprint_latex_qformula tw pfn fm
Parameters:
TextWriter
pfn : int -> 'a -> unit
fm : formula<'a>
|
|
Full Usage:
fprint_qformula tw pfn fm
Parameters:
TextWriter
pfn : int -> 'a -> unit
fm : formula<'a>
|
Note
The quotations symbols |
Full Usage:
print_formula pfn fm
Parameters:
int -> 'a -> unit
fm : formula<'a>
Modifiers: inline Type parameters: 'a |
|
Full Usage:
print_qformula pfn fm
Parameters:
int -> 'a -> unit
fm : formula<'a>
Modifiers: inline Type parameters: 'a |
|
Full Usage:
sprint_formula pfn fm
Parameters:
int -> 'a -> unit
fm : formula<'a>
Returns: string
Modifiers: inline Type parameters: 'a |
|
Full Usage:
sprint_qformula pfn fm
Parameters:
int -> 'a -> unit
fm : formula<'a>
Returns: string
Modifiers: inline Type parameters: 'a |
Function or value | Description | ||
|
See also: Formulas.dest_imp, Formulas.consequent.
Example
Evaluates to Atom "p" .
Example
Throws to System.Exception: dest_imp .
|
||
|
Recursively breaks apart repeated conjunctions \(p \land q \land r \cdots \) into the list of all the conjuncts \([p, q, r, \ldots]\).
Example
Evaluates to [Atom "p"; Atom "q"; Atom "r"] .
Example
Evaluates to [Imp (Atom "a", Atom "b")] .
|
||
|
See also: Formulas.dest_imp, Formulas.antecedent.
Example
Evaluates to Atom "q" .
Example
Throws to System.Exception: dest_imp .
|
||
|
It breaks apart a conjunction \(p \land q\) into the pair of its conjuncts \((p, q)\).
Example
Evaluates to (Atom "p", Atom "q") .
Example
Throws to System.Exception: dest_and .
|
||
|
It breaks apart a logical equivalence \(p \Leftrightarrow q\) into the pair of its members \((p, q)\).
Example
Evaluates to (Atom "p", Atom "q") .
Example
Throws to System.Exception: dest_iff .
|
||
|
It breaks apart an implications \(p \Rightarrow q\) into the pair of its antecedent and consequent \((p, q)\). See also: Formulas.antecedent, Formulas.consequent.
Example
Evaluates to (Atom "p", Atom "q") .
Example
Throws to System.Exception: dest_imp .
|
||
|
It breaks apart a disjunction \(p \lor q\) into the pair of its conjuncts \((p, q)\).
Example
Evaluates to (Atom "p", Atom "q") .
Example
Throws to System.Exception: dest_or .
|
||
|
Recursively breaks apart repeated disjunctions \(p \lor q \lor r \cdots \) into the list of all the disjuncts \([p, q, r, \ldots]\).
Example
Evaluates to [Atom "p"; Atom "q"; Atom "r"] .
Example
Evaluates to [Imp (Atom "a", Atom "b")] .
|
||
Full Usage:
strip_quant fm
Parameters:
formula<'a>
-
The supposed quantified formula.
Returns: string list * formula<'a>
The pair of the list of its quantified variables and body, if the input
formula is a universally quantified formula. If the formula is not a
universally quantified one, the list of variables is empty.
|
It breaks apart a quantified formula \(\forall xy\ldots z.\ p\) into a pair of the list of its quantified variables and body \(([x,y,\ldots,z], p)\).
Example
Evaluates to (["y"; "x"], Atom "p") .
Example
Evaluates to ([], Atom "p") .
|
Function or value | Description |
|
|
|
|
|
|
|
|
|
|
Function or value | Description |
Full Usage:
atom_union mapping fm
Parameters:
'T -> 'U list
-
The function to transform each attributes of the input formula's atoms into a sublist to be concatenated.
fm : formula<'T>
-
The input formula.
Returns: 'U list
The concatenation without duplicates of the transformed sublists.
|
Except for the final removing of duplicates, it is for formula what ListModule.collect is for list.
Example
Evaluates to [1; 2; 3; 4] .
Example
The sample evaluates to [1; 2; 3; 4] and not to [1; 1; 2; 1; 2; 3; 1; 2; 3; 4] since duplicates are removed;
|
|
It is for formula what ListModule.map is for list.
Example
Evaluates to And (Atom 5, Atom 10) .
|
Full Usage:
overatoms folder fm state
Parameters:
'T -> 'State -> 'State
-
The function to update the state given the input elements.
fm : formula<'T>
-
The input formula.
state : 'State
-
The initial state.
Returns: 'State
The final state value.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to each attributes of formula's atoms,
threading an accumulator argument through the computation. Take the
third argument, and apply the function to it and the attribute of the
first atom of the formula. Then feed this result into the function
along with the second atom and so on. Return the final result. If the
input function is It is for formula what ListModule.fold is for list.
NoteAlthough the inversion between the second and third arguments would seem to make this function similar to ListModule.foldBack, it actually corresponds to ListModule.fold because the folder function takes the accumulator as the first argument and the atom's argument as the second. Example
val fm: obj
Evaluates to 3 .
|