Plain-language statement
Sqrt correctly computes Nat.sqrt.
Exact Lean statement
theorem sqrt_correct (n : Nat) (cn : SKI) (hcn : IsChurch n cn) :
IsChurch (Nat.sqrt n) (Sqrt ⬝ cn)Formal artifact
Lean source
theorem sqrt_correct (n : Nat) (cn : SKI) (hcn : IsChurch n cn) : IsChurch (Nat.sqrt n) (Sqrt ⬝ cn) := by apply isChurch_trans _ (sqrt_def cn) apply RFind_correct (fun k => if n < (k + 1) * (k + 1) then 0 else 1) (SqrtCond ⬝ cn) · -- SqrtCond ⬝ cn correctly computes the function intro i y hy apply isChurch_trans _ (sqrtCond_def cn y) have hsucc := succ_correct i y hy have hle := le_correct _ n _ cn (mul_correct hsucc hsucc) hcn have hneg := neg_correct _ _ hle apply isChurch_trans _ (cond_correct _ _ _ _ hneg) grind · -- fNat (Nat.sqrt n) = 0 simp [Nat.lt_succ_sqrt] · -- ∀ i < Nat.sqrt n, fNat i ≠ 0 grind [Nat.le_sqrt]- Project
- Lean Computer Science Library
- License
- Apache-2.0
- Commit
- f36649cff2c9
- Source
- Cslib/Languages/CombinatoryLogic/Recursion.lean:447-462
Reuse this declaration
Bring the exact result into your workflow
The import identifies the source module. Your project still needs the pinned package dependency shown on this page.
What this badge means
This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.
Continue in this project
Related declarations
Unique minimal
Cslib.Automata.DA.FinAcc.unique_minimal
Plain-language statement
The minimal DFA M accepting the language l is unique up to unique isomorphism.
Source project: Lean Computer Science Library
Person-level attribution pending.
Buchi Family cover
Cslib.Automata.NA.Buchi.buchiFamily_cover
Project documentation
na.buchiFamily is a cover if na has only finitely many states. This theorem uses the Ramsey theorem for infinite graphs and does not depend on any details of na.BuchiCongruence other than that it is of finite index.
Source project: Lean Computer Science Library
Person-level attribution pending.
Buchi Family saturation
Cslib.Automata.NA.Buchi.buchiFamily_saturation
Plain-language statement
na.buchiFamily saturates the ω-language accepted by na.
Source project: Lean Computer Science Library
Person-level attribution pending.