lean4-htt/tests/lean/run/newfrontend3.lean
Kim Morrison 3a408e0e54
feat: change Array.get to take a Nat and a proof (#6032)
This PR changes the signature of `Array.get` to take a Nat and a proof,
rather than a `Fin`, for consistency with the rest of the (planned)
Array API. Note that because of bootstrapping issues we can't provide
`get_elem_tactic` as an autoparameter for the proof. As users will
mostly use the `xs[i]` notation provided by `GetElem`, this hopefully
isn't a problem.

We may restore `Fin` based versions, either here or downstream, as
needed, but they won't be the "main" functions.

---------

Co-authored-by: David Thrane Christiansen <david@davidchristiansen.dk>
2024-11-12 03:30:46 +00:00

33 lines
690 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.

--
structure S :=
(g {α} : αα)
def f (h : Nat → ({α : Type} → αα) × Bool) : Nat :=
(h 0).1 1
def tst : Nat :=
f fun n => (fun x => x, true)
def ex : id (Nat → Nat) :=
by {
intro;
assumption
}
def g (i j k : Nat) (a : Array Nat) (h₁ : i < k) (h₂ : k < j) (h₃ : j < a.size) : Nat :=
let vj := a[j];
let vi := a[i];
vi + vj
set_option pp.all true in
#print g
#check g.proof_1
theorem ex1 {p q r s : Prop} : p ∧ q ∧ r ∧ s → r ∧ s ∧ q ∧ p :=
fun ⟨hp, hq, hr, hs⟩ => ⟨hr, hs, hq, hp⟩
theorem ex2 {p q r s : Prop} : p ∧ q ∧ r ∧ s → r ∧ s ∧ q ∧ p := by
intro ⟨hp, hq, hr, hs⟩
exact ⟨hr, hs, hq, hp⟩