@@ -1917,30 +1917,37 @@ syntax "‹" withoutPosition(term) "›" : term
19171917macro_rules | `(‹$type›) => `((by assumption : $type))
19181918
19191919/--
1920- `get_elem_tactic_trivial ` is an extensible tactic automatically called
1920+ `get_elem_tactic_extensible ` is an extensible tactic automatically called
19211921by the notation `arr[i]` to prove any side conditions that arise when
19221922constructing the term (e.g. the index is in bounds of the array).
1923- The default behavior is to just try `trivial` (which handles the case
1924- where `i < arr.size` is in the context) and `simp +arith` and `omega`
1923+ The default behavior is to try `simp +arith` and `omega`
19251924(for doing linear arithmetic in the index).
1925+
1926+ (Note that the core tactic `get_elem_tactic` has already tried
1927+ `done` and `assumption` before the extensible tactic is called.)
19261928-/
1929+ syntax "get_elem_tactic_extensible" : tactic
1930+
1931+ /-- `get_elem_tactic_trivial` has been deprecated in favour of `get_elem_tactic_extensible`. -/
19271932syntax "get_elem_tactic_trivial" : tactic
19281933
1934+ macro_rules | `(tactic| get_elem_tactic_extensible) => `(tactic| omega)
1935+ macro_rules | `(tactic| get_elem_tactic_extensible) => `(tactic| simp +arith; done)
1936+
19291937macro_rules | `(tactic| get_elem_tactic_trivial) => `(tactic| omega)
19301938macro_rules | `(tactic| get_elem_tactic_trivial) => `(tactic| simp +arith; done)
1931- macro_rules | `(tactic| get_elem_tactic_trivial) => `(tactic| trivial)
19321939
19331940/--
19341941`get_elem_tactic` is the tactic automatically called by the notation `arr[i]`
19351942to prove any side conditions that arise when constructing the term
19361943(e.g. the index is in bounds of the array). It just delegates to
1937- `get_elem_tactic_trivial ` and gives a diagnostic error message otherwise;
1938- users are encouraged to extend `get_elem_tactic_trivial ` instead of this tactic.
1944+ `get_elem_tactic_extensible ` and gives a diagnostic error message otherwise;
1945+ users are encouraged to extend `get_elem_tactic_extensible ` instead of this tactic.
19391946-/
19401947macro "get_elem_tactic" : tactic =>
19411948 `(tactic| first
19421949 /-
1943- Recall that `macro_rules` (namely, for `get_elem_tactic_trivial `) are tried in reverse order.
1950+ Recall that `macro_rules` (namely, for `get_elem_tactic_extensible `) are tried in reverse order.
19441951 We first, however, try `done`, since the necessary proof may already have been
19451952 found during unification, in which case there is no goal to solve (see #6999).
19461953 If a goal is present, we want `assumption` to be tried first.
@@ -1953,15 +1960,15 @@ macro "get_elem_tactic" : tactic =>
19531960 If `omega` is used to "fill" this proof, we will have a more complex proof term that
19541961 cannot be inferred by unification.
19551962 We hardcoded `assumption` here to ensure users cannot accidentally break this IF
1956- they add new `macro_rules` for `get_elem_tactic_trivial `.
1963+ they add new `macro_rules` for `get_elem_tactic_extensible `.
19571964
19581965 TODO: Implement priorities for `macro_rules`.
1959- TODO: Ensure we have **high-priority** macro_rules for `get_elem_tactic_trivial ` which are
1966+ TODO: Ensure we have **high-priority** macro_rules for `get_elem_tactic_extensible ` which are
19601967 just `done` and `assumption`.
19611968 -/
19621969 | done
19631970 | assumption
1964- | get_elem_tactic_trivial
1971+ | get_elem_tactic_extensible
19651972 | fail "failed to prove index is valid, possible solutions:
19661973 - Use `have`-expressions to prove the index is valid
19671974 - Use `a[i]!` notation instead, runtime check is performed, and 'Panic' error message is produced if index is not valid
0 commit comments