fact: Definition ainstr (st : State) : G Instruction := let '(St im m stk pc ) := st in let fix stack_length s := match s with | _ :: s' => 1 + stack_length s' | _ => 0 end in let sl := stack_length stk in let fix containsRet s := match s with | _ ::: _ => true | _ :: s' => containsRet s' | _ => false end in let onLength len x := if leb x len then x else 0 in freq_ (returnGen Nop) [ (1, returnGen Nop); (10, liftGen Push gen_Z); (if sl < 1 ? then 0 else 10, liftGen BCall (if Nat.eqb sl 0 then returnGen 0 else choose (0, Z.of_nat sl-1))%Z); (if containsRet stk then 10 else 0, returnGen BRet); (if sl < 2 ? then 0 else 10, returnGen Add); (if sl < 1 ? then 0 else 10, returnGen Load); (if sl < 2 ? then 0 else 100, returnGen Store)].
imports: QuickChick(QuickChick) ZArith List QuickChick.ifcbasic(Machine)