Hanxi "Gary" Chen

Hanxi Chen

About

Profile picture

I am a CS Ph.D. student at Cornell University, advised by Prof. Alexandra Silva and Prof. Andrew Myers. My research interests are in programming languages and formal verification, with recent work on probabilistic programming and concurrency. I am also a mentor at Cornell’s Math+AI, working with Prof. Daniel Halpern-Leistner. In Fall 2026 I’m mentoring two projects there: one on benchmarks and tools for autoformalization, and one on large language models for program reasoning.

Before Cornell, I graduated from the University of Pennsylvania with a B.S.E. and M.S.E. in Computer Science from Penn Engineering and a B.S. in Economics from Wharton. I was a member of Penn’s PLClub, advised by Prof. Steve Zdancewic, where I worked on Verifying LLVM (Vellvm), differential testing for LLVM compilers, and linear logic. I was a Wharton Research Scholar supervised by Prof. Sanjeev Khanna on knapsack problems with precedence constraints.

Publications

[arXiv] · Under submission Oblivious Probabilistic Outcome Logic: Verifying Probabilistic Programs with an Oblivious Adversary
Hanxi Chen, Noam Zilberstein, Andrew C. Myers, Alexandra Silva
Abstract

In the context of probabilistic programs, an oblivious adversary resolves nondeterminism without seeing the outcomes of random draws. Obliviousness is a common assumption in online algorithms and distributed protocols, but the complex interaction between random draws and adversarial choices makes it challenging to reason about correctness. While there has been significant progress toward reasoning about programs that combine randomization with nondeterminism, most of the work has focused on the adaptive model, whose omniscient view of program state is too powerful to establish correctness for certain classes of programs. We introduce Oblivious Probabilistic Outcome Logic (opOL), a new logic for reasoning about probabilistic programs with nondeterminism controlled by an oblivious adversary. Building on Outcome Logic and Probabilistic Separation Logic, opOL models adversarial choice as a resource and uses probabilistic independence to ensure that random outcomes are hidden from the adversary. The opOL proof system provides expressive and compositional rules for case analysis on both random and nondeterministic outcomes, and for proving almost-sure termination. Expressivity is tested through several case studies, including a paging algorithm and a leader election protocol. The opOL metatheory and case studies are mechanized in Lean 4.

[arXiv] · Under submission Type-Confusion Security
Silei Ren*, Hanxi Chen*, Suraaj Kanniwadi, Andrew C. Myers
Abstract

Type systems are a lightweight way to obtain formal assurance that code upholds security properties. However, decentralized systems, such as smart contracts and Model Context Protocol ecosystems, have limited ability to constrain the behavior of untrusted code. In such systems, attackers may attempt to confuse trusted code by supplying values that do not behave according to their advertised types, an attack that we call type confusion. Well-known attacks such as confused deputy attacks, reentrancy attacks, and control-flow hijacking can be understood as instances of type confusion. We define type confusion security as the property that unrestricted attackers who need not follow the type system have no more power than limited attackers who fully obey it. We formally define type confusion security as a real–ideal emulation, and in the context of an information-flow-typed core calculus that statically enforces security against well-typed attackers, prove that its run-time checks also enforce security against ill-typed attackers. In this system, programmers can write code while reasoning about security only against well-typed attackers; the security guarantees enforced by the type system still hold. We mechanize a proof of type confusion security in Lean.

