fact: Definition gen_term_size_unfold (p : nat * type) (e : env) : G term := match p with | (0, tau) => gen_term_no_app tau e | (S n', tau) => match vars_with_type e tau with | [] => oneOf_ (gen_term_no_app tau e) [ (do! tau' <- gen_type; do! m <- choose (0, n'); do! m' <- choose (n' - m, n'); liftGen2 App (gen_term_size (n' - m, (Arrow tau' tau)) e) (gen_term_size (n' - m', tau') e)); (match tau with | N => liftGen Const arbitrary | Arrow tau1 tau2 => liftGen Abs (@gen_term_size (S n', tau2) (tau1 :: e)) end)] | def :: vars => oneOf_ (gen_term_no_app tau e) [ (do! tau' <- gen_type; do! m <- choose (0, n'); do! m' <- choose (n' - m, n'); liftGen2 App (gen_term_size (n' - m, (Arrow tau' tau)) e) (@gen_term_size (n' - m', tau') e)); (match tau with | N => liftGen Const arbitrary | Arrow tau1 tau2 => liftGen Abs (gen_term_size (S n', tau2) (tau1 :: e)) end); elems_ def (def :: vars) ] end end.
imports: mathcomp(ssreflect ssrbool eqtype) Arith List String Lia Program Relations Wellfounded Lexicographic_Product QuickChick(QuickChick) QuickChick.stlc(monad)