## lo.logic – Moving between expressions in the typed lambda calculus and sentences in higher order logic

In ‘An Introduction to Mathematical Logic through Type Theory’, Andrews describes a way of translating sentences in higher order logic into lambda terms in his version of the typed lambda calculus (see §51.) I am wondering if there is a uniform, neat way to do the opposite – convert a lambda term $$X$$ in his system back into a sentence of higher order logic (I’m happy to restrict attention to cases in which $$X$$ has type $$o$$.)

Basically, I am trying to figure out whether every expression (of type $$o$$) in the version of the typed lambda calculus in question can be read as an ordinary sentence of higher order logic in a natural and uniform way.

Some more information on Andrews’ setup: he has constants $$Q_{((o alpha) alpha)}$$ for each type $$alpha$$ and a constant $$iota_{(i(oi))}$$. (Here $$i$$ is the type of individuals and $$o$$ the type of truth values.) He then defines:

$$begin{array}{lcl} A_{alpha} = B_{alpha} & mbox{stands for} & Q_{((o alpha) alpha)} A_{alpha} B_{alpha} \ A_{o} leftrightarrow B_{o} & mbox{stands for} & Q_{((oo)o)} A B \ T_{o} & mbox{stands for} & Q_{((oo)o)}=Q_{((oo)o)} \ F_{o} & mbox{stands for} & lambda x_{o} T = lambda x_{o} x_{o} \ Pi_{(o(o alpha))} & mbox{stands for} & Q_{(o(o alpha)(o alpha))} lambda x_{alpha} T_o \ forall x_{alpha} A_o & mbox{stands for} & Pi_{(o(o alpha))} lambda x_{alpha} T_o \ wedge_{(o(oo))} & mbox{stands for} & lambda v_1 lambda v_2 (lambda x_{(o(oo))} (x_{(o(oo))}TT) = lambda x_{(o(oo))} (x_{(o(oo))} v_1 v_2)) \ A_o wedge B_o & mbox{stands for} & wedge_{(o(oo))} A_o B_o \ supset_{(o(oo))} & mbox{stands for} & lambda x_0 lambda y_0 (x_0 = (x_0 wedge y_0)) \ A_o supset B_o & mbox{stands for} & supset_{(o(oo))} A_o B_o \ neg_{(oo)} & mbox{stands for} & Q_{(o(oo))} F \ vee_{(o(oo))} & mbox{stands for} & lambda x_0 lambda y_0 neg((neg x_0) wedge (neg y_0)) \ A_o vee B_o & mbox{stands for} & vee_{(o(oo))} A_o B_o \ exists x_{alpha} A & mbox{stands for} & neg forall x_{alpha} neg A \ A_{alpha} neq B_{alpha} & mbox{stands for} & neg (A_{alpha} = B_{alpha}) \ end{array}$$

Having spelled all that out, I should say that I don’t particularly care what formulation of the typed lambda calculus is used.

## logic – Universal Quantifiers in QBFs

I’ve been looking into reductions to/from the TQBF language and have managed to get stuck on something that is almost certainly not true (or, if it is true I’m missing a significant computational cost associated with it) with respect to simplifying TQBF instances.

For the sake of simplicity, let’s restrict attention to TQBF instances in prenex normal form and CNF with no free variables. My hypothesis (which I strongly suspect is wrong, but have been unable to find a counter-example) is that such a TQBF is satisfiable if and only if the TQBF that results from removing all instances of universally quantified variables from the sentence is satisfiable. For example, take the following instance:

$$exists a forall b exists c forall d$$ $$psi(a,b,c,d)$$

$$psi(a,b,c,d) = (neg a vee b vee c)wedge (neg b vee neg c vee d)wedge (a vee c vee neg d)$$

First, I contend that this instance is not satisfiable (easily verifiable by hand). If we apply the method I describe above, we get the following “core”:

$$exists a exists c$$ $$phi(a,c)$$,

$$phi (a,c) = (neg a vee c)wedge (neg c) wedge (a vee c)$$

which is clearly not satisfiable. If instead of this example we look at this:

$$exists a forall b exists c forall d$$ $$psi(a,b,c,d)$$

$$psi(a,b,c,d) = (neg a vee b vee neg c)wedge (neg b vee c vee d)wedge (a vee c vee neg d)$$

which clearly is satisfiable (set c to true, a to false) and which has a “core” of

$$exists a exists c$$ $$phi(a,c)$$,

