@stevenvo780/st-lang 4.5.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bdd/index.d.ts +4 -0
- package/dist/bdd/index.d.ts.map +1 -0
- package/dist/bdd/index.js +29 -0
- package/dist/bdd/index.js.map +1 -0
- package/dist/bdd/manager.d.ts +122 -0
- package/dist/bdd/manager.d.ts.map +1 -0
- package/dist/bdd/manager.js +524 -0
- package/dist/bdd/manager.js.map +1 -0
- package/dist/bdd/types.d.ts +20 -0
- package/dist/bdd/types.d.ts.map +1 -0
- package/dist/bdd/types.js +28 -0
- package/dist/bdd/types.js.map +1 -0
- package/dist/game-theory/common-games.d.ts +50 -0
- package/dist/game-theory/common-games.d.ts.map +1 -0
- package/dist/game-theory/common-games.js +112 -0
- package/dist/game-theory/common-games.js.map +1 -0
- package/dist/game-theory/dominance.d.ts +26 -0
- package/dist/game-theory/dominance.d.ts.map +1 -0
- package/dist/game-theory/dominance.js +203 -0
- package/dist/game-theory/dominance.js.map +1 -0
- package/dist/game-theory/index.d.ts +8 -0
- package/dist/game-theory/index.d.ts.map +1 -0
- package/dist/game-theory/index.js +47 -0
- package/dist/game-theory/index.js.map +1 -0
- package/dist/game-theory/lemke-howson.d.ts +3 -0
- package/dist/game-theory/lemke-howson.d.ts.map +1 -0
- package/dist/game-theory/lemke-howson.js +269 -0
- package/dist/game-theory/lemke-howson.js.map +1 -0
- package/dist/game-theory/linalg.d.ts +7 -0
- package/dist/game-theory/linalg.d.ts.map +1 -0
- package/dist/game-theory/linalg.js +69 -0
- package/dist/game-theory/linalg.js.map +1 -0
- package/dist/game-theory/pure-nash.d.ts +3 -0
- package/dist/game-theory/pure-nash.d.ts.map +1 -0
- package/dist/game-theory/pure-nash.js +86 -0
- package/dist/game-theory/pure-nash.js.map +1 -0
- package/dist/game-theory/support-enumeration.d.ts +3 -0
- package/dist/game-theory/support-enumeration.d.ts.map +1 -0
- package/dist/game-theory/support-enumeration.js +214 -0
- package/dist/game-theory/support-enumeration.js.map +1 -0
- package/dist/game-theory/types.d.ts +57 -0
- package/dist/game-theory/types.d.ts.map +1 -0
- package/dist/game-theory/types.js +191 -0
- package/dist/game-theory/types.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -1
- package/dist/index.js.map +1 -1
- package/dist/information-theory/index.d.ts +29 -0
- package/dist/information-theory/index.d.ts.map +1 -0
- package/dist/information-theory/index.js +323 -0
- package/dist/information-theory/index.js.map +1 -0
- package/dist/namespaces/logic.d.ts +42 -0
- package/dist/namespaces/logic.d.ts.map +1 -0
- package/dist/namespaces/logic.js +112 -0
- package/dist/namespaces/logic.js.map +1 -0
- package/dist/namespaces/proof-systems.d.ts +18 -0
- package/dist/namespaces/proof-systems.d.ts.map +1 -0
- package/dist/namespaces/proof-systems.js +59 -0
- package/dist/namespaces/proof-systems.js.map +1 -0
- package/dist/namespaces/reasoning.d.ts +26 -0
- package/dist/namespaces/reasoning.d.ts.map +1 -0
- package/dist/namespaces/reasoning.js +72 -0
- package/dist/namespaces/reasoning.js.map +1 -0
- package/dist/namespaces/semantics.d.ts +21 -0
- package/dist/namespaces/semantics.d.ts.map +1 -0
- package/dist/namespaces/semantics.js +64 -0
- package/dist/namespaces/semantics.js.map +1 -0
- package/dist/namespaces/solvers.d.ts +22 -0
- package/dist/namespaces/solvers.d.ts.map +1 -0
- package/dist/namespaces/solvers.js +66 -0
- package/dist/namespaces/solvers.js.map +1 -0
- package/dist/namespaces/type-theory.d.ts +22 -0
- package/dist/namespaces/type-theory.d.ts.map +1 -0
- package/dist/namespaces/type-theory.js +65 -0
- package/dist/namespaces/type-theory.js.map +1 -0
- package/dist/optimization/branch-and-bound.d.ts +11 -0
- package/dist/optimization/branch-and-bound.d.ts.map +1 -0
- package/dist/optimization/branch-and-bound.js +311 -0
- package/dist/optimization/branch-and-bound.js.map +1 -0
- package/dist/optimization/index.d.ts +5 -0
- package/dist/optimization/index.d.ts.map +1 -0
- package/dist/optimization/index.js +20 -0
- package/dist/optimization/index.js.map +1 -0
- package/dist/optimization/simplex.d.ts +8 -0
- package/dist/optimization/simplex.d.ts.map +1 -0
- package/dist/optimization/simplex.js +408 -0
- package/dist/optimization/simplex.js.map +1 -0
- package/dist/optimization/standard-form.d.ts +11 -0
- package/dist/optimization/standard-form.d.ts.map +1 -0
- package/dist/optimization/standard-form.js +112 -0
- package/dist/optimization/standard-form.js.map +1 -0
- package/dist/optimization/types.d.ts +44 -0
- package/dist/optimization/types.d.ts.map +1 -0
- package/dist/optimization/types.js +15 -0
- package/dist/optimization/types.js.map +1 -0
- package/dist/profiles/hol/connectives.d.ts +46 -0
- package/dist/profiles/hol/connectives.d.ts.map +1 -0
- package/dist/profiles/hol/connectives.js +104 -0
- package/dist/profiles/hol/connectives.js.map +1 -0
- package/dist/profiles/hol/index.d.ts +7 -0
- package/dist/profiles/hol/index.d.ts.map +1 -0
- package/dist/profiles/hol/index.js +77 -0
- package/dist/profiles/hol/index.js.map +1 -0
- package/dist/profiles/hol/rules.d.ts +31 -0
- package/dist/profiles/hol/rules.d.ts.map +1 -0
- package/dist/profiles/hol/rules.js +258 -0
- package/dist/profiles/hol/rules.js.map +1 -0
- package/dist/profiles/hol/term.d.ts +52 -0
- package/dist/profiles/hol/term.d.ts.map +1 -0
- package/dist/profiles/hol/term.js +345 -0
- package/dist/profiles/hol/term.js.map +1 -0
- package/dist/profiles/hol/type-system.d.ts +38 -0
- package/dist/profiles/hol/type-system.d.ts.map +1 -0
- package/dist/profiles/hol/type-system.js +133 -0
- package/dist/profiles/hol/type-system.js.map +1 -0
- package/dist/profiles/hol/types.d.ts +59 -0
- package/dist/profiles/hol/types.d.ts.map +1 -0
- package/dist/profiles/hol/types.js +26 -0
- package/dist/profiles/hol/types.js.map +1 -0
- package/dist/smt-lib/ast.d.ts +138 -0
- package/dist/smt-lib/ast.d.ts.map +1 -0
- package/dist/smt-lib/ast.js +73 -0
- package/dist/smt-lib/ast.js.map +1 -0
- package/dist/smt-lib/emitter.d.ts +12 -0
- package/dist/smt-lib/emitter.d.ts.map +1 -0
- package/dist/smt-lib/emitter.js +174 -0
- package/dist/smt-lib/emitter.js.map +1 -0
- package/dist/smt-lib/index.d.ts +6 -0
- package/dist/smt-lib/index.d.ts.map +1 -0
- package/dist/smt-lib/index.js +31 -0
- package/dist/smt-lib/index.js.map +1 -0
- package/dist/smt-lib/parser.d.ts +13 -0
- package/dist/smt-lib/parser.d.ts.map +1 -0
- package/dist/smt-lib/parser.js +614 -0
- package/dist/smt-lib/parser.js.map +1 -0
- package/dist/smt-lib/tokenizer.d.ts +16 -0
- package/dist/smt-lib/tokenizer.d.ts.map +1 -0
- package/dist/smt-lib/tokenizer.js +234 -0
- package/dist/smt-lib/tokenizer.js.map +1 -0
- package/dist/tests/api/namespaces.test.d.ts +9 -0
- package/dist/tests/api/namespaces.test.d.ts.map +1 -0
- package/dist/tests/api/namespaces.test.js +218 -0
- package/dist/tests/api/namespaces.test.js.map +1 -0
- package/dist/tests/bdd/manager.test.d.ts +2 -0
- package/dist/tests/bdd/manager.test.d.ts.map +1 -0
- package/dist/tests/bdd/manager.test.js +472 -0
- package/dist/tests/bdd/manager.test.js.map +1 -0
- package/dist/tests/game-theory/game-theory.test.d.ts +2 -0
- package/dist/tests/game-theory/game-theory.test.d.ts.map +1 -0
- package/dist/tests/game-theory/game-theory.test.js +252 -0
- package/dist/tests/game-theory/game-theory.test.js.map +1 -0
- package/dist/tests/hol/hol.test.d.ts +2 -0
- package/dist/tests/hol/hol.test.d.ts.map +1 -0
- package/dist/tests/hol/hol.test.js +340 -0
- package/dist/tests/hol/hol.test.js.map +1 -0
- package/dist/tests/information-theory/information-theory.test.d.ts +2 -0
- package/dist/tests/information-theory/information-theory.test.d.ts.map +1 -0
- package/dist/tests/information-theory/information-theory.test.js +291 -0
- package/dist/tests/information-theory/information-theory.test.js.map +1 -0
- package/dist/tests/optimization/ilp.test.d.ts +2 -0
- package/dist/tests/optimization/ilp.test.d.ts.map +1 -0
- package/dist/tests/optimization/ilp.test.js +204 -0
- package/dist/tests/optimization/ilp.test.js.map +1 -0
- package/dist/tests/optimization/lp.test.d.ts +2 -0
- package/dist/tests/optimization/lp.test.d.ts.map +1 -0
- package/dist/tests/optimization/lp.test.js +224 -0
- package/dist/tests/optimization/lp.test.js.map +1 -0
- package/dist/tests/properties/agm.property.test.d.ts +2 -0
- package/dist/tests/properties/agm.property.test.d.ts.map +1 -0
- package/dist/tests/properties/agm.property.test.js +75 -0
- package/dist/tests/properties/agm.property.test.js.map +1 -0
- package/dist/tests/properties/anti-unification.property.test.d.ts +2 -0
- package/dist/tests/properties/anti-unification.property.test.d.ts.map +1 -0
- package/dist/tests/properties/anti-unification.property.test.js +43 -0
- package/dist/tests/properties/anti-unification.property.test.js.map +1 -0
- package/dist/tests/properties/argumentation.property.test.d.ts +2 -0
- package/dist/tests/properties/argumentation.property.test.d.ts.map +1 -0
- package/dist/tests/properties/argumentation.property.test.js +51 -0
- package/dist/tests/properties/argumentation.property.test.js.map +1 -0
- package/dist/tests/properties/bayesian.property.test.d.ts +2 -0
- package/dist/tests/properties/bayesian.property.test.d.ts.map +1 -0
- package/dist/tests/properties/bayesian.property.test.js +32 -0
- package/dist/tests/properties/bayesian.property.test.js.map +1 -0
- package/dist/tests/properties/bisimulation.property.test.d.ts +2 -0
- package/dist/tests/properties/bisimulation.property.test.d.ts.map +1 -0
- package/dist/tests/properties/bisimulation.property.test.js +50 -0
- package/dist/tests/properties/bisimulation.property.test.js.map +1 -0
- package/dist/tests/properties/cdcl.property.test.d.ts +2 -0
- package/dist/tests/properties/cdcl.property.test.d.ts.map +1 -0
- package/dist/tests/properties/cdcl.property.test.js +70 -0
- package/dist/tests/properties/cdcl.property.test.js.map +1 -0
- package/dist/tests/properties/coinduction.property.test.d.ts +2 -0
- package/dist/tests/properties/coinduction.property.test.d.ts.map +1 -0
- package/dist/tests/properties/coinduction.property.test.js +34 -0
- package/dist/tests/properties/coinduction.property.test.js.map +1 -0
- package/dist/tests/properties/constructive-reals.property.test.d.ts +2 -0
- package/dist/tests/properties/constructive-reals.property.test.d.ts.map +1 -0
- package/dist/tests/properties/constructive-reals.property.test.js +59 -0
- package/dist/tests/properties/constructive-reals.property.test.js.map +1 -0
- package/dist/tests/properties/csp.property.test.d.ts +2 -0
- package/dist/tests/properties/csp.property.test.d.ts.map +1 -0
- package/dist/tests/properties/csp.property.test.js +58 -0
- package/dist/tests/properties/csp.property.test.js.map +1 -0
- package/dist/tests/properties/generators.d.ts +78 -0
- package/dist/tests/properties/generators.d.ts.map +1 -0
- package/dist/tests/properties/generators.js +348 -0
- package/dist/tests/properties/generators.js.map +1 -0
- package/dist/tests/properties/ho-unify.property.test.d.ts +2 -0
- package/dist/tests/properties/ho-unify.property.test.d.ts.map +1 -0
- package/dist/tests/properties/ho-unify.property.test.js +46 -0
- package/dist/tests/properties/ho-unify.property.test.js.map +1 -0
- package/dist/tests/properties/hyperreal.property.test.d.ts +2 -0
- package/dist/tests/properties/hyperreal.property.test.d.ts.map +1 -0
- package/dist/tests/properties/hyperreal.property.test.js +33 -0
- package/dist/tests/properties/hyperreal.property.test.js.map +1 -0
- package/dist/tests/properties/intuit-nj.property.test.d.ts +2 -0
- package/dist/tests/properties/intuit-nj.property.test.d.ts.map +1 -0
- package/dist/tests/properties/intuit-nj.property.test.js +57 -0
- package/dist/tests/properties/intuit-nj.property.test.js.map +1 -0
- package/dist/tests/properties/lambda-calc.property.test.d.ts +2 -0
- package/dist/tests/properties/lambda-calc.property.test.d.ts.map +1 -0
- package/dist/tests/properties/lambda-calc.property.test.js +35 -0
- package/dist/tests/properties/lambda-calc.property.test.js.map +1 -0
- package/dist/tests/properties/mln.property.test.d.ts +2 -0
- package/dist/tests/properties/mln.property.test.d.ts.map +1 -0
- package/dist/tests/properties/mln.property.test.js +41 -0
- package/dist/tests/properties/mln.property.test.js.map +1 -0
- package/dist/tests/properties/mltt.property.test.d.ts +2 -0
- package/dist/tests/properties/mltt.property.test.d.ts.map +1 -0
- package/dist/tests/properties/mltt.property.test.js +33 -0
- package/dist/tests/properties/mltt.property.test.js.map +1 -0
- package/dist/tests/properties/nbe.property.test.d.ts +2 -0
- package/dist/tests/properties/nbe.property.test.d.ts.map +1 -0
- package/dist/tests/properties/nbe.property.test.js +44 -0
- package/dist/tests/properties/nbe.property.test.js.map +1 -0
- package/dist/tests/properties/planning.property.test.d.ts +2 -0
- package/dist/tests/properties/planning.property.test.d.ts.map +1 -0
- package/dist/tests/properties/planning.property.test.js +51 -0
- package/dist/tests/properties/planning.property.test.js.map +1 -0
- package/dist/tests/properties/profile-bridge.property.test.d.ts +2 -0
- package/dist/tests/properties/profile-bridge.property.test.d.ts.map +1 -0
- package/dist/tests/properties/profile-bridge.property.test.js +71 -0
- package/dist/tests/properties/profile-bridge.property.test.js.map +1 -0
- package/dist/tests/properties/refinement-types.property.test.d.ts +2 -0
- package/dist/tests/properties/refinement-types.property.test.d.ts.map +1 -0
- package/dist/tests/properties/refinement-types.property.test.js +37 -0
- package/dist/tests/properties/refinement-types.property.test.js.map +1 -0
- package/dist/tests/properties/sequent-g3.property.test.d.ts +2 -0
- package/dist/tests/properties/sequent-g3.property.test.d.ts.map +1 -0
- package/dist/tests/properties/sequent-g3.property.test.js +34 -0
- package/dist/tests/properties/sequent-g3.property.test.js.map +1 -0
- package/dist/tests/properties/symbolic-diff.property.test.d.ts +2 -0
- package/dist/tests/properties/symbolic-diff.property.test.d.ts.map +1 -0
- package/dist/tests/properties/symbolic-diff.property.test.js +49 -0
- package/dist/tests/properties/symbolic-diff.property.test.js.map +1 -0
- package/dist/tests/properties/system-f.property.test.d.ts +2 -0
- package/dist/tests/properties/system-f.property.test.d.ts.map +1 -0
- package/dist/tests/properties/system-f.property.test.js +37 -0
- package/dist/tests/properties/system-f.property.test.js.map +1 -0
- package/dist/tests/properties/theorem-cache.property.test.d.ts +2 -0
- package/dist/tests/properties/theorem-cache.property.test.d.ts.map +1 -0
- package/dist/tests/properties/theorem-cache.property.test.js +38 -0
- package/dist/tests/properties/theorem-cache.property.test.js.map +1 -0
- package/dist/tests/properties/trs.property.test.d.ts +2 -0
- package/dist/tests/properties/trs.property.test.d.ts.map +1 -0
- package/dist/tests/properties/trs.property.test.js +34 -0
- package/dist/tests/properties/trs.property.test.js.map +1 -0
- package/dist/tests/properties/unification.property.test.d.ts +2 -0
- package/dist/tests/properties/unification.property.test.d.ts.map +1 -0
- package/dist/tests/properties/unification.property.test.js +42 -0
- package/dist/tests/properties/unification.property.test.js.map +1 -0
- package/dist/tests/smt-lib/emitter.test.d.ts +2 -0
- package/dist/tests/smt-lib/emitter.test.d.ts.map +1 -0
- package/dist/tests/smt-lib/emitter.test.js +155 -0
- package/dist/tests/smt-lib/emitter.test.js.map +1 -0
- package/dist/tests/smt-lib/parser.test.d.ts +2 -0
- package/dist/tests/smt-lib/parser.test.d.ts.map +1 -0
- package/dist/tests/smt-lib/parser.test.js +164 -0
- package/dist/tests/smt-lib/parser.test.js.map +1 -0
- package/dist/tests/smt-lib/tokenizer.test.d.ts +2 -0
- package/dist/tests/smt-lib/tokenizer.test.d.ts.map +1 -0
- package/dist/tests/smt-lib/tokenizer.test.js +59 -0
- package/dist/tests/smt-lib/tokenizer.test.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HOLTerm, HOLType } from './types';
|
|
2
|
+
/** Constante `T : bool`. */
|
|
3
|
+
export declare const True: HOLTerm;
|
|
4
|
+
/** Constante `⊥ : bool`. */
|
|
5
|
+
export declare const Bottom: HOLTerm;
|
|
6
|
+
/** Constante `∧ : bool → bool → bool`. */
|
|
7
|
+
export declare const And: HOLTerm;
|
|
8
|
+
/** Constante `∨ : bool → bool → bool`. */
|
|
9
|
+
export declare const Or: HOLTerm;
|
|
10
|
+
/** Constante `¬ : bool → bool`. */
|
|
11
|
+
export declare const Not: HOLTerm;
|
|
12
|
+
/** Constante `⇒ : bool → bool → bool`. */
|
|
13
|
+
export declare const Implies: HOLTerm;
|
|
14
|
+
/**
|
|
15
|
+
* Constante `∀ : (α → bool) → bool`. Polimórfica vía la tvar `α`.
|
|
16
|
+
* El consumidor debe usar `mkForall` para instanciar al tipo
|
|
17
|
+
* correcto antes de aplicar.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Forall: HOLTerm;
|
|
20
|
+
/**
|
|
21
|
+
* Constante `∃ : (α → bool) → bool`. Igual que `∀`, polimórfica.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Exists: HOLTerm;
|
|
24
|
+
/** Construye `p ∧ q`. */
|
|
25
|
+
export declare function mkAnd(p: HOLTerm, q: HOLTerm): HOLTerm;
|
|
26
|
+
/** Construye `p ∨ q`. */
|
|
27
|
+
export declare function mkOr(p: HOLTerm, q: HOLTerm): HOLTerm;
|
|
28
|
+
/** Construye `¬ p`. */
|
|
29
|
+
export declare function mkNot(p: HOLTerm): HOLTerm;
|
|
30
|
+
/** Construye `p ⇒ q`. */
|
|
31
|
+
export declare function mkImplies(p: HOLTerm, q: HOLTerm): HOLTerm;
|
|
32
|
+
/**
|
|
33
|
+
* Construye `∀x:α. body`. Internamente: `(∀ : (α→bool)→bool) (λx:α. body)`
|
|
34
|
+
* con el `∀` instanciado al tipo correcto.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mkForall(param: string, paramType: HOLType, body: HOLTerm): HOLTerm;
|
|
37
|
+
/**
|
|
38
|
+
* Construye `∃x:α. body`. Análogo a `mkForall`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function mkExists(param: string, paramType: HOLType, body: HOLTerm): HOLTerm;
|
|
41
|
+
/**
|
|
42
|
+
* Validador: lanza si `t` no tiene tipo `bool`. Útil para checks
|
|
43
|
+
* externos antes de pasarle a `assume` o construir conectivas.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assertBool(t: HOLTerm): void;
|
|
46
|
+
//# sourceMappingURL=connectives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,OAAO,CAKlF;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAK3C"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// HOL — Conectivas y cuantificadores definidos
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Siguiendo HOL Light, todo se define a partir de la igualdad
|
|
7
|
+
// primitiva (`=`) y λ-binding. Cada conectiva es un `const`
|
|
8
|
+
// con un tipo polimórfico fijo; las definiciones internas
|
|
9
|
+
// (qué λ-término representa) se documentan pero el núcleo no
|
|
10
|
+
// las usa directamente — son referencias para constructores
|
|
11
|
+
// ergonómicos.
|
|
12
|
+
//
|
|
13
|
+
// Definiciones canónicas:
|
|
14
|
+
// T = (λp:bool. p) = (λp:bool. p)
|
|
15
|
+
// ∧ p q = (λf. f p q) = (λf. f T T)
|
|
16
|
+
// ⇒ p q = (p ∧ q) = p
|
|
17
|
+
// ∀ (P : α→bool) = P = (λx:α. T)
|
|
18
|
+
// ∃ (P : α→bool) = ∀ q. (∀ x. P x ⇒ q) ⇒ q
|
|
19
|
+
// ∨ p q = ∀ r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
|
|
20
|
+
// ⊥ = ∀ p:bool. p
|
|
21
|
+
// ¬ p = p ⇒ ⊥
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.Exists = exports.Forall = exports.Implies = exports.Not = exports.Or = exports.And = exports.Bottom = exports.True = void 0;
|
|
24
|
+
exports.mkAnd = mkAnd;
|
|
25
|
+
exports.mkOr = mkOr;
|
|
26
|
+
exports.mkNot = mkNot;
|
|
27
|
+
exports.mkImplies = mkImplies;
|
|
28
|
+
exports.mkForall = mkForall;
|
|
29
|
+
exports.mkExists = mkExists;
|
|
30
|
+
exports.assertBool = assertBool;
|
|
31
|
+
const type_system_1 = require("./type-system");
|
|
32
|
+
const term_1 = require("./term");
|
|
33
|
+
// Constantes -------------------------------------------------
|
|
34
|
+
/** Constante `T : bool`. */
|
|
35
|
+
exports.True = (0, term_1.mkConst)('T', type_system_1.TyBool);
|
|
36
|
+
/** Constante `⊥ : bool`. */
|
|
37
|
+
exports.Bottom = (0, term_1.mkConst)('F', type_system_1.TyBool);
|
|
38
|
+
/** Constante `∧ : bool → bool → bool`. */
|
|
39
|
+
exports.And = (0, term_1.mkConst)('∧', (0, type_system_1.funTy)(type_system_1.TyBool, (0, type_system_1.funTy)(type_system_1.TyBool, type_system_1.TyBool)));
|
|
40
|
+
/** Constante `∨ : bool → bool → bool`. */
|
|
41
|
+
exports.Or = (0, term_1.mkConst)('∨', (0, type_system_1.funTy)(type_system_1.TyBool, (0, type_system_1.funTy)(type_system_1.TyBool, type_system_1.TyBool)));
|
|
42
|
+
/** Constante `¬ : bool → bool`. */
|
|
43
|
+
exports.Not = (0, term_1.mkConst)('¬', (0, type_system_1.funTy)(type_system_1.TyBool, type_system_1.TyBool));
|
|
44
|
+
/** Constante `⇒ : bool → bool → bool`. */
|
|
45
|
+
exports.Implies = (0, term_1.mkConst)('⇒', (0, type_system_1.funTy)(type_system_1.TyBool, (0, type_system_1.funTy)(type_system_1.TyBool, type_system_1.TyBool)));
|
|
46
|
+
/**
|
|
47
|
+
* Constante `∀ : (α → bool) → bool`. Polimórfica vía la tvar `α`.
|
|
48
|
+
* El consumidor debe usar `mkForall` para instanciar al tipo
|
|
49
|
+
* correcto antes de aplicar.
|
|
50
|
+
*/
|
|
51
|
+
exports.Forall = (0, term_1.mkConst)('∀', (0, type_system_1.funTy)((0, type_system_1.funTy)((0, type_system_1.tvar)('α'), type_system_1.TyBool), type_system_1.TyBool));
|
|
52
|
+
/**
|
|
53
|
+
* Constante `∃ : (α → bool) → bool`. Igual que `∀`, polimórfica.
|
|
54
|
+
*/
|
|
55
|
+
exports.Exists = (0, term_1.mkConst)('∃', (0, type_system_1.funTy)((0, type_system_1.funTy)((0, type_system_1.tvar)('α'), type_system_1.TyBool), type_system_1.TyBool));
|
|
56
|
+
// Constructores ergonómicos ---------------------------------
|
|
57
|
+
/** Construye `p ∧ q`. */
|
|
58
|
+
function mkAnd(p, q) {
|
|
59
|
+
return (0, term_1.mkComb)((0, term_1.mkComb)(exports.And, p), q);
|
|
60
|
+
}
|
|
61
|
+
/** Construye `p ∨ q`. */
|
|
62
|
+
function mkOr(p, q) {
|
|
63
|
+
return (0, term_1.mkComb)((0, term_1.mkComb)(exports.Or, p), q);
|
|
64
|
+
}
|
|
65
|
+
/** Construye `¬ p`. */
|
|
66
|
+
function mkNot(p) {
|
|
67
|
+
return (0, term_1.mkComb)(exports.Not, p);
|
|
68
|
+
}
|
|
69
|
+
/** Construye `p ⇒ q`. */
|
|
70
|
+
function mkImplies(p, q) {
|
|
71
|
+
return (0, term_1.mkComb)((0, term_1.mkComb)(exports.Implies, p), q);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Construye `∀x:α. body`. Internamente: `(∀ : (α→bool)→bool) (λx:α. body)`
|
|
75
|
+
* con el `∀` instanciado al tipo correcto.
|
|
76
|
+
*/
|
|
77
|
+
function mkForall(param, paramType, body) {
|
|
78
|
+
// Instancia el ∀ al tipo del parámetro.
|
|
79
|
+
const forallTy = (0, type_system_1.funTy)((0, type_system_1.funTy)(paramType, type_system_1.TyBool), type_system_1.TyBool);
|
|
80
|
+
const forallInst = (0, term_1.mkConst)('∀', forallTy);
|
|
81
|
+
const lambda = { kind: 'abs', param, paramType, body };
|
|
82
|
+
return (0, term_1.mkComb)(forallInst, lambda);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Construye `∃x:α. body`. Análogo a `mkForall`.
|
|
86
|
+
*/
|
|
87
|
+
function mkExists(param, paramType, body) {
|
|
88
|
+
const existsTy = (0, type_system_1.funTy)((0, type_system_1.funTy)(paramType, type_system_1.TyBool), type_system_1.TyBool);
|
|
89
|
+
const existsInst = (0, term_1.mkConst)('∃', existsTy);
|
|
90
|
+
const lambda = { kind: 'abs', param, paramType, body };
|
|
91
|
+
return (0, term_1.mkComb)(existsInst, lambda);
|
|
92
|
+
}
|
|
93
|
+
// Helpers para asegurar que un término es bool ---------------
|
|
94
|
+
/**
|
|
95
|
+
* Validador: lanza si `t` no tiene tipo `bool`. Útil para checks
|
|
96
|
+
* externos antes de pasarle a `assume` o construir conectivas.
|
|
97
|
+
*/
|
|
98
|
+
function assertBool(t) {
|
|
99
|
+
const ty = (0, term_1.typeOf)(t);
|
|
100
|
+
if (ty.kind !== 'tconst' || ty.name !== 'bool') {
|
|
101
|
+
throw new Error(`Se esperaba bool, recibido ${ty.kind === 'tconst' ? ty.name : ty.kind}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=connectives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectives.js","sourceRoot":"","sources":["../../../src/profiles/hol/connectives.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,+CAA+C;AAC/C,+DAA+D;AAC/D,EAAE;AACF,8DAA8D;AAC9D,4DAA4D;AAC5D,0DAA0D;AAC1D,6DAA6D;AAC7D,4DAA4D;AAC5D,eAAe;AACf,EAAE;AACF,0BAA0B;AAC1B,+CAA+C;AAC/C,6CAA6C;AAC7C,+BAA+B;AAC/B,mCAAmC;AACnC,6CAA6C;AAC7C,8CAA8C;AAC9C,+BAA+B;AAC/B,yBAAyB;;;AAyCzB,sBAEC;AAGD,oBAEC;AAGD,sBAEC;AAGD,8BAEC;AAMD,4BAMC;AAKD,4BAKC;AAQD,gCAKC;AA1FD,+CAAoD;AACpD,iCAAiD;AAEjD,+DAA+D;AAE/D,4BAA4B;AACf,QAAA,IAAI,GAAY,IAAA,cAAO,EAAC,GAAG,EAAE,oBAAM,CAAC,CAAC;AAElD,4BAA4B;AACf,QAAA,MAAM,GAAY,IAAA,cAAO,EAAC,GAAG,EAAE,oBAAM,CAAC,CAAC;AAEpD,0CAA0C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M,CAAC,CAAC;AACpC,CAAC;AAED,+DAA+D;AAE/D;;;GAGG;AACH,SAAgB,UAAU,CAAC,CAAU;IACnC,MAAM,EAAE,GAAG,IAAA,aAAM,EAAC,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,8BAA8B,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { HOLType, HOLTerm, HOLTheorem, HOLSequent } from './types';
|
|
2
|
+
export { tvar, tconst, tapp, TyBool, TyInd, funTy, funTyN, typeEq, isFunType, funDomain, funCodomain, typeToString, substType, freeTypeVars, } from './type-system';
|
|
3
|
+
export { mkVar, mkConst, mkAbs, typeOf, alphaEq, freeVars, occursFree, freshName, substTerm, instTypeInTerm, termToString, eqConst, mkEq, destEq, isEq, isIff, } from './term';
|
|
4
|
+
export { mkComb as mkCombTerm } from './term';
|
|
5
|
+
export { refl, trans, mkComb, abs, beta, assume, eqMp, deductAntisymRule, instType, inst, instTyped, } from './rules';
|
|
6
|
+
export { True, Bottom, And, Or, Not, Implies, Forall, Exists, mkAnd, mkOr, mkNot, mkImplies, mkForall, mkExists, assertBool, } from './connectives';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/profiles/hol/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGxE,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,SAAS,EACT,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,QAAQ,CAAC;AAKhB,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,IAAI,EACJ,MAAM,EACN,GAAG,EACH,EAAE,EACF,GAAG,EACH,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Higher-Order Logic (HOL Light style) — Entrada pública
|
|
4
|
+
// ============================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Exists = exports.Forall = exports.Implies = exports.Not = exports.Or = exports.And = exports.Bottom = exports.True = exports.instTyped = exports.inst = exports.instType = exports.deductAntisymRule = exports.eqMp = exports.assume = exports.beta = exports.abs = exports.mkComb = exports.trans = exports.refl = exports.mkCombTerm = exports.isIff = exports.isEq = exports.destEq = exports.mkEq = exports.eqConst = exports.termToString = exports.instTypeInTerm = exports.substTerm = exports.freshName = exports.occursFree = exports.freeVars = exports.alphaEq = exports.typeOf = exports.mkAbs = exports.mkConst = exports.mkVar = exports.freeTypeVars = exports.substType = exports.typeToString = exports.funCodomain = exports.funDomain = exports.isFunType = exports.typeEq = exports.funTyN = exports.funTy = exports.TyInd = exports.TyBool = exports.tapp = exports.tconst = exports.tvar = void 0;
|
|
7
|
+
exports.assertBool = exports.mkExists = exports.mkForall = exports.mkImplies = exports.mkNot = exports.mkOr = exports.mkAnd = void 0;
|
|
8
|
+
// Sistema de tipos
|
|
9
|
+
var type_system_1 = require("./type-system");
|
|
10
|
+
Object.defineProperty(exports, "tvar", { enumerable: true, get: function () { return type_system_1.tvar; } });
|
|
11
|
+
Object.defineProperty(exports, "tconst", { enumerable: true, get: function () { return type_system_1.tconst; } });
|
|
12
|
+
Object.defineProperty(exports, "tapp", { enumerable: true, get: function () { return type_system_1.tapp; } });
|
|
13
|
+
Object.defineProperty(exports, "TyBool", { enumerable: true, get: function () { return type_system_1.TyBool; } });
|
|
14
|
+
Object.defineProperty(exports, "TyInd", { enumerable: true, get: function () { return type_system_1.TyInd; } });
|
|
15
|
+
Object.defineProperty(exports, "funTy", { enumerable: true, get: function () { return type_system_1.funTy; } });
|
|
16
|
+
Object.defineProperty(exports, "funTyN", { enumerable: true, get: function () { return type_system_1.funTyN; } });
|
|
17
|
+
Object.defineProperty(exports, "typeEq", { enumerable: true, get: function () { return type_system_1.typeEq; } });
|
|
18
|
+
Object.defineProperty(exports, "isFunType", { enumerable: true, get: function () { return type_system_1.isFunType; } });
|
|
19
|
+
Object.defineProperty(exports, "funDomain", { enumerable: true, get: function () { return type_system_1.funDomain; } });
|
|
20
|
+
Object.defineProperty(exports, "funCodomain", { enumerable: true, get: function () { return type_system_1.funCodomain; } });
|
|
21
|
+
Object.defineProperty(exports, "typeToString", { enumerable: true, get: function () { return type_system_1.typeToString; } });
|
|
22
|
+
Object.defineProperty(exports, "substType", { enumerable: true, get: function () { return type_system_1.substType; } });
|
|
23
|
+
Object.defineProperty(exports, "freeTypeVars", { enumerable: true, get: function () { return type_system_1.freeTypeVars; } });
|
|
24
|
+
// Términos
|
|
25
|
+
var term_1 = require("./term");
|
|
26
|
+
Object.defineProperty(exports, "mkVar", { enumerable: true, get: function () { return term_1.mkVar; } });
|
|
27
|
+
Object.defineProperty(exports, "mkConst", { enumerable: true, get: function () { return term_1.mkConst; } });
|
|
28
|
+
Object.defineProperty(exports, "mkAbs", { enumerable: true, get: function () { return term_1.mkAbs; } });
|
|
29
|
+
Object.defineProperty(exports, "typeOf", { enumerable: true, get: function () { return term_1.typeOf; } });
|
|
30
|
+
Object.defineProperty(exports, "alphaEq", { enumerable: true, get: function () { return term_1.alphaEq; } });
|
|
31
|
+
Object.defineProperty(exports, "freeVars", { enumerable: true, get: function () { return term_1.freeVars; } });
|
|
32
|
+
Object.defineProperty(exports, "occursFree", { enumerable: true, get: function () { return term_1.occursFree; } });
|
|
33
|
+
Object.defineProperty(exports, "freshName", { enumerable: true, get: function () { return term_1.freshName; } });
|
|
34
|
+
Object.defineProperty(exports, "substTerm", { enumerable: true, get: function () { return term_1.substTerm; } });
|
|
35
|
+
Object.defineProperty(exports, "instTypeInTerm", { enumerable: true, get: function () { return term_1.instTypeInTerm; } });
|
|
36
|
+
Object.defineProperty(exports, "termToString", { enumerable: true, get: function () { return term_1.termToString; } });
|
|
37
|
+
Object.defineProperty(exports, "eqConst", { enumerable: true, get: function () { return term_1.eqConst; } });
|
|
38
|
+
Object.defineProperty(exports, "mkEq", { enumerable: true, get: function () { return term_1.mkEq; } });
|
|
39
|
+
Object.defineProperty(exports, "destEq", { enumerable: true, get: function () { return term_1.destEq; } });
|
|
40
|
+
Object.defineProperty(exports, "isEq", { enumerable: true, get: function () { return term_1.isEq; } });
|
|
41
|
+
Object.defineProperty(exports, "isIff", { enumerable: true, get: function () { return term_1.isIff; } });
|
|
42
|
+
// mkComb se expone desde rules.ts (que reexporta) para que el
|
|
43
|
+
// "mkComb regla" (sobre teoremas) sea el público, mientras que
|
|
44
|
+
// el constructor de términos vive como `mkCombTerm`.
|
|
45
|
+
var term_2 = require("./term");
|
|
46
|
+
Object.defineProperty(exports, "mkCombTerm", { enumerable: true, get: function () { return term_2.mkComb; } });
|
|
47
|
+
// Reglas primitivas
|
|
48
|
+
var rules_1 = require("./rules");
|
|
49
|
+
Object.defineProperty(exports, "refl", { enumerable: true, get: function () { return rules_1.refl; } });
|
|
50
|
+
Object.defineProperty(exports, "trans", { enumerable: true, get: function () { return rules_1.trans; } });
|
|
51
|
+
Object.defineProperty(exports, "mkComb", { enumerable: true, get: function () { return rules_1.mkComb; } });
|
|
52
|
+
Object.defineProperty(exports, "abs", { enumerable: true, get: function () { return rules_1.abs; } });
|
|
53
|
+
Object.defineProperty(exports, "beta", { enumerable: true, get: function () { return rules_1.beta; } });
|
|
54
|
+
Object.defineProperty(exports, "assume", { enumerable: true, get: function () { return rules_1.assume; } });
|
|
55
|
+
Object.defineProperty(exports, "eqMp", { enumerable: true, get: function () { return rules_1.eqMp; } });
|
|
56
|
+
Object.defineProperty(exports, "deductAntisymRule", { enumerable: true, get: function () { return rules_1.deductAntisymRule; } });
|
|
57
|
+
Object.defineProperty(exports, "instType", { enumerable: true, get: function () { return rules_1.instType; } });
|
|
58
|
+
Object.defineProperty(exports, "inst", { enumerable: true, get: function () { return rules_1.inst; } });
|
|
59
|
+
Object.defineProperty(exports, "instTyped", { enumerable: true, get: function () { return rules_1.instTyped; } });
|
|
60
|
+
// Conectivas y cuantificadores definidos
|
|
61
|
+
var connectives_1 = require("./connectives");
|
|
62
|
+
Object.defineProperty(exports, "True", { enumerable: true, get: function () { return connectives_1.True; } });
|
|
63
|
+
Object.defineProperty(exports, "Bottom", { enumerable: true, get: function () { return connectives_1.Bottom; } });
|
|
64
|
+
Object.defineProperty(exports, "And", { enumerable: true, get: function () { return connectives_1.And; } });
|
|
65
|
+
Object.defineProperty(exports, "Or", { enumerable: true, get: function () { return connectives_1.Or; } });
|
|
66
|
+
Object.defineProperty(exports, "Not", { enumerable: true, get: function () { return connectives_1.Not; } });
|
|
67
|
+
Object.defineProperty(exports, "Implies", { enumerable: true, get: function () { return connectives_1.Implies; } });
|
|
68
|
+
Object.defineProperty(exports, "Forall", { enumerable: true, get: function () { return connectives_1.Forall; } });
|
|
69
|
+
Object.defineProperty(exports, "Exists", { enumerable: true, get: function () { return connectives_1.Exists; } });
|
|
70
|
+
Object.defineProperty(exports, "mkAnd", { enumerable: true, get: function () { return connectives_1.mkAnd; } });
|
|
71
|
+
Object.defineProperty(exports, "mkOr", { enumerable: true, get: function () { return connectives_1.mkOr; } });
|
|
72
|
+
Object.defineProperty(exports, "mkNot", { enumerable: true, get: function () { return connectives_1.mkNot; } });
|
|
73
|
+
Object.defineProperty(exports, "mkImplies", { enumerable: true, get: function () { return connectives_1.mkImplies; } });
|
|
74
|
+
Object.defineProperty(exports, "mkForall", { enumerable: true, get: function () { return connectives_1.mkForall; } });
|
|
75
|
+
Object.defineProperty(exports, "mkExists", { enumerable: true, get: function () { return connectives_1.mkExists; } });
|
|
76
|
+
Object.defineProperty(exports, "assertBool", { enumerable: true, get: function () { return connectives_1.assertBool; } });
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/profiles/hol/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,yDAAyD;AACzD,+DAA+D;;;;AAI/D,mBAAmB;AACnB,6CAeuB;AAdrB,mGAAA,IAAI,OAAA;AACJ,qGAAA,MAAM,OAAA;AACN,mGAAA,IAAI,OAAA;AACJ,qGAAA,MAAM,OAAA;AACN,oGAAA,KAAK,OAAA;AACL,oGAAA,KAAK,OAAA;AACL,qGAAA,MAAM,OAAA;AACN,qGAAA,MAAM,OAAA;AACN,wGAAA,SAAS,OAAA;AACT,wGAAA,SAAS,OAAA;AACT,0GAAA,WAAW,OAAA;AACX,2GAAA,YAAY,OAAA;AACZ,wGAAA,SAAS,OAAA;AACT,2G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@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HOLTerm, HOLTheorem, HOLType } from './types';
|
|
2
|
+
import { funTy } from './type-system';
|
|
3
|
+
import { freeVars } from './term';
|
|
4
|
+
export declare function refl(t: HOLTerm): HOLTheorem;
|
|
5
|
+
export declare function trans(thm1: HOLTheorem, thm2: HOLTheorem): HOLTheorem;
|
|
6
|
+
export declare function mkCombRule(thm1: HOLTheorem, thm2: HOLTheorem): HOLTheorem;
|
|
7
|
+
export declare function abs(v: HOLTerm, thm1: HOLTheorem): HOLTheorem;
|
|
8
|
+
export declare function beta(t: HOLTerm): HOLTheorem;
|
|
9
|
+
export declare function assume(p: HOLTerm): HOLTheorem;
|
|
10
|
+
export declare function eqMp(thm1: HOLTheorem, thm2: HOLTheorem): HOLTheorem;
|
|
11
|
+
export declare function deductAntisymRule(thm1: HOLTheorem, thm2: HOLTheorem): HOLTheorem;
|
|
12
|
+
export declare function instType(subst: Record<string, HOLType>, thm1: HOLTheorem): HOLTheorem;
|
|
13
|
+
interface InstEntry {
|
|
14
|
+
name: string;
|
|
15
|
+
type: HOLType;
|
|
16
|
+
value: HOLTerm;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Sustituye variables libres en `thm1` según `subst`. El mapa
|
|
20
|
+
* usa keys `name::typeString` para distinguir variables con
|
|
21
|
+
* mismo nombre y distinto tipo.
|
|
22
|
+
*/
|
|
23
|
+
export declare function inst(subst: Record<string, HOLTerm>, thm1: HOLTheorem): HOLTheorem;
|
|
24
|
+
/**
|
|
25
|
+
* Variante explícita: cada entrada especifica `{ name, type, value }`.
|
|
26
|
+
* Necesaria si dos variables comparten nombre pero distinto tipo.
|
|
27
|
+
*/
|
|
28
|
+
export declare function instTyped(entries: InstEntry[], thm1: HOLTheorem): HOLTheorem;
|
|
29
|
+
export { mkCombRule as mkComb };
|
|
30
|
+
export { freeVars, funTy };
|
|
31
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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G,UAAU,CAajF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CA8C5E;AAID,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// HOL — Reglas primitivas de inferencia
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Núcleo deductivo estilo HOL Light. 10 reglas primitivas:
|
|
7
|
+
//
|
|
8
|
+
// REFL : |- t = t
|
|
9
|
+
// TRANS : |- a = b, |- b = c ⇒ |- a = c
|
|
10
|
+
// MK_COMB : |- f = g, |- x = y ⇒ |- f x = g y
|
|
11
|
+
// ABS : |- s = t ⇒ |- (λv.s) = (λv.t)
|
|
12
|
+
// BETA : |- (λv.t) v = t
|
|
13
|
+
// ASSUME(p) : p |- p
|
|
14
|
+
// EQ_MP : |- p ↔ q, |- p ⇒ |- q
|
|
15
|
+
// DEDUCT_ANTISYM_RULE : A |- p, B |- q ⇒ (A\{q}) ∪ (B\{p}) |- p ↔ q
|
|
16
|
+
// INST_TYPE : sustitución de tipos
|
|
17
|
+
// INST : sustitución de términos en variables libres
|
|
18
|
+
//
|
|
19
|
+
// Las hipótesis son una multiset modelada como array; al unir
|
|
20
|
+
// hipótesis deduplicamos por α-equivalencia.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.funTy = exports.freeVars = void 0;
|
|
23
|
+
exports.refl = refl;
|
|
24
|
+
exports.trans = trans;
|
|
25
|
+
exports.mkCombRule = mkCombRule;
|
|
26
|
+
exports.mkComb = mkCombRule;
|
|
27
|
+
exports.abs = abs;
|
|
28
|
+
exports.beta = beta;
|
|
29
|
+
exports.assume = assume;
|
|
30
|
+
exports.eqMp = eqMp;
|
|
31
|
+
exports.deductAntisymRule = deductAntisymRule;
|
|
32
|
+
exports.instType = instType;
|
|
33
|
+
exports.inst = inst;
|
|
34
|
+
exports.instTyped = instTyped;
|
|
35
|
+
const type_system_1 = require("./type-system");
|
|
36
|
+
Object.defineProperty(exports, "funTy", { enumerable: true, get: function () { return type_system_1.funTy; } });
|
|
37
|
+
const term_1 = require("./term");
|
|
38
|
+
Object.defineProperty(exports, "freeVars", { enumerable: true, get: function () { return term_1.freeVars; } });
|
|
39
|
+
// Helpers ----------------------------------------------------
|
|
40
|
+
function unionHyps(a, b) {
|
|
41
|
+
const out = [...a];
|
|
42
|
+
for (const h of b) {
|
|
43
|
+
if (!out.some((existing) => (0, term_1.alphaEq)(existing, h))) {
|
|
44
|
+
out.push(h);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
function removeHyp(hyps, target) {
|
|
50
|
+
let removed = false;
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const h of hyps) {
|
|
53
|
+
if (!removed && (0, term_1.alphaEq)(h, target)) {
|
|
54
|
+
removed = true;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
out.push(h);
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
function thm(rule, hyps, concl, derived) {
|
|
62
|
+
return Object.freeze({ rule, hyps, concl, derived });
|
|
63
|
+
}
|
|
64
|
+
// REFL : |- t = t ---------------------------------------------
|
|
65
|
+
function refl(t) {
|
|
66
|
+
// typeOf valida bien-formación.
|
|
67
|
+
(0, term_1.typeOf)(t);
|
|
68
|
+
return thm('REFL', [], (0, term_1.mkEq)(t, t));
|
|
69
|
+
}
|
|
70
|
+
// TRANS : |- a = b, |- b = c -> |- a = c ----------------------
|
|
71
|
+
function trans(thm1, thm2) {
|
|
72
|
+
const eq1 = (0, term_1.destEq)(thm1.concl);
|
|
73
|
+
const eq2 = (0, term_1.destEq)(thm2.concl);
|
|
74
|
+
if (eq1 === null) {
|
|
75
|
+
throw new Error(`TRANS: la primera premisa no es una igualdad: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
76
|
+
}
|
|
77
|
+
if (eq2 === null) {
|
|
78
|
+
throw new Error(`TRANS: la segunda premisa no es una igualdad: ${(0, term_1.termToString)(thm2.concl)}`);
|
|
79
|
+
}
|
|
80
|
+
if (!(0, term_1.alphaEq)(eq1[1], eq2[0])) {
|
|
81
|
+
throw new Error(`TRANS: las premisas no encajan: ${(0, term_1.termToString)(eq1[1])} ≠ ${(0, term_1.termToString)(eq2[0])}`);
|
|
82
|
+
}
|
|
83
|
+
return thm('TRANS', unionHyps(thm1.hyps, thm2.hyps), (0, term_1.mkEq)(eq1[0], eq2[1]), [thm1, thm2]);
|
|
84
|
+
}
|
|
85
|
+
// MK_COMB : |- f = g, |- x = y -> |- f x = g y ----------------
|
|
86
|
+
function mkCombRule(thm1, thm2) {
|
|
87
|
+
const fg = (0, term_1.destEq)(thm1.concl);
|
|
88
|
+
const xy = (0, term_1.destEq)(thm2.concl);
|
|
89
|
+
if (fg === null) {
|
|
90
|
+
throw new Error(`MK_COMB: la primera premisa no es igualdad: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
91
|
+
}
|
|
92
|
+
if (xy === null) {
|
|
93
|
+
throw new Error(`MK_COMB: la segunda premisa no es igualdad: ${(0, term_1.termToString)(thm2.concl)}`);
|
|
94
|
+
}
|
|
95
|
+
// mkComb validará compatibilidad de tipos; lo hacemos en orden para
|
|
96
|
+
// dar un mensaje claro si fuesen incompatibles.
|
|
97
|
+
const fxType = (0, term_1.typeOf)(fg[0]);
|
|
98
|
+
if (!(0, type_system_1.isFunType)(fxType)) {
|
|
99
|
+
throw new Error(`MK_COMB: lado izquierdo no es función: ${(0, term_1.termToString)(fg[0])} : ${(0, type_system_1.typeToString)(fxType)}`);
|
|
100
|
+
}
|
|
101
|
+
const left = (0, term_1.mkComb)(fg[0], xy[0]);
|
|
102
|
+
const right = (0, term_1.mkComb)(fg[1], xy[1]);
|
|
103
|
+
return thm('MK_COMB', unionHyps(thm1.hyps, thm2.hyps), (0, term_1.mkEq)(left, right), [thm1, thm2]);
|
|
104
|
+
}
|
|
105
|
+
// ABS : |- s = t -> |- (λv.s) = (λv.t) ------------------------
|
|
106
|
+
function abs(v, thm1) {
|
|
107
|
+
if (v.kind !== 'var') {
|
|
108
|
+
throw new Error(`ABS: el binder debe ser una variable, no ${v.kind}`);
|
|
109
|
+
}
|
|
110
|
+
const eq = (0, term_1.destEq)(thm1.concl);
|
|
111
|
+
if (eq === null) {
|
|
112
|
+
throw new Error(`ABS: la premisa no es una igualdad: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
113
|
+
}
|
|
114
|
+
// La variable abstraida no puede aparecer libre en las hipótesis.
|
|
115
|
+
for (const h of thm1.hyps) {
|
|
116
|
+
if ((0, term_1.occursFree)(v.name, v.type, h)) {
|
|
117
|
+
throw new Error(`ABS: la variable ${v.name} aparece libre en una hipótesis: ${(0, term_1.termToString)(h)}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const lhs = (0, term_1.mkAbs)(v.name, v.type, eq[0]);
|
|
121
|
+
const rhs = (0, term_1.mkAbs)(v.name, v.type, eq[1]);
|
|
122
|
+
return thm('ABS', thm1.hyps.slice(), (0, term_1.mkEq)(lhs, rhs), [thm1]);
|
|
123
|
+
}
|
|
124
|
+
// BETA : |- (λv.t) v = t --------------------------------------
|
|
125
|
+
// HOL Light original: BETA solo acepta el término exacto `(λx.t) x`.
|
|
126
|
+
// Para usar β a forma `(λx.t) y` se compone con INST.
|
|
127
|
+
function beta(t) {
|
|
128
|
+
if (t.kind !== 'comb' || t.fn.kind !== 'abs') {
|
|
129
|
+
throw new Error(`BETA: necesita una aplicación de λ: ${(0, term_1.termToString)(t)}`);
|
|
130
|
+
}
|
|
131
|
+
const lambda = t.fn;
|
|
132
|
+
const arg = t.arg;
|
|
133
|
+
if (arg.kind !== 'var' || arg.name !== lambda.param || !(0, type_system_1.typeEq)(arg.type, lambda.paramType)) {
|
|
134
|
+
throw new Error(`BETA: el argumento debe ser exactamente el binder; usa INST para argumentos arbitrarios. ` +
|
|
135
|
+
`Recibido: ${(0, term_1.termToString)(arg)}`);
|
|
136
|
+
}
|
|
137
|
+
// Resultado: (λv.body) v = body
|
|
138
|
+
return thm('BETA', [], (0, term_1.mkEq)(t, lambda.body), []);
|
|
139
|
+
}
|
|
140
|
+
// ASSUME(p) : p |- p ------------------------------------------
|
|
141
|
+
function assume(p) {
|
|
142
|
+
const ty = (0, term_1.typeOf)(p);
|
|
143
|
+
if (!(0, type_system_1.typeEq)(ty, type_system_1.TyBool)) {
|
|
144
|
+
throw new Error(`ASSUME: la hipótesis debe ser de tipo bool, tiene tipo ${(0, type_system_1.typeToString)(ty)}`);
|
|
145
|
+
}
|
|
146
|
+
return thm('ASSUME', [p], p);
|
|
147
|
+
}
|
|
148
|
+
// EQ_MP : |- p = q (bool), |- p -> |- q -----------------------
|
|
149
|
+
function eqMp(thm1, thm2) {
|
|
150
|
+
const eq = (0, term_1.destEq)(thm1.concl);
|
|
151
|
+
if (eq === null) {
|
|
152
|
+
throw new Error(`EQ_MP: la primera premisa no es igualdad: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
153
|
+
}
|
|
154
|
+
if (!(0, type_system_1.typeEq)((0, term_1.typeOf)(eq[0]), type_system_1.TyBool)) {
|
|
155
|
+
throw new Error(`EQ_MP: la igualdad no es entre booleanos: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
156
|
+
}
|
|
157
|
+
if (!(0, term_1.alphaEq)(eq[0], thm2.concl)) {
|
|
158
|
+
throw new Error(`EQ_MP: la segunda premisa no es α-igual al LHS: ${(0, term_1.termToString)(thm2.concl)} vs ${(0, term_1.termToString)(eq[0])}`);
|
|
159
|
+
}
|
|
160
|
+
return thm('EQ_MP', unionHyps(thm1.hyps, thm2.hyps), eq[1], [thm1, thm2]);
|
|
161
|
+
}
|
|
162
|
+
// DEDUCT_ANTISYM_RULE -----------------------------------------
|
|
163
|
+
// A |- p, B |- q -> (A - {q}) ∪ (B - {p}) |- p ↔ q
|
|
164
|
+
//
|
|
165
|
+
// Equivalente: deriva la bi-implicación a partir de dos
|
|
166
|
+
// teoremas que se "implican" via descarga de hipótesis.
|
|
167
|
+
function deductAntisymRule(thm1, thm2) {
|
|
168
|
+
if (!(0, type_system_1.typeEq)((0, term_1.typeOf)(thm1.concl), type_system_1.TyBool)) {
|
|
169
|
+
throw new Error(`DEDUCT_ANTISYM_RULE: thm1 no es bool: ${(0, term_1.termToString)(thm1.concl)}`);
|
|
170
|
+
}
|
|
171
|
+
if (!(0, type_system_1.typeEq)((0, term_1.typeOf)(thm2.concl), type_system_1.TyBool)) {
|
|
172
|
+
throw new Error(`DEDUCT_ANTISYM_RULE: thm2 no es bool: ${(0, term_1.termToString)(thm2.concl)}`);
|
|
173
|
+
}
|
|
174
|
+
const p = thm1.concl;
|
|
175
|
+
const q = thm2.concl;
|
|
176
|
+
const hyps = unionHyps(removeHyp(thm1.hyps, q), removeHyp(thm2.hyps, p));
|
|
177
|
+
return thm('DEDUCT_ANTISYM_RULE', hyps, (0, term_1.mkEq)(p, q), [thm1, thm2]);
|
|
178
|
+
}
|
|
179
|
+
// INST_TYPE : sustitución de variables de tipo ----------------
|
|
180
|
+
function instType(subst, thm1) {
|
|
181
|
+
const newHyps = thm1.hyps.map((h) => (0, term_1.instTypeInTerm)(subst, h));
|
|
182
|
+
const newConcl = (0, term_1.instTypeInTerm)(subst, thm1.concl);
|
|
183
|
+
// Deduplicamos hipótesis tras la sustitución porque pueden
|
|
184
|
+
// colapsar (e.g. P[α] y P[β] con α↦β).
|
|
185
|
+
const dedup = [];
|
|
186
|
+
for (const h of newHyps) {
|
|
187
|
+
if (!dedup.some((existing) => (0, term_1.alphaEq)(existing, h)))
|
|
188
|
+
dedup.push(h);
|
|
189
|
+
}
|
|
190
|
+
return thm('INST_TYPE', dedup, newConcl, [thm1]);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Sustituye variables libres en `thm1` según `subst`. El mapa
|
|
194
|
+
* usa keys `name::typeString` para distinguir variables con
|
|
195
|
+
* mismo nombre y distinto tipo.
|
|
196
|
+
*/
|
|
197
|
+
function inst(subst, thm1) {
|
|
198
|
+
// El usuario provee `Record<string, HOLTerm>`: las keys son
|
|
199
|
+
// los nombres de variables. Inferimos el tipo de la variable
|
|
200
|
+
// a partir del valor (debe coincidir con el de la ocurrencia
|
|
201
|
+
// libre). Si una variable libre tiene mismo nombre pero
|
|
202
|
+
// distintos tipos en distintos lugares, esta API es ambigua;
|
|
203
|
+
// recomendamos pasar `instTyped` (más abajo) en ese caso.
|
|
204
|
+
const entries = Object.entries(subst).map(([name, value]) => ({
|
|
205
|
+
name,
|
|
206
|
+
type: (0, term_1.typeOf)(value),
|
|
207
|
+
value,
|
|
208
|
+
}));
|
|
209
|
+
return instTyped(entries, thm1);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Variante explícita: cada entrada especifica `{ name, type, value }`.
|
|
213
|
+
* Necesaria si dos variables comparten nombre pero distinto tipo.
|
|
214
|
+
*/
|
|
215
|
+
function instTyped(entries, thm1) {
|
|
216
|
+
// Validación: cada `value` debe tener el tipo declarado.
|
|
217
|
+
for (const e of entries) {
|
|
218
|
+
if (!(0, type_system_1.typeEq)((0, term_1.typeOf)(e.value), e.type)) {
|
|
219
|
+
throw new Error(`INST: tipo del valor no coincide con la variable ${e.name}: ` +
|
|
220
|
+
`${(0, type_system_1.typeToString)((0, term_1.typeOf)(e.value))} vs ${(0, type_system_1.typeToString)(e.type)}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// Sustituimos en paralelo: para evitar interferencia con
|
|
224
|
+
// sustituciones encadenadas, primero renombramos las variables
|
|
225
|
+
// a fresh y luego instanciamos. En la práctica, HOL Light hace
|
|
226
|
+
// una sustitución secuencial usando un mapeo y reescribiendo
|
|
227
|
+
// los binders cuando hace falta para evitar captura. Nuestra
|
|
228
|
+
// `substTerm` ya es capture-free, así que sustituimos en orden,
|
|
229
|
+
// pero con un truco para "paralelismo": renombramos cada var
|
|
230
|
+
// a un nombre intermedio único antes de aplicar los valores.
|
|
231
|
+
const intermediate = entries.map((e, i) => ({
|
|
232
|
+
name: e.name,
|
|
233
|
+
type: e.type,
|
|
234
|
+
intermediateName: `__inst${i}__`,
|
|
235
|
+
value: e.value,
|
|
236
|
+
}));
|
|
237
|
+
let curHyps = thm1.hyps.slice();
|
|
238
|
+
let curConcl = thm1.concl;
|
|
239
|
+
// Fase 1: renombrar var(name, type) → var(intermediateName, type)
|
|
240
|
+
for (const e of intermediate) {
|
|
241
|
+
const intermediateVar = (0, term_1.mkVar)(e.intermediateName, e.type);
|
|
242
|
+
curHyps = curHyps.map((h) => (0, term_1.substTerm)(e.name, e.type, intermediateVar, h));
|
|
243
|
+
curConcl = (0, term_1.substTerm)(e.name, e.type, intermediateVar, curConcl);
|
|
244
|
+
}
|
|
245
|
+
// Fase 2: reemplazar intermediateName → value real.
|
|
246
|
+
for (const e of intermediate) {
|
|
247
|
+
curHyps = curHyps.map((h) => (0, term_1.substTerm)(e.intermediateName, e.type, e.value, h));
|
|
248
|
+
curConcl = (0, term_1.substTerm)(e.intermediateName, e.type, e.value, curConcl);
|
|
249
|
+
}
|
|
250
|
+
// Dedup tras sustitución.
|
|
251
|
+
const dedup = [];
|
|
252
|
+
for (const h of curHyps) {
|
|
253
|
+
if (!dedup.some((existing) => (0, term_1.alphaEq)(existing, h)))
|
|
254
|
+
dedup.push(h);
|
|
255
|
+
}
|
|
256
|
+
return thm('INST', dedup, curConcl, [thm1]);
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/profiles/hol/rules.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,wCAAwC;AACxC,+DAA+D;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AE,CAAC,CAAC,CAAC,CAAC;QAChF,QAAQ,GAAG,IAAA,gBAAS,EAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC;IAED,0BAA0B;IAC1B,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAA,cAAO,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HOLTerm, HOLType } from './types';
|
|
2
|
+
export declare const mkVar: (name: string, type: HOLType) => HOLTerm;
|
|
3
|
+
export declare const mkConst: (name: string, type: HOLType) => HOLTerm;
|
|
4
|
+
export declare const mkComb: (fn: HOLTerm, arg: HOLTerm) => HOLTerm;
|
|
5
|
+
export declare const mkAbs: (param: string, paramType: HOLType, body: HOLTerm) => HOLTerm;
|
|
6
|
+
/**
|
|
7
|
+
* Calcula el tipo de un término bien formado. Lanza si el
|
|
8
|
+
* término está mal tipado (combinación con dominios disjuntos).
|
|
9
|
+
*/
|
|
10
|
+
export declare function typeOf(t: HOLTerm): HOLType;
|
|
11
|
+
/**
|
|
12
|
+
* Igualdad estructural módulo α-renaming. Implementación con
|
|
13
|
+
* dos mapas de profundidad (de Bruijn implícito sobre nombres).
|
|
14
|
+
*/
|
|
15
|
+
export declare function alphaEq(a: HOLTerm, b: HOLTerm): boolean;
|
|
16
|
+
interface VarEntry {
|
|
17
|
+
name: string;
|
|
18
|
+
type: HOLType;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Devuelve las variables libres de `t` con su tipo. Una variable
|
|
22
|
+
* con mismo nombre pero distinto tipo aparece dos veces.
|
|
23
|
+
*/
|
|
24
|
+
export declare function freeVars(t: HOLTerm, out?: VarEntry[]): VarEntry[];
|
|
25
|
+
/**
|
|
26
|
+
* Devuelve true si `name` aparece libre en `term` con tipo `ty`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function occursFree(name: string, ty: HOLType, term: HOLTerm): boolean;
|
|
29
|
+
/** Genera un nombre fresco respecto a un conjunto de nombres prohibidos. */
|
|
30
|
+
export declare function freshName(base: string, forbidden: Set<string>): string;
|
|
31
|
+
/**
|
|
32
|
+
* Sustituye [v := value] en `term`. Renombra binders si haría
|
|
33
|
+
* falta para evitar captura. `v` se identifica por nombre + tipo.
|
|
34
|
+
*/
|
|
35
|
+
export declare function substTerm(name: string, ty: HOLType, value: HOLTerm, term: HOLTerm): HOLTerm;
|
|
36
|
+
export declare function instTypeInTerm(subst: Record<string, HOLType>, term: HOLTerm): HOLTerm;
|
|
37
|
+
export declare function termToString(t: HOLTerm): string;
|
|
38
|
+
/**
|
|
39
|
+
* Constructor de igualdad polimórfica `= : α → α → bool`.
|
|
40
|
+
* Devuelve la `const` `=` instanciada al tipo del término.
|
|
41
|
+
*/
|
|
42
|
+
export declare function eqConst(ty: HOLType): HOLTerm;
|
|
43
|
+
/** Construye el término `l = r` (chequea que sus tipos coincidan). */
|
|
44
|
+
export declare function mkEq(l: HOLTerm, r: HOLTerm): HOLTerm;
|
|
45
|
+
/** Descompone `l = r` en `[l, r]` o null si no es igualdad. */
|
|
46
|
+
export declare function destEq(t: HOLTerm): [HOLTerm, HOLTerm] | null;
|
|
47
|
+
/** True si `t` es una igualdad de la forma `l = r`. */
|
|
48
|
+
export declare function isEq(t: HOLTerm): boolean;
|
|
49
|
+
/** True si `t` es una bi-implicación bool ↔ bool (sintácticamente `=` sobre bool). */
|
|
50
|
+
export declare function isIff(t: H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