Ground Terms #
A GroundTerm is a constant or a functional term with arbitrary nesting of function symbols (SkolemFS).
Aiming to define GroundTerm, we need to define a more basic structure first, where we do not demand yet that function symbol arities are respected.
PreGroundTerms need to be able to model Skolem terms, i.e. function terms. We can represent those conveniently using inductively defined FiniteTrees.
With PreGroundTerms in place, we merely define GroundTerms to be the PreGroundTerms where arity_ok holds.
We then define appropriate constructors and recursion principles on the GroundTerm to make it behave almost like an inductive type with a GroundTerm.const and GroundTerm.func constructor.
The PreGroundTerm is simply a FiniteTree (SkolemFS sig) sig.C. That is a tree that features Skolem function symbols in its inner nodes and constants in its leaf nodes.
Equations
- PreGroundTerm sig = FiniteTree (SkolemFS sig) sig.C
Instances For
The arity of a functional term is ok if the defined arity of its function symbol matches its number of children and arity_ok also holds for each child. For constants, i.e. the leaf nodes, the arity is trivially ok.
Equations
- One or more equations did not get rendered due to their size.
- PreGroundTerm.arity_ok (FiniteTree.leaf a) = true
Instances For
As mentioned above, a GroundTerm is simply a PreGroundTerm subtype where arity_ok holds.
Equations
- GroundTerm sig = { t : PreGroundTerm sig // PreGroundTerm.arity_ok t = true }
Instances For
A GroundTerm can be direclty constructed from a constant.
Equations
- GroundTerm.const c = ⟨FiniteTree.leaf c, ⋯⟩
Instances For
The GroundTerm.const constructor is injective.
Also, a GroundTerm can be constructed from a SkolemFS and a list of GroundTerms as long as the length of the list matches the function symbol's arity.
Equations
- GroundTerm.func func ts arity_ok = ⟨FiniteTree.inner func ts.unattach, ⋯⟩
Instances For
The GroundTerm.func constructor is injective.
GroundTerm.func can never be equal to GroundTerm.const.
A term cannot occur in its own child.
We define a cases eliminator for the GroundTerm having a case for each constructor. This allows to use the cases tactic direcly on GroundTerms.
Equations
- One or more equations did not get rendered due to their size.
Instances For
We define an induction eliminator for the GroundTerm having a case for each constructor. This allows to use the induction tactic direcly on GroundTerms.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A GroundTerm that has been constructed from a constant can be converted into this constants again.
Equations
- t.toConst isConst = match eq : t.val with | FiniteTree.leaf c => c | FiniteTree.inner a a_1 => ⋯.elim
Instances For
For a GroundTerm that has been constructed as a functional term, we can obtain the function symbol.
Equations
- t.functionSymbol isFunc = match eq : t.val with | FiniteTree.leaf a => ⋯.elim | FiniteTree.inner func a => func
Instances For
The depth of a GroundTerm is the depth of the underlying FiniteTree, i.e. the deepest nesting of function symbols (+1).
Equations
- t.depth = FiniteTree.depth t.val
Instances For
The constants occurring in a GroundTerm are exactly the leaves of the underlying FiniteTree.
Equations
Instances For
The functions (i.e. function symbols SkolemFS) occurring in a GroundTerm are exactly the inner labels of the underlying FiniteTree.
Equations
Instances For
The rules that occur in the Skolem symbols of a GroundTerm.
Equations
Instances For
Applying toConst to a GroundTerm.const yields exactly the contained constant.
Applying functionSymbol to a GroundTerm.func yields exactly the contained function symbol.
Constants have depth 1.
The depth of a function term is the maximum depth of its children + 1.
Every term has a depth greater zero since constants already have depth 1.
The constants of a constant are the singleton list with the constant itself.
The constants of a function term are the constants of its children.
A constant has no functions.
The functions of a function term consist of the function symbol of the current term and the function symbols of all its children.
A constant has no rules.
The rules of a function term consist of the rules of the current term and the rules of all its children.