Skip to content

Remove unnecessary coercions between bool/prop/Type#4279

Draft
gebner wants to merge 6 commits into
masterfrom
gebner_squash_cleanup
Draft

Remove unnecessary coercions between bool/prop/Type#4279
gebner wants to merge 6 commits into
masterfrom
gebner_squash_cleanup

Conversation

@gebner

@gebner gebner commented May 26, 2026

Copy link
Copy Markdown
Contributor

No description provided.

gebner and others added 6 commits June 22, 2026 23:38
The compiler now automatically inserts b2t (bool→prop) and t2b (prop→bool)
coercions when there is a type mismatch. Remove explicit uses from:

Library:
- FStar.Int.fsti: requires clauses in incr/decr
- FStar.UInt.fsti: requires clauses in incr/decr/incr_underspec/decr_underspec
- FStar.RefinementExtensionality.fst: refinement type

Tests:
- TestGhost.fst, SimplifyProp.fst, Unit1.WPsAndTriples.fst: requires clauses
- Bug026, Bug155, Bug292: refinement types
- Bug237, Bug281: t2b removal in if-conditions
- Lib.LoopCombinators.fst: requires/ensures clauses
- NegativeTests.Neg.fst, TestErrorLocations.fst: error message tests
- Caller.fst: comment update

Remaining b2t uses are either:
- Definitions (Prims.fst)
- Local variables (Parametricity.fst aliases binder_to_term as b2t)
- Quoted terms in metaprogramming (TReflGuards, TestImmutableArray)
- normalize_term interactions where auto-coercion doesn't fire

squash uses are all semantic (parameter types, return types) not coercions.
strong_excluded_middle only appears in its definition module.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…more

Continue removing manual coercions now handled by automatic insertion:

b2t removal (examples/):
- SfLists, Problem01, GC, LambdaOmega, Unification, Huffman, RBTree,
  BinarySearchTreeBasic

t2b removal (examples/ and pulse/):
- LambdaOmega, StlcStrongDbParSubst
- Pulse.Lib.ForEvery: removed local t2b definition and all uses

b2t removal (pulse/):
- PulseTutorial.MonotonicCounter*, Pulse.Lib.Task, Pulse.Lib.ForEvery

squash removal (function arg/return types, ulib/ and tests/):
- FStar.UInt128, FStar.Math.Euclid, FStar.Seq.Properties,
  FStar.FunctionalExtensionality
- CalcInference, ClassicalSugar, StrictUnfolding, TwoPhaseTC,
  UnifierArith, HoleBy, CoreCheckMatch, Bug3353, BugBoxInjectivity

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The compiler now auto-inserts squash coercions, making explicit squash
in function parameter and return type positions redundant.

Key changes:
- FStar.Classical.Sugar.fst/fsti: all squash wrappers removed
- FStar.Tactics.{MApply0,V2.Derived,Simplifier,CanonMonoid,Canon.Lemmas,
  BV.Lemmas,PatternMatching,PrettifyType,Parametricity}: squash removed
- FStar.{Classical,Pervasives,ReflexiveTransitiveClosure,WellFounded,
  Seq.Permutation,Seq.Sorted,Sequence.Base,Bijection,BV,FiniteSet.Ambient,
  Reflection.TermEq}: squash removed
- ~80 test files: squash removed from parameters and return types
- pulse/: squash removed where applicable

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Pulse language extension now supports auto-coercion of squash in
returns clauses and function parameter types. Remove explicit squash
from these positions across pulse lib, core, examples, and checker.

Preserves 'let x : squash p = ()' proof patterns which still require
explicit squash in Pulse.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gebner gebner force-pushed the gebner_squash_cleanup branch from 46636ee to dd7fad1 Compare June 24, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant