2.3. Using cbv with stdlib data structures
cbv also reduces operations on standard-library data structures. A HashSet
membership query is not definitionally true:
example
: (({} : HashSet Nat).insert 4 |>.contains 4) = true := ⊢ (∅.insert 4).contains 4 = true
⊢ (∅.insert 4).contains 4 = true
but cbv evaluates it:
-- set_option trace.Meta.Tactic.cbv true in
-- set_option trace.Meta.Tactic.cbv.simprocs true in
-- set_option trace.Meta.Tactic.cbv.rewrite true in
-- set_option trace.Meta.Tactic.cbv.unfold true in
theorem hashset_simp_eval
: (({} : HashSet Nat).insert 4 |>.contains 4) = true := ⊢ (∅.insert 4).contains 4 = true
All goals completed! 🐙
The generated proof uses the relevant HashSet lemmas:
#print hashset_simp_eval