OKlibrary  0.2.1.6
ConstraintTemplateGlobalPropagation.mac
Go to the documentation of this file.
00001 /* Matthew Gwynne, 7.12.2010 (Swansea) */
00002 /* Copyright 2010 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")$
00023 oklib_include("OKlib/ComputerAlgebra/Cryptology/Lisp/Cryptanalysis/Rijndael/ConstraintTemplateGlobalPropagation.mac")$
00024 
00025 kill(f)$
00026 
00027 /********************************
00028  * Propagation functions            *
00029  ********************************
00030 */
00031 
00032 okltest_prop_all_csttl(f) := block(
00033   assert(f([],[],[]) = [[],[]]),
00034   assert(f([],[],[lambda([a,b],[[1],[]])]) = [[1],[]]),
00035   assert(f([["test_cst",[1,2,3]]],[],
00036            [lambda([a,b],[[["new_test",[1,2,3,4]]],[]])]) =
00037          [[["new_test",[1,2,3,4]]],[]]),
00038   true)$
00039 
00040 
00041 /****************************************
00042  * Standard functions                   *
00043  ****************************************
00044 */
00045 
00046 okltest_prop_eq_vars_l(f) := block(
00047   assert(f([]) = []),
00048   assert(f([["eq_cst",[1,2,3,4]]]) = [veq(1,3),veq(2,4)]),
00049   assert(f([["eq_cst",[1,2,3,4]], ["test",[4,5,6]]]) = [veq(1,3),veq(2,4)]),
00050   true)$
00051 
00052 okltest_prop_eq_csttl(f) := block(
00053   assert(f([],[]) = [[],[]]),
00054   assert(f([["eq_cst",[1,2,3,4]]],[1,2,3,4]) = [[],[veq(1,3),veq(2,4)]]),
00055   assert(f([["eq_cst",[1,2,3,4]], ["test",[4,5,6]]], [1,2,3,4,5,6]) =
00056     [[["test",[veq(2,4),5,6]]],[veq(1,3),veq(2,4),5,6]]),
00057   assert(f([["eq_cst",[1,2,3,4]], ["eq_cst",[3,4,5,6]], ["test",[4,5,6]]],
00058       [1,2,3,4,5,6]) =
00059     [[["test",[veq(veq(2,4),6),veq(veq(1,3),5),veq(veq(2,4),6)]]],
00060      [veq(veq(1,3),5),veq(veq(2,4),6)]]),
00061   true)$
00062