4 import Prelude hiding (LT)
9 import Cube hiding (i, j, k)
11 import Misc (all_equal)
12 import Tests.FunctionValues ()
13 import Tetrahedron (b0, b1, b2, b3, c, fv,
14 v0, v1, v2, v3, volume)
16 instance Arbitrary Cube where
18 (Positive h') <- arbitrary :: Gen (Positive Double)
19 i' <- choose (coordmin, coordmax)
20 j' <- choose (coordmin, coordmax)
21 k' <- choose (coordmin, coordmax)
22 fv' <- arbitrary :: Gen FunctionValues
23 return (Cube h' i' j' k' fv')
25 coordmin = -268435456 -- -(2^29 / 2)
26 coordmax = 268435456 -- +(2^29 / 2)
31 -- | Since the grid size is necessarily positive, all tetrahedrons
32 -- (which comprise cubes of positive volume) must have positive volume
34 prop_all_volumes_positive :: Cube -> Bool
35 prop_all_volumes_positive cube =
36 null nonpositive_volumes
38 ts = tetrahedrons cube
39 volumes = map volume ts
40 nonpositive_volumes = filter (<= 0) volumes
42 -- | In fact, since all of the tetrahedra are identical, we should
43 -- already know their volumes. There's 24 tetrahedra to a cube, so
44 -- we'd expect the volume of each one to be (1/24)*h^3.
45 prop_tetrahedron0_volumes_exact :: Cube -> Bool
46 prop_tetrahedron0_volumes_exact cube =
47 volume (tetrahedron0 cube) ~~= (1/24)*(delta^(3::Int))
52 -- | In fact, since all of the tetrahedra are identical, we should
53 -- already know their volumes. There's 24 tetrahedra to a cube, so
54 -- we'd expect the volume of each one to be (1/24)*h^3.
55 prop_tetrahedron1_volumes_exact :: Cube -> Bool
56 prop_tetrahedron1_volumes_exact cube =
57 volume (tetrahedron1 cube) ~~= (1/24)*(delta^(3::Int))
61 -- | In fact, since all of the tetrahedra are identical, we should
62 -- already know their volumes. There's 24 tetrahedra to a cube, so
63 -- we'd expect the volume of each one to be (1/24)*h^3.
64 prop_tetrahedron2_volumes_exact :: Cube -> Bool
65 prop_tetrahedron2_volumes_exact cube =
66 volume (tetrahedron2 cube) ~~= (1/24)*(delta^(3::Int))
70 -- | In fact, since all of the tetrahedra are identical, we should
71 -- already know their volumes. There's 24 tetrahedra to a cube, so
72 -- we'd expect the volume of each one to be (1/24)*h^3.
73 prop_tetrahedron3_volumes_exact :: Cube -> Bool
74 prop_tetrahedron3_volumes_exact cube =
75 volume (tetrahedron3 cube) ~~= (1/24)*(delta^(3::Int))
79 -- | In fact, since all of the tetrahedra are identical, we should
80 -- already know their volumes. There's 24 tetrahedra to a cube, so
81 -- we'd expect the volume of each one to be (1/24)*h^3.
82 prop_tetrahedron4_volumes_exact :: Cube -> Bool
83 prop_tetrahedron4_volumes_exact cube =
84 volume (tetrahedron4 cube) ~~= (1/24)*(delta^(3::Int))
88 -- | In fact, since all of the tetrahedra are identical, we should
89 -- already know their volumes. There's 24 tetrahedra to a cube, so
90 -- we'd expect the volume of each one to be (1/24)*h^3.
91 prop_tetrahedron5_volumes_exact :: Cube -> Bool
92 prop_tetrahedron5_volumes_exact cube =
93 volume (tetrahedron5 cube) ~~= (1/24)*(delta^(3::Int))
97 -- | In fact, since all of the tetrahedra are identical, we should
98 -- already know their volumes. There's 24 tetrahedra to a cube, so
99 -- we'd expect the volume of each one to be (1/24)*h^3.
100 prop_tetrahedron6_volumes_exact :: Cube -> Bool
101 prop_tetrahedron6_volumes_exact cube =
102 volume (tetrahedron6 cube) ~~= (1/24)*(delta^(3::Int))
106 -- | In fact, since all of the tetrahedra are identical, we should
107 -- already know their volumes. There's 24 tetrahedra to a cube, so
108 -- we'd expect the volume of each one to be (1/24)*h^3.
109 prop_tetrahedron7_volumes_exact :: Cube -> Bool
110 prop_tetrahedron7_volumes_exact cube =
111 volume (tetrahedron7 cube) ~~= (1/24)*(delta^(3::Int))
115 -- | In fact, since all of the tetrahedra are identical, we should
116 -- already know their volumes. There's 24 tetrahedra to a cube, so
117 -- we'd expect the volume of each one to be (1/24)*h^3.
118 prop_tetrahedron8_volumes_exact :: Cube -> Bool
119 prop_tetrahedron8_volumes_exact cube =
120 volume (tetrahedron8 cube) ~~= (1/24)*(delta^(3::Int))
124 -- | In fact, since all of the tetrahedra are identical, we should
125 -- already know their volumes. There's 24 tetrahedra to a cube, so
126 -- we'd expect the volume of each one to be (1/24)*h^3.
127 prop_tetrahedron9_volumes_exact :: Cube -> Bool
128 prop_tetrahedron9_volumes_exact cube =
129 volume (tetrahedron9 cube) ~~= (1/24)*(delta^(3::Int))
133 -- | In fact, since all of the tetrahedra are identical, we should
134 -- already know their volumes. There's 24 tetrahedra to a cube, so
135 -- we'd expect the volume of each one to be (1/24)*h^3.
136 prop_tetrahedron10_volumes_exact :: Cube -> Bool
137 prop_tetrahedron10_volumes_exact cube =
138 volume (tetrahedron10 cube) ~~= (1/24)*(delta^(3::Int))
142 -- | In fact, since all of the tetrahedra are identical, we should
143 -- already know their volumes. There's 24 tetrahedra to a cube, so
144 -- we'd expect the volume of each one to be (1/24)*h^3.
145 prop_tetrahedron11_volumes_exact :: Cube -> Bool
146 prop_tetrahedron11_volumes_exact cube =
147 volume (tetrahedron11 cube) ~~= (1/24)*(delta^(3::Int))
151 -- | In fact, since all of the tetrahedra are identical, we should
152 -- already know their volumes. There's 24 tetrahedra to a cube, so
153 -- we'd expect the volume of each one to be (1/24)*h^3.
154 prop_tetrahedron12_volumes_exact :: Cube -> Bool
155 prop_tetrahedron12_volumes_exact cube =
156 volume (tetrahedron12 cube) ~~= (1/24)*(delta^(3::Int))
160 -- | In fact, since all of the tetrahedra are identical, we should
161 -- already know their volumes. There's 24 tetrahedra to a cube, so
162 -- we'd expect the volume of each one to be (1/24)*h^3.
163 prop_tetrahedron13_volumes_exact :: Cube -> Bool
164 prop_tetrahedron13_volumes_exact cube =
165 volume (tetrahedron13 cube) ~~= (1/24)*(delta^(3::Int))
169 -- | In fact, since all of the tetrahedra are identical, we should
170 -- already know their volumes. There's 24 tetrahedra to a cube, so
171 -- we'd expect the volume of each one to be (1/24)*h^3.
172 prop_tetrahedron14_volumes_exact :: Cube -> Bool
173 prop_tetrahedron14_volumes_exact cube =
174 volume (tetrahedron14 cube) ~~= (1/24)*(delta^(3::Int))
178 -- | In fact, since all of the tetrahedra are identical, we should
179 -- already know their volumes. There's 24 tetrahedra to a cube, so
180 -- we'd expect the volume of each one to be (1/24)*h^3.
181 prop_tetrahedron15_volumes_exact :: Cube -> Bool
182 prop_tetrahedron15_volumes_exact cube =
183 volume (tetrahedron15 cube) ~~= (1/24)*(delta^(3::Int))
187 -- | In fact, since all of the tetrahedra are identical, we should
188 -- already know their volumes. There's 24 tetrahedra to a cube, so
189 -- we'd expect the volume of each one to be (1/24)*h^3.
190 prop_tetrahedron16_volumes_exact :: Cube -> Bool
191 prop_tetrahedron16_volumes_exact cube =
192 volume (tetrahedron16 cube) ~~= (1/24)*(delta^(3::Int))
196 -- | In fact, since all of the tetrahedra are identical, we should
197 -- already know their volumes. There's 24 tetrahedra to a cube, so
198 -- we'd expect the volume of each one to be (1/24)*h^3.
199 prop_tetrahedron17_volumes_exact :: Cube -> Bool
200 prop_tetrahedron17_volumes_exact cube =
201 volume (tetrahedron17 cube) ~~= (1/24)*(delta^(3::Int))
205 -- | In fact, since all of the tetrahedra are identical, we should
206 -- already know their volumes. There's 24 tetrahedra to a cube, so
207 -- we'd expect the volume of each one to be (1/24)*h^3.
208 prop_tetrahedron18_volumes_exact :: Cube -> Bool
209 prop_tetrahedron18_volumes_exact cube =
210 volume (tetrahedron18 cube) ~~= (1/24)*(delta^(3::Int))
214 -- | In fact, since all of the tetrahedra are identical, we should
215 -- already know their volumes. There's 24 tetrahedra to a cube, so
216 -- we'd expect the volume of each one to be (1/24)*h^3.
217 prop_tetrahedron19_volumes_exact :: Cube -> Bool
218 prop_tetrahedron19_volumes_exact cube =
219 volume (tetrahedron19 cube) ~~= (1/24)*(delta^(3::Int))
223 -- | In fact, since all of the tetrahedra are identical, we should
224 -- already know their volumes. There's 24 tetrahedra to a cube, so
225 -- we'd expect the volume of each one to be (1/24)*h^3.
226 prop_tetrahedron20_volumes_exact :: Cube -> Bool
227 prop_tetrahedron20_volumes_exact cube =
228 volume (tetrahedron20 cube) ~~= (1/24)*(delta^(3::Int))
232 -- | In fact, since all of the tetrahedra are identical, we should
233 -- already know their volumes. There's 24 tetrahedra to a cube, so
234 -- we'd expect the volume of each one to be (1/24)*h^3.
235 prop_tetrahedron21_volumes_exact :: Cube -> Bool
236 prop_tetrahedron21_volumes_exact cube =
237 volume (tetrahedron21 cube) ~~= (1/24)*(delta^(3::Int))
241 -- | In fact, since all of the tetrahedra are identical, we should
242 -- already know their volumes. There's 24 tetrahedra to a cube, so
243 -- we'd expect the volume of each one to be (1/24)*h^3.
244 prop_tetrahedron22_volumes_exact :: Cube -> Bool
245 prop_tetrahedron22_volumes_exact cube =
246 volume (tetrahedron22 cube) ~~= (1/24)*(delta^(3::Int))
250 -- | In fact, since all of the tetrahedra are identical, we should
251 -- already know their volumes. There's 24 tetrahedra to a cube, so
252 -- we'd expect the volume of each one to be (1/24)*h^3.
253 prop_tetrahedron23_volumes_exact :: Cube -> Bool
254 prop_tetrahedron23_volumes_exact cube =
255 volume (tetrahedron23 cube) ~~= (1/24)*(delta^(3::Int))
259 -- | All tetrahedron should have their v0 located at the center of the cube.
260 prop_v0_all_equal :: Cube -> Bool
261 prop_v0_all_equal cube = (v0 t0) == (v0 t1)
263 t0 = head (tetrahedrons cube) -- Doesn't matter which two we choose.
264 t1 = head $ tail (tetrahedrons cube)
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_tetrahedron0_volumes_positive :: Cube -> Bool
270 prop_tetrahedron0_volumes_positive cube =
271 volume (tetrahedron0 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_tetrahedron1_volumes_positive :: Cube -> Bool
276 prop_tetrahedron1_volumes_positive cube =
277 volume (tetrahedron1 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_tetrahedron2_volumes_positive :: Cube -> Bool
282 prop_tetrahedron2_volumes_positive cube =
283 volume (tetrahedron2 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_tetrahedron3_volumes_positive :: Cube -> Bool
288 prop_tetrahedron3_volumes_positive cube =
289 volume (tetrahedron3 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_tetrahedron4_volumes_positive :: Cube -> Bool
294 prop_tetrahedron4_volumes_positive cube =
295 volume (tetrahedron4 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_tetrahedron5_volumes_positive :: Cube -> Bool
300 prop_tetrahedron5_volumes_positive cube =
301 volume (tetrahedron5 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_tetrahedron6_volumes_positive :: Cube -> Bool
306 prop_tetrahedron6_volumes_positive cube =
307 volume (tetrahedron6 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_tetrahedron7_volumes_positive :: Cube -> Bool
312 prop_tetrahedron7_volumes_positive cube =
313 volume (tetrahedron7 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_tetrahedron8_volumes_positive :: Cube -> Bool
318 prop_tetrahedron8_volumes_positive cube =
319 volume (tetrahedron8 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_tetrahedron9_volumes_positive :: Cube -> Bool
324 prop_tetrahedron9_volumes_positive cube =
325 volume (tetrahedron9 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_tetrahedron10_volumes_positive :: Cube -> Bool
330 prop_tetrahedron10_volumes_positive cube =
331 volume (tetrahedron10 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_tetrahedron11_volumes_positive :: Cube -> Bool
336 prop_tetrahedron11_volumes_positive cube =
337 volume (tetrahedron11 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_tetrahedron12_volumes_positive :: Cube -> Bool
342 prop_tetrahedron12_volumes_positive cube =
343 volume (tetrahedron12 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_tetrahedron13_volumes_positive :: Cube -> Bool
348 prop_tetrahedron13_volumes_positive cube =
349 volume (tetrahedron13 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_tetrahedron14_volumes_positive :: Cube -> Bool
354 prop_tetrahedron14_volumes_positive cube =
355 volume (tetrahedron14 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_tetrahedron15_volumes_positive :: Cube -> Bool
360 prop_tetrahedron15_volumes_positive cube =
361 volume (tetrahedron15 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_tetrahedron16_volumes_positive :: Cube -> Bool
366 prop_tetrahedron16_volumes_positive cube =
367 volume (tetrahedron16 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_tetrahedron17_volumes_positive :: Cube -> Bool
372 prop_tetrahedron17_volumes_positive cube =
373 volume (tetrahedron17 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_tetrahedron18_volumes_positive :: Cube -> Bool
378 prop_tetrahedron18_volumes_positive cube =
379 volume (tetrahedron18 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_tetrahedron19_volumes_positive :: Cube -> Bool
384 prop_tetrahedron19_volumes_positive cube =
385 volume (tetrahedron19 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_tetrahedron20_volumes_positive :: Cube -> Bool
390 prop_tetrahedron20_volumes_positive cube =
391 volume (tetrahedron20 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_tetrahedron21_volumes_positive :: Cube -> Bool
396 prop_tetrahedron21_volumes_positive cube =
397 volume (tetrahedron21 cube) > 0
399 -- | This pretty much repeats the prop_all_volumes_positive property,
400 -- but will let me know which tetrahedrons's vertices are disoriented.
401 prop_tetrahedron22_volumes_positive :: Cube -> Bool
402 prop_tetrahedron22_volumes_positive cube =
403 volume (tetrahedron22 cube) > 0
405 -- | This pretty much repeats the prop_all_volumes_positive property,
406 -- but will let me know which tetrahedrons's vertices are disoriented.
407 prop_tetrahedron23_volumes_positive :: Cube -> Bool
408 prop_tetrahedron23_volumes_positive cube =
409 volume (tetrahedron23 cube) > 0
412 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Note that the
413 -- third and fourth indices of c-t1 have been switched. This is
414 -- because we store the triangles oriented such that their volume is
415 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde point
416 -- in opposite directions, one of them has to have negative volume!
417 prop_c0120_identity1 :: Cube -> Bool
418 prop_c0120_identity1 cube =
419 c t0 0 1 2 0 ~= (c t0 0 0 2 1 + c t3 0 0 1 2) / 2
421 t0 = tetrahedron0 cube
422 t3 = tetrahedron3 cube
425 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
426 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
427 prop_c0120_identity2 :: Cube -> Bool
428 prop_c0120_identity2 cube =
429 c t1 0 1 2 0 ~= (c t1 0 0 2 1 + c t0 0 0 1 2) / 2
431 t0 = tetrahedron0 cube
432 t1 = tetrahedron1 cube
434 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
435 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
436 prop_c0120_identity3 :: Cube -> Bool
437 prop_c0120_identity3 cube =
438 c t2 0 1 2 0 ~= (c t2 0 0 2 1 + c t1 0 0 1 2) / 2
440 t1 = tetrahedron1 cube
441 t2 = tetrahedron2 cube
443 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
444 -- 'prop_c0120_identity1' with tetrahedrons 2 and 3.
445 prop_c0120_identity4 :: Cube -> Bool
446 prop_c0120_identity4 cube =
447 c t3 0 1 2 0 ~= (c t3 0 0 2 1 + c t2 0 0 1 2) / 2
449 t2 = tetrahedron2 cube
450 t3 = tetrahedron3 cube
453 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
454 -- 'prop_c0120_identity1' with tetrahedrons 4 and 5.
455 prop_c0120_identity5 :: Cube -> Bool
456 prop_c0120_identity5 cube =
457 c t5 0 1 2 0 ~= (c t5 0 0 2 1 + c t4 0 0 1 2) / 2
459 t4 = tetrahedron4 cube
460 t5 = tetrahedron5 cube
462 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
463 -- -- 'prop_c0120_identity1' with tetrahedrons 5 and 6.
464 prop_c0120_identity6 :: Cube -> Bool
465 prop_c0120_identity6 cube =
466 c t6 0 1 2 0 ~= (c t6 0 0 2 1 + c t5 0 0 1 2) / 2
468 t5 = tetrahedron5 cube
469 t6 = tetrahedron6 cube
472 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
473 -- -- 'prop_c0120_identity1' with tetrahedrons 6 and 7.
474 prop_c0120_identity7 :: Cube -> Bool
475 prop_c0120_identity7 cube =
476 c t7 0 1 2 0 ~= (c t7 0 0 2 1 + c t6 0 0 1 2) / 2
478 t6 = tetrahedron6 cube
479 t7 = tetrahedron7 cube
482 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
483 -- 'prop_c0120_identity1'.
484 prop_c0210_identity1 :: Cube -> Bool
485 prop_c0210_identity1 cube =
486 c t0 0 2 1 0 ~= (c t0 0 1 1 1 + c t3 0 1 1 1) / 2
488 t0 = tetrahedron0 cube
489 t3 = tetrahedron3 cube
492 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
493 -- 'prop_c0120_identity1'.
494 prop_c0300_identity1 :: Cube -> Bool
495 prop_c0300_identity1 cube =
496 c t0 0 3 0 0 ~= (c t0 0 2 0 1 + c t3 0 2 1 0) / 2
498 t0 = tetrahedron0 cube
499 t3 = tetrahedron3 cube
502 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
503 -- 'prop_c0120_identity1'.
504 prop_c1110_identity :: Cube -> Bool
505 prop_c1110_identity cube =
506 c t0 1 1 1 0 ~= (c t0 1 0 1 1 + c t3 1 0 1 1) / 2
508 t0 = tetrahedron0 cube
509 t3 = tetrahedron3 cube
512 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
513 -- 'prop_c0120_identity1'.
514 prop_c1200_identity1 :: Cube -> Bool
515 prop_c1200_identity1 cube =
516 c t0 1 2 0 0 ~= (c t0 1 1 0 1 + c t3 1 1 1 0) / 2
518 t0 = tetrahedron0 cube
519 t3 = tetrahedron3 cube
522 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
523 -- 'prop_c0120_identity1'.
524 prop_c2100_identity1 :: Cube -> Bool
525 prop_c2100_identity1 cube =
526 c t0 2 1 0 0 ~= (c t0 2 0 0 1 + c t3 2 0 1 0) / 2
528 t0 = tetrahedron0 cube
529 t3 = tetrahedron3 cube
533 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). Note that the
534 -- third and fourth indices of c-t3 have been switched. This is
535 -- because we store the triangles oriented such that their volume is
536 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
537 -- point in opposite directions, one of them has to have negative
539 prop_c0102_identity1 :: Cube -> Bool
540 prop_c0102_identity1 cube =
541 c t0 0 1 0 2 ~= (c t0 0 0 1 2 + c t1 0 0 2 1) / 2
543 t0 = tetrahedron0 cube
544 t1 = tetrahedron1 cube
547 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
548 -- 'prop_c0102_identity1'.
549 prop_c0201_identity1 :: Cube -> Bool
550 prop_c0201_identity1 cube =
551 c t0 0 2 0 1 ~= (c t0 0 1 1 1 + c t1 0 1 1 1) / 2
553 t0 = tetrahedron0 cube
554 t1 = tetrahedron1 cube
557 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
558 -- 'prop_c0102_identity1'.
559 prop_c0300_identity2 :: Cube -> Bool
560 prop_c0300_identity2 cube =
561 c t0 0 3 0 0 ~= (c t0 0 2 1 0 + c t1 0 2 0 1) / 2
563 t0 = tetrahedron0 cube
564 t1 = tetrahedron1 cube
567 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
568 -- 'prop_c0102_identity1'.
569 prop_c1101_identity :: Cube -> Bool
570 prop_c1101_identity cube =
571 c t0 1 1 0 1 ~= (c t0 1 0 1 1 + c t1 1 0 1 1) / 2
573 t0 = tetrahedron0 cube
574 t1 = tetrahedron1 cube
577 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
578 -- 'prop_c0102_identity1'.
579 prop_c1200_identity2 :: Cube -> Bool
580 prop_c1200_identity2 cube =
581 c t0 1 2 0 0 ~= (c t0 1 1 1 0 + c t1 1 1 0 1) / 2
583 t0 = tetrahedron0 cube
584 t1 = tetrahedron1 cube
587 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
588 -- 'prop_c0102_identity1'.
589 prop_c2100_identity2 :: Cube -> Bool
590 prop_c2100_identity2 cube =
591 c t0 2 1 0 0 ~= (c t0 2 0 1 0 + c t1 2 0 0 1) / 2
593 t0 = tetrahedron0 cube
594 t1 = tetrahedron1 cube
597 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). The third and
598 -- fourth indices of c-t6 have been switched. This is because we
599 -- store the triangles oriented such that their volume is
600 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
601 -- point in opposite directions, one of them has to have negative
603 prop_c3000_identity :: Cube -> Bool
604 prop_c3000_identity cube =
605 c t0 3 0 0 0 ~= c t0 2 1 0 0 + c t6 2 1 0 0
606 - ((c t0 2 0 1 0 + c t0 2 0 0 1)/ 2)
608 t0 = tetrahedron0 cube
609 t6 = tetrahedron6 cube
612 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
613 -- 'prop_c3000_identity'.
614 prop_c2010_identity :: Cube -> Bool
615 prop_c2010_identity cube =
616 c t0 2 0 1 0 ~= c t0 1 1 1 0 + c t6 1 1 0 1
617 - ((c t0 1 0 2 0 + c t0 1 0 1 1)/ 2)
619 t0 = tetrahedron0 cube
620 t6 = tetrahedron6 cube
623 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
624 -- 'prop_c3000_identity'.
625 prop_c2001_identity :: Cube -> Bool
626 prop_c2001_identity cube =
627 c t0 2 0 0 1 ~= c t0 1 1 0 1 + c t6 1 1 1 0
628 - ((c t0 1 0 0 2 + c t0 1 0 1 1)/ 2)
630 t0 = tetrahedron0 cube
631 t6 = tetrahedron6 cube
634 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
635 -- 'prop_c3000_identity'.
636 prop_c1020_identity :: Cube -> Bool
637 prop_c1020_identity cube =
638 c t0 1 0 2 0 ~= c t0 0 1 2 0 + c t6 0 1 0 2
639 - ((c t0 0 0 3 0 + c t0 0 0 2 1)/ 2)
641 t0 = tetrahedron0 cube
642 t6 = tetrahedron6 cube
645 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
646 -- 'prop_c3000_identity'.
647 prop_c1002_identity :: Cube -> Bool
648 prop_c1002_identity cube =
649 c t0 1 0 0 2 ~= c t0 0 1 0 2 + c t6 0 1 2 0
650 - ((c t0 0 0 0 3 + c t0 0 0 1 2)/ 2)
652 t0 = tetrahedron0 cube
653 t6 = tetrahedron6 cube
656 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
657 -- 'prop_c3000_identity'.
658 prop_c1011_identity :: Cube -> Bool
659 prop_c1011_identity cube =
660 c t0 1 0 1 1 ~= c t0 0 1 1 1 + c t6 0 1 1 1 -
661 ((c t0 0 0 1 2 + c t0 0 0 2 1)/ 2)
663 t0 = tetrahedron0 cube
664 t6 = tetrahedron6 cube
668 -- | Given in Sorokina and Zeilfelder, p. 78.
669 prop_cijk1_identity :: Cube -> Bool
670 prop_cijk1_identity cube =
671 and [ c t0 i j k 1 ~=
672 (c t1 (i+1) j k 0) * ((b0 t0) (v3 t1)) +
673 (c t1 i (j+1) k 0) * ((b1 t0) (v3 t1)) +
674 (c t1 i j (k+1) 0) * ((b2 t0) (v3 t1)) +
675 (c t1 i j k 1) * ((b3 t0) (v3 t1)) | i <- [0..2],
680 t0 = tetrahedron0 cube
681 t1 = tetrahedron1 cube
684 -- | The function values at the interior should be the same for all tetrahedra.
685 prop_interior_values_all_identical :: Cube -> Bool
686 prop_interior_values_all_identical cube =
687 all_equal [i0, i1, i2, i3, i4, i5, i6, i7, i8,
688 i9, i10, i11, i12, i13, i14, i15, i16,
689 i17, i18, i19, i20, i21, i22, i23]
691 i0 = eval (Tetrahedron.fv (tetrahedron0 cube)) I
692 i1 = eval (Tetrahedron.fv (tetrahedron1 cube)) I
693 i2 = eval (Tetrahedron.fv (tetrahedron2 cube)) I
694 i3 = eval (Tetrahedron.fv (tetrahedron3 cube)) I
695 i4 = eval (Tetrahedron.fv (tetrahedron4 cube)) I
696 i5 = eval (Tetrahedron.fv (tetrahedron5 cube)) I
697 i6 = eval (Tetrahedron.fv (tetrahedron6 cube)) I
698 i7 = eval (Tetrahedron.fv (tetrahedron7 cube)) I
699 i8 = eval (Tetrahedron.fv (tetrahedron8 cube)) I
700 i9 = eval (Tetrahedron.fv (tetrahedron9 cube)) I
701 i10 = eval (Tetrahedron.fv (tetrahedron10 cube)) I
702 i11 = eval (Tetrahedron.fv (tetrahedron11 cube)) I
703 i12 = eval (Tetrahedron.fv (tetrahedron12 cube)) I
704 i13 = eval (Tetrahedron.fv (tetrahedron13 cube)) I
705 i14 = eval (Tetrahedron.fv (tetrahedron14 cube)) I
706 i15 = eval (Tetrahedron.fv (tetrahedron15 cube)) I
707 i16 = eval (Tetrahedron.fv (tetrahedron16 cube)) I
708 i17 = eval (Tetrahedron.fv (tetrahedron17 cube)) I
709 i18 = eval (Tetrahedron.fv (tetrahedron18 cube)) I
710 i19 = eval (Tetrahedron.fv (tetrahedron19 cube)) I
711 i20 = eval (Tetrahedron.fv (tetrahedron20 cube)) I
712 i21 = eval (Tetrahedron.fv (tetrahedron21 cube)) I
713 i22 = eval (Tetrahedron.fv (tetrahedron22 cube)) I
714 i23 = eval (Tetrahedron.fv (tetrahedron23 cube)) I
717 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
718 -- This test checks the rotation works as expected.
719 prop_c_tilde_2100_rotation_correct :: Cube -> Bool
720 prop_c_tilde_2100_rotation_correct cube =
723 t0 = tetrahedron0 cube
724 t6 = tetrahedron6 cube
726 -- What gets computed for c2100 of t6.
727 expr1 = eval (Tetrahedron.fv t6) $
729 (1/12)*(T + R + L + D) +
730 (1/64)*(FT + FR + FL + FD) +
733 (1/96)*(RT + LD + LT + RD) +
734 (1/192)*(BT + BR + BL + BD)
736 -- What should be computed for c2100 of t6.
737 expr2 = eval (Tetrahedron.fv t0) $
739 (1/12)*(F + R + L + B) +
740 (1/64)*(FT + RT + LT + BT) +
743 (1/96)*(FR + FL + BR + BL) +
744 (1/192)*(FD + RD + LD + BD)
747 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
748 -- This test checks the actual value based on the FunctionValues of the cube.
749 prop_c_tilde_2100_correct :: Cube -> Bool
750 prop_c_tilde_2100_correct cube =
751 c t6 2 1 0 0 == (3/8)*int
752 + (1/12)*(f + r + l + b)
753 + (1/64)*(ft + rt + lt + bt)
754 + (7/48)*t + (1/48)*d + (1/96)*(fr + fl + br + bl)
755 + (1/192)*(fd + rd + ld + bd)
757 t0 = tetrahedron0 cube
758 t6 = tetrahedron6 cube
759 fvs = Tetrahedron.fv t0
780 -- Tests to check that the correct edges are incidental.
781 prop_t0_shares_edge_with_t1 :: Cube -> Bool
782 prop_t0_shares_edge_with_t1 cube =
783 (v1 t0) == (v1 t1) && (v3 t0) == (v2 t1)
785 t0 = tetrahedron0 cube
786 t1 = tetrahedron1 cube
788 prop_t0_shares_edge_with_t3 :: Cube -> Bool
789 prop_t0_shares_edge_with_t3 cube =
790 (v1 t0) == (v1 t3) && (v2 t0) == (v3 t3)
792 t0 = tetrahedron0 cube
793 t3 = tetrahedron3 cube
795 prop_t0_shares_edge_with_t6 :: Cube -> Bool
796 prop_t0_shares_edge_with_t6 cube =
797 (v2 t0) == (v3 t6) && (v3 t0) == (v2 t6)
799 t0 = tetrahedron0 cube
800 t6 = tetrahedron6 cube
802 prop_t1_shares_edge_with_t2 :: Cube -> Bool
803 prop_t1_shares_edge_with_t2 cube =
804 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
806 t1 = tetrahedron1 cube
807 t2 = tetrahedron2 cube
809 prop_t1_shares_edge_with_t19 :: Cube -> Bool
810 prop_t1_shares_edge_with_t19 cube =
811 (v2 t1) == (v3 t19) && (v3 t1) == (v2 t19)
813 t1 = tetrahedron1 cube
814 t19 = tetrahedron19 cube
816 prop_t2_shares_edge_with_t3 :: Cube -> Bool
817 prop_t2_shares_edge_with_t3 cube =
818 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
820 t1 = tetrahedron1 cube
821 t2 = tetrahedron2 cube
823 prop_t2_shares_edge_with_t12 :: Cube -> Bool
824 prop_t2_shares_edge_with_t12 cube =
825 (v2 t2) == (v3 t12) && (v3 t2) == (v2 t12)
827 t2 = tetrahedron2 cube
828 t12 = tetrahedron12 cube
830 prop_t3_shares_edge_with_t21 :: Cube -> Bool
831 prop_t3_shares_edge_with_t21 cube =
832 (v2 t3) == (v3 t21) && (v3 t3) == (v2 t21)
834 t3 = tetrahedron3 cube
835 t21 = tetrahedron21 cube
837 prop_t4_shares_edge_with_t5 :: Cube -> Bool
838 prop_t4_shares_edge_with_t5 cube =
839 (v1 t4) == (v1 t5) && (v3 t4) == (v2 t5)
841 t4 = tetrahedron4 cube
842 t5 = tetrahedron5 cube
844 prop_t4_shares_edge_with_t7 :: Cube -> Bool
845 prop_t4_shares_edge_with_t7 cube =
846 (v1 t4) == (v1 t7) && (v2 t4) == (v3 t7)
848 t4 = tetrahedron4 cube
849 t7 = tetrahedron7 cube
851 prop_t4_shares_edge_with_t10 :: Cube -> Bool
852 prop_t4_shares_edge_with_t10 cube =
853 (v2 t4) == (v3 t10) && (v3 t4) == (v2 t10)
855 t4 = tetrahedron4 cube
856 t10 = tetrahedron10 cube
858 prop_t5_shares_edge_with_t6 :: Cube -> Bool
859 prop_t5_shares_edge_with_t6 cube =
860 (v1 t5) == (v1 t6) && (v3 t5) == (v2 t6)
862 t5 = tetrahedron5 cube
863 t6 = tetrahedron6 cube
865 prop_t5_shares_edge_with_t16 :: Cube -> Bool
866 prop_t5_shares_edge_with_t16 cube =
867 (v2 t5) == (v3 t16) && (v3 t5) == (v2 t16)
869 t5 = tetrahedron5 cube
870 t16 = tetrahedron16 cube
872 prop_t6_shares_edge_with_t7 :: Cube -> Bool
873 prop_t6_shares_edge_with_t7 cube =
874 (v1 t6) == (v1 t7) && (v3 t6) == (v2 t7)
876 t6 = tetrahedron6 cube
877 t7 = tetrahedron7 cube
879 prop_t7_shares_edge_with_t20 :: Cube -> Bool
880 prop_t7_shares_edge_with_t20 cube =
881 (v2 t7) == (v3 t20) && (v2 t7) == (v3 t20)
883 t7 = tetrahedron7 cube
884 t20 = tetrahedron20 cube