Is expression evaluated before assigning type?Proving that $Omega = (lambda x.xx)(lambda x.xx)$ is not typable in the simply typed lambda calculusHas a Dependent Type always a Type?If $f(x)=g(x)$ for all $x:A$, why is it not true that $lambda x.f(x)=lambda x.g(x)$?Proving that $Omega = (lambda x.xx)(lambda x.xx)$ is not typable in the simply typed lambda calculusQuestions regarding well formed expressions in the Theory of typesWikipedia's explanation of the lambda-calclulus form of Curry's paradox makes no senseThe place of lambda abstraction in internal and Mitchell-Bénabou languagesBasic problem with lambda-calculus syntaxHow should I type this lambda expression?Variable Condition in Typed Lambda Calculus“Type dependence” in type theory and category theory?

Why do we use polarized capacitors?

Lied on resume at previous job

Prime joint compound before latex paint?

Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?

(Soft question) does light intensity oscillate really fast since it is a wave?

Why is the design of haulage companies so “special”?

Should the British be getting ready for a no-deal Brexit?

Why was the "bread communication" in the arena of Catching Fire left out in the movie?

Are cabin dividers used to "hide" the flex of the airplane?

Are objects structures and/or vice versa?

How to manage monthly salary

"My colleague's body is amazing"

Find the number of surjections from A to B.

Why airport relocation isn't done gradually?

How can I fix this gap between bookcases I made?

What causes the sudden spool-up sound from an F-16 when enabling afterburner?

Pristine Bit Checking

If a centaur druid Wild Shapes into a Giant Elk, do their Charge features stack?

Is it wise to hold on to stock that has plummeted and then stabilized?

What happens when a metallic dragon and a chromatic dragon mate?

How to deal with fear of taking dependencies

Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?

Filling an area between two curves

Was there ever an axiom rendered a theorem?



Is expression evaluated before assigning type?


Proving that $Omega = (lambda x.xx)(lambda x.xx)$ is not typable in the simply typed lambda calculusHas a Dependent Type always a Type?If $f(x)=g(x)$ for all $x:A$, why is it not true that $lambda x.f(x)=lambda x.g(x)$?Proving that $Omega = (lambda x.xx)(lambda x.xx)$ is not typable in the simply typed lambda calculusQuestions regarding well formed expressions in the Theory of typesWikipedia's explanation of the lambda-calclulus form of Curry's paradox makes no senseThe place of lambda abstraction in internal and Mitchell-Bénabou languagesBasic problem with lambda-calculus syntaxHow should I type this lambda expression?Variable Condition in Typed Lambda Calculus“Type dependence” in type theory and category theory?













0












$begingroup$


I am assigning type to an $lambda$-expression: if false then M else N
where if A then B else C and false have their usual meanings (read: not specified).



The problem arises because M and N have different types. While clearly the expression evaluates to N & hence should be assigned type(N) but apparently it is expected that for if-else, the types for B & C should be same.



How to proceed on this? Should I use conjuncted type?










share|cite|improve this question









$endgroup$











  • $begingroup$
    What do you mean by conjuncted type?
    $endgroup$
    – Potato44
    Mar 30 at 12:00











  • $begingroup$
    I may have used the word "conjunction" incorrectly. I'm referring to this answer
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:41











  • $begingroup$
    That sounds like intersection types. Do you also have union types?
    $endgroup$
    – Potato44
    Mar 31 at 17:42










  • $begingroup$
    No, I don't think we have covered them yet.
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:46















0












$begingroup$


I am assigning type to an $lambda$-expression: if false then M else N
where if A then B else C and false have their usual meanings (read: not specified).



The problem arises because M and N have different types. While clearly the expression evaluates to N & hence should be assigned type(N) but apparently it is expected that for if-else, the types for B & C should be same.



How to proceed on this? Should I use conjuncted type?










share|cite|improve this question









$endgroup$











  • $begingroup$
    What do you mean by conjuncted type?
    $endgroup$
    – Potato44
    Mar 30 at 12:00











  • $begingroup$
    I may have used the word "conjunction" incorrectly. I'm referring to this answer
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:41











  • $begingroup$
    That sounds like intersection types. Do you also have union types?
    $endgroup$
    – Potato44
    Mar 31 at 17:42










  • $begingroup$
    No, I don't think we have covered them yet.
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:46