[NFM'25] Vellvm: Formalizing the Informal LLVM (An Experience Report)
Calvin Beck*, Hanxi Chen*, Steve Zdancewic
Abstract

This report presents our methodology for and experience with formalizing a specification of LLVM IR in the Verified LLVM Project (Vellvm). Vellvm provides a specification for a large, practical subset of LLVM IR in the Rocq Proof Assistant in the support of verified compilers and program transformations. Program transformations often rely on the subtle details, and as a result Vellvm's semantics are quite comprehensive: for instance we provide a sophisticated low-level memory model to support low-level operations, such as casts between pointers and integers, and justify optimizations in their presence. Our approach implements the semantics via monadic interpreters, which rely on a coinductively-defined data structure called ITrees. Crucially, this methodology supports the extraction of an executable interpreter, proved to refine the specification. We use the reference interpreter to validate the accuracy of the formalization, employing random differential testing between Clang and Vellvm implemented in our own LLVM IR program generator (GenLLVM), as well as via state-of-the-art C compiler testing frameworks (CSmith and YARPGen). Such testing has found bugs in both the Vellvm semantics and Clang. We believe that tools from the Vellvm project can be useful for other LLVM IR-related projects, and that the overall methodology applies to other formal verification efforts.

[CoqPL'25] Vellvm: Formalizing the Informal
Calvin Beck*, Hanxi Chen*, Steve Zdancewic
Abstract

The Vellvm project is an extensive undertaking to formalize a large subset of LLVM IR in the Coq proof assistant. LLVM IR is an intermediate language that is widely used as a common target for front-end compilers. Compilers for different languages can share the LLVM infrastructure for performing optimizations and generating target code for various instruction set architectures. The bedrock of many languages is LLVM IR, and formalizing it gives us an important tool for compiler verification efforts. In this talk we will explore the difficulties that come up when attempting to formalize a large real world language. We'll touch upon how proof assistants like Coq can reveal issues in informal specifications, how testing tools like QuickChick can help bridge the gap between informal real world implementations and our formal Coq semantics, and we will also touch upon aspects of the LLVM IR could be updated to better suit verification efforts. Furthermore, we'll discuss some of the challenges we have encountered along the way, including limitations with the Coq type system, extraction bugs, and performance issues for proofs and extracted code.

[ICFP'24] A Two-Phase Infinite/Finite Low-Level Memory Model: Reconciling Integer–Pointer Casts, Finite Space, and undef at the LLVM IR Level of Abstraction
Calvin Beck, Irene Yoon, Hanxi Chen, Yannick Zakowski, Steve Zdancewic
[MIT PL Review 2025]
Abstract

This paper provides a novel approach to reconciling complex low-level memory model features, such as pointer–integer casts, with desired refinements that are needed to justify the correctness of program transformations. The idea is to use a "two-phase" memory model, one with an unbounded memory and corresponding unbounded integer type, and one with a finite memory; the connection between the two levels is made explicit by a notion of refinement that handles out-of-memory behaviors. This approach allows for more optimizations to be performed and establishes a clear boundary between the idealized semantics of a program and the implementation of that program on finite hardware. The two-phase memory model has been incorporated into an LLVM IR semantics, demonstrating its utility in practice in the context of a low-level language with features like undef and bitcast. This yields infinite and finite memory versions of the language semantics that are proven to be in refinement with respect to out-of-memory behaviors. Each semantics is accompanied by a verified executable reference interpreter. The semantics justify optimizations, such as dead-alloca-elimination, that were previously impossible or difficult to prove correct.

*Equal contribution

Research

Current Projects

opOL: Oblivious Probabilistic Outcome Logic
Lean 4Program logicProbabilistic programming
Practical randomized protocols in distributed systems and hardware often rely on oblivious adversaries, but randomization + control flow can leak entropy through schedule consumption, making their correctness subtle to reason about. opOL develops a program logic, mechanized in Lean for verifying probabilistic programs against oblivious adversaries.

Joint work with Prof. Noam Zilberstein (now at Stevens), Prof. Andrew C. Myers, and Prof. Alexandra Silva.

Type-Confusion Security
Information flowType systemsSecurity
In decentralized systems, untrusted components can ignore the type system and lie about the interfaces they provide. Type-confusion security is a real–ideal emulation definition stating that ill-typed attackers have no more power than well-typed ones. It captures confused-deputy and reentrancy attacks. In an information-flow-typed core calculus, run-time checks extend the type system’s static protection to ill-typed attackers. We mechanized it in Lean 4 as an extensible, executable framework for modeling other attacks.

Joint work with Dr. Silei Ren, Suraaj Kanniwadi, and Prof. Andrew C. Myers.

Autoformalization
Lean 4AI for Mathematics
Autoformalization asks AI systems to translate mathematical statements and proofs into Lean code. Cornell’s ongoing Math+AI project develops challenging research-level benchmarks, a survey for comparing Lean proofs, a collection of formalization problems, and LaTeX-to-Lean proof tooling.

Joint work with Prof. Daniel Halpern-Leistner (Cornell Mathematics).

Selected Past Projects

Vellvm: Differential Testing for LLVM
RocqLLVM IRDifferential testing
LLVM IR is a widely used compiler intermediate representation whose official semantics are informal. Vellvm formalizes a practical subset of LLVM IR in Rocq, including a memory model for optimization reasoning and differential testing to validate the semantics and find LLVM bugs.

Joint work with Dr. Calvin Beck and Prof. Steve Zdancewic.

Knapsack Problems with Precedence Constraints
Algorithms
Real-world knapsack problems, including cryptocurrency mining and inventory planning, often involve dependencies. However, precedence-constrained knapsack is strongly NP-hard in general. This project studies special graph classes where exact pseudo-polynomial algorithms are possible.

Joint work with Prof. Sanjeev Khanna (now at NYU).

Education

Penn Engineering The Wharton School

University of Pennsylvania

Penn Engineering & The Wharton SchoolPhiladelphia, PA

2020–2025
  • M.S.E. in Computer and Information Science
  • B.S.E. in Computer Science (Mathematics Minor)CIS Senior Thesis
  • B.S. in Economics Wharton Research Scholars

Summa Cum Laude3.97/4.00

Advised by Prof. Steve Zdancewic and Prof. Sanjeev Khanna.

MCIT TA Award · CIS Faculty Appreciation Award

Teaching

Cornell University

CS 4110 / CS 5110

Programming Languages and Logics

with Prof. Nate Foster

  • Graduate Teaching Assistant Fall 2025

University of Pennsylvania

CIS 5020 / CIT 5960 / CIS 3200

Analysis of Algorithms

with Prof. Sanjeev Khanna

  • Head Teaching Assistant Spring 2023, Summer 2023, Fall 2023, Summer 2024
  • Teaching Assistant Summer 2022, Fall 2022

Service

Cornell PL Seminar (PLDG)

Co-Czar 2026

ATVA 2026

Artifact Evaluation Committee Jul 2026

PLDI 2026

Artifact Evaluation Committee Jan 2026

POPL 2026

Artifact Evaluation Committee Nov 2025

POPL 2025

Student Volunteer Jan 2025

SPLASH 2024

Student Volunteer Oct 2024

OPLSS 2024

Student Volunteer Jun 2024

Contact

I would love to hear about a collaboration, an idea in programming languages and formal verification, or whatever you happen to be working on.

Email
hanxic@cs.cornell.edu
GitHub
github.com/hanxic
LinkedIn
linkedin.com/in/hanxic