4 import Prelude hiding (LT)
8 import Cube hiding (i, j, k)
10 import Misc (all_equal)
11 import Tests.FunctionValues ()
12 import Tetrahedron (b0, b1, b2, b3, c, fv,
13 v0, v1, v2, v3, volume)
19 -- | Since the grid size is necessarily positive, all tetrahedrons
20 -- (which comprise cubes of positive volume) must have positive volume
22 prop_all_volumes_positive :: Cube -> Bool
23 prop_all_volumes_positive cube =
24 null nonpositive_volumes
26 ts = tetrahedrons cube
27 volumes = map volume ts
28 nonpositive_volumes = filter (<= 0) volumes
30 -- | In fact, since all of the tetrahedra are identical, we should
31 -- already know their volumes. There's 24 tetrahedra to a cube, so
32 -- we'd expect the volume of each one to be (1/24)*h^3.
33 prop_tetrahedron0_volumes_exact :: Cube -> Bool
34 prop_tetrahedron0_volumes_exact cube =
35 volume (tetrahedron0 cube) ~~= (1/24)*(delta^(3::Int))
40 -- | In fact, since all of the tetrahedra are identical, we should
41 -- already know their volumes. There's 24 tetrahedra to a cube, so
42 -- we'd expect the volume of each one to be (1/24)*h^3.
43 prop_tetrahedron1_volumes_exact :: Cube -> Bool
44 prop_tetrahedron1_volumes_exact cube =
45 volume (tetrahedron1 cube) ~~= (1/24)*(delta^(3::Int))
49 -- | In fact, since all of the tetrahedra are identical, we should
50 -- already know their volumes. There's 24 tetrahedra to a cube, so
51 -- we'd expect the volume of each one to be (1/24)*h^3.
52 prop_tetrahedron2_volumes_exact :: Cube -> Bool
53 prop_tetrahedron2_volumes_exact cube =
54 volume (tetrahedron2 cube) ~~= (1/24)*(delta^(3::Int))
58 -- | In fact, since all of the tetrahedra are identical, we should
59 -- already know their volumes. There's 24 tetrahedra to a cube, so
60 -- we'd expect the volume of each one to be (1/24)*h^3.
61 prop_tetrahedron3_volumes_exact :: Cube -> Bool
62 prop_tetrahedron3_volumes_exact cube =
63 volume (tetrahedron3 cube) ~~= (1/24)*(delta^(3::Int))
67 -- | In fact, since all of the tetrahedra are identical, we should
68 -- already know their volumes. There's 24 tetrahedra to a cube, so
69 -- we'd expect the volume of each one to be (1/24)*h^3.
70 prop_tetrahedron4_volumes_exact :: Cube -> Bool
71 prop_tetrahedron4_volumes_exact cube =
72 volume (tetrahedron4 cube) ~~= (1/24)*(delta^(3::Int))
76 -- | In fact, since all of the tetrahedra are identical, we should
77 -- already know their volumes. There's 24 tetrahedra to a cube, so
78 -- we'd expect the volume of each one to be (1/24)*h^3.
79 prop_tetrahedron5_volumes_exact :: Cube -> Bool
80 prop_tetrahedron5_volumes_exact cube =
81 volume (tetrahedron5 cube) ~~= (1/24)*(delta^(3::Int))
85 -- | In fact, since all of the tetrahedra are identical, we should
86 -- already know their volumes. There's 24 tetrahedra to a cube, so
87 -- we'd expect the volume of each one to be (1/24)*h^3.
88 prop_tetrahedron6_volumes_exact :: Cube -> Bool
89 prop_tetrahedron6_volumes_exact cube =
90 volume (tetrahedron6 cube) ~~= (1/24)*(delta^(3::Int))
94 -- | In fact, since all of the tetrahedra are identical, we should
95 -- already know their volumes. There's 24 tetrahedra to a cube, so
96 -- we'd expect the volume of each one to be (1/24)*h^3.
97 prop_tetrahedron7_volumes_exact :: Cube -> Bool
98 prop_tetrahedron7_volumes_exact cube =
99 volume (tetrahedron7 cube) ~~= (1/24)*(delta^(3::Int))
103 -- | In fact, since all of the tetrahedra are identical, we should
104 -- already know their volumes. There's 24 tetrahedra to a cube, so
105 -- we'd expect the volume of each one to be (1/24)*h^3.
106 prop_tetrahedron8_volumes_exact :: Cube -> Bool
107 prop_tetrahedron8_volumes_exact cube =
108 volume (tetrahedron8 cube) ~~= (1/24)*(delta^(3::Int))
112 -- | In fact, since all of the tetrahedra are identical, we should
113 -- already know their volumes. There's 24 tetrahedra to a cube, so
114 -- we'd expect the volume of each one to be (1/24)*h^3.
115 prop_tetrahedron9_volumes_exact :: Cube -> Bool
116 prop_tetrahedron9_volumes_exact cube =
117 volume (tetrahedron9 cube) ~~= (1/24)*(delta^(3::Int))
121 -- | In fact, since all of the tetrahedra are identical, we should
122 -- already know their volumes. There's 24 tetrahedra to a cube, so
123 -- we'd expect the volume of each one to be (1/24)*h^3.
124 prop_tetrahedron10_volumes_exact :: Cube -> Bool
125 prop_tetrahedron10_volumes_exact cube =
126 volume (tetrahedron10 cube) ~~= (1/24)*(delta^(3::Int))
130 -- | In fact, since all of the tetrahedra are identical, we should
131 -- already know their volumes. There's 24 tetrahedra to a cube, so
132 -- we'd expect the volume of each one to be (1/24)*h^3.
133 prop_tetrahedron11_volumes_exact :: Cube -> Bool
134 prop_tetrahedron11_volumes_exact cube =
135 volume (tetrahedron11 cube) ~~= (1/24)*(delta^(3::Int))
139 -- | In fact, since all of the tetrahedra are identical, we should
140 -- already know their volumes. There's 24 tetrahedra to a cube, so
141 -- we'd expect the volume of each one to be (1/24)*h^3.
142 prop_tetrahedron12_volumes_exact :: Cube -> Bool
143 prop_tetrahedron12_volumes_exact cube =
144 volume (tetrahedron12 cube) ~~= (1/24)*(delta^(3::Int))
148 -- | In fact, since all of the tetrahedra are identical, we should
149 -- already know their volumes. There's 24 tetrahedra to a cube, so
150 -- we'd expect the volume of each one to be (1/24)*h^3.
151 prop_tetrahedron13_volumes_exact :: Cube -> Bool
152 prop_tetrahedron13_volumes_exact cube =
153 volume (tetrahedron13 cube) ~~= (1/24)*(delta^(3::Int))
157 -- | In fact, since all of the tetrahedra are identical, we should
158 -- already know their volumes. There's 24 tetrahedra to a cube, so
159 -- we'd expect the volume of each one to be (1/24)*h^3.
160 prop_tetrahedron14_volumes_exact :: Cube -> Bool
161 prop_tetrahedron14_volumes_exact cube =
162 volume (tetrahedron14 cube) ~~= (1/24)*(delta^(3::Int))
166 -- | In fact, since all of the tetrahedra are identical, we should
167 -- already know their volumes. There's 24 tetrahedra to a cube, so
168 -- we'd expect the volume of each one to be (1/24)*h^3.
169 prop_tetrahedron15_volumes_exact :: Cube -> Bool
170 prop_tetrahedron15_volumes_exact cube =
171 volume (tetrahedron15 cube) ~~= (1/24)*(delta^(3::Int))
175 -- | In fact, since all of the tetrahedra are identical, we should
176 -- already know their volumes. There's 24 tetrahedra to a cube, so
177 -- we'd expect the volume of each one to be (1/24)*h^3.
178 prop_tetrahedron16_volumes_exact :: Cube -> Bool
179 prop_tetrahedron16_volumes_exact cube =
180 volume (tetrahedron16 cube) ~~= (1/24)*(delta^(3::Int))
184 -- | In fact, since all of the tetrahedra are identical, we should
185 -- already know their volumes. There's 24 tetrahedra to a cube, so
186 -- we'd expect the volume of each one to be (1/24)*h^3.
187 prop_tetrahedron17_volumes_exact :: Cube -> Bool
188 prop_tetrahedron17_volumes_exact cube =
189 volume (tetrahedron17 cube) ~~= (1/24)*(delta^(3::Int))
193 -- | In fact, since all of the tetrahedra are identical, we should
194 -- already know their volumes. There's 24 tetrahedra to a cube, so
195 -- we'd expect the volume of each one to be (1/24)*h^3.
196 prop_tetrahedron18_volumes_exact :: Cube -> Bool
197 prop_tetrahedron18_volumes_exact cube =
198 volume (tetrahedron18 cube) ~~= (1/24)*(delta^(3::Int))
202 -- | In fact, since all of the tetrahedra are identical, we should
203 -- already know their volumes. There's 24 tetrahedra to a cube, so
204 -- we'd expect the volume of each one to be (1/24)*h^3.
205 prop_tetrahedron19_volumes_exact :: Cube -> Bool
206 prop_tetrahedron19_volumes_exact cube =
207 volume (tetrahedron19 cube) ~~= (1/24)*(delta^(3::Int))
211 -- | In fact, since all of the tetrahedra are identical, we should
212 -- already know their volumes. There's 24 tetrahedra to a cube, so
213 -- we'd expect the volume of each one to be (1/24)*h^3.
214 prop_tetrahedron20_volumes_exact :: Cube -> Bool
215 prop_tetrahedron20_volumes_exact cube =
216 volume (tetrahedron20 cube) ~~= (1/24)*(delta^(3::Int))
220 -- | In fact, since all of the tetrahedra are identical, we should
221 -- already know their volumes. There's 24 tetrahedra to a cube, so
222 -- we'd expect the volume of each one to be (1/24)*h^3.
223 prop_tetrahedron21_volumes_exact :: Cube -> Bool
224 prop_tetrahedron21_volumes_exact cube =
225 volume (tetrahedron21 cube) ~~= (1/24)*(delta^(3::Int))
229 -- | In fact, since all of the tetrahedra are identical, we should
230 -- already know their volumes. There's 24 tetrahedra to a cube, so
231 -- we'd expect the volume of each one to be (1/24)*h^3.
232 prop_tetrahedron22_volumes_exact :: Cube -> Bool
233 prop_tetrahedron22_volumes_exact cube =
234 volume (tetrahedron22 cube) ~~= (1/24)*(delta^(3::Int))
238 -- | In fact, since all of the tetrahedra are identical, we should
239 -- already know their volumes. There's 24 tetrahedra to a cube, so
240 -- we'd expect the volume of each one to be (1/24)*h^3.
241 prop_tetrahedron23_volumes_exact :: Cube -> Bool
242 prop_tetrahedron23_volumes_exact cube =
243 volume (tetrahedron23 cube) ~~= (1/24)*(delta^(3::Int))
247 -- | All tetrahedron should have their v0 located at the center of the cube.
248 prop_v0_all_equal :: Cube -> Bool
249 prop_v0_all_equal cube = (v0 t0) == (v0 t1)
251 t0 = head (tetrahedrons cube) -- Doesn't matter which two we choose.
252 t1 = head $ tail (tetrahedrons cube)
255 -- | This pretty much repeats the prop_all_volumes_positive property,
256 -- but will let me know which tetrahedrons's vertices are disoriented.
257 prop_tetrahedron0_volumes_positive :: Cube -> Bool
258 prop_tetrahedron0_volumes_positive cube =
259 volume (tetrahedron0 cube) > 0
261 -- | This pretty much repeats the prop_all_volumes_positive property,
262 -- but will let me know which tetrahedrons's vertices are disoriented.
263 prop_tetrahedron1_volumes_positive :: Cube -> Bool
264 prop_tetrahedron1_volumes_positive cube =
265 volume (tetrahedron1 cube) > 0
267 -- | This pretty much repeats the prop_all_volumes_positive property,
268 -- but will let me know which tetrahedrons's vertices are disoriented.
269 prop_tetrahedron2_volumes_positive :: Cube -> Bool
270 prop_tetrahedron2_volumes_positive cube =
271 volume (tetrahedron2 cube) > 0
273 -- | This pretty much repeats the prop_all_volumes_positive property,
274 -- but will let me know which tetrahedrons's vertices are disoriented.
275 prop_tetrahedron3_volumes_positive :: Cube -> Bool
276 prop_tetrahedron3_volumes_positive cube =
277 volume (tetrahedron3 cube) > 0
279 -- | This pretty much repeats the prop_all_volumes_positive property,
280 -- but will let me know which tetrahedrons's vertices are disoriented.
281 prop_tetrahedron4_volumes_positive :: Cube -> Bool
282 prop_tetrahedron4_volumes_positive cube =
283 volume (tetrahedron4 cube) > 0
285 -- | This pretty much repeats the prop_all_volumes_positive property,
286 -- but will let me know which tetrahedrons's vertices are disoriented.
287 prop_tetrahedron5_volumes_positive :: Cube -> Bool
288 prop_tetrahedron5_volumes_positive cube =
289 volume (tetrahedron5 cube) > 0
291 -- | This pretty much repeats the prop_all_volumes_positive property,
292 -- but will let me know which tetrahedrons's vertices are disoriented.
293 prop_tetrahedron6_volumes_positive :: Cube -> Bool
294 prop_tetrahedron6_volumes_positive cube =
295 volume (tetrahedron6 cube) > 0
297 -- | This pretty much repeats the prop_all_volumes_positive property,
298 -- but will let me know which tetrahedrons's vertices are disoriented.
299 prop_tetrahedron7_volumes_positive :: Cube -> Bool
300 prop_tetrahedron7_volumes_positive cube =
301 volume (tetrahedron7 cube) > 0
303 -- | This pretty much repeats the prop_all_volumes_positive property,
304 -- but will let me know which tetrahedrons's vertices are disoriented.
305 prop_tetrahedron8_volumes_positive :: Cube -> Bool
306 prop_tetrahedron8_volumes_positive cube =
307 volume (tetrahedron8 cube) > 0
309 -- | This pretty much repeats the prop_all_volumes_positive property,
310 -- but will let me know which tetrahedrons's vertices are disoriented.
311 prop_tetrahedron9_volumes_positive :: Cube -> Bool
312 prop_tetrahedron9_volumes_positive cube =
313 volume (tetrahedron9 cube) > 0
315 -- | This pretty much repeats the prop_all_volumes_positive property,
316 -- but will let me know which tetrahedrons's vertices are disoriented.
317 prop_tetrahedron10_volumes_positive :: Cube -> Bool
318 prop_tetrahedron10_volumes_positive cube =
319 volume (tetrahedron10 cube) > 0
321 -- | This pretty much repeats the prop_all_volumes_positive property,
322 -- but will let me know which tetrahedrons's vertices are disoriented.
323 prop_tetrahedron11_volumes_positive :: Cube -> Bool
324 prop_tetrahedron11_volumes_positive cube =
325 volume (tetrahedron11 cube) > 0
327 -- | This pretty much repeats the prop_all_volumes_positive property,
328 -- but will let me know which tetrahedrons's vertices are disoriented.
329 prop_tetrahedron12_volumes_positive :: Cube -> Bool
330 prop_tetrahedron12_volumes_positive cube =
331 volume (tetrahedron12 cube) > 0
333 -- | This pretty much repeats the prop_all_volumes_positive property,
334 -- but will let me know which tetrahedrons's vertices are disoriented.
335 prop_tetrahedron13_volumes_positive :: Cube -> Bool
336 prop_tetrahedron13_volumes_positive cube =
337 volume (tetrahedron13 cube) > 0
339 -- | This pretty much repeats the prop_all_volumes_positive property,
340 -- but will let me know which tetrahedrons's vertices are disoriented.
341 prop_tetrahedron14_volumes_positive :: Cube -> Bool
342 prop_tetrahedron14_volumes_positive cube =
343 volume (tetrahedron14 cube) > 0
345 -- | This pretty much repeats the prop_all_volumes_positive property,
346 -- but will let me know which tetrahedrons's vertices are disoriented.
347 prop_tetrahedron15_volumes_positive :: Cube -> Bool
348 prop_tetrahedron15_volumes_positive cube =
349 volume (tetrahedron15 cube) > 0
351 -- | This pretty much repeats the prop_all_volumes_positive property,
352 -- but will let me know which tetrahedrons's vertices are disoriented.
353 prop_tetrahedron16_volumes_positive :: Cube -> Bool
354 prop_tetrahedron16_volumes_positive cube =
355 volume (tetrahedron16 cube) > 0
357 -- | This pretty much repeats the prop_all_volumes_positive property,
358 -- but will let me know which tetrahedrons's vertices are disoriented.
359 prop_tetrahedron17_volumes_positive :: Cube -> Bool
360 prop_tetrahedron17_volumes_positive cube =
361 volume (tetrahedron17 cube) > 0
363 -- | This pretty much repeats the prop_all_volumes_positive property,
364 -- but will let me know which tetrahedrons's vertices are disoriented.
365 prop_tetrahedron18_volumes_positive :: Cube -> Bool
366 prop_tetrahedron18_volumes_positive cube =
367 volume (tetrahedron18 cube) > 0
369 -- | This pretty much repeats the prop_all_volumes_positive property,
370 -- but will let me know which tetrahedrons's vertices are disoriented.
371 prop_tetrahedron19_volumes_positive :: Cube -> Bool
372 prop_tetrahedron19_volumes_positive cube =
373 volume (tetrahedron19 cube) > 0
375 -- | This pretty much repeats the prop_all_volumes_positive property,
376 -- but will let me know which tetrahedrons's vertices are disoriented.
377 prop_tetrahedron20_volumes_positive :: Cube -> Bool
378 prop_tetrahedron20_volumes_positive cube =
379 volume (tetrahedron20 cube) > 0
381 -- | This pretty much repeats the prop_all_volumes_positive property,
382 -- but will let me know which tetrahedrons's vertices are disoriented.
383 prop_tetrahedron21_volumes_positive :: Cube -> Bool
384 prop_tetrahedron21_volumes_positive cube =
385 volume (tetrahedron21 cube) > 0
387 -- | This pretty much repeats the prop_all_volumes_positive property,
388 -- but will let me know which tetrahedrons's vertices are disoriented.
389 prop_tetrahedron22_volumes_positive :: Cube -> Bool
390 prop_tetrahedron22_volumes_positive cube =
391 volume (tetrahedron22 cube) > 0
393 -- | This pretty much repeats the prop_all_volumes_positive property,
394 -- but will let me know which tetrahedrons's vertices are disoriented.
395 prop_tetrahedron23_volumes_positive :: Cube -> Bool
396 prop_tetrahedron23_volumes_positive cube =
397 volume (tetrahedron23 cube) > 0
400 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Note that the
401 -- third and fourth indices of c-t1 have been switched. This is
402 -- because we store the triangles oriented such that their volume is
403 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde point
404 -- in opposite directions, one of them has to have negative volume!
405 prop_c0120_identity1 :: Cube -> Bool
406 prop_c0120_identity1 cube =
407 c t0 0 1 2 0 ~= (c t0 0 0 2 1 + c t3 0 0 1 2) / 2
409 t0 = tetrahedron0 cube
410 t3 = tetrahedron3 cube
413 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
414 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
415 prop_c0120_identity2 :: Cube -> Bool
416 prop_c0120_identity2 cube =
417 c t1 0 1 2 0 ~= (c t1 0 0 2 1 + c t0 0 0 1 2) / 2
419 t0 = tetrahedron0 cube
420 t1 = tetrahedron1 cube
422 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
423 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
424 prop_c0120_identity3 :: Cube -> Bool
425 prop_c0120_identity3 cube =
426 c t2 0 1 2 0 ~= (c t2 0 0 2 1 + c t1 0 0 1 2) / 2
428 t1 = tetrahedron1 cube
429 t2 = tetrahedron2 cube
431 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
432 -- 'prop_c0120_identity1' with tetrahedrons 2 and 3.
433 prop_c0120_identity4 :: Cube -> Bool
434 prop_c0120_identity4 cube =
435 c t3 0 1 2 0 ~= (c t3 0 0 2 1 + c t2 0 0 1 2) / 2
437 t2 = tetrahedron2 cube
438 t3 = tetrahedron3 cube
441 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
442 -- 'prop_c0120_identity1' with tetrahedrons 4 and 5.
443 prop_c0120_identity5 :: Cube -> Bool
444 prop_c0120_identity5 cube =
445 c t5 0 1 2 0 ~= (c t5 0 0 2 1 + c t4 0 0 1 2) / 2
447 t4 = tetrahedron4 cube
448 t5 = tetrahedron5 cube
450 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
451 -- -- 'prop_c0120_identity1' with tetrahedrons 5 and 6.
452 prop_c0120_identity6 :: Cube -> Bool
453 prop_c0120_identity6 cube =
454 c t6 0 1 2 0 ~= (c t6 0 0 2 1 + c t5 0 0 1 2) / 2
456 t5 = tetrahedron5 cube
457 t6 = tetrahedron6 cube
460 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
461 -- -- 'prop_c0120_identity1' with tetrahedrons 6 and 7.
462 prop_c0120_identity7 :: Cube -> Bool
463 prop_c0120_identity7 cube =
464 c t7 0 1 2 0 ~= (c t7 0 0 2 1 + c t6 0 0 1 2) / 2
466 t6 = tetrahedron6 cube
467 t7 = tetrahedron7 cube
470 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
471 -- 'prop_c0120_identity1'.
472 prop_c0210_identity1 :: Cube -> Bool
473 prop_c0210_identity1 cube =
474 c t0 0 2 1 0 ~= (c t0 0 1 1 1 + c t3 0 1 1 1) / 2
476 t0 = tetrahedron0 cube
477 t3 = tetrahedron3 cube
480 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
481 -- 'prop_c0120_identity1'.
482 prop_c0300_identity1 :: Cube -> Bool
483 prop_c0300_identity1 cube =
484 c t0 0 3 0 0 ~= (c t0 0 2 0 1 + c t3 0 2 1 0) / 2
486 t0 = tetrahedron0 cube
487 t3 = tetrahedron3 cube
490 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
491 -- 'prop_c0120_identity1'.
492 prop_c1110_identity :: Cube -> Bool
493 prop_c1110_identity cube =
494 c t0 1 1 1 0 ~= (c t0 1 0 1 1 + c t3 1 0 1 1) / 2
496 t0 = tetrahedron0 cube
497 t3 = tetrahedron3 cube
500 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
501 -- 'prop_c0120_identity1'.
502 prop_c1200_identity1 :: Cube -> Bool
503 prop_c1200_identity1 cube =
504 c t0 1 2 0 0 ~= (c t0 1 1 0 1 + c t3 1 1 1 0) / 2
506 t0 = tetrahedron0 cube
507 t3 = tetrahedron3 cube
510 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
511 -- 'prop_c0120_identity1'.
512 prop_c2100_identity1 :: Cube -> Bool
513 prop_c2100_identity1 cube =
514 c t0 2 1 0 0 ~= (c t0 2 0 0 1 + c t3 2 0 1 0) / 2
516 t0 = tetrahedron0 cube
517 t3 = tetrahedron3 cube
521 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). Note that the
522 -- third and fourth indices of c-t3 have been switched. This is
523 -- because we store the triangles oriented such that their volume is
524 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
525 -- point in opposite directions, one of them has to have negative
527 prop_c0102_identity1 :: Cube -> Bool
528 prop_c0102_identity1 cube =
529 c t0 0 1 0 2 ~= (c t0 0 0 1 2 + c t1 0 0 2 1) / 2
531 t0 = tetrahedron0 cube
532 t1 = tetrahedron1 cube
535 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
536 -- 'prop_c0102_identity1'.
537 prop_c0201_identity1 :: Cube -> Bool
538 prop_c0201_identity1 cube =
539 c t0 0 2 0 1 ~= (c t0 0 1 1 1 + c t1 0 1 1 1) / 2
541 t0 = tetrahedron0 cube
542 t1 = tetrahedron1 cube
545 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
546 -- 'prop_c0102_identity1'.
547 prop_c0300_identity2 :: Cube -> Bool
548 prop_c0300_identity2 cube =
549 c t0 0 3 0 0 ~= (c t0 0 2 1 0 + c t1 0 2 0 1) / 2
551 t0 = tetrahedron0 cube
552 t1 = tetrahedron1 cube
555 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
556 -- 'prop_c0102_identity1'.
557 prop_c1101_identity :: Cube -> Bool
558 prop_c1101_identity cube =
559 c t0 1 1 0 1 ~= (c t0 1 0 1 1 + c t1 1 0 1 1) / 2
561 t0 = tetrahedron0 cube
562 t1 = tetrahedron1 cube
565 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
566 -- 'prop_c0102_identity1'.
567 prop_c1200_identity2 :: Cube -> Bool
568 prop_c1200_identity2 cube =
569 c t0 1 2 0 0 ~= (c t0 1 1 1 0 + c t1 1 1 0 1) / 2
571 t0 = tetrahedron0 cube
572 t1 = tetrahedron1 cube
575 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
576 -- 'prop_c0102_identity1'.
577 prop_c2100_identity2 :: Cube -> Bool
578 prop_c2100_identity2 cube =
579 c t0 2 1 0 0 ~= (c t0 2 0 1 0 + c t1 2 0 0 1) / 2
581 t0 = tetrahedron0 cube
582 t1 = tetrahedron1 cube
585 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). The third and
586 -- fourth indices of c-t6 have been switched. This is because we
587 -- store the triangles oriented such that their volume is
588 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
589 -- point in opposite directions, one of them has to have negative
591 prop_c3000_identity :: Cube -> Bool
592 prop_c3000_identity cube =
593 c t0 3 0 0 0 ~= c t0 2 1 0 0 + c t6 2 1 0 0
594 - ((c t0 2 0 1 0 + c t0 2 0 0 1)/ 2)
596 t0 = tetrahedron0 cube
597 t6 = tetrahedron6 cube
600 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
601 -- 'prop_c3000_identity'.
602 prop_c2010_identity :: Cube -> Bool
603 prop_c2010_identity cube =
604 c t0 2 0 1 0 ~= c t0 1 1 1 0 + c t6 1 1 0 1
605 - ((c t0 1 0 2 0 + c t0 1 0 1 1)/ 2)
607 t0 = tetrahedron0 cube
608 t6 = tetrahedron6 cube
611 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
612 -- 'prop_c3000_identity'.
613 prop_c2001_identity :: Cube -> Bool
614 prop_c2001_identity cube =
615 c t0 2 0 0 1 ~= c t0 1 1 0 1 + c t6 1 1 1 0
616 - ((c t0 1 0 0 2 + c t0 1 0 1 1)/ 2)
618 t0 = tetrahedron0 cube
619 t6 = tetrahedron6 cube
622 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
623 -- 'prop_c3000_identity'.
624 prop_c1020_identity :: Cube -> Bool
625 prop_c1020_identity cube =
626 c t0 1 0 2 0 ~= c t0 0 1 2 0 + c t6 0 1 0 2
627 - ((c t0 0 0 3 0 + c t0 0 0 2 1)/ 2)
629 t0 = tetrahedron0 cube
630 t6 = tetrahedron6 cube
633 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
634 -- 'prop_c3000_identity'.
635 prop_c1002_identity :: Cube -> Bool
636 prop_c1002_identity cube =
637 c t0 1 0 0 2 ~= c t0 0 1 0 2 + c t6 0 1 2 0
638 - ((c t0 0 0 0 3 + c t0 0 0 1 2)/ 2)
640 t0 = tetrahedron0 cube
641 t6 = tetrahedron6 cube
644 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
645 -- 'prop_c3000_identity'.
646 prop_c1011_identity :: Cube -> Bool
647 prop_c1011_identity cube =
648 c t0 1 0 1 1 ~= c t0 0 1 1 1 + c t6 0 1 1 1 -
649 ((c t0 0 0 1 2 + c t0 0 0 2 1)/ 2)
651 t0 = tetrahedron0 cube
652 t6 = tetrahedron6 cube
656 -- | Given in Sorokina and Zeilfelder, p. 78.
657 prop_cijk1_identity :: Cube -> Bool
658 prop_cijk1_identity cube =
659 and [ c t0 i j k 1 ~=
660 (c t1 (i+1) j k 0) * ((b0 t0) (v3 t1)) +
661 (c t1 i (j+1) k 0) * ((b1 t0) (v3 t1)) +
662 (c t1 i j (k+1) 0) * ((b2 t0) (v3 t1)) +
663 (c t1 i j k 1) * ((b3 t0) (v3 t1)) | i <- [0..2],
668 t0 = tetrahedron0 cube
669 t1 = tetrahedron1 cube
672 -- | The function values at the interior should be the same for all tetrahedra.
673 prop_interior_values_all_identical :: Cube -> Bool
674 prop_interior_values_all_identical cube =
675 all_equal [i0, i1, i2, i3, i4, i5, i6, i7, i8,
676 i9, i10, i11, i12, i13, i14, i15, i16,
677 i17, i18, i19, i20, i21, i22, i23]
679 i0 = eval (Tetrahedron.fv (tetrahedron0 cube)) I
680 i1 = eval (Tetrahedron.fv (tetrahedron1 cube)) I
681 i2 = eval (Tetrahedron.fv (tetrahedron2 cube)) I
682 i3 = eval (Tetrahedron.fv (tetrahedron3 cube)) I
683 i4 = eval (Tetrahedron.fv (tetrahedron4 cube)) I
684 i5 = eval (Tetrahedron.fv (tetrahedron5 cube)) I
685 i6 = eval (Tetrahedron.fv (tetrahedron6 cube)) I
686 i7 = eval (Tetrahedron.fv (tetrahedron7 cube)) I
687 i8 = eval (Tetrahedron.fv (tetrahedron8 cube)) I
688 i9 = eval (Tetrahedron.fv (tetrahedron9 cube)) I
689 i10 = eval (Tetrahedron.fv (tetrahedron10 cube)) I
690 i11 = eval (Tetrahedron.fv (tetrahedron11 cube)) I
691 i12 = eval (Tetrahedron.fv (tetrahedron12 cube)) I
692 i13 = eval (Tetrahedron.fv (tetrahedron13 cube)) I
693 i14 = eval (Tetrahedron.fv (tetrahedron14 cube)) I
694 i15 = eval (Tetrahedron.fv (tetrahedron15 cube)) I
695 i16 = eval (Tetrahedron.fv (tetrahedron16 cube)) I
696 i17 = eval (Tetrahedron.fv (tetrahedron17 cube)) I
697 i18 = eval (Tetrahedron.fv (tetrahedron18 cube)) I
698 i19 = eval (Tetrahedron.fv (tetrahedron19 cube)) I
699 i20 = eval (Tetrahedron.fv (tetrahedron20 cube)) I
700 i21 = eval (Tetrahedron.fv (tetrahedron21 cube)) I
701 i22 = eval (Tetrahedron.fv (tetrahedron22 cube)) I
702 i23 = eval (Tetrahedron.fv (tetrahedron23 cube)) I
705 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
706 -- This test checks the rotation works as expected.
707 prop_c_tilde_2100_rotation_correct :: Cube -> Bool
708 prop_c_tilde_2100_rotation_correct cube =
711 t0 = tetrahedron0 cube
712 t6 = tetrahedron6 cube
714 -- What gets computed for c2100 of t6.
715 expr1 = eval (Tetrahedron.fv t6) $
717 (1/12)*(T + R + L + D) +
718 (1/64)*(FT + FR + FL + FD) +
721 (1/96)*(RT + LD + LT + RD) +
722 (1/192)*(BT + BR + BL + BD)
724 -- What should be computed for c2100 of t6.
725 expr2 = eval (Tetrahedron.fv t0) $
727 (1/12)*(F + R + L + B) +
728 (1/64)*(FT + RT + LT + BT) +
731 (1/96)*(FR + FL + BR + BL) +
732 (1/192)*(FD + RD + LD + BD)
735 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
736 -- This test checks the actual value based on the FunctionValues of the cube.
737 prop_c_tilde_2100_correct :: Cube -> Bool
738 prop_c_tilde_2100_correct cube =
739 c t6 2 1 0 0 == (3/8)*int
740 + (1/12)*(f + r + l + b)
741 + (1/64)*(ft + rt + lt + bt)
742 + (7/48)*t + (1/48)*d + (1/96)*(fr + fl + br + bl)
743 + (1/192)*(fd + rd + ld + bd)
745 t0 = tetrahedron0 cube
746 t6 = tetrahedron6 cube
747 fvs = Tetrahedron.fv t0
768 -- Tests to check that the correct edges are incidental.
769 prop_t0_shares_edge_with_t1 :: Cube -> Bool
770 prop_t0_shares_edge_with_t1 cube =
771 (v1 t0) == (v1 t1) && (v3 t0) == (v2 t1)
773 t0 = tetrahedron0 cube
774 t1 = tetrahedron1 cube
776 prop_t0_shares_edge_with_t3 :: Cube -> Bool
777 prop_t0_shares_edge_with_t3 cube =
778 (v1 t0) == (v1 t3) && (v2 t0) == (v3 t3)
780 t0 = tetrahedron0 cube
781 t3 = tetrahedron3 cube
783 prop_t0_shares_edge_with_t6 :: Cube -> Bool
784 prop_t0_shares_edge_with_t6 cube =
785 (v2 t0) == (v3 t6) && (v3 t0) == (v2 t6)
787 t0 = tetrahedron0 cube
788 t6 = tetrahedron6 cube
790 prop_t1_shares_edge_with_t2 :: Cube -> Bool
791 prop_t1_shares_edge_with_t2 cube =
792 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
794 t1 = tetrahedron1 cube
795 t2 = tetrahedron2 cube
797 prop_t1_shares_edge_with_t19 :: Cube -> Bool
798 prop_t1_shares_edge_with_t19 cube =
799 (v2 t1) == (v3 t19) && (v3 t1) == (v2 t19)
801 t1 = tetrahedron1 cube
802 t19 = tetrahedron19 cube
804 prop_t2_shares_edge_with_t3 :: Cube -> Bool
805 prop_t2_shares_edge_with_t3 cube =
806 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
808 t1 = tetrahedron1 cube
809 t2 = tetrahedron2 cube
811 prop_t2_shares_edge_with_t12 :: Cube -> Bool
812 prop_t2_shares_edge_with_t12 cube =
813 (v2 t2) == (v3 t12) && (v3 t2) == (v2 t12)
815 t2 = tetrahedron2 cube
816 t12 = tetrahedron12 cube
818 prop_t3_shares_edge_with_t21 :: Cube -> Bool
819 prop_t3_shares_edge_with_t21 cube =
820 (v2 t3) == (v3 t21) && (v3 t3) == (v2 t21)
822 t3 = tetrahedron3 cube
823 t21 = tetrahedron21 cube
825 prop_t4_shares_edge_with_t5 :: Cube -> Bool
826 prop_t4_shares_edge_with_t5 cube =
827 (v1 t4) == (v1 t5) && (v3 t4) == (v2 t5)
829 t4 = tetrahedron4 cube
830 t5 = tetrahedron5 cube
832 prop_t4_shares_edge_with_t7 :: Cube -> Bool
833 prop_t4_shares_edge_with_t7 cube =
834 (v1 t4) == (v1 t7) && (v2 t4) == (v3 t7)
836 t4 = tetrahedron4 cube
837 t7 = tetrahedron7 cube
839 prop_t4_shares_edge_with_t10 :: Cube -> Bool
840 prop_t4_shares_edge_with_t10 cube =
841 (v2 t4) == (v3 t10) && (v3 t4) == (v2 t10)
843 t4 = tetrahedron4 cube
844 t10 = tetrahedron10 cube
846 prop_t5_shares_edge_with_t6 :: Cube -> Bool
847 prop_t5_shares_edge_with_t6 cube =
848 (v1 t5) == (v1 t6) && (v3 t5) == (v2 t6)
850 t5 = tetrahedron5 cube
851 t6 = tetrahedron6 cube
853 prop_t5_shares_edge_with_t16 :: Cube -> Bool
854 prop_t5_shares_edge_with_t16 cube =
855 (v2 t5) == (v3 t16) && (v3 t5) == (v2 t16)
857 t5 = tetrahedron5 cube
858 t16 = tetrahedron16 cube
860 prop_t6_shares_edge_with_t7 :: Cube -> Bool
861 prop_t6_shares_edge_with_t7 cube =
862 (v1 t6) == (v1 t7) && (v3 t6) == (v2 t7)
864 t6 = tetrahedron6 cube
865 t7 = tetrahedron7 cube
867 prop_t7_shares_edge_with_t20 :: Cube -> Bool
868 prop_t7_shares_edge_with_t20 cube =
869 (v2 t7) == (v3 t20) && (v2 t7) == (v3 t20)
871 t7 = tetrahedron7 cube
872 t20 = tetrahedron20 cube