MCPcopy Create free account
hub / github.com/argumentcomputer/ix / extract_nat_lit

Function extract_nat_lit

crates/kernel/src/whnf.rs:2851–2862  ·  view source on GitHub ↗

Extract a nat value from a literal or `Nat.zero` constructor. Matches both `Nat(n)` literals and the `Nat.zero` constructor constant, mirroring C++ `is_nat_lit_ext` and lean4lean `rawNatLitExt?`. After iota reduction, `Nat.zero` can appear as `Const(Nat.zero, [])` which must be recognized for native Nat operations to fire.

(
  e: &'a KExpr<M>,
  prims: &Primitives<M>,
)

Source from the content-addressed store, hash-verified

2849 )
2850 },
2851 _ => false,
2852 }
2853 }
2854
2855 /// Native Nat.decLe/decEq/decLt reduction.
2856 ///
2857 /// Intercepts `Nat.decLe n m`, `Nat.decEq n m`, `Nat.decLt n m` when both
2858 /// arguments are Nat literals. Computes the boolean result natively and
2859 /// constructs the appropriate `Decidable.isTrue prop proof` or
2860 /// `Decidable.isFalse prop proof`.
2861 ///
2862 /// Constructors in the kernel are fully explicit:
2863 /// `Decidable.isTrue : (p : Prop) → p → Decidable p`
2864 /// `Decidable.isFalse : (p : Prop) → (p → False) → Decidable p`
2865 /// so the proposition `p` must be supplied as the first argument.

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected