Repeating Constant Mappings #
Just like arbitrary functions, we can repeat constant mappings.
However, the behavior here is special since constant mappings are not of the form A -> A but of the form sig.C -> GroundTerm sig.
We can still repeat them by using ConstantMapping.apply_ground_term for the repetition.
We could also define repetition directly using Function.repeat_fun with ConstantMapping.apply_ground_term
but this only gives us a GroundTermMapping.
Here, we specifically define ConstantMapping.repeat_fun instead, which is again a ConstantMapping.
We also prove that this can be translated into a call of Function.repeat_fun with ConstantMapping.apply_ground_term.
We can repeat a constant mapping in the obvious way.
Note that we cannot directly use Function.repeat_fun since this could only give us a GroundTermMapping but not a ConstantMapping.
Equations
Instances For
As usual, repeating a mapping 0 times yields the id mapping.
A n+1 times repetition is a n times repetition followed by applying the ground term version of the ConstantMapping.
Repeating once yields the mapping itself.
ConstantMapping.repeat_fun can be expressed using Function.repeat_fun on ConstantMapping.apply_ground_term.
A n+1 times repetition is a single application followed by a n times repetition.