8214c7add4
Before this commit, the elaborator was solving constraints of the form ctx |- (?m x) == (f x) as ?m <- (fun x : A, f x) where A is the domain of f. In our kernel, the terms f and (fun x, f x) are not definitionally equal. So, the solution above is not the only one. Another possible solution is ?m <- f Depending of the circumstances we want ?m <- (fun x : A, f x) OR ?m <- f. For example, when Lean is elaborating the eta-theorem in kernel.lean, the first solution should be used: ?m <- (fun x : A, f x) When we are elaborating the axiom_of_choice theorem, we need to use the second one: ?m <- f Of course, we can always provide the parameters explicitly and bypass the elaborator. However, this goes against the idea that the elaborator can do mechanical steps for us. This commit addresses this issue by creating a case-split ?m <- (fun x : A, f x) OR ?m <- f Another solution is to implement eta-expanded normal forms in the Kernel. With this change, we were able to cleanup the following "hacks" in kernel.lean: @eps_ax A (nonempty_ex_intro H) P w Hw @axiom_of_choice A B P H where we had to explicitly provided the implicit arguments This commit also improves the imitation step for Pi-terms that are actually arrows. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
43 lines
1.8 KiB
Text
43 lines
1.8 KiB
Text
Set: pp::colors
|
|
Set: pp::unicode
|
|
Assumed: A
|
|
Assumed: B
|
|
Assumed: C
|
|
Assumed: P
|
|
Assumed: F1
|
|
Assumed: F2
|
|
Assumed: H
|
|
Assumed: a
|
|
eta (F2 a) : (λ x : B, F2 a x) = F2 a
|
|
funext (λ a : A, trans (symm (eta (F1 a))) (trans (funext (λ b : B, H a b)) (eta (F2 a)))) : F1 = F2
|
|
funext (λ a : A, funext (λ b : B, H a b)) : F1 = F2
|
|
Proved: T1
|
|
Proved: T2
|
|
Proved: T3
|
|
Proved: T4
|
|
theorem T1 : F1 = F2 := funext (λ a : A, funext (λ b : B, H a b))
|
|
theorem T2 : (λ (x1 : A) (x2 : B), F1 x1 x2) = F2 := funext (λ a : A, funext (λ b : B, H a b))
|
|
theorem T3 : F1 = (λ (x1 : A) (x2 : B), F2 x1 x2) := funext (λ a : A, funext (λ b : B, H a b))
|
|
theorem T4 : (λ (x1 : A) (x2 : B), F1 x1 x2) = (λ (x1 : A) (x2 : B), F2 x1 x2) :=
|
|
funext (λ a : A, funext (λ b : B, H a b))
|
|
Set: lean::pp::implicit
|
|
theorem T1 : @eq (A → B → C) F1 F2 :=
|
|
@funext A (λ x : A, B → C) F1 F2 (λ a : A, @funext B (λ x : B, C) (F1 a) (F2 a) (λ b : B, H a b))
|
|
theorem T2 : @eq (A → B → C) (λ (x1 : A) (x2 : B), F1 x1 x2) F2 :=
|
|
@funext A
|
|
(λ x : A, B → C)
|
|
(λ (x1 : A) (x2 : B), F1 x1 x2)
|
|
F2
|
|
(λ a : A, @funext B (λ x : B, C) (λ x2 : B, F1 a x2) (F2 a) (λ b : B, H a b))
|
|
theorem T3 : @eq (A → B → C) F1 (λ (x1 : A) (x2 : B), F2 x1 x2) :=
|
|
@funext A
|
|
(λ x : A, B → C)
|
|
F1
|
|
(λ (x1 : A) (x2 : B), F2 x1 x2)
|
|
(λ a : A, @funext B (λ x : B, C) (F1 a) (λ x2 : B, F2 a x2) (λ b : B, H a b))
|
|
theorem T4 : @eq (A → B → C) (λ (x1 : A) (x2 : B), F1 x1 x2) (λ (x1 : A) (x2 : B), F2 x1 x2) :=
|
|
@funext A
|
|
(λ x : A, B → C)
|
|
(λ (x1 : A) (x2 : B), F1 x1 x2)
|
|
(λ (x1 : A) (x2 : B), F2 x1 x2)
|
|
(λ a : A, @funext B (λ x : B, C) (λ x2 : B, F1 a x2) (λ x2 : B, F2 a x2) (λ b : B, H a b))
|