summaryrefslogtreecommitdiff
path: root/backends/lean/Base/IList
diff options
context:
space:
mode:
authorSon Ho2023-07-25 14:08:44 +0200
committerSon Ho2023-07-25 14:08:44 +0200
commit876137dff361620d8ade1a4ee94fa9274df0bdc6 (patch)
treed25cb5bf68b53b2f67e67186317f666407d09a04 /backends/lean/Base/IList
parentc652e97f7ab13164150331b4aa3f2e7ef11d24b9 (diff)
Improve int_tac and scalar_tac
Diffstat (limited to 'backends/lean/Base/IList')
-rw-r--r--backends/lean/Base/IList/IList.lean12
1 files changed, 4 insertions, 8 deletions
diff --git a/backends/lean/Base/IList/IList.lean b/backends/lean/Base/IList/IList.lean
index 1773e593..2443b1a6 100644
--- a/backends/lean/Base/IList/IList.lean
+++ b/backends/lean/Base/IList/IList.lean
@@ -46,21 +46,18 @@ theorem indexOpt_bounds (ls : List α) (i : Int) :
ls.indexOpt i = none ↔ i < 0 ∨ ls.len ≤ i :=
match ls with
| [] =>
- have : ¬ (i < 0) → 0 ≤ i := by intro; linarith -- TODO: simplify (we could boost int_tac)
+ have : ¬ (i < 0) → 0 ≤ i := by int_tac
by simp; tauto
| _ :: tl =>
have := indexOpt_bounds tl (i - 1)
if h: i = 0 then
by
simp [*];
- -- TODO: int_tac/scalar_tac should also explore the goal!
- have := tl.len_pos
- linarith
+ int_tac
else by
simp [*]
constructor <;> intros <;>
- -- TODO: tactic to split all disjunctions
- rename_i hor <;> cases hor <;>
+ casesm* _ ∨ _ <;> -- splits all the disjunctions
first | left; int_tac | right; int_tac
theorem indexOpt_eq_index [Inhabited α] (ls : List α) (i : Int) :
@@ -126,7 +123,6 @@ theorem length_update (ls : List α) (i : Int) (x : α) : (ls.update i x).length
theorem len_update (ls : List α) (i : Int) (x : α) : (ls.update i x).len = ls.len := by
simp [len_eq_length]
-
theorem left_length_eq_append_eq (l1 l2 l1' l2' : List α) (heq : l1.length = l1'.length) :
l1 ++ l2 = l1' ++ l2' ↔ l1 = l1' ∧ l2 = l2' := by
revert l1'
@@ -203,7 +199,7 @@ theorem index_eq
(l.update i x).index i = x
:=
fun _ _ => match l with
- | [] => by simp at *; exfalso; scalar_tac -- TODO: exfalso needed. Son FIXME
+ | [] => by simp at *; scalar_tac
| hd :: tl =>
if h: i = 0 then
by