Skip to content

Instantly share code, notes, and snippets.

@leodemoura
Created November 3, 2014 17:11
Show Gist options
  • Save leodemoura/f30759cd8183c1da6a1e to your computer and use it in GitHub Desktop.
Save leodemoura/f30759cd8183c1da6a1e to your computer and use it in GitHub Desktop.
relativization
import logic data.nat
inductive funext [class] : Prop :=
intro : (∀ {A : Type} {B : A → Type} {f g : Π x, B x} (H : ∀ x, f x = g x), f = g) → funext
namespace funext
definition apply [F : funext] : ∀ {A : Type} {B : A → Type} {f g : Π x, B x} (H : ∀ x, f x = g x), f = g :=
rec_on F (λax, ax)
end funext
section
variables [F₁₁ : funext.{1 1}]
include F₁₁
open nat
theorem ex : (λx y, x + y) = (λx y, y + x) :=
funext.apply (take x, funext.apply (take y, add.comm x y))
end
check ex -- Error funext cannot be synthesized
check (λ F : funext, ex) -- Ok F is used as argument for ex
axiom funext_ax : ∀ (A : Type) (B : A → Type) (f g : Π x, B x) (H : ∀ x, f x = g x), f = g
theorem funext_ax_inst [instance] : funext :=
funext.intro funext_ax
check ex -- Ok, funext_inst is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment