V2EX  ›  英汉词典

Contravariance

定义 Definition

名词 (n.) 逆变;反变。在类型理论和编程语言中,指一种类型参数的变换关系:当类型的继承方向与其容器或上下文的方向相反时,称为逆变。在数学和物理学中,指张量分量在坐标变换下的一种特定变换方式(与协变相对)。

发音 Pronunciation

/ˌkɒntrəˈveəriəns/

例句 Examples

Understanding contravariance in generic types can help you write more flexible and type-safe code.
理解泛型中的逆变性可以帮助你编写更灵活、更类型安全的代码。

In category theory, contravariance describes a functor that reverses the direction of morphisms, mapping each arrow in one category to an arrow pointing the opposite way in another.
在范畴论中,逆变描述的是一种反转态射方向的函子,即将一个范畴中的每个箭头映射为另一个范畴中方向相反的箭头。

词源 Etymology

由拉丁语前缀 contra-(意为"相反、对立")与 variance(变化、变异)组合而成。variance 源自拉丁语 variare(变化),最终来自 varius(不同的、多样的)。该词最早在数学和物理学的张量分析中使用,后被引入计算机科学的类型理论领域,用于描述类型参数在子类型关系中方向相反的变换特性。与之相对的概念是 covariance(协变),其中前缀 co- 表示"一起、同方向"。

相关词汇 Related Words

文学与学术引用 Literary & Academic References

  • 《Categories for the Working Mathematician》(Saunders Mac Lane)——范畴论的经典著作,系统阐述了逆变函子(contravariant functor)的概念。
  • 《Types and Programming Languages》(Benjamin C. Pierce)——类型理论的权威教材,详细讨论了逆变在子类型和泛型中的应用。
  • 《The Gravitation》(Misner, Thorne & Wheeler)——广义相对论经典教材,深入讲解了逆变张量(contravariant tensor)在物理学中的作用。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   863 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 64ms · UTC 21:03 · PVG 05:03 · LAX 14:03 · JFK 17:03
♥ Do have faith in what you're doing.