statement stringlengths 1 2.88k | proof stringlengths 0 13.9k | type stringclasses 10
values | symbolic_name stringlengths 1 131 | library stringclasses 417
values | filename stringlengths 17 80 | imports listlengths 0 16 | deps listlengths 0 64 | docstring stringlengths 0 10.2k | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
gen (α : Type u) | reader_t (ulift ℕ) rand α | def | slim_check.gen | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"rand"
] | Monad to generate random examples to test properties with.
It has a `nat` parameter so that the caller can decide on the
size of the examples. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
io.run_gen {α} (x : gen α) (i : ℕ) : io α | io.run_rand (x.run ⟨i⟩) | def | slim_check.io.run_gen | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"io.run_rand"
] | Execute a `gen` inside the `io` monad using `i` as the example
size and with a fresh random number generator. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
choose_any [random α] : gen α | ⟨ λ _, rand.random α ⟩ | def | slim_check.gen.choose_any | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"rand.random",
"random"
] | Lift `random.random` to the `gen` monad. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
choose [bounded_random α] (x y : α) (p : x ≤ y) : gen (x .. y) | ⟨ λ _, rand.random_r x y p ⟩ | def | slim_check.gen.choose | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"bounded_random",
"rand.random_r"
] | Lift `random.random_r` to the `gen` monad. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
choose_nat (x y : ℕ) (p : x ≤ y) : gen (x .. y) | choose x y p | def | slim_check.gen.choose_nat | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [] | Generate a `nat` example between `x` and `y`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
choose_nat' (x y : ℕ) (p : x < y) : gen (set.Ico x y) | have ∀ i, x < i → i ≤ y → i.pred < y,
from λ i h₀ h₁,
show i.pred.succ ≤ y,
by rwa succ_pred_eq_of_pos; apply lt_of_le_of_lt (nat.zero_le _) h₀,
subtype.map pred (λ i (h : x+1 ≤ i ∧ i ≤ y), ⟨le_pred_of_lt h.1, this _ h.1 h.2⟩) <$>
choose (x+1) y p | def | slim_check.gen.choose_nat' | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"set.Ico",
"subtype.map"
] | Generate a `nat` example between `x` and `y`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sized (cmd : ℕ → gen α) : gen α | ⟨ λ ⟨sz⟩, reader_t.run (cmd sz) ⟨sz⟩ ⟩ | def | slim_check.gen.sized | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [] | Get access to the size parameter of the `gen` monad. For
reasons of universe polymorphism, it is specified in
continuation passing style. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
resize (f : ℕ → ℕ) (cmd : gen α) : gen α | ⟨ λ ⟨sz⟩, reader_t.run cmd ⟨f sz⟩ ⟩ | def | slim_check.gen.resize | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [] | Apply a function to the size parameter. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
vector_of : ∀ (n : ℕ) (cmd : gen α), gen (vector α n) | | 0 _ := return vector.nil
| (succ n) cmd := vector.cons <$> cmd <*> vector_of n cmd | def | slim_check.gen.vector_of | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [] | Create `n` examples using `cmd`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
list_of (cmd : gen α) : gen (list α) | sized $ λ sz, do
do ⟨ n ⟩ ← uliftable.up $ choose_nat 0 (sz + 1) dec_trivial,
v ← vector_of n.val cmd,
return v.to_list | def | slim_check.gen.list_of | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"uliftable.up"
] | Create a list of examples using `cmd`. The size is controlled
by the size parameter of `gen`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
one_of (xs : list (gen α)) (pos : 0 < xs.length) : gen α | do
⟨⟨n, h, h'⟩⟩ ← uliftable.up $ choose_nat' 0 xs.length pos,
list.nth_le xs n h' | def | slim_check.gen.one_of | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"uliftable.up"
] | Given a list of example generators, choose one to create an example. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
elements (xs : list α) (pos : 0 < xs.length) : gen α | do
⟨⟨n,h₀,h₁⟩⟩ ← uliftable.up $ choose_nat' 0 xs.length pos,
pure $ list.nth_le xs n h₁ | def | slim_check.gen.elements | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"uliftable.up"
] | Given a list of example generators, choose one to create an example. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
freq_aux : Π (xs : list (ℕ+ × gen α)) i, i < (xs.map (subtype.val ∘ prod.fst)).sum → gen α | | [] i h := false.elim (nat.not_lt_zero _ h)
| ((i, x) :: xs) j h :=
if h' : j < i then x
else freq_aux xs (j - i)
(by { rw tsub_lt_iff_right (le_of_not_gt h'),
simpa [list.sum_cons, add_comm] using h }) | def | slim_check.gen.freq_aux | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"tsub_lt_iff_right"
] | `freq_aux xs i _` takes a weighted list of generator and a number meant to select one of the
generators.
If we consider `freq_aux [(1, gena), (3, genb), (5, genc)] 4 _`, we choose a generator by splitting
the interval 1-9 into 1-1, 2-4, 5-9 so that the width of each interval corresponds to one of the
number in the lis... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
freq (xs : list (ℕ+ × gen α)) (pos : 0 < xs.length) : gen α | let s := (xs.map (subtype.val ∘ prod.fst)).sum in
have ha : 1 ≤ s, from
(le_trans pos $
list.length_map (subtype.val ∘ prod.fst) xs ▸
(list.length_le_sum_of_one_le _ (λ i, by { simp, intros, assumption }))),
have 0 ≤ s - 1, from le_tsub_of_add_le_right ha,
uliftable.adapt_up gen.{0} gen.{u} (choose_nat 0 (s... | def | slim_check.gen.freq | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"le_tsub_iff_right",
"le_tsub_of_add_le_right",
"list.length_le_sum_of_one_le",
"uliftable.adapt_up"
] | `freq [(1, gena), (3, genb), (5, genc)] _` will choose one of `gena`, `genb`, `genc` with
probabilities proportional to the number accompanying them. In this example, the sum of
those numbers is 9, `gena` will be chosen with probability ~1/9, `genb` with ~3/9 (i.e. 1/3)
and `genc` with probability 5/9. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
permutation_of {α : Type u} : Π xs : list α, gen (subtype $ list.perm xs) | | [] := pure ⟨[], list.perm.nil ⟩
| (x :: xs) := do
⟨xs',h⟩ ← permutation_of xs,
⟨⟨n,_,h'⟩⟩ ← uliftable.up $ choose_nat 0 xs'.length dec_trivial,
pure ⟨list.insert_nth n x xs',
list.perm.trans (list.perm.cons _ h)
(list.perm_insert_nth _ _ h').symm ⟩ | def | slim_check.gen.permutation_of | testing.slim_check | src/testing/slim_check/gen.lean | [
"control.random",
"control.uliftable",
"data.list.big_operators.lemmas",
"data.list.perm"
] | [
"list.perm",
"list.perm_insert_nth",
"uliftable.up"
] | Generate a random permutation of a given list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sizeof_lt {α} [has_sizeof α] (x y : α) | sizeof x < sizeof y | def | slim_check.sizeof_lt | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | `sizeof_lt x y` compares the sizes of `x` and `y`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
shrink_fn (α : Type*) [has_sizeof α] | Π x : α, lazy_list { y : α // sizeof_lt y x } | def | slim_check.shrink_fn | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list"
] | `shrink_fn α` is the type of functions that shrink an
argument of type `α` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable | [wf : has_sizeof α]
(sample [] : gen α)
(shrink : Π x : α, lazy_list { y : α // @sizeof _ wf y < @sizeof _ wf x } := λ _, lazy_list.nil) | class | slim_check.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"shrink"
] | `sampleable α` provides ways of creating examples of type `α`,
and given such an example `x : α`, gives us a way to shrink it
and find simpler examples. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable_functor (F : Type u → Type v) [functor F] | [wf : Π α [has_sizeof α], has_sizeof (F α)]
(sample [] : ∀ {α}, gen α → gen (F α))
(shrink : ∀ α [has_sizeof α], shrink_fn α → shrink_fn (F α))
(p_repr : ∀ α, has_repr α → has_repr (F α)) | class | slim_check.sampleable_functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | `sampleable_functor F` makes it possible to create samples of and
shrink `F α` given a sampling function and a shrinking function for
arbitrary `α` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable_bifunctor (F : Type u → Type v → Type w) [bifunctor F] | [wf : Π α β [has_sizeof α] [has_sizeof β], has_sizeof (F α β)]
(sample [] : ∀ {α β}, gen α → gen β → gen (F α β))
(shrink : ∀ α β [has_sizeof α] [has_sizeof β], shrink_fn α → shrink_fn β → shrink_fn (F α β))
(p_repr : ∀ α β, has_repr α → has_repr β → has_repr (F α β)) | class | slim_check.sampleable_bifunctor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"bifunctor",
"shrink"
] | `sampleable_bifunctor F` makes it possible to create samples of
and shrink `F α β` given a sampling function and a shrinking function
for arbitrary `α` and `β` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable.mk_trivial_interp : tactic unit | tactic.refine ``(id) | def | slim_check.sampleable.mk_trivial_interp | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | This function helps infer the proxy representation and
interpretation in `sampleable_ext` instances. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable_ext (α : Sort u) | (proxy_repr : Type v)
[wf : has_sizeof proxy_repr]
(interp [] : proxy_repr → α . sampleable.mk_trivial_interp)
[p_repr : has_repr proxy_repr]
(sample [] : gen proxy_repr)
(shrink : shrink_fn proxy_repr) | class | slim_check.sampleable_ext | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | `sampleable_ext` generalizes the behavior of `sampleable`
and makes it possible to express instances for types that
do not lend themselves to introspection, such as `ℕ → ℕ`.
If we test a quantification over functions the
counter-examples cannot be shrunken or printed meaningfully.
For that purpose, `sampleable_ext` pr... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable_ext.of_sampleable {α} [sampleable α] [has_repr α] : sampleable_ext α | { proxy_repr := α,
sample := sampleable.sample α,
shrink := shrink } | instance | slim_check.sampleable_ext.of_sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sampleable.functor {α} {F} [functor F] [sampleable_functor F] [sampleable α] :
sampleable (F α) | { wf := _,
sample := sampleable_functor.sample F (sampleable.sample α),
shrink := sampleable_functor.shrink α sampleable.shrink } | instance | slim_check.sampleable.functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sampleable.bifunctor {α β} {F} [bifunctor F] [sampleable_bifunctor F] [sampleable α]
[sampleable β] : sampleable (F α β) | { wf := _,
sample := sampleable_bifunctor.sample F (sampleable.sample α) (sampleable.sample β),
shrink := sampleable_bifunctor.shrink α β sampleable.shrink sampleable.shrink } | instance | slim_check.sampleable.bifunctor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"bifunctor",
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sampleable_ext.functor {α} {F} [functor F] [sampleable_functor F] [sampleable_ext α] :
sampleable_ext (F α) | { wf := _,
proxy_repr := F (proxy_repr α),
interp := functor.map (interp _),
sample := sampleable_functor.sample F (sampleable_ext.sample α),
shrink := sampleable_functor.shrink _ sampleable_ext.shrink,
p_repr := sampleable_functor.p_repr _ sampleable_ext.p_repr } | instance | slim_check.sampleable_ext.functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sampleable_ext.bifunctor {α β} {F} [bifunctor F] [sampleable_bifunctor F]
[sampleable_ext α] [sampleable_ext β] : sampleable_ext (F α β) | { wf := _,
proxy_repr := F (proxy_repr α) (proxy_repr β),
interp := bifunctor.bimap (interp _) (interp _),
sample := sampleable_bifunctor.sample F (sampleable_ext.sample α) (sampleable_ext.sample β),
shrink := sampleable_bifunctor.shrink _ _ sampleable_ext.shrink sampleable_ext.shrink,
p_repr := sampleable_bi... | instance | slim_check.sampleable_ext.bifunctor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"bifunctor",
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat.shrink' (k : ℕ) : Π n : ℕ, n ≤ k →
list { m : ℕ // has_well_founded.r m k } → list { m : ℕ // has_well_founded.r m k } | | n hn ls :=
if h : n ≤ 1
then ls.reverse
else
have h₂ : 0 < n, by linarith,
have 1 * n / 2 < n,
from nat.div_lt_of_lt_mul (nat.mul_lt_mul_of_pos_right (by norm_num) h₂),
have n / 2 < n, by simpa,
let m := n / 2 in
have h₀ : m ≤ k, from le_trans (le_of_lt this) hn,
have h₃ : 0 < m,
... | def | slim_check.nat.shrink' | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"nat.div_lt_of_lt_mul"
] | `nat.shrink' k n` creates a list of smaller natural numbers by
successively dividing `n` by 2 and subtracting the difference from
`k`. For example, `nat.shrink 100 = [50, 75, 88, 94, 97, 99]`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
nat.shrink (n : ℕ) : list { m : ℕ // has_well_founded.r m n } | if h : n > 0 then
have ∀ k, 1 < k → n / k < n, from
λ k hk,
nat.div_lt_of_lt_mul
(suffices 1 * n < k * n, by simpa,
nat.mul_lt_mul_of_pos_right hk h),
⟨n/11, this _ (by norm_num)⟩ :: ⟨n/3, this _ (by norm_num)⟩ :: nat.shrink' n n le_rfl []
else
[] | def | slim_check.nat.shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"le_rfl",
"nat.div_lt_of_lt_mul"
] | `nat.shrink n` creates a list of smaller natural numbers by
successively dividing by 2 and subtracting the difference from
`n`. For example, `nat.shrink 100 = [50, 75, 88, 94, 97, 99]`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable.lift (α : Type u) {β : Type u} [sampleable α] (f : α → β) (g : β → α)
(h : ∀ (a : α), sizeof (g (f a)) ≤ sizeof a) : sampleable β | { wf := ⟨ sizeof ∘ g ⟩,
sample := f <$> sample α,
shrink := λ x,
have ∀ a, sizeof a < sizeof (g x) → sizeof (g (f a)) < sizeof (g x),
by introv h'; solve_by_elim [lt_of_le_of_lt],
subtype.map f this <$> shrink (g x) } | def | slim_check.sampleable.lift | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"subtype.map"
] | Transport a `sampleable` instance from a type `α` to a type `β` using
functions between the two, going in both directions.
Function `g` is used to define the well-founded order that
`shrink` is expected to follow. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
nat.sampleable : sampleable ℕ | { sample := sized $ λ sz, freq [(1, coe <$> choose_any (fin $ succ (sz^3))),
(3, coe <$> choose_any (fin $ succ sz))] dec_trivial,
shrink := λ x, lazy_list.of_list $ nat.shrink x } | instance | slim_check.nat.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list.of_list",
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
iterate_shrink {α} [has_to_string α] [sampleable α]
(p : α → Prop) [decidable_pred p] :
α → option α | well_founded.fix has_well_founded.wf $ λ x f_rec,
do trace sformat!"{x} : {(shrink x).to_list}" $ pure (),
y ← (shrink x).find (λ a, p a),
f_rec y y.property <|> some y.val | def | slim_check.iterate_shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | `iterate_shrink p x` takes a decidable predicate `p` and a
value `x` of some sampleable type and recursively shrinks `x`.
It first calls `shrink x` to get a list of candidate sample,
finds the first that satisfies `p` and recursively tries
to shrink that one. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fin.sampleable {n : ℕ} [ne_zero n] : sampleable (fin n) | sampleable.lift ℕ fin.of_nat' fin.val $
λ i, (mod_le _ _ : i % n ≤ i) | instance | slim_check.fin.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"fin.of_nat'",
"ne_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
fin.sampleable' {n} : sampleable (fin (succ n)) | sampleable.lift ℕ fin.of_nat fin.val $
λ i, (mod_le _ _ : i % succ n ≤ i) | instance | slim_check.fin.sampleable' | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
pnat.sampleable : sampleable ℕ+ | sampleable.lift ℕ nat.succ_pnat pnat.nat_pred $ λ a,
by unfold_wf; simp only [pnat.nat_pred, succ_pnat, pnat.mk_coe, tsub_zero, succ_sub_succ_eq_sub] | instance | slim_check.pnat.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"nat.succ_pnat",
"pnat.mk_coe",
"pnat.nat_pred",
"tsub_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int.has_sizeof : has_sizeof ℤ | ⟨ int.nat_abs ⟩ | def | slim_check.int.has_sizeof | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Redefine `sizeof` for `int` to make it easier to use with `nat` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
int.sampleable : sampleable ℤ | { wf := _,
sample := sized $ λ sz,
freq [(1, subtype.val <$> choose (-(sz^3 + 1) : ℤ) (sz^3 + 1) (neg_le_self dec_trivial)),
(3, subtype.val <$> choose (-(sz + 1)) (sz + 1) (neg_le_self dec_trivial))]
dec_trivial,
shrink :=
λ x, lazy_list.of_list $ (nat.shrink $ int.nat_... | instance | slim_check.int.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list.of_list",
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
bool.sampleable : sampleable bool | { wf := ⟨ λ b, if b then 1 else 0 ⟩,
sample := do { x ← choose_any bool,
return x },
shrink := λ b, if h : b then lazy_list.singleton ⟨ff, by cases h; unfold_wf⟩
else lazy_list.nil } | instance | slim_check.bool.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list.singleton",
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
prod.shrink {α β} [has_sizeof α] [has_sizeof β]
(shr_a : shrink_fn α) (shr_b : shrink_fn β) : shrink_fn (α × β) | | ⟨x₀,x₁⟩ :=
let xs₀ : lazy_list { y : α × β // sizeof_lt y (x₀,x₁) } :=
(shr_a x₀).map $ subtype.map (λ a, (a, x₁))
(λ x h, by dsimp [sizeof_lt]; unfold_wf; apply h),
xs₁ : lazy_list { y : α × β // sizeof_lt y (x₀,x₁) } :=
(shr_b x₁).map $ subtype.map (λ a, (x₀, a... | def | slim_check.prod.shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"subtype.map"
] | Provided two shrinking functions `prod.shrink` shrinks a pair `(x, y)` by
first shrinking `x` and pairing the results with `y` and then shrinking
`y` and pairing the results with `x`.
All pairs either contain `x` untouched or `y` untouched. We rely on
shrinking being repeated for `x` to get maximally shrunken and then... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prod.sampleable : sampleable_bifunctor.{u v} prod | { wf := _,
sample := λ α β sama samb, do
{ ⟨x⟩ ← (uliftable.up $ sama : gen (ulift.{max u v} α)),
⟨y⟩ ← (uliftable.up $ samb : gen (ulift.{max u v} β)),
pure (x,y) },
shrink := @prod.shrink,
p_repr := @prod.has_repr } | instance | slim_check.prod.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"uliftable.up"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sigma.sampleable {α β} [sampleable α] [sampleable β] : sampleable (Σ _ : α, β) | sampleable.lift (α × β) (λ ⟨x,y⟩, ⟨x,y⟩) (λ ⟨x,y⟩, ⟨x,y⟩) $ λ ⟨x,y⟩, le_rfl | instance | slim_check.sigma.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"le_rfl"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sum.shrink {α β} [has_sizeof α] [has_sizeof β] (shrink_α : shrink_fn α)
(shrink_β : shrink_fn β) : shrink_fn (α ⊕ β) | | (sum.inr x) := (shrink_β x).map $ subtype.map sum.inr $ λ a,
by dsimp [sizeof_lt]; unfold_wf; solve_by_elim
| (sum.inl x) := (shrink_α x).map $ subtype.map sum.inl $ λ a,
by dsimp [sizeof_lt]; unfold_wf; solve_by_elim | def | slim_check.sum.shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"subtype.map"
] | shrinking function for sum types | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sum.sampleable : sampleable_bifunctor.{u v} sum | { wf := _,
sample := λ (α : Type u) (β : Type v) sam_α sam_β,
(@uliftable.up_map gen.{u} gen.{max u v} _ _ _ _ (@sum.inl α β) sam_α <|>
@uliftable.up_map gen.{v} gen.{max v u} _ _ _ _ (@sum.inr α β) sam_β),
shrink := λ α β Iα Iβ shr_α shr_β, @sum.shrink _ _ Iα Iβ shr_α shr_β,
p_repr := @s... | instance | slim_check.sum.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"uliftable.up_map"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.sampleable : sampleable ℚ | sampleable.lift (ℤ × ℕ+) (λ x, prod.cases_on x rat.mk_pnat) (λ r, (r.num, ⟨r.denom, r.pos⟩)) $
begin
intro i,
rcases i with ⟨x,⟨y,hy⟩⟩; unfold_wf;
dsimp [rat.mk_pnat],
mono*,
{ rw [← int.coe_nat_le, int.coe_nat_abs, int.coe_nat_abs],
apply int.abs_div_le_abs },
{ change _ - 1 ≤ y-1,
apply tsub_le_ts... | instance | slim_check.rat.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"int.abs_div_le_abs",
"int.coe_nat_abs",
"int.coe_nat_le",
"rat.mk_pnat",
"tsub_le_tsub_right"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sampleable_char (length : nat) (characters : string) : sampleable char | { sample := do { x ← choose_nat 0 length dec_trivial,
if x.val = 0 then do
n ← sample ℕ,
pure $ char.of_nat n
else do
i ← choose_nat 0 (characters.length - 1) dec_trivial,
pure (characters.mk_iterator.nextn i).... | def | slim_check.sampleable_char | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | `sampleable_char` can be specialized into customized `sampleable char` instances.
The resulting instance has `1 / length` chances of making an unrestricted choice of characters
and it otherwise chooses a character from `characters` with uniform probabilities. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
char.sampleable : sampleable char | sampleable_char 3 " 0123abcABC:,;`\\/" | instance | slim_check.char.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.sizeof_drop_lt_sizeof_of_lt_length {xs : list α} {k}
(hk : 0 < k) (hk' : k < xs.length) :
sizeof (list.drop k xs) < sizeof xs | begin
induction xs with x xs generalizing k,
{ cases hk' },
cases k,
{ cases hk },
have : sizeof xs < sizeof (x :: xs),
{ unfold_wf },
cases k,
{ simp only [this, list.drop] },
{ simp only [list.drop],
transitivity,
{ solve_by_elim [xs_ih, lt_of_succ_lt_succ hk', zero_lt_succ] },
{ assumpt... | lemma | slim_check.list.sizeof_drop_lt_sizeof_of_lt_length | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.sizeof_cons_lt_right (a b : α) {xs : list α} (h : sizeof a < sizeof b) :
sizeof (a :: xs) < sizeof (b :: xs) | by unfold_wf; assumption | lemma | slim_check.list.sizeof_cons_lt_right | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.sizeof_cons_lt_left (x : α) {xs xs' : list α} (h : sizeof xs < sizeof xs') :
sizeof (x :: xs) < sizeof (x :: xs') | by unfold_wf; assumption | lemma | slim_check.list.sizeof_cons_lt_left | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.sizeof_append_lt_left {xs ys ys' : list α} (h : sizeof ys < sizeof ys') :
sizeof (xs ++ ys) < sizeof (xs ++ ys') | begin
induction xs,
{ apply h },
{ unfold_wf,
simp only [list.sizeof, add_lt_add_iff_left],
exact xs_ih }
end | lemma | slim_check.list.sizeof_append_lt_left | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.one_le_sizeof (xs : list α) : 1 ≤ sizeof xs | by cases xs; unfold_wf; linarith | lemma | slim_check.list.one_le_sizeof | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
list.shrink_removes (k : ℕ) (hk : 0 < k) : Π (xs : list α) n,
n = xs.length → lazy_list { ys : list α // sizeof_lt ys xs } | | xs n hn :=
if hkn : k > n then lazy_list.nil
else
if hkn' : k = n then
have 1 < xs.sizeof,
by { subst_vars, cases xs, { contradiction },
unfold_wf, apply lt_of_lt_of_le,
show 1 < 1 + has_sizeof.sizeof xs_hd + 1, { linarith },
{ mono, apply list.one_le_sizeof, } },
... | def | slim_check.list.shrink_removes | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"lazy_list.singleton",
"list.split_at",
"list.split_at_eq_take_drop",
"list.take_append_drop",
"prod.mk.inj_iff",
"subtype.map"
] | `list.shrink_removes` shrinks a list by removing chunks of size `k` in
the middle of the list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
list.shrink_one : shrink_fn (list α) | | [] := lazy_list.nil
| (x :: xs) :=
lazy_list.append
(subtype.map (λ x', x' :: xs) (λ a, list.sizeof_cons_lt_right _ _) <$> shr x)
(subtype.map ((::) x) (λ _, list.sizeof_cons_lt_left _) <$> list.shrink_one xs) | def | slim_check.list.shrink_one | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list.append",
"subtype.map"
] | `list.shrink_one xs` shrinks list `xs` by shrinking only one item in
the list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
list.shrink_with (xs : list α) :
lazy_list { ys : list α // sizeof_lt ys xs } | let n := xs.length in
lazy_list.append
((lazy_list.cons n $ (shrink n).reverse.map subtype.val).bind (λ k,
if hk : 0 < k
then list.shrink_removes k hk xs n rfl
else lazy_list.nil ))
(list.shrink_one shr _) | def | slim_check.list.shrink_with | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"lazy_list.append",
"shrink"
] | `list.shrink_with shrink_f xs` shrinks `xs` by first
considering `xs` with chunks removed in the middle (starting with
chunks of size `xs.length` and halving down to `1`) and then
shrinks only one element of the list.
This strategy is taken directly from Haskell's QuickCheck | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
list.sampleable : sampleable_functor list.{u} | { wf := _,
sample := λ α sam_α, list_of sam_α,
shrink := λ α Iα shr_α, @list.shrink_with _ Iα shr_α,
p_repr := @list.has_repr } | instance | slim_check.list.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
Prop.sampleable_ext : sampleable_ext Prop | { proxy_repr := bool,
interp := coe,
sample := choose_any bool,
shrink := λ _, lazy_list.nil } | instance | slim_check.Prop.sampleable_ext | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
no_shrink (α : Type*) | α | def | slim_check.no_shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | `no_shrink` is a type annotation to signal that
a certain type is not to be shrunk. It can be useful in
combination with other types: e.g. `xs : list (no_shrink ℤ)`
will result in the list being cut down but individual
integers being kept as is. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
no_shrink.inhabited {α} [inhabited α] : inhabited (no_shrink α) | ⟨ (default : α) ⟩ | instance | slim_check.no_shrink.inhabited | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
no_shrink.mk {α} (x : α) : no_shrink α | x | def | slim_check.no_shrink.mk | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Introduction of the `no_shrink` type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
no_shrink.get {α} (x : no_shrink α) : α | x | def | slim_check.no_shrink.get | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Selector of the `no_shrink` type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
no_shrink.sampleable {α} [sampleable α] : sampleable (no_shrink α) | { sample := no_shrink.mk <$> sample α } | instance | slim_check.no_shrink.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
string.sampleable : sampleable string | { sample := do { x ← list_of (sample char), pure x.as_string },
.. sampleable.lift (list char) list.as_string string.to_list $ λ _, le_rfl } | instance | slim_check.string.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"le_rfl"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tree.sample (sample : gen α) : ℕ → gen (tree α) | n | if h : n > 0
then have n / 2 < n, from div_lt_self h (by norm_num),
tree.node <$> sample <*> tree.sample (n / 2) <*> tree.sample (n / 2)
else pure tree.nil | def | slim_check.tree.sample | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"div_lt_self",
"tree"
] | implementation of `sampleable (tree α)` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
rec_shrink {α : Type*} [has_sizeof α] (t : α)
(sh : Π x : α, sizeof_lt x t → lazy_list { y : α // sizeof_lt y x }) :
shrink_fn { t' : α // sizeof_lt t' t } | | ⟨t',ht'⟩ := (λ t'' : { y : α // sizeof_lt y t' },
⟨⟨t''.val, lt_trans t''.property ht'⟩, t''.property⟩ ) <$> sh t' ht' | def | slim_check.rec_shrink | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list"
] | `rec_shrink x f_rec` takes the recursive call `f_rec` introduced
by `well_founded.fix` and turns it into a shrinking function whose
result is adequate to use in a recursive call. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tree.one_le_sizeof {α} [has_sizeof α] (t : tree α) : 1 ≤ sizeof t | by cases t; unfold_wf; linarith | lemma | slim_check.tree.one_le_sizeof | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"tree"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rec_shrink_with [has_sizeof α]
(shrink_a : Π x : α, shrink_fn { y : α // sizeof_lt y x } →
list (lazy_list { y : α // sizeof_lt y x })) :
shrink_fn α | well_founded.fix (sizeof_measure_wf _) $ λ t f_rec,
lazy_list.join
(lazy_list.of_list $
shrink_a t $ λ ⟨t', h⟩, rec_shrink _ f_rec _) | def | slim_check.rec_shrink_with | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"lazy_list.join",
"lazy_list.of_list"
] | Recursion principle for shrinking tree-like structures. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
rec_shrink_with_eq [has_sizeof α]
(shrink_a : Π x : α, shrink_fn { y : α // sizeof_lt y x } →
list (lazy_list { y : α // sizeof_lt y x }))
(x : α) :
rec_shrink_with shrink_a x =
lazy_list.join
(lazy_list.of_list $ shrink_a x $ λ t', rec_shrink _ (λ x h', rec_shrink_with shrink_a x) _) | begin
conv_lhs { rw [rec_shrink_with, well_founded.fix_eq], },
congr, ext ⟨y, h⟩, refl
end | lemma | slim_check.rec_shrink_with_eq | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list",
"lazy_list.join",
"lazy_list.of_list"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tree.shrink_with [has_sizeof α] (shrink_a : shrink_fn α) : shrink_fn (tree α) | rec_shrink_with $ λ t,
match t with
| tree.nil := λ f_rec, []
| (tree.node x t₀ t₁) :=
λ f_rec,
have h₂ : sizeof_lt tree.nil (tree.node x t₀ t₁),
by clear _match; have := tree.one_le_sizeof t₀;
dsimp [sizeof_lt, sizeof, has_sizeof.sizeof] at *;
unfold_wf; linarith,
have h₀ : sizeof_lt t₀ (tree.nod... | def | slim_check.tree.shrink_with | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"lazy_list.of_list",
"tree"
] | `tree.shrink_with shrink_f t` shrinks `xs` by using the empty tree,
each subtrees, and by shrinking the subtree to recombine them.
This strategy is taken directly from Haskell's QuickCheck | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sampleable_tree : sampleable_functor tree | { wf := _,
sample := λ α sam_α, sized $ tree.sample sam_α,
shrink := λ α Iα shr_α, @tree.shrink_with _ Iα shr_α,
p_repr := @tree.has_repr } | instance | slim_check.sampleable_tree | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"tree"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
small (α : Type*) | α | def | slim_check.small | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"small"
] | Type tag that signals to `slim_check` to use small values for a given type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
small.mk {α} (x : α) : small α | x | def | slim_check.small.mk | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"small"
] | Add the `small` type tag | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
large (α : Type*) | α | def | slim_check.large | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Type tag that signals to `slim_check` to use large values for a given type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
large.mk {α} (x : α) : large α | x | def | slim_check.large.mk | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Add the `large` type tag | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
small.functor : functor small | id.monad.to_functor | instance | slim_check.small.functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"small"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
large.functor : functor large | id.monad.to_functor | instance | slim_check.large.functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
small.inhabited [inhabited α] : inhabited (small α) | ⟨ (default : α) ⟩ | instance | slim_check.small.inhabited | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"small"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
large.inhabited [inhabited α] : inhabited (large α) | ⟨ (default : α) ⟩ | instance | slim_check.large.inhabited | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
small.sampleable_functor : sampleable_functor small | { wf := _,
sample := λ α samp, gen.resize (λ n, n / 5 + 5) samp,
shrink := λ α _, id,
p_repr := λ α, id } | instance | slim_check.small.sampleable_functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"small"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
large.sampleable_functor : sampleable_functor large | { wf := _,
sample := λ α samp, gen.resize (λ n, n * 5) samp,
shrink := λ α _, id,
p_repr := λ α, id } | instance | slim_check.large.sampleable_functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ulift.sampleable_functor : sampleable_functor ulift.{u v} | { wf := λ α h, ⟨ λ ⟨x⟩, @sizeof α h x ⟩,
sample := λ α samp, uliftable.up_map ulift.up $ samp,
shrink := λ α _ shr ⟨x⟩, (shr x).map (subtype.map ulift.up (λ a h, h)),
p_repr := λ α h, ⟨ @repr α h ∘ ulift.down ⟩ } | instance | slim_check.ulift.sampleable_functor | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"subtype.map",
"uliftable.up_map"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat_le.sampleable {y} : slim_check.sampleable { x : ℕ // x ≤ y } | { sample :=
do { ⟨x,h⟩ ← slim_check.gen.choose_nat 0 y dec_trivial,
pure ⟨x, h.2⟩},
shrink := λ ⟨x, h⟩, (λ a : subtype _, subtype.rec_on a $
λ x' h', ⟨⟨x', le_trans (le_of_lt h') h⟩, h'⟩) <$> shrink x } | instance | slim_check.nat_le.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"slim_check.gen.choose_nat",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat_ge.sampleable {x} : slim_check.sampleable { y : ℕ // x ≤ y } | { sample :=
do { (y : ℕ) ← slim_check.sampleable.sample ℕ,
pure ⟨x+y, by norm_num⟩ },
shrink := λ ⟨y, h⟩, (λ a : { y' // sizeof y' < sizeof (y - x) },
subtype.rec_on a $ λ δ h', ⟨⟨x + δ, nat.le_add_right _ _⟩, lt_tsub_iff_left.mp h'⟩) <$>
shrink (y - x) } | instance | slim_check.nat_ge.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat_gt.sampleable {x} : slim_check.sampleable { y : ℕ // x < y } | { sample :=
do { (y : ℕ) ← slim_check.sampleable.sample ℕ,
pure ⟨x+y+1, by linarith⟩ },
shrink := λ x, shrink _ } | instance | slim_check.nat_gt.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"shrink",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
le.sampleable {y : α} [sampleable α] [linear_ordered_add_comm_group α] :
slim_check.sampleable { x : α // x ≤ y } | { sample :=
do { x ← sample α,
pure ⟨y - |x|, sub_le_self _ (abs_nonneg _) ⟩ },
shrink := λ _, lazy_list.nil } | instance | slim_check.le.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"abs_nonneg",
"linear_ordered_add_comm_group",
"shrink",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ge.sampleable {x : α} [sampleable α] [linear_ordered_add_comm_group α] :
slim_check.sampleable { y : α // x ≤ y } | { sample :=
do { y ← sample α,
pure ⟨x + |y|, by norm_num [abs_nonneg]⟩ },
shrink := λ _, lazy_list.nil } | instance | slim_check.ge.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"abs_nonneg",
"linear_ordered_add_comm_group",
"shrink",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_le.sampleable {y : ℤ} : slim_check.sampleable { x : ℤ // x ≤ y } | sampleable.lift ℕ (λ n, ⟨y - n, int.sub_left_le_of_le_add $ by simp⟩) (λ ⟨i, h⟩, (y - i).nat_abs)
(λ n, by unfold_wf; simp [int_le.sampleable._match_1]; ring) | instance | slim_check.int_le.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"ring",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_ge.sampleable {x : ℤ} : slim_check.sampleable { y : ℤ // x ≤ y } | sampleable.lift ℕ (λ n, ⟨x + n, by simp⟩) (λ ⟨i, h⟩, (i - x).nat_abs)
(λ n, by unfold_wf; simp [int_ge.sampleable._match_1]; ring) | instance | slim_check.int_ge.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"ring",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_lt.sampleable {y} : slim_check.sampleable { x : ℤ // x < y } | sampleable.lift ℕ (λ n, ⟨y - (n+1), int.sub_left_lt_of_lt_add $
by linarith [int.coe_nat_nonneg n]⟩)
(λ ⟨i, h⟩, (y - i - 1).nat_abs)
(λ n, by unfold_wf; simp [int_lt.sampleable._match_1]; ring) | instance | slim_check.int_lt.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"int.coe_nat_nonneg",
"ring",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_gt.sampleable {x} : slim_check.sampleable { y : ℤ // x < y } | sampleable.lift ℕ (λ n, ⟨x + (n+1), by linarith⟩) (λ ⟨i, h⟩, (i - x - 1).nat_abs)
(λ n, by unfold_wf; simp [int_gt.sampleable._match_1]; ring) | instance | slim_check.int_gt.sampleable | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"ring",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
perm.slim_check {xs : list α} : slim_check.sampleable { ys : list α // list.perm xs ys } | { sample := permutation_of xs,
shrink := λ _, lazy_list.nil } | instance | slim_check.perm.slim_check | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"list.perm",
"shrink",
"slim_check.sampleable"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
perm'.slim_check {xs : list α} :
slim_check.sampleable { ys : list α // list.perm ys xs } | { sample := subtype.map id (@list.perm.symm α _) <$> permutation_of xs,
shrink := λ _, lazy_list.nil }
setup_tactic_parser | instance | slim_check.perm'.slim_check | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"list.perm",
"list.perm.symm",
"shrink",
"slim_check.sampleable",
"subtype.map"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
print_samples {t : Type u} [has_repr t] (g : gen t) : io unit | do
xs ← io.run_rand $ uliftable.down $
do { xs ← (list.range 10).mmap $ g.run ∘ ulift.up,
pure ⟨xs.map repr⟩ },
xs.mmap' io.put_str_ln | def | slim_check.print_samples | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [
"io.run_rand",
"uliftable.down"
] | Print (at most) 10 samples of a given type to stdout for debugging. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_generator (e : expr) : tactic (expr × expr) | do
t ← infer_type e,
match t with
| `(gen %%t) := do
repr_inst ← mk_app ``has_repr [t] >>= mk_instance,
pure (repr_inst, e)
| _ := do
samp_inst ← to_expr ``(sampleable_ext %%e) >>= mk_instance,
repr_inst ← mk_mapp ``sampleable_ext.p_repr [e, samp_inst],
gen ← mk_mapp ``sampleable_ext.sample [none, samp_inst],... | def | slim_check.mk_generator | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | Create a `gen α` expression from the argument of `#sample` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sample_cmd (_ : parse $ tk "#sample") : lean.parser unit | do e ← texpr,
of_tactic $ do
e ← i_to_expr e,
(repr_inst, gen) ← mk_generator e,
print_samples ← mk_mapp ``print_samples [none, repr_inst, gen],
sample ← eval_expr (io unit) print_samples,
unsafe_run_io sample | def | slim_check.sample_cmd | testing.slim_check | src/testing/slim_check/sampleable.lean | [
"data.lazy_list.basic",
"data.tree",
"data.pnat.basic",
"control.bifunctor",
"control.ulift",
"testing.slim_check.gen",
"tactic.linarith"
] | [] | `#sample my_type`, where `my_type` has an instance of `sampleable`, prints ten random
values of type `my_type` of using an increasing size parameter.
```lean
#sample nat
-- prints
-- 0
-- 0
-- 2
-- 24
-- 64
-- 76
-- 5
-- 132
-- 8
-- 449
-- or some other sequence of numbers
#sample list int
-- prints
-- []
-- [1, 1]
-... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
test_result (p : Prop)
| success : (psum unit p) → test_result
| gave_up {} : ℕ → test_result
| failure : ¬ p → (list string) → ℕ → test_result | inductive | slim_check.test_result | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | Result of trying to disprove `p`
The constructors are:
* `success : (psum unit p) → test_result`
succeed when we find another example satisfying `p`
In `success h`, `h` is an optional proof of the proposition.
Without the proof, all we know is that we found one example
where `p` holds. With a pr... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
test_result.to_string {p} : test_result p → string | | (test_result.success (psum.inl ())) := "success (without proof)"
| (test_result.success (psum.inr h)) := "success (with proof)"
| (test_result.gave_up n) := sformat!"gave up {n} times"
| (test_result.failure a vs _) := sformat!"failed {vs}" | def | slim_check.test_result.to_string | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | format a `test_result` as a string. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
slim_check_cfg | (num_inst : ℕ := 100) -- number of examples
(max_size : ℕ := 100) -- final size argument
(trace_discarded : bool := ff) -- enable the printing out of discarded samples
(trace_success : bool := ff) -- enable the printing out of successful tests
(trace_shrink : ... | structure | slim_check.slim_check_cfg | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | configuration for testing a property | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
printable_prop (p : Prop) | (print_prop : option string) | class | slim_check.printable_prop | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | `printable_prop p` allows one to print a proposition so that
`slim_check` can indicate how values relate to each other. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
default_printable_prop {p} : printable_prop p | ⟨ none ⟩ | instance | slim_check.default_printable_prop | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
testable (p : Prop) | (run [] (cfg : slim_check_cfg) (minimize : bool) : gen (test_result p)) | class | slim_check.testable | testing.slim_check | src/testing/slim_check/testable.lean | [
"testing.slim_check.sampleable"
] | [] | `testable p` uses random examples to try to disprove `p`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.