# [PPL-devel] Equivalent dimensions

Mario Mendez mario at cs.unm.edu
Fri Jul 22 23:28:57 CEST 2005

```Thanks! It's true that you already answered the question but I was
looking for an example....

P M Hill wrote:
> On Thu, 21 Jul 2005, Mario Mendez wrote:
>
>> Thank you! Another question then:
>>
>> How can I insert dimensions in the middle?
>> E.G: convert
>>     [B=2,E=8]  Dim= N
>> in      [B=2,G=8]  Dim = N + 2
>> after inserting two "universe" dimensions between the original B and
>> E. I already know how to add at the beginning/end, but no idea about
>> how to use the library for this particular purpose.
>
>
> I am not completely clear. If you mean that you want to insert two
> dimensions between the "B" and "C" dimensions, and rename the "E"
> dimension as "G", then here is a snippet of Prolog that does this.
>
>   T = c,
>   ppl_new_Polyhedron_from_space_dimension(T, 5, universe, P),
>   ppl_Polyhedron_add_constraints(P, [B = 2, E = 8]),
>   ppl_Polyhedron_map_space_dimensions(P,
>         [A-A, B-B, C-E, D-F, E-G, F-C, G-D]),
>   ppl_new_Polyhedron_from_space_dimension(T, 7, universe, Q),
>   ppl_Polyhedron_add_constraints(Q, [B = 2, G = 8]),
>   ppl_Polyhedron_equals_Polyhedron(P, Q).
>
>
> Basically, I have added the 2 new dimensions to the end and then use the
> "map_space_dimensions" predicate to rearrange the order of the dimensions.
>
>>
>> PS: I'm working in a abstract domain based on your library for finding
>> linear invariants....
>>
>
> Best wishes,
>   Pat

```