lean4-htt/tests/lean/proj_notation.lean
Leonardo de Moura 8e2dcb8ad8 chore(frontends/lean): remove ^. variants (~> and )
This modification was motivated by a discussion at slack.
2017-03-28 12:23:33 -07:00

39 lines
626 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 myprod (A B : Type) :=
(fst : A) (snd : B)
variable p : myprod nat nat
variable f : nat → nat
#check p^.fst
#check p^.1
#check p^.2
#check p^.snd
#check f p^.1
#check p^.1 + p^.2
example (A B : Type) : A × B → B × A :=
λ h, ⟨h^.2, h^.1⟩
example (A B : Type) : A × B → B × A :=
λ h, ⟨h^.snd, h^.fst⟩
structure position (A B : Type) :=
(x : A) (y : B)
structure car :=
(pos : position nat nat) (cheap : bool)
#check λ c : car, c^.pos^.x
#check λ c : car, c^.fst
#check λ c : car, c^.0
#check λ c : car, c^.3
#check λ n : nat, n^.1
#check p.1
#check p.2
#check λ c : car, c.1.2