lean4-htt/library/smt/array.lean
Leonardo de Moura 52d4189805 feat(library/tactic): add dsimp_config configuration object for the dsimp tactic family
Now, `dsimp` fails if the goal did not change.
We can use the config object to obtain the previous behavior:
```
dsimp {fail_if_unchaged := ff}
```
See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
at issue #1694
2017-06-30 17:15:10 -07:00

30 lines
937 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
-/
namespace smt
universes u v
def array (α : Type u) (β : Type v) := α → β
variables {α : Type u} {β : Type v}
open tactic
def select (a : array α β) (i : α) : β :=
a i
lemma arrayext (a₁ a₂ : array α β) : (∀ i, select a₁ i = select a₂ i) → a₁ = a₂ :=
funext
variable [decidable_eq α]
def store (a : array α β) (i : α) (v : β) : array α β :=
λ j, if j = i then v else select a j
@[simp] lemma select_store (a : array α β) (i : α) (v : β) : select (store a i v) i = v :=
by unfold smt.store smt.select; rewrite if_pos; reflexivity
@[simp] lemma select_store_ne (a : array α β) (i j : α) (v : β) : j ≠ i → select (store a i v) j = select a j :=
by intros; unfold smt.store smt.select; rewrite if_neg; assumption
end smt