:

## Nested Verification

Maple

Nested verification can be done in Maple using the following command,

```VerifyTools:-AddVerification('nested'=proc(x,y,ver::verification)
if whattype(x)=whattype(y) then
if x::Vector then verify(x,y,'Vector'('nested'(args[3..-1])))
elif x::Matrix then verify(x,y,'Matrix'('nested'(args[3..-1])))
elif x::Array then verify(x,y,'Array'('nested'(args[3..-1])))
elif x::array then verify(x,y,'array'('nested'(args[3..-1])))
elif x::set then verify(x,y,'set'('nested'(args[3..-1])))
elif x::list then verify(x,y,'list'('nested'(args[3..-1])))
elif x::relation then verify(x,y,'relation'('nested'(args[3..-1])))
elif x::range then verify(x,y,'range'('nested'(args[3..-1])))
else verify(x,y,args[3..-1]) fi
else verify(x,y,args[3..-1])
fi end);```

It works as follows,

`verify(expr1,expr2,nested);`

or

`verify(expr1,expr2,nested(some_verification));`

where `some_verification` should be substituted for some verification name. For example,

```A:=<<[[exp(I*x),x-x^2],{sin(x)^2,3}],(x-x^2<0)>|
<(5=y-z),{{[[1..2,3..x^2+x],5],3},(y-1)^2}>>;

A :=

[                 2             2              ]
[[[exp(x I), x - x ], {3, sin(x) }] , 5 = y - z]

[     2                            2                   2 ]
[x - x  < 0 , {{3, [[1 .. 2, 3 .. x  + x], 5]}, (y - 1) }]

B:=<<[[cos(x)+I*sin(x),x*(1-x)],{2+sin(x)^2+cos(x)^2,1-cos(x)^2}],(x<x^2)>|
<(z=y-5),{y^2-2*y+1,{3,[[cosh(x)^2-sinh(x)^2..2.,3.0..x*(x+1)],5.0000]}}>>;

B :=

[
[[[cos(x) + sin(x) I, x (1 - x)],

2            2         2              ]
{1 - cos(x) , 2 + sin(x)  + cos(x) }] , z = y - 5]

[     2     2
[x < x  , {y  - 2 y + 1,

2          2
{3, [[cosh(x)  - sinh(x)  .. 2., 3.0 .. x (x + 1)], 5.0000]}}

]
]

verify(A,B,nested(testeq));

true```

Another example,

```verify([[2,3],{1,5}],[[2.,3.0],{1.,5.00}],nested);

true```

______________
Alec Mihailovs
http://mihailovs.com/Alec/

﻿