diff --git a/source/Scrolls/T3DBouncingScroll.mmt b/source/Scrolls/T3DBouncingScroll.mmt index 2c858cc8b3897ce6b8527e35b4b743a54a63bf38..01fe9052d3190b474bfce2d71d9f0d42715ec2fd 100644 --- a/source/Scrolls/T3DBouncingScroll.mmt +++ b/source/Scrolls/T3DBouncingScroll.mmt @@ -42,12 +42,26 @@ theory T3DBouncingScroll = [rht, rp, rv, rg] ⟨plus_real_lit (plus_real_lit (rp _x) (times_real_lit (rv _x) rht)) (times_real_lit (times_real_lit 0.5 (rg _x)) (times_real_lit rht rht)), plus_real_lit (plus_real_lit (rp _y) (times_real_lit (rv _y) rht)) (times_real_lit (times_real_lit 0.5 (rg _y)) (times_real_lit rht rht)), plus_real_lit (plus_real_lit (rp _z) (times_real_lit (rv _z) rht)) (times_real_lit (times_real_lit 0.5 (rg _z)) (times_real_lit rht rht))⟩ â™ - check_hit : (℠× wall) ⟶ point ⟶ point ⟶ point ⟶ bool ☠= - [rw, rp, rv, rg] ([np : point] (bool) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r rw).point3) ((Ï€r rw).point2)) (point_subtractI np ((Ï€r rw).point2))) (vec_cross (point_subtractI ((Ï€r rw).point3) ((Ï€r rw).point2)) (point_subtractI ((Ï€r rw).point1) ((Ï€r rw).point2))))) - thenx ((bool) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r rw).point3) ((Ï€r rw).point1)) (point_subtractI np ((Ï€r rw).point1))) (vec_cross (point_subtractI ((Ï€r rw).point3) ((Ï€r rw).point1)) (point_subtractI ((Ï€r rw).point2) ((Ï€r rw).point1))))) - thenx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r rw).point2) ((Ï€r rw).point1)) (point_subtractI np ((Ï€r rw).point1))) (vec_cross (point_subtractI ((Ï€r rw).point2) ((Ï€r rw).point1)) (point_subtractI ((Ï€r rw).point3) ((Ï€r rw).point1))))) - elsex false) - elsex false) (get_pt (Ï€l rw) rp rv rg) â™ + check_hit1 : point ⟶ point ⟶ point ⟶ ((℠× ℠× wall) ⟶ (℠× ℠× wall)) ☠= + [rp, rv, rg] ([rw: ℠× ℠× wall] ([np : point] (℠× ℠× wall) ifx (leq_real_lit (Ï€l rw) 0.000001) + thenx (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩) + elsex ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point2)) (point_subtractI np ((Ï€r (Ï€r rw)).point2))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point2)) (point_subtractI ((Ï€r (Ï€r rw)).point1) ((Ï€r (Ï€r rw)).point2))))) + thenx ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1)) (point_subtractI np ((Ï€r (Ï€r rw)).point1))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1)) (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1))))) + thenx ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1)) (point_subtractI np ((Ï€r (Ï€r rw)).point1))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1)) (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1))))) + thenx (rw) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩)) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩)) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩))) (get_pt (Ï€l rw) rp rv rg)) â™ + check_hit2 : point ⟶ point ⟶ point ⟶ ((℠× ℠× wall) ⟶ (℠× ℠× wall)) ☠= + [rp, rv, rg] ([rw: ℠× ℠× wall] ([np : point] (℠× ℠× wall) ifx (leq_real_lit (Ï€l (Ï€r rw)) 0.000001) + thenx (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩) + elsex ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point2)) (point_subtractI np ((Ï€r (Ï€r rw)).point2))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point2)) (point_subtractI ((Ï€r (Ï€r rw)).point1) ((Ï€r (Ï€r rw)).point2))))) + thenx ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1)) (point_subtractI np ((Ï€r (Ï€r rw)).point1))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1)) (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1))))) + thenx ((℠× ℠× wall) ifx (leq_real_lit 0.0 (scalar_productI (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1)) (point_subtractI np ((Ï€r (Ï€r rw)).point1))) (vec_cross (point_subtractI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).point1)) (point_subtractI ((Ï€r (Ï€r rw)).point3) ((Ï€r (Ï€r rw)).point1))))) + thenx (rw) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩)) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩)) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩))) (get_pt (Ï€l (Ï€r rw)) rp rv rg)) â™ fold_func : (℠× wall) ⟶ (point × â„) ⟶ (point × â„) ☠= [cur][acc] (point × â„) ifx (leq_real_lit (Ï€l cur) (Ï€r acc)) thenx (⟨(Ï€r cur).norm_vec, (Ï€l cur)⟩) elsex acc â™ calc_new_vals : (point × point × (point × â„) × â„) ⟶ (point × â„) ⟶ (point × point × â„) ☠= @@ -71,9 +85,9 @@ theory T3DBouncingScroll = thenx (⟨πl wsi, Ï€r (Ï€r wsi)⟩) elsex (⟨πl (Ï€r wsi), Ï€r (Ï€r wsi)⟩))) â™ get_next_vals : List[wall] ⟶ (point × â„) ⟶ ((point × point × (point × â„) × â„) ⟶ (point × point × (point × â„) × â„)) ☠= - [aw, abv] ([v : point × point × (point × â„) × â„] ([x : point × point × â„] ⟨πl x, Ï€l (Ï€r x), ((((((get_abcs aw (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv)) map mget_hts) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) filter ([wsk : ℠× wall] check_hit wsk (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), Ï€r (Ï€r x)⟩) (calc_new_vals v abv)) â™ + [aw, abv] ([v : point × point × (point × â„) × â„] ([x : point × point × â„] ⟨πl x, Ï€l (Ï€r x), (((((((get_abcs aw (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv)) map mget_hts) map (check_hit1 (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) map (check_hit2 (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), Ï€r (Ï€r x)⟩) (calc_new_vals v abv)) â™ prep : List[wall] ⟶ point ⟶ point ⟶ point ⟶ (point × point × (point × â„) × â„) ☠= - [awi, p, v, g] ⟨p, v, ((((((get_abcs awi p v g) map mget_hts) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) filter ([wsk : ℠× wall] check_hit wsk p v g)) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), 0.0⟩ â™ + [awi, p, v, g] ⟨p, v, (((((((get_abcs awi p v g) map mget_hts) map (check_hit1 p v g)) map (check_hit2 p v g)) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), 0.0⟩ â™ get_pos_fun: point ⟶ point ⟶ point ⟶ (℠⟶ point) ☠= [p, v, g] ([t] ⟨plus_real_lit (times_real_lit (times_real_lit 0.5 (g _x)) (times_real_lit t t)) (plus_real_lit (p _x) (times_real_lit (v _x) t)), plus_real_lit (times_real_lit (times_real_lit 0.5 (g _y)) (times_real_lit t t)) (plus_real_lit (p _y) (times_real_lit (v _y) t)), plus_real_lit (times_real_lit (times_real_lit 0.5 (g _z)) (times_real_lit t t)) (plus_real_lit (p _z) (times_real_lit (v _z) t))⟩) â™ red_ht : (point × point × (point × â„)) ⟶ ℠☠= diff --git a/source/Scrolls/W3DBouncingScroll.mmt b/source/Scrolls/W3DBouncingScroll.mmt index 6915a782c8688fe0756e16e3a08484b97175a040..0a2aa4ea311a13c724e3c631c7f6631b51941917 100644 --- a/source/Scrolls/W3DBouncingScroll.mmt +++ b/source/Scrolls/W3DBouncingScroll.mmt @@ -42,14 +42,30 @@ theory W3DBouncingScroll = [rht, rp, rv, rg] ⟨plus_real_lit (plus_real_lit (rp _x) (times_real_lit (rv _x) rht)) (times_real_lit (times_real_lit 0.5 (rg _x)) (times_real_lit rht rht)), plus_real_lit (plus_real_lit (rp _y) (times_real_lit (rv _y) rht)) (times_real_lit (times_real_lit 0.5 (rg _y)) (times_real_lit rht rht)), plus_real_lit (plus_real_lit (rp _z) (times_real_lit (rv _z) rht)) (times_real_lit (times_real_lit 0.5 (rg _z)) (times_real_lit rht rht))⟩ â™ - check_hit : (℠× wall) ⟶ point ⟶ point ⟶ point ⟶ bool ☠= - [rw, rp, rv, rg] ([np : point] (bool) ifx (leq_real_lit (scalar_productI ((Ï€r rw).point1) ((Ï€r rw).u)) (scalar_productI np ((Ï€r rw).u))) - thenx ((bool) ifx (leq_real_lit (scalar_productI np ((Ï€r rw).u)) (scalar_productI ((Ï€r rw).point2) ((Ï€r rw).u))) - thenx ((bool) ifx (leq_real_lit (scalar_productI ((Ï€r rw).point1) (point_subtractI ((Ï€r rw).point4) ((Ï€r rw).point1))) (scalar_productI np (point_subtractI ((Ï€r rw).point4) ((Ï€r rw).point1)))) - thenx (leq_real_lit (scalar_productI np (point_subtractI ((Ï€r rw).point4) ((Ï€r rw).point1))) (scalar_productI ((Ï€r rw).point4) (point_subtractI ((Ï€r rw).point4) ((Ï€r rw).point1)))) - elsex false) - elsex false) - elsex false) (get_pt (Ï€l rw) rp rv rg) â™ + check_hit1 : point ⟶ point ⟶ point ⟶ ((℠× ℠× wall) ⟶ (℠× ℠× wall)) ☠= + [rp, rv, rg] ([rw: ℠× ℠× wall] ([np : point] (℠× ℠× wall) ifx (leq_real_lit (Ï€l rw) 0.000001) + thenx (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩) + elsex ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI ((Ï€r (Ï€r rw)).point1) ((Ï€r (Ï€r rw)).u)) (scalar_productI np ((Ï€r (Ï€r rw)).u))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI np ((Ï€r (Ï€r rw)).u)) (scalar_productI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).u))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI ((Ï€r (Ï€r rw)).point1) (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1))) (scalar_productI np (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1)))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI np (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1))) (scalar_productI ((Ï€r (Ï€r rw)).point4) (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1)))) + thenx (rw) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩)) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩)) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩)) + elsex (⟨-1.0, Ï€l (Ï€r rw), Ï€r (Ï€r rw)⟩))) (get_pt (Ï€l rw) rp rv rg)) â™ + check_hit2 : point ⟶ point ⟶ point ⟶ ((℠× ℠× wall) ⟶ (℠× ℠× wall)) ☠= + [rp, rv, rg] ([rw: ℠× ℠× wall] ([np : point] (℠× ℠× wall) ifx (leq_real_lit (Ï€l (Ï€r rw)) 0.000001) + thenx (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩) + elsex ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI ((Ï€r (Ï€r rw)).point1) ((Ï€r (Ï€r rw)).u)) (scalar_productI np ((Ï€r (Ï€r rw)).u))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI np ((Ï€r (Ï€r rw)).u)) (scalar_productI ((Ï€r (Ï€r rw)).point2) ((Ï€r (Ï€r rw)).u))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI ((Ï€r (Ï€r rw)).point1) (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1))) (scalar_productI np (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1)))) + thenx ((℠× ℠× wall) ifx (leq_real_lit (scalar_productI np (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1))) (scalar_productI ((Ï€r (Ï€r rw)).point4) (point_subtractI ((Ï€r (Ï€r rw)).point4) ((Ï€r (Ï€r rw)).point1)))) + thenx (rw) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩)) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩)) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩)) + elsex (⟨πl rw, -1.0, Ï€r (Ï€r rw)⟩))) (get_pt (Ï€l (Ï€r rw)) rp rv rg)) â™ fold_func : (℠× wall) ⟶ (point × â„) ⟶ (point × â„) ☠= [cur][acc] (point × â„) ifx (leq_real_lit (Ï€l cur) (Ï€r acc)) thenx (⟨(Ï€r cur).norm_vec, (Ï€l cur)⟩) elsex acc â™ calc_new_vals : (point × point × (point × â„) × â„) ⟶ (point × â„) ⟶ (point × point × â„) ☠= @@ -73,9 +89,9 @@ theory W3DBouncingScroll = thenx (⟨πl wsi, Ï€r (Ï€r wsi)⟩) elsex (⟨πl (Ï€r wsi), Ï€r (Ï€r wsi)⟩))) â™ get_next_vals : List[wall] ⟶ (point × â„) ⟶ ((point × point × (point × â„) × â„) ⟶ (point × point × (point × â„) × â„)) ☠= - [aw, abv] ([v : point × point × (point × â„) × â„] ([x : point × point × â„] ⟨πl x, Ï€l (Ï€r x), ((((((get_abcs aw (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv)) map mget_hts) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) filter ([wsk : ℠× wall] check_hit wsk (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), Ï€r (Ï€r x)⟩) (calc_new_vals v abv)) â™ + [aw, abv] ([v : point × point × (point × â„) × â„] ([x : point × point × â„] ⟨πl x, Ï€l (Ï€r x), (((((((get_abcs aw (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv)) map mget_hts) map (check_hit1 (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) map (check_hit2 (Ï€l x) (Ï€l (Ï€r x)) (Ï€l abv))) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), Ï€r (Ï€r x)⟩) (calc_new_vals v abv)) â™ prep : List[wall] ⟶ point ⟶ point ⟶ point ⟶ (point × point × (point × â„) × â„) ☠= - [awi, p, v, g] ⟨p, v, ((((((get_abcs awi p v g) map mget_hts) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) filter ([wsk : ℠× wall] check_hit wsk p v g)) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), 0.0⟩ â™ + [awi, p, v, g] ⟨p, v, (((((((get_abcs awi p v g) map mget_hts) map (check_hit1 p v g)) map (check_hit2 p v g)) map map_reduce_hts) filter ([wsj : ℠× wall] leq_real_lit 0.000001 (Ï€l wsj))) fold ⟨⟨-1.0, -1.0, -1.0⟩, 99999.9⟩ fold_func), 0.0⟩ â™ get_pos_fun: point ⟶ point ⟶ point ⟶ (℠⟶ point) ☠= [p, v, g] ([t] ⟨plus_real_lit (times_real_lit (times_real_lit 0.5 (g _x)) (times_real_lit t t)) (plus_real_lit (p _x) (times_real_lit (v _x) t)), plus_real_lit (times_real_lit (times_real_lit 0.5 (g _y)) (times_real_lit t t)) (plus_real_lit (p _y) (times_real_lit (v _y) t)), plus_real_lit (times_real_lit (times_real_lit 0.5 (g _z)) (times_real_lit t t)) (plus_real_lit (p _z) (times_real_lit (v _z) t))⟩) â™ red_ht : (point × point × (point × â„)) ⟶ ℠☠=