OKlibrary  0.2.1.6
Representations.mac
Go to the documentation of this file.
00001 /* Matthew Gwynne, 23.7.2008 (Swansea) */
00002 /* Copyright 2008 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 
00024 kill(f)$
00025 
00026 /* *****************
00027    * Pruefer Codes *
00028    *****************
00029 */
00030 
00031 okltest_tree2pruefercode_og(f) := block(
00032   assert(f([[1],[]]) = []),
00033   assert(f([[1,2], [{1,2}]]) = []),
00034   assert(f([[1,2,3],[{1,2},{2,3}]]) = [2]),
00035   assert(f([[1,2,3],[{2,1},{1,3}]]) = [1]),
00036   assert(f([[1,2,3,4,5,6],[{1,2},{3,2},{2,4},{4,5},{4,6}]]) = [2,2,4,4]),
00037   assert(f([[6,5,4,3,2,1],[{1,2},{3,2},{2,4},{4,5},{4,6}]]) = [4,4,2,2]),
00038   true)$
00039 
00040 okltest_pruefercode2tree_og(f) := block(
00041   assert(f([1],[]) = [[1],[]]),
00042   assert(f([1,2], []) = [[1,2],[{1,2}]]),
00043   assert(f([1,2,3],[2]) = [[1,2,3],[{1,2},{2,3}]]),
00044   assert(f([1,2,3],[1]) = [[1,2,3],[{2,1},{1,3}]]),
00045   assert(f([1,2,3,4,5,6],[2,2,4,4]) =
00046     [[1,2,3,4,5,6],[{1,2},{3,2},{2,4},{4,5},{4,6}]]),
00047   assert(f([6,5,4,3,2,1],[4,4,2,2]) =
00048     [[6,5,4,3,2,1],[{4,6},{4,5},{2,4},{2,3},{1,2}]]),
00049   true)$
00050