0












0








0





$begingroup$


I am assigning type to an $lambda$-expression: if false then M else N
where if A then B else C and false have their usual meanings (read: not specified).



The problem arises because M and N have different types. While clearly the expression evaluates to N & hence should be assigned type(N) but apparently it is expected that for if-else, the types for B & C should be same.



How to proceed on this? Should I use conjuncted type?










share|cite|improve this question









$endgroup$




I am assigning type to an $lambda$-expression: if false then M else N
where if A then B else C and false have their usual meanings (read: not specified).



The problem arises because M and N have different types. While clearly the expression evaluates to N & hence should be assigned type(N) but apparently it is expected that for if-else, the types for B & C should be same.



How to proceed on this? Should I use conjuncted type?







lambda-calculus type-theory






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Mar 30 at 5:18









Sudutt HarneSudutt Harne

33




33











  • $begingroup$
    What do you mean by conjuncted type?
    $endgroup$
    – Potato44
    Mar 30 at 12:00











  • $begingroup$
    I may have used the word "conjunction" incorrectly. I'm referring to this answer
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:41











  • $begingroup$
    That sounds like intersection types. Do you also have union types?
    $endgroup$
    – Potato44
    Mar 31 at 17:42










  • $begingroup$
    No, I don't think we have covered them yet.
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:46
















  • $begingroup$
    What do you mean by conjuncted type?
    $endgroup$
    – Potato44
    Mar 30 at 12:00











  • $begingroup$
    I may have used the word "conjunction" incorrectly. I'm referring to this answer
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:41











  • $begingroup$
    That sounds like intersection types. Do you also have union types?
    $endgroup$
    – Potato44
    Mar 31 at 17:42










  • $begingroup$
    No, I don't think we have covered them yet.
    $endgroup$
    – Sudutt Harne
    Mar 31 at 17:46















$begingroup$
What do you mean by conjuncted type?
$endgroup$
– Potato44
Mar 30 at 12:00





$begingroup$
What do you mean by conjuncted type?
$endgroup$
– Potato44
Mar 30 at 12:00













$begingroup$
I may have used the word "conjunction" incorrectly. I'm referring to this answer
$endgroup$
– Sudutt Harne
Mar 31 at 17:41





$begingroup$
I may have used the word "conjunction" incorrectly. I'm referring to this answer
$endgroup$
– Sudutt Harne
Mar 31 at 17:41













$begingroup$
That sounds like intersection types. Do you also have union types?
$endgroup$
– Potato44
Mar 31 at 17:42




$begingroup$
That sounds like intersection types. Do you also have union types?
$endgroup$
– Potato44
Mar 31 at 17:42












$begingroup$
No, I don't think we have covered them yet.
$endgroup$
– Sudutt Harne
Mar 31 at 17:46




$begingroup$
No, I don't think we have covered them yet.
$endgroup$
– Sudutt Harne
Mar 31 at 17:46










1 Answer
1






active

oldest

votes


















0












$begingroup$

Type checking is something that happens before evaluation.



In most common type systems for lambda calculus, including simply typed lambda calculus and System F, if false then M else N is ill typed if N and M have different types. Unless you have been told otherwise you are probably working with one of these.



There are extensions such as union types and certain forms of subtyping that allow if false then M else N to be well formed with N and Mhaving different types.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
    $endgroup$
    – Sudutt Harne
    Mar 31 at 18:34










  • $begingroup$
    I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
    $endgroup$
    – Potato44
    Mar 31 at 20:43











Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3167956%2fis-expression-evaluated-before-assigning-type%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

Type checking is something that happens before evaluation.



In most common type systems for lambda calculus, including simply typed lambda calculus and System F, if false then M else N is ill typed if N and M have different types. Unless you have been told otherwise you are probably working with one of these.



There are extensions such as union types and certain forms of subtyping that allow if false then M else N to be well formed with N and Mhaving different types.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
    $endgroup$
    – Sudutt Harne
    Mar 31 at 18:34










  • $begingroup$
    I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
    $endgroup$
    – Potato44
    Mar 31 at 20:43















