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

Boston (Lincolnshire) Stedsbyld | Berne yn Boston | NavigaasjemenuBoston Borough CouncilBoston, Lincolnshire

Ballerup Komuun Stääden an saarpen | Futnuuten | Luke uk diar | Nawigatsjuunwww.ballerup.dkwww.statistikbanken.dk: Tabelle BEF44 (Folketal pr. 1. januar fordelt på byer)Commonskategorii: Ballerup Komuun55° 44′ N, 12° 22′ O

Why is this an NFA, but not an FA? The 2019 Stack Overflow Developer Survey Results Are InConvert from DFA to NFAProve that a PDA with accept states accepts all context-free languagesHow can a DFA corresponding to an NFA have a transition that the original NFA does not?Intersection of 2 deterministic finite state automata, but nondeterministicallyFinite automata as dynamical systemsLanguages acceptable with just a single final stateFind equivalence classes of given regular expressionWhy is this transition considered to be non deterministic?Converting NFA to DFA. Loops and exits.Given a transition table do digraph, determine if it is DFA or NFA and build grammar