F*: 一种面向证明的通用编程语言
F*: A general-purpose proof-oriented programming language

原始链接: https://fstar-lang.org/

F* 是一种通用的、以证明为导向的编程语言,专为高可靠性软件而设计。它将纯函数式编程、带有副作用的编程与依赖类型相结合,并利用 SMT 求解器和基于策略的定理证明来验证代码的正确性。 F* 是开源的,由微软研究院、法国国家信息与自动化研究所(Inria)及社区共同开发。虽然它默认使用 OCaml,但也支持通过 KaRaMeL 和 Vale 等专用工具将其提取到 C、Wasm、F# 和汇编语言。这种多功能性使其成为需要严格安全性和高性能项目的理想选择。 其关键应用包括 **Project Everest**,该项目生产的经过验证的加密库(如 HACL*、EverCrypt)已被 Linux 内核、Mozilla Firefox 和 Tezos 区块链等主流系统使用。此外,**EverParse** 提供经过形式化验证的高性能二进制解析器,已应用于微软 Azure 和 Windows Hyper-V。 除了密码学和系统领域,F* 还是形式化方法领域的一个活跃研究平台,涵盖了用于并发性、分离逻辑和信息安全的高级逻辑。它被广泛应用于学术界和工业界,用于开发经过验证的编译器、安全协议和稳健系统,通过数学证明确保关键软件免受漏洞攻击。

这篇 Hacker News 讨论帖探讨了以证明为导向的编程语言 F*。讨论始于对 F* 官网的批评,一位用户表达了对网站缺乏直观、“显眼”代码示例的不满。该用户认为,潜在开发者需要立即看到语法和实际应用案例(例如“Hello World”或 HTTP 服务器)来评估一门语言。 其他评论者提供了教程和文档链接,但也有人指出了技术障碍,例如在线沙箱无法使用。一位参与者为该语言的易用性进行了辩护,将 F* 比作编程界的“矮人要塞”——即设计上就具有复杂性和高门槛。尽管文档存在不足,但经验丰富的用户称赞了 F* 与现有 C 代码库的集成能力以及强大的验证功能。总体而言,这次讨论凸显了编程社区中一种常见的矛盾:对快速、直观入门方式的渴望,与先进的、侧重形式化验证的语言所固有的复杂性之间的博弈。
相关文章

原文

F* (pronounced F star) is a general-purpose proof-oriented programming language, supporting both purely functional and effectful programming. It combines the expressive power of dependent types with proof automation based on SMT solving and tactic-based interactive theorem proving.

F* programs compile, by default, to OCaml. Various fragments of F* can also be extracted to F#, to C or Wasm by a tool called KaRaMeL, or to assembly using the Vale toolchain. F* is implemented in F* and bootstrapped using OCaml.

F* is open source on GitHub and is under active development by Microsoft Research, Inria, and by the community.


F* is distributed under the Apache 2.0 license. Binaries for Windows, Linux, and Mac OS X are posted regularly on the releases page on GitHub. You can also install F* from OPAM, Docker, Nix, or build it from sources, by following the instructions in INSTALL.md.


An online book Proof-oriented Programming In F* is being written and regular updates are posted online. You probably want to read it while trying out examples and exercises in your browser by clicking the image below.

F* Tutorial

Low*

We also have a tutorial that covers Low*, a low-level subset of F*, which can be compiled to C by KaRaMeL.

Course Material

F* courses are often taught at various seasonal schools. Lectures and course materials for some of them are also a useful resource.

  • Embedding Proof-oriented Programming Languages in F*
  • Formal Verification with F* and Meta-F*
  • Verifying Low-Level Code for Correctness and Security
  • Program Verification with F*

F* is used in several projects in both industrial and academic settings. We list a few of them here. If you are using F* in your project, please let us know by writing to the fstar-mailing-list.

Project Everest

Project Everest is an umbrella project that develops high-assurance secure communication software in F*. A big part of the development of F* has been motivated by the scenarios that Project Everest targets. Several offshoots from Project Everest continue as their own projects, including some of those listed below.

HACL*, ValeCrypt, and EverCrypt

HACL* is a library of high-assurance cryptographic primitives, written in F* and extracted to C. ValeCrypt provides formally proven implementations of cryptographic primitives in Vale, a framework for verified assembly language programming embedded in F*. EverCrypt combines them into a single cryptographic provider. Code from these projects is now used in production in several projects, including Mozilla Firefox, the Linux kernel, Python, mbedTLS, the Tezos blockchain, the ElectionGuard electronic voting SDK, and the Wireguard VPN.

EverParse

EverParse is a parser generator for binary formats that produces C code extracted from formally proven F*. Parsers from EverParse are used in production in several projects, including in Windows Hyper-V, where every network packet passing through the Azure cloud platform is parsed and validated first by code generated by EverParse. EverParse is also used in other production settings, including ebpf-for-windows.


F* is an active topic of research, both in the programming languages and formal methods community, as well as from an application perspective in the security and systems communities. We list a few of them below, with full citations to these papers available in this bibliography. If you would like your paper included in this list, please contact [email protected].

The Design of F* and its DSLs

Semantics and Effects

Applications in Security and Cryptography

Many papers applying F* in security and cryptography can be found in the Project Everest bibliography. We mention a few prominent ones here as well as other applications not related to Project Everest.

Applications in Systems

Applications in Parsing

Applications in Programming, Program Proof, and Program Analysis

AI-assisted Programming

Miscellaneous

Papers about an older version of F*

The first paper to introduce a system called F* was in 2011. Although the current version of F* was redesigned and implemented in 2015, we include some of these older papers here for completeness.

联系我们 contact @ memedata.com