0












$begingroup$

Type checking is something that happens before evaluation.



In most common type systems for lambda calculus, including simply typed lambda calculus and System F, if false then M else N is ill typed if N and M have different types. Unless you have been told otherwise you are probably working with one of these.



There are extensions such as union types and certain forms of subtyping that allow if false then M else N to be well formed with N and Mhaving different types.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
    $endgroup$
    – Sudutt Harne
    Mar 31 at 18:34










  • $begingroup$
    I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
    $endgroup$
    – Potato44
    Mar 31 at 20:43













0












0








0





$begingroup$

Type checking is something that happens before evaluation.



In most common type systems for lambda calculus, including simply typed lambda calculus and System F, if false then M else N is ill typed if N and M have different types. Unless you have been told otherwise you are probably working with one of these.



There are extensions such as union types and certain forms of subtyping that allow if false then M else N to be well formed with N and Mhaving different types.






share|cite|improve this answer









$endgroup$



Type checking is something that happens before evaluation.



In most common type systems for lambda calculus, including simply typed lambda calculus and System F, if false then M else N is ill typed if N and M have different types. Unless you have been told otherwise you are probably working with one of these.



There are extensions such as union types and certain forms of subtyping that allow if false then M else N to be well formed with N and Mhaving different types.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Mar 31 at 18:14









Potato44Potato44

1185




1185











  • $begingroup$
    Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
    $endgroup$
    – Sudutt Harne
    Mar 31 at 18:34










  • $begingroup$
    I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
    $endgroup$
    – Potato44
    Mar 31 at 20:43
















  • $begingroup$
    Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
    $endgroup$
    – Sudutt Harne
    Mar 31 at 18:34










  • $begingroup$
    I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
    $endgroup$
    – Potato44
    Mar 31 at 20:43















$begingroup$
Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
$endgroup$
– Sudutt Harne
Mar 31 at 18:34




$begingroup$
Thanks for the explanation! Could you suggest some books/authoritative references to study this further from?
$endgroup$
– Sudutt Harne
Mar 31 at 18:34












$begingroup$
I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
$endgroup$
– Potato44
Mar 31 at 20:43




$begingroup$
I haven't read either myself, but two I have seen recommended by others are " Practical Foundations for Programming Languages" by Robert Harper and " Types and Programming Languages" by Benjamin Pierce.
$endgroup$
– Potato44
Mar 31 at 20:43

















draft saved

draft discarded
















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

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

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3167956%2fis-expression-evaluated-before-assigning-type%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Triangular numbers and gcdProving sum of a set is $0 pmod n$ if $n$ is odd, or $fracn2 pmod n$ if $n$ is even?Is greatest common divisor of two numbers really their smallest linear combination?GCD, LCM RelationshipProve a set of nonnegative integers with greatest common divisor 1 and closed under addition has all but finite many nonnegative integers.all pairs of a and b in an equation containing gcdTriangular Numbers Modulo $k$ - Hit All Values?Understanding the Existence and Uniqueness of the GCDGCD and LCM with logical symbolsThe greatest common divisor of two positive integers less than 100 is equal to 3. Their least common multiple is twelve times one of the integers.Suppose that for all integers $x$, $x|a$ and $x|b$ if and only if $x|c$. Then $c = gcd(a,b)$Which is the gcd of 2 numbers which are multiplied and the result is 600000?

Ingelân Ynhâld Etymology | Geografy | Skiednis | Polityk en bestjoer | Ekonomy | Demografy | Kultuer | Klimaat | Sjoch ek | Keppelings om utens | Boarnen, noaten en referinsjes Navigaasjemenuwww.gov.ukOffisjele webside fan it regear fan it Feriene KeninkrykOffisjele webside fan it Britske FerkearsburoNederlânsktalige ynformaasje fan it Britske FerkearsburoOffisjele webside fan English Heritage, de organisaasje dy't him ynset foar it behâld fan it Ingelske kultuergoedYnwennertallen fan alle Britske stêden út 'e folkstelling fan 2011Notes en References, op dizze sideEngland

Հադիս Բովանդակություն Անվանում և նշանակություն | Դասակարգում | Աղբյուրներ | Նավարկման ցանկ