forked from thanhnguyen-aws/plausible
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNonLinearPatternsTest.lean
More file actions
31 lines (28 loc) · 1.28 KB
/
Copy pathNonLinearPatternsTest.lean
File metadata and controls
31 lines (28 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Plausible.Chamelean.DecOpt
import Plausible.Chamelean.Enumerators
import Plausible.Chamelean.DeriveConstrainedProducer
import Plausible.Chamelean.EnumeratorCombinators
import Test.DeriveEnumSuchThat.DeriveBSTEnumerator
-- See `Test/DeriveArbitrarySuchThat/NonLinearPatternsTest.lean` for the definition of the inductive relations
import Test.DeriveArbitrarySuchThat.NonLinearPatternsTest
set_option guard_msgs.diff true
/--
info: Try this enumerator: instance : EnumSizedSuchThat BinaryTree (fun t_1 => GoodTree in1_1 in2_1 t_1) where
enumSizedST :=
let rec aux_enum (initSize : Nat) (size : Nat) (in1_1 : Nat) (in2_1 : Nat) : OptionT Enumerator BinaryTree :=
match size with
| Nat.zero =>
EnumeratorCombinators.enumerate
[match DecOpt.decOpt (BEq.beq in1_1 in2_1) initSize with
| Option.some Bool.true => return BinaryTree.Leaf
| _ => OptionT.fail]
| Nat.succ size' =>
EnumeratorCombinators.enumerate
[match DecOpt.decOpt (BEq.beq in1_1 in2_1) initSize with
| Option.some Bool.true => return BinaryTree.Leaf
| _ => OptionT.fail,
]
fun size => aux_enum size size in1_1 in2_1
-/
#guard_msgs(info, drop warning) in
#derive_enumerator (fun (t : BinaryTree) => GoodTree in1 in2 t)