diff --git a/source/Scrolls/BouncingScroll.mmt b/source/Scrolls/BouncingScroll.mmt index 331f8a052ac5f65cf385a9723d02a33afc819ea2..9f136cc8e1d95a862d40bd7607169cc45a9c18ed 100644 --- a/source/Scrolls/BouncingScroll.mmt +++ b/source/Scrolls/BouncingScroll.mmt @@ -10,14 +10,14 @@ theory BouncingScroll = meta ?MetaAnnotations?solutionTheory ?BouncingScroll/Solution â™ include ?StepUntil â™ theory funcs = - //get_ht : ℠⟶ ℠⟶ ℠⟶ ℠☠= + get_ht : ℠⟶ ℠⟶ ℠⟶ ℠☠= [z,zv,g] times_real_lit (minus_real_lit (plus_real_lit zv (sqrt (plus_real_lit (times_real_lit zv zv) (minus_real_lit (times_real_lit (times_real_lit 2.0 g) z)))))) (inv_real_lit g) â™ - //new_ht : ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠☠= + new_ht : ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠☠= [zv,g,ht,bo] times_real_lit (times_real_lit (minus_real_lit 2.0) (times_real_lit (minus_real_lit bo) (plus_real_lit (times_real_lit g ht) zv))) (inv_real_lit g) â™ - //prep : ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ☠= + prep : ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ☠= [x,y,z,xv,yv,zv,g,bo] ⟨⟨x, y, z⟩, ⟨xv, yv, zv⟩, ⟨g, get_ht z zv g, bo⟩⟩ â™ //vals order: (x,y,z),(xv,yv,zv),(g,ht,bo) â™ - //edit : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ☠= + edit : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ☠= [vals] ⟨⟨plus_real_lit (Ï€l (Ï€l vals)) (times_real_lit (Ï€l (Ï€r (Ï€r (Ï€r vals)))) (Ï€l (Ï€l (Ï€r vals)))), plus_real_lit (Ï€l (Ï€r (Ï€l vals))) (times_real_lit (Ï€l (Ï€r (Ï€r (Ï€r vals)))) (Ï€l (Ï€r (Ï€l (Ï€r vals))))), 0.0⟩, @@ -27,26 +27,16 @@ theory BouncingScroll = ⟨(Ï€l (Ï€r (Ï€r vals))), new_ht (Ï€r (Ï€r (Ï€l (Ï€r vals)))) (Ï€l (Ï€r (Ï€r vals))) (Ï€l (Ï€r (Ï€r (Ï€r vals)))) (Ï€r (Ï€r (Ï€r (Ï€r vals)))), (Ï€r (Ï€r (Ï€r (Ï€r vals))))⟩⟩ â™ - //fun0 : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= - [vals] cons vals nil â™ - //fun1 : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= - [vals] cons vals (fun0 (edit vals)) â™ - //fun2 : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= - [vals] cons vals (fun1 (edit vals)) â™ - //fun3 : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= - [vals] cons vals (fun2 (edit vals)) â™ - //red_ht_helper : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ ℠☠= + red_ht_helper : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ ℠☠= [cele] Ï€l (Ï€r (Ï€r (Ï€r cele))) â™ - //red_ht : List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ⟶ List[â„] ☠= + red_ht : List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ⟶ List[â„] ☠= [clsele] clsele map ([xele] red_ht_helper xele) â™ - //red_vals_helper : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ ((℠× ℠× â„) × (℠× ℠× â„)) ☠= - [cel] ⟨πl cel, Ï€l (Ï€r cel)⟩ â™ - //red_vals : List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ⟶ List[(℠× ℠× â„) × (℠× ℠× â„)] ☠= - [cls] (cls map ([x1] red_vals_helper x1)) ++ nil â™ - //get_pos_fun: ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ (℠⟶ (℠× ℠× â„)) ☠= + get_pos_fun: ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ ℠⟶ (℠⟶ (℠× ℠× â„)) ☠= [x,y,z,xv,yv,zv,g] ([t] ⟨plus_real_lit x (times_real_lit xv t), plus_real_lit y (times_real_lit yv t), plus_real_lit (times_real_lit (times_real_lit 0.5 g) (times_real_lit t t)) (plus_real_lit z (times_real_lit zv t))⟩ ) â™ - //red_funcs : List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ⟶ List[℠⟶ (℠× ℠× â„)] ☠= - [cls] (cls map ([x] get_pos_fun (Ï€l (Ï€l vals)) (Ï€l (Ï€r (Ï€l vals))) (Ï€r (Ï€r (Ï€l vals))) (Ï€l (Ï€l (Ï€r vals))) (Ï€l (Ï€r (Ï€l (Ï€r vals)))) (Ï€r (Ï€r (Ï€l (Ï€r vals)))) (Ï€l (Ï€r (Ï€r vals))))) ++ nil â™ + red_funcs : List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ⟶ List[℠⟶ (℠× ℠× â„)] ☠= + [cls] (cls map ([vals] get_pos_fun (Ï€l (Ï€l vals)) (Ï€l (Ï€r (Ï€l vals))) (Ï€r (Ï€r (Ï€l vals))) (Ï€l (Ï€l (Ï€r vals))) (Ï€l (Ï€r (Ï€l (Ï€r vals)))) (Ï€r (Ï€r (Ï€l (Ï€r vals)))) (Ï€l (Ï€r (Ï€r vals))))) ++ nil â™ + end_cond : ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) ⟶ bool ☠= + [vals] leq_real_lit (Ï€l (Ï€r (Ï€r (Ï€r vals)))) 0.1 â™ âš // start position and velocity â™ theory Problem = @@ -64,15 +54,11 @@ theory BouncingScroll = // the output of the scroll â™ theory Solution = include ?BouncingScroll/Problem â™ - //full_list: List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= - fun3 (prep xposition yposition zposition xvelocity yvelocity zvelocity g_base bounce) â™ + full_list: List[(℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)] ☠= stepUntil ((℠× ℠× â„) × (℠× ℠× â„) × (℠× ℠× â„)) (prep xposition yposition zposition xvelocity yvelocity zvelocity g_base bounce) edit end_cond â™ + ht_list_test: List[â„] ☠= red_ht (cons (prep xposition yposition zposition xvelocity yvelocity zvelocity g_base bounce) nil) â™ + fun_list_test : List[℠⟶ (℠× ℠× â„)] ☠= red_funcs (cons (prep xposition yposition zposition xvelocity yvelocity zvelocity g_base bounce) nil) â™ //ht_list: List[â„] ☠= red_ht full_list â™ - //val_list: List[(℠× ℠× â„) × (℠× ℠× â„)] ☠= red_vals full_list â™ - test_func : ℠⟶ ℠☠= - [x] plus_real_lit x 1.0 â™ - test_bool : ℠⟶ bool ☠= - [x] leq_real_lit 10.0 x â™ - out_list: List[â„] ☠= stepUntil â„ 0.0 test_func test_bool â™ + //fun_list : List[℠⟶ (℠× ℠× â„)] ☠= red_funcs full_list â™ meta ?MetaAnnotations?label "BouncingScroll" â™ meta ?MetaAnnotations?description s"Bouncing " â™ âš