lean4-htt/tests/lean/run/mk_byte.lean
Leonardo de Moura e4b3dee526 feat(library/simplify): use custom matcher in the simplifier, and remove hack from type_context
@joehendrix This commit is implementing the matcher that postpones
implicit arguments. The lemma get_data_mk_byte can be proved without
using any hacks in the type_context unifier.

I also added the trace class: simplify.implicit_failure
If we use the command

   set_option trace.simplify.implicit_failure true

Then, the simplifier will generate a diagnostic message every time it
succeeds in the explicit part, but fails in the implicit one.

Please feel free to suggest a better name to his option.

BTW, we can now easily extend the matcher with additional features.
I'm wondering if we will eventually want to write some of these
extensions in Lean.
2017-02-08 22:24:13 -08:00

19 lines
489 B
Text

import data.bitvec
open vector
def byte_type := bitvec 8
-- A byte is formed from concatenating two bits and a 6-bit field.
def mk_byte (a b : bool) (l : bitvec 6) : byte_type := a :: b :: l
-- Get the third component
def get_data (byte : byte_type) : bitvec 6 := vector.dropn 2 byte
lemma get_data_mk_byte {a b : bool} {l : bitvec 6} : get_data (mk_byte a b l) = l :=
begin
apply vector.eq,
unfold mk_byte,
unfold get_data,
simp [to_list_dropn, to_list_cons, list.dropn]
end