lean4-htt/tests/lean/PPInstances.lean
2021-08-12 09:33:30 +02:00

45 lines
1.5 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.

class Semiring (α : Type) where add : ααα
class Ring (α : Type) where add : ααα
class AddCommMonoid (α : Type) where
class AddCommGroup (α : Type) where
class Module (α β : Type) [Semiring α] [AddCommMonoid β] where
class NormedField (α : Type) where
add : ααα
add_comm : ∀ (x y : α), @Add.add _ ⟨add⟩ x y = @Add.add _ ⟨add⟩ y x
class SemiNormedGroup (α : Type) where
class SemiNormedSpace (α β : Type) [NormedField α] [SemiNormedGroup β] where
instance SemiNormedGroup.toAddCommMonoid [SemiNormedGroup α] : AddCommMonoid α := {}
instance Ring.toSemiring [instR : Ring α] : Semiring α := { add := instR.add }
instance NormedField.toRing [instNF : NormedField α] : Ring α := { add := instNF.add }
instance SemiNormedSpace.toModule [NormedField α] [SemiNormedGroup β] [SemiNormedSpace α β] : Module α β := {}
constant R : Type := Unit
constant foo (a b : R) : R := a
instance R.NormedField : NormedField R := { add := foo, add_comm := sorry }
instance R.Ring : Ring R := { add := foo }
variable {E : Type} [instSNG : SemiNormedGroup E] [instSNS : SemiNormedSpace R E]
set_option pp.all true
set_option pp.instances false in
set_option pp.instanceTypes false in
#check Module R E
set_option pp.instances false in
set_option pp.instanceTypes true in
#check Module R E
set_option pp.instances true in
set_option pp.instanceTypes false in
#check Module R E
set_option pp.instances true in
set_option pp.instanceTypes true in
#check Module R E