$$phi (a,c) = (neg a vee neg c)wedge (c) wedge (a vee c)$$

that is also satisfiable with the same variable settings.

If this method always works, that would seem to imply that there is a reduction from TQBF to SAT in time linear in the number of universal quantifiers and the number of occurrences of the universally quantified variables in the formula, showing that TQBF is NP-Complete (it is already known to be PSPACE-Complete and thus NP-Hard, so if it is in NP it is NP-Complete) and furthermore that NP=PSPACE. I would be utterly stunned if this is the case, but I have been unable to find a counterexample (or a missing computational cost in the reduction that makes it not polynomial time). What am I missing?

## logic – Lambda calculus simplification excercise

Below is the lambda expression which I am finding difficult to reduce i.e. I am not able to understand how to go about this problem.

(λx.λy.yx)z (λw.w)
I am lost with this.

if anyone could lead me in the right direction that would be much appreciated

## php – HOW can I implement a logic hooks with sugarcrm?

I want to implement a Sugar Logic Hook that fires when invoice status becomes validated.

This my logic hook:

<?php
$hook_version = 1;$hook_array = Array();
$hook_array('after_save') = Array();$hook_array('after_save')() = Array(1, 'status invoices Changes', '/var/www/html/suitecrm/modules/AOS_Invoices/AOS_LogicHooks.php','AOS_LogicHooks', 'statusInvoicesChanges');
?>


This is my action class:

<?php
class AOS_LogicHooks {

public function statusInvoicesChanges (SugarBean $bean,$event, $arguments) { if ($dictionary('AOS_Invoices')('fields')('status')='validated') {
\$GLOBALS('log')->fatal("Status has been changed");
}
}
}
?>


What am I missing?

## first order logic – How to describe Deterministic Transitive Closure in FOL

In “Finite Model Theory and Its Applications”, page 152, it is said that Deterministic Transitive Closure, on ordered finite structures, captures LOGSPACE.

Hence, taking into account that FOL captures LOGSPACE, it should be possible to:

• Given a functional relation R(X,Y) (e.g. “motherOf(X,Y)”)
• It should be possible to define, in FOL, a predicate T(X,Y) that captures its transitive closure (e.g. “femaleAncestor(X, Y)”)

I would like to know how to define such predicate. This would be quite easy in Datalog, using recursion, but it should be possible to define it without recursion, which is the question that puzzles me.

## SharePoint List View Complex Filter Logic

I’m creating a SP list view and trying to apply a filter to it without creating calculating columns to compare:

Show items only when the following is true:

• Status equals to “Cancelled” AND Cancelled Date is greater than or equal to [TODAY]-180 AND Region equals to “1”;
OR
• Status equals to “Rejected” AND Rejected Date is greater than or equal to [TODAY]-180 AND Region equals to “1”

Below is what I’ve tried. Most likely it’s the order of the AND/ORs but I can’t seem to figure it out.

.

Any help would be much appreciated. Thanks!

## design patterns – Have the same logic in two different class hierarchies

I have the following class hierarchies

  abstract class Base<T> {
abstarct <T> getRelevantType();
}

class A : Base<AType>
{
AType getRelevantType()
}

class B : Base<BType>
{
BType getRelevantType()
}

class A1 : A {
getRelevantType()
// logic
}
class A2 : A {
getRelevantType()
/// logic
}


….

   class B1 : B {
getRelevantType()
// logic
}
class B2 : B {
getRelevantType()
// logic
}


Now I have a situation where I have a logic that needs to be run once with AType and once with BType.

A7 : A
{
// same logic
}

B7 : B
{
// same logic
}


Now, I’m just thinking without changing the current design of (A1 : A, B1 : B ……) if there’s a way I can achieve it or maybe a design pattern I’m not aware of (since I can’t inherit from multiple classes).

The only way I thought of is to create a generic class which would contains the same logic and which be passed as a parameter to each one of the different classes.

E.g.

class commonLogic<T>()
{
public doLogic();
}

A7 : A
{
Ctr (commonLogic logic)
getRelevantType()
{
logic.doLogic()
}

}

B7 : B
{
Ctr (commonLogic logic)
getRelevantType()
{
logic.doLogic()
}

}
`

## boolean algebra – why does bool(9) or any other no. except 1&0 with bool give the output true and why not false in python ? What is the logic behind it?

Thanks for contributing an answer to Computer Science Stack Exchange!

But avoid

• Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.