lean4-htt/tests/elab/unifhint3.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

69 lines
1.3 KiB
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.

/- Coercion pullback example from the paper "Hints in Unification" -/
universe u
structure Monoid where
α : Type u
op : ααα
unit : α
structure Group where
α : Type u
op : ααα
unit : α
inv : αα
structure Ring where
α : Type u
mul : ααα
add : ααα
neg : αα
one : α
zero : α
def Group.ofRing (r : Ring) : Group where
α := r.α
op := r.add
inv := r.neg
unit := r.zero
def Monoid.ofRing (r : Ring) : Monoid where
α := r.α
op := r.mul
unit := r.one
instance : CoeSort Ring (Type u) where
coe s := s.α
instance : CoeSort Monoid (Type u) where
coe s := s.α
instance : CoeSort Group (Type u) where
coe s := s.α
def gop {s : Group} (a b : s) : s :=
s.op a b
def mop {s : Monoid} (a b : s) : s :=
s.op a b
infix:70 (priority := high) "*" => mop
infix:65 (priority := high) "+" => gop
unif_hint (r : Ring) (g : Group) where
g =?= Group.ofRing r
|-
r.α =?= g.α
unif_hint (r : Ring) (m : Monoid) where
m =?= Monoid.ofRing r
|-
r.α =?= m.α
def distrib {r : Ring} (a b c : r) := a * (b + c) = a * b + a * c
theorem ex1 {r : Ring} (a b c : r) : distrib a b c = (a * (b + c) = a * b + a * c) :=
rfl
theorem ex2 {r : Ring} (a b c : r) : distrib a b c = (mop a (gop b c) = gop (mop a b) (mop a c)) :=
